org.rythmengine.conf
Class RythmConfiguration

java.lang.Object
  extended by org.rythmengine.conf.RythmConfiguration

public class RythmConfiguration
extends Object

Store the configuration for a rythm engine instance. Different engine instance has different configuration instance.


Field Summary
static RythmConfiguration EMPTY_CONF
           
 
Constructor Summary
RythmConfiguration(Map<String,?> configuration, RythmEngine engine)
          Construct a RythmConfiguration with a map.
 
Method Summary
 String allowedSystemProperties()
           
 IByteCodeEnhancer byteCodeEnhancer()
          Return RythmConfigurationKey.CODEGEN_BYTE_CODE_ENHANCER without lookup
 IByteCodeHelper byteCodeHelper()
          Return RythmConfigurationKey.ENGINE_CLASS_LOADER_BYTE_CODE_HELPER_IMPL without lookup
 boolean cacheDisabled()
          Return true if cache is disabled for the engine instance.
 boolean cacheEnabled()
          Return true if cache is not disabled for the engine instance.
 boolean compactModeEnabled()
          Return RythmConfigurationKey.CODEGEN_COMPACT_ENABLED without look up
 void debug()
           
 boolean debugJavaSourceEnabled()
          Get RythmConfigurationKey.ENGINE_OUTPUT_JAVA_SOURCE_ENABLED without lookup
 ICodeType defaultCodeType()
          Return RythmConfigurationKey.DEFAULT_CODE_TYPE_IMPL without lookup
 boolean disableFileWrite()
          Return inversed value of RythmConfigurationKey.ENGINE_FILE_WRITE_ENABLED without lookup
 IDurationParser durationParser()
          Return RythmConfigurationKey.CACHE_DURATION_PARSER_IMPL without lookup
 boolean dynamicExpEnabled()
           
static RythmConfiguration get()
          Return RythmConfiguration instance of current RythmEngine, or if it is not inside a RythmEngine runtime context, an empty configuration is returned
<T> T
get(RythmConfigurationKey key)
          Return configuration by configuration key
<T> T
get(String key)
          Look up configuration by a String key.
 II18nMessageResolver i18nMessageResolver()
          Get RythmConfigurationKey.I18N_MESSAGE_RESOLVER without lookup
 boolean loadPrecompiled()
          Return RythmConfigurationKey.ENGINE_LOAD_PRECOMPILED_ENABLED without lookup
 Locale locale()
          Get RythmConfigurationKey.I18N_LOCALE without lookup
 boolean logRenderTime()
          Return RythmConfigurationKey.LOG_TIME_RENDER_ENABLED without look up
 List<String> messageSources()
          Get RythmConfigurationKey.I18N_MESSAGE_SOURCES without lookup
 boolean naturalTemplateEnabled()
          Get RythmConfigurationKey.FEATURE_NATURAL_TEMPLATE_ENABLED without lookup
 boolean playFramework()
          Return RythmConfigurationKey.ENGINE_PLAYFRAMEWORK without lookup
 String pluginVersion()
          Return plugin version without lookup
 boolean precompileMode()
          Return RythmConfigurationKey.ENGINE_PRECOMPILE_MODE without lookup
 String resourceNameSuffix()
          Get RythmConfigurationKey.RESOURCE_NAME_SUFFIX without lookup
 Set<String> restrictedClasses()
          Return RythmConfigurationKey.SANDBOX_RESTRICTED_CLASS without lookup

 boolean sandboxTmpIO()
           
 void setTemplateHome(File home)
          Set template source home path

 boolean smartEscapeEnabled()
          Get RythmConfigurationKey.FEATURE_SMART_ESCAPE_ENABLED without lookup
 ISourceCodeEnhancer sourceEnhancer()
           
 File templateHome()
          Return RythmConfigurationKey.HOME_TEMPLATE without lookup
 File tmpDir()
          Return RythmConfigurationKey.HOME_TMP without lookup
 boolean transformEnabled()
          Return RythmConfigurationKey.FEATURE_TRANSFORM_ENABLED without look up
 boolean typeInferenceEnabled()
          Get RythmConfigurationKey.FEATURE_TYPE_INFERENCE_ENABLED without lookup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_CONF

public static final RythmConfiguration EMPTY_CONF
Constructor Detail

RythmConfiguration

public RythmConfiguration(Map<String,?> configuration,
                          RythmEngine engine)
Construct a RythmConfiguration with a map. The map is copied to the original map of the configuration instance

Parameters:
configuration -
Method Detail

get

public <T> T get(RythmConfigurationKey key)
Return configuration by configuration key

Type Parameters:
T -
Parameters:
key -
Returns:
the configured item

get

public <T> T get(String key)
Look up configuration by a String key. If the String key can be converted into rythm configuration key, then it is converted and call to get(RythmConfigurationKey) method. Otherwise the original configuration map is used to fetch the value from the string key

Type Parameters:
T -
Parameters:
key -
Returns:
the configured item

pluginVersion

public String pluginVersion()
Return plugin version without lookup

Returns:
plugin version

byteCodeHelper

public IByteCodeHelper byteCodeHelper()
Return RythmConfigurationKey.ENGINE_CLASS_LOADER_BYTE_CODE_HELPER_IMPL without lookup

Returns:
the byte code helper

playFramework

public boolean playFramework()
Return RythmConfigurationKey.ENGINE_PLAYFRAMEWORK without lookup

Returns:
true if the engine is used by playframework

logRenderTime

public boolean logRenderTime()
Return RythmConfigurationKey.LOG_TIME_RENDER_ENABLED without look up

Returns:
true if enable log render time

loadPrecompiled

public boolean loadPrecompiled()
Return RythmConfigurationKey.ENGINE_LOAD_PRECOMPILED_ENABLED without lookup

Returns:
true if load precompiled

precompileMode

public boolean precompileMode()
Return RythmConfigurationKey.ENGINE_PRECOMPILE_MODE without lookup

Returns:
true if precompiling

disableFileWrite

public boolean disableFileWrite()
Return inversed value of RythmConfigurationKey.ENGINE_FILE_WRITE_ENABLED without lookup

Returns:
true if file write is disabled

restrictedClasses

public Set<String> restrictedClasses()
Return RythmConfigurationKey.SANDBOX_RESTRICTED_CLASS without lookup

Note, the return value also contains rythm's built-in restricted classes

Returns:
a set of restricted classes

typeInferenceEnabled

public boolean typeInferenceEnabled()
Get RythmConfigurationKey.FEATURE_TYPE_INFERENCE_ENABLED without lookup

Returns:
true if type inference is enabled

smartEscapeEnabled

public boolean smartEscapeEnabled()
Get RythmConfigurationKey.FEATURE_SMART_ESCAPE_ENABLED without lookup

Returns:
true if smart escape is enabled

naturalTemplateEnabled

public boolean naturalTemplateEnabled()
Get RythmConfigurationKey.FEATURE_NATURAL_TEMPLATE_ENABLED without lookup

Returns:
true if natural template is enabled

debugJavaSourceEnabled

public boolean debugJavaSourceEnabled()
Get RythmConfigurationKey.ENGINE_OUTPUT_JAVA_SOURCE_ENABLED without lookup

Returns:
true if debug java source is enabled

cacheEnabled

public boolean cacheEnabled()
Return true if cache is not disabled for the engine instance. A cache is disabled when

Returns:
true if cache enabled

cacheDisabled

public boolean cacheDisabled()
Return true if cache is disabled for the engine instance.

Returns:
false if cache enabled
See Also:
cacheEnabled()

transformEnabled

public boolean transformEnabled()
Return RythmConfigurationKey.FEATURE_TRANSFORM_ENABLED without look up

Returns:
true if transform enabled

compactModeEnabled

public boolean compactModeEnabled()
Return RythmConfigurationKey.CODEGEN_COMPACT_ENABLED without look up

Returns:
true if compact mode is enabled

dynamicExpEnabled

public boolean dynamicExpEnabled()

durationParser

public IDurationParser durationParser()
Return RythmConfigurationKey.CACHE_DURATION_PARSER_IMPL without lookup

Returns:
the duration parser implementation

defaultCodeType

public ICodeType defaultCodeType()
Return RythmConfigurationKey.DEFAULT_CODE_TYPE_IMPL without lookup

Returns:
default code type

tmpDir

public File tmpDir()
Return RythmConfigurationKey.HOME_TMP without lookup

Returns:
temp dir

templateHome

public File templateHome()
Return RythmConfigurationKey.HOME_TEMPLATE without lookup

Returns:
template home

setTemplateHome

public void setTemplateHome(File home)
Set template source home path

Note, this is not supposed to be used by user application or third party plugin


byteCodeEnhancer

public IByteCodeEnhancer byteCodeEnhancer()
Return RythmConfigurationKey.CODEGEN_BYTE_CODE_ENHANCER without lookup

Returns:
the byte code enhancer implementation

sourceEnhancer

public ISourceCodeEnhancer sourceEnhancer()

locale

public Locale locale()
Get RythmConfigurationKey.I18N_LOCALE without lookup

Returns:
locale

messageSources

public List<String> messageSources()
Get RythmConfigurationKey.I18N_MESSAGE_SOURCES without lookup


i18nMessageResolver

public II18nMessageResolver i18nMessageResolver()
Get RythmConfigurationKey.I18N_MESSAGE_RESOLVER without lookup


resourceNameSuffix

public String resourceNameSuffix()
Get RythmConfigurationKey.RESOURCE_NAME_SUFFIX without lookup


allowedSystemProperties

public String allowedSystemProperties()

sandboxTmpIO

public boolean sandboxTmpIO()

get

public static RythmConfiguration get()
Return RythmConfiguration instance of current RythmEngine, or if it is not inside a RythmEngine runtime context, an empty configuration is returned

Returns:
the configuration instance associated with engine running in the current thread

debug

public void debug()


Copyright © 2013. All Rights Reserved.