org.rythmengine.conf
Enum RythmConfigurationKey

java.lang.Object
  extended by java.lang.Enum<RythmConfigurationKey>
      extended by org.rythmengine.conf.RythmConfigurationKey
All Implemented Interfaces:
Serializable, Comparable<RythmConfigurationKey>

public enum RythmConfigurationKey
extends Enum<RythmConfigurationKey>

RythmEngine configuration keys. General rules:


Enum Constant Summary
BUILT_IN_CODE_TYPE_ENABLED
          "built_in.code_type.enabled": Enable built-in code type implementations

BUILT_IN_TRANSFORMER_ENABLED
          "built_in.transformer.enabled": Enable built-in transformer implementations

CACHE_DURATION_PARSER_IMPL
          "cache.duration_parser.impl": set duration parser implementation.
CACHE_ENABLED
          "cache.enabled": Enable disable cache service.
CACHE_PROD_ONLY_ENABLED
          "cache.prod_only.enabled": Turn on/off cache at dev mode.
CACHE_SERVICE_IMPL
          "cache.service.impl": Set cache service implementation

CODEGEN_BYTE_CODE_ENHANCER
          "codegen.byte_code_enhancer.impl": Set template byte code enhancer implementation.
CODEGEN_COMPACT_ENABLED
          "codegen.compact.enabled": Enable/disable compact redundant space and lines

CODEGEN_SOURCE_CODE_ENHANCER
          "codegen.source_code_enhancer.impl": Set template source code enhancer implementation.
DEFAULT_CACHE_TTL
          "default.cache_ttl": Set default cache ttl in second

DEFAULT_CODE_TYPE_IMPL
          "default.code_type.impl": Set default code type

ENGINE_CLASS_LOADER_BYTE_CODE_HELPER_IMPL
          "engine.class_loader.byte_code_helper.impl": Set the bytecode helper implementation
ENGINE_CLASS_LOADER_PARENT_IMPL
          "engine.class_loader.parent.impl": Set the parent class loader of the rythm template class loader
ENGINE_FILE_WRITE_ENABLED
          "engine.file_write.enabled": Enable/disable write to file system.
ENGINE_ID
          "engine.id": Set the ID of rythm engine instance
ENGINE_LOAD_PRECOMPILED_ENABLED
          "engine.load_precompiled.enabled": Set the flag so that Rythm will load precompiled template class directly from bytecode cached in the precompiled root when running in prod mode.
ENGINE_MODE
          "engine.mode": Set the mode of rythm engine
ENGINE_OUTPUT_JAVA_SOURCE_ENABLED
           
ENGINE_PLAYFRAMEWORK
          "engine.playframework.enabled": A special flag used when Rythm is working with rythm-plugin for Play!Framework.
ENGINE_PLUGIN_VERSION
          "engine.plugin.version": Set by plugin of certain framework, e.g.
ENGINE_PRECOMPILE_MODE
          "engine.precompile_mode.enabled": Set/unset precompile mode.
EXT_PROP_ACCESSOR
          "ext.prop_accessor": User defined property accessors, should be a list of class names separated by ",".
EXT_TRANSFORMER
          "ext.transformer": User defined transformers, should be a list of class names separated by ",".
FEATURE_DYNAMIC_EXP
          "engine.dynamic_exp.eanbled": Generate code to enable evaluate dynamic expressions, and the java beans spec can be supported when this option is turned on
FEATURE_NATURAL_TEMPLATE_ENABLED
          "feature.natural_template.enabled": Enable disable natural template.
FEATURE_SMART_ESCAPE_ENABLED
          "feature.smart_escape.enabled": Enable disable smart escape.
FEATURE_TRANSFORM_ENABLED
          "feature.transform.enabled": Enable disable transformer

FEATURE_TYPE_INFERENCE_ENABLED
          "feature.type_inference.enabled": Enable disable type inference.
HOME_PRECOMPILED
          "home.precompiled.dir": Set the dir root of the precompiled template bytecodes.
HOME_TEMPLATE
          "home.template.dir": Set the home dir of template files.
HOME_TMP
          "home.tmp.dir": Set the rythm tmp dir.
I18N_LOCALE
          "i18n.locale": the locale for the rythm runtime environment.
I18N_MESSAGE_RESOLVER
          "i18n.message.resolver.impl": Set i18n message resolver.
I18N_MESSAGE_SOURCES
          "i18n.message.sources": Set message sources.
LOG_ENABLED
          "log.enabled": Enable disable log in Rythm.
LOG_FACTORY_IMPL
          "log.factory.impl": Configure the logger factory implementation.
LOG_SOURCE_JAVA_ENABLED
          "log.source.java.enabled": Print out relevant java source lines when exception encountered

LOG_SOURCE_TEMPLATE_ENABLED
          "log.source.template.enabled": Print out relevant template source lines when exception encountered

LOG_TIME_RENDER_ENABLED
          "log.time.render.enabled": Log time spent executing a template.
RENDER_EXCEPTION_HANDLER
          "render.exception_handler.impl": Set render exception handler implementation.
RENDER_LISTENER
          "render.listener.impl": Set tag invocation listener implementation.
RESOURCE_LOADER_IMPL
          "resource.loader.impl": The resource loader implementation
RESOURCE_NAME_SUFFIX
          "resource.name.suffix": does resource name has special rythm suffix attached? E.g.
SANBOX_THREAD_FACTORY_IMPL
          "sandbox.thread_factory.impl": Configure the thread factory to be used by the sandbox executing service.
SANDBOX_ALLOWED_SYSTEM_PROPERTIES
          "sandbox.allowed_system_properties": Set allowed system properties in string separated by ,.
SANDBOX_POOL_SIZE
          "sandbox.pool.size": Set the thread pool size of sandbox executors.
SANDBOX_RESTRICTED_CLASS
          "sandbox.restricted_class": Set restricted classes for sandbox execution.
SANDBOX_SECURE_CODE
          "sandbox.secure_mode": used in sandbox security manager to turn on/off secure zone
SANDBOX_SECURITY_MANAGER_IMPL
          "sandbox.security_manager.impl": Set the security manager to be used when running a template in sandbox mode.
SANDBOX_TEMP_IO_ENABLED
          "sandbox.tmp_dir.io.enabled": enable or disable tmp dir IO in sandbox mode When tmp_dir io is enabled, template running in sandbox mode can read/write files in "java.io.tmpdir"
SANDBOX_TIMEOUT
          "sandbox.timeout": Set the timeout of a sandbox execution in milliseconds.
 
Method Summary
<T> T
getConfiguration(Map<String,?> configuration)
          Return configuration value from the configuration data map using the key of this setting instance
<T> T
getDefaultConfiguration()
          Return default configuration of this item
protected  Object getDefVal(Map<String,?> configuration)
          Return default value of this setting.
 String getKey()
          Return the key string
 String toString()
          Calling to this method is equals to calling getKey()
static RythmConfigurationKey valueOf(String name)
          Returns the enum constant of this type with the specified name.
static RythmConfigurationKey valueOfIgnoreCase(String s)
          Return key enum instance from the string in case insensitive mode
static RythmConfigurationKey[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

BUILT_IN_CODE_TYPE_ENABLED

public static final RythmConfigurationKey BUILT_IN_CODE_TYPE_ENABLED
"built_in.code_type.enabled": Enable built-in code type implementations

Default value: true


BUILT_IN_TRANSFORMER_ENABLED

public static final RythmConfigurationKey BUILT_IN_TRANSFORMER_ENABLED
"built_in.transformer.enabled": Enable built-in transformer implementations

Default value: true

See Also:
FEATURE_TRANSFORM_ENABLED

CACHE_ENABLED

public static final RythmConfigurationKey CACHE_ENABLED
"cache.enabled": Enable disable cache service. When this setting is turned off, the CACHE_SERVICE_IMPL will be set to NoCacheService without regarding to it's configuration

Default value: false

TODO: add link to cache service reference


CACHE_SERVICE_IMPL

public static final RythmConfigurationKey CACHE_SERVICE_IMPL
"cache.service.impl": Set cache service implementation

Default value: SimpleCacheService

Note when CACHE_ENABLED is set to false, then this setting will be ignored, and the service impl will be set to NoCacheService anyway

TODO: add link to cache service reference


CACHE_DURATION_PARSER_IMPL

public static final RythmConfigurationKey CACHE_DURATION_PARSER_IMPL
"cache.duration_parser.impl": set duration parser implementation.

Default value: IDurationParser.DEFAULT_PARSER


CACHE_PROD_ONLY_ENABLED

public static final RythmConfigurationKey CACHE_PROD_ONLY_ENABLED
"cache.prod_only.enabled": Turn on/off cache at dev mode. When this setting is turned on, then cache will not effect at dev mode

Default value: true


CODEGEN_COMPACT_ENABLED

public static final RythmConfigurationKey CODEGEN_COMPACT_ENABLED
"codegen.compact.enabled": Enable/disable compact redundant space and lines

Default value: true


CODEGEN_SOURCE_CODE_ENHANCER

public static final RythmConfigurationKey CODEGEN_SOURCE_CODE_ENHANCER
"codegen.source_code_enhancer.impl": Set template source code enhancer implementation.

Default value: null


CODEGEN_BYTE_CODE_ENHANCER

public static final RythmConfigurationKey CODEGEN_BYTE_CODE_ENHANCER
"codegen.byte_code_enhancer.impl": Set template byte code enhancer implementation.

Default value: null


DEFAULT_CODE_TYPE_IMPL

public static final RythmConfigurationKey DEFAULT_CODE_TYPE_IMPL
"default.code_type.impl": Set default code type

Default value: raw

TODO: what if BUILT_IN_CODE_TYPE_ENABLED is false


DEFAULT_CACHE_TTL

public static final RythmConfigurationKey DEFAULT_CACHE_TTL
"default.cache_ttl": Set default cache ttl in second

Default value: 60 * 60(1hr


ENGINE_MODE

public static final RythmConfigurationKey ENGINE_MODE
"engine.mode": Set the mode of rythm engine

Default value: Rythm.Mode.prod


ENGINE_ID

public static final RythmConfigurationKey ENGINE_ID
"engine.id": Set the ID of rythm engine instance

Default value: "re-" plus a random String with 3 chars


ENGINE_CLASS_LOADER_PARENT_IMPL

public static final RythmConfigurationKey ENGINE_CLASS_LOADER_PARENT_IMPL
"engine.class_loader.parent.impl": Set the parent class loader of the rythm template class loader

Default value: first try to use current thread's context class loader if the context classloader is null, then use the class loader which loads the Rythm.class


ENGINE_CLASS_LOADER_BYTE_CODE_HELPER_IMPL

public static final RythmConfigurationKey ENGINE_CLASS_LOADER_BYTE_CODE_HELPER_IMPL
"engine.class_loader.byte_code_helper.impl": Set the bytecode helper implementation

Default value: null


ENGINE_LOAD_PRECOMPILED_ENABLED

public static final RythmConfigurationKey ENGINE_LOAD_PRECOMPILED_ENABLED
"engine.load_precompiled.enabled": Set the flag so that Rythm will load precompiled template class directly from bytecode cached in the precompiled root when running in prod mode.

Default value: false


ENGINE_FILE_WRITE_ENABLED

public static final RythmConfigurationKey ENGINE_FILE_WRITE_ENABLED
"engine.file_write.enabled": Enable/disable write to file system. This option is used by rythm to check if it should write template class bytecode cache to disk or not. In some cases you want to disable file write due the limit of the runtime environment, e.g. on GAE platform

Default value: true


ENGINE_PRECOMPILE_MODE

public static final RythmConfigurationKey ENGINE_PRECOMPILE_MODE
"engine.precompile_mode.enabled": Set/unset precompile mode. This option is used by play-rythm plugin (could also be other plugin) to notify rythm that is is doing a precompile. User application should not use this option

Default value: false


ENGINE_OUTPUT_JAVA_SOURCE_ENABLED

public static final RythmConfigurationKey ENGINE_OUTPUT_JAVA_SOURCE_ENABLED

ENGINE_PLAYFRAMEWORK

public static final RythmConfigurationKey ENGINE_PLAYFRAMEWORK
"engine.playframework.enabled": A special flag used when Rythm is working with rythm-plugin for Play!Framework. Usually you should not touch this setting.

Default value: false


ENGINE_PLUGIN_VERSION

public static final RythmConfigurationKey ENGINE_PLUGIN_VERSION
"engine.plugin.version": Set by plugin of certain framework, e.g. play!framework. Used to determine whether it needs to refresh the cached template class bytecode. Default value: "" (empty string)


FEATURE_TRANSFORM_ENABLED

public static final RythmConfigurationKey FEATURE_TRANSFORM_ENABLED
"feature.transform.enabled": Enable disable transformer

Default value: true


FEATURE_TYPE_INFERENCE_ENABLED

public static final RythmConfigurationKey FEATURE_TYPE_INFERENCE_ENABLED
"feature.type_inference.enabled": Enable disable type inference. TODO add link to type inference reference page

Default value: false


FEATURE_SMART_ESCAPE_ENABLED

public static final RythmConfigurationKey FEATURE_SMART_ESCAPE_ENABLED
"feature.smart_escape.enabled": Enable disable smart escape. TODO: add link to smart escape reference page

Default value: true


FEATURE_NATURAL_TEMPLATE_ENABLED

public static final RythmConfigurationKey FEATURE_NATURAL_TEMPLATE_ENABLED
"feature.natural_template.enabled": Enable disable natural template. TODO: add reference link to natural template

Default value: true


FEATURE_DYNAMIC_EXP

public static final RythmConfigurationKey FEATURE_DYNAMIC_EXP
"engine.dynamic_exp.eanbled": Generate code to enable evaluate dynamic expressions, and the java beans spec can be supported when this option is turned on


HOME_TEMPLATE

public static final RythmConfigurationKey HOME_TEMPLATE
"home.template.dir": Set the home dir of template files. This configuration is used when the RESOURCE_LOADER_IMPL is not configured, therefore the TemplateResourceManager will try to load FileTemplateResource from this template home dir configured.

Default value: a file created with the following logic

new File(Thread.currentThread().getContextClassLoader().getResource("rythm").getFile())


HOME_TMP

public static final RythmConfigurationKey HOME_TMP
"home.tmp.dir": Set the rythm tmp dir. The tmp dir is to where Rythm write compiled template class bytecode when running in the dev mode.

Default value: a file created with the following logic

new File(System.__getProperty("java.io.tmpdir"), "__rythm")


HOME_PRECOMPILED

public static final RythmConfigurationKey HOME_PRECOMPILED
"home.precompiled.dir": Set the dir root of the precompiled template bytecodes. Default value: null

See Also:
ENGINE_LOAD_PRECOMPILED_ENABLED

I18N_LOCALE

public static final RythmConfigurationKey I18N_LOCALE
"i18n.locale": the locale for the rythm runtime environment. This configuration return the Locale type of instance.

Default value: java.util.Locale.getDefault()

See Also:
Java Locale

I18N_MESSAGE_SOURCES

public static final RythmConfigurationKey I18N_MESSAGE_SOURCES
"i18n.message.sources": Set message sources. Should be a String of message (resource bundle) properties file names separated by ",", E.g. "format,exception,windows".

Default value: message

See Also:
[Spring]Internationalization using MessageSource

I18N_MESSAGE_RESOLVER

public static final RythmConfigurationKey I18N_MESSAGE_RESOLVER
"i18n.message.resolver.impl": Set i18n message resolver. Should implement II18nMessageResolver interface. Default value: II18nMessageResolver.DefaultImpl.INSTANCE, which delegate to S.i18n(org.rythmengine.template.ITemplate, String, Object...) method


LOG_ENABLED

public static final RythmConfigurationKey LOG_ENABLED
"log.enabled": Enable disable log in Rythm. Default value: true


LOG_FACTORY_IMPL

public static final RythmConfigurationKey LOG_FACTORY_IMPL
"log.factory.impl": Configure the logger factory implementation. When this configuration is not set, then a JDKLogger.Factory instance is used to create the logger

Default value: org.rythmengine.logger.JDKLogger.Factory


LOG_SOURCE_JAVA_ENABLED

public static final RythmConfigurationKey LOG_SOURCE_JAVA_ENABLED
"log.source.java.enabled": Print out relevant java source lines when exception encountered

Default value: true


LOG_SOURCE_TEMPLATE_ENABLED

public static final RythmConfigurationKey LOG_SOURCE_TEMPLATE_ENABLED
"log.source.template.enabled": Print out relevant template source lines when exception encountered

Default value: true


LOG_TIME_RENDER_ENABLED

public static final RythmConfigurationKey LOG_TIME_RENDER_ENABLED
"log.time.render.enabled": Log time spent executing a template. The level used to log the time logRenderTime is ILogger.debug(String, Object...)

Default value: false


RENDER_LISTENER

public static final RythmConfigurationKey RENDER_LISTENER
"render.listener.impl": Set tag invocation listener implementation.

Default value: null


RENDER_EXCEPTION_HANDLER

public static final RythmConfigurationKey RENDER_EXCEPTION_HANDLER
"render.exception_handler.impl": Set render exception handler implementation.

Default value: null


RESOURCE_LOADER_IMPL

public static final RythmConfigurationKey RESOURCE_LOADER_IMPL
"resource.loader.impl": The resource loader implementation

Default value: null. But if this is not configured, try templates will be loaded as file template resource first and if still not found then try to load as classpath resource.

See Also:
HOME_TEMPLATE

RESOURCE_NAME_SUFFIX

public static final RythmConfigurationKey RESOURCE_NAME_SUFFIX
"resource.name.suffix": does resource name has special rythm suffix attached? E.g. .rythm or .rtl etc. Default is empty string

Note, do not use regular file extensions for this setting, like ".html", ".js" etc as they can be used to identify the code type of the template


SANDBOX_SECURITY_MANAGER_IMPL

public static final RythmConfigurationKey SANDBOX_SECURITY_MANAGER_IMPL
"sandbox.security_manager.impl": Set the security manager to be used when running a template in sandbox mode.

Default value: null. When no security manager is configured, when the sandbox mode is running, an instance of RythmSecurityManager will be initiated to supervise the execution. Usually you should NOT set this configuration and allow Rythm to run it's SecurityManager implementation.


SANDBOX_TIMEOUT

public static final RythmConfigurationKey SANDBOX_TIMEOUT
"sandbox.timeout": Set the timeout of a sandbox execution in milliseconds. If the execution failed to return after timeout, then Rythm will interrupt the execution thread and force it to return. This setting prevent infinite loop in untrusted template.

Default value: 2000


SANDBOX_POOL_SIZE

public static final RythmConfigurationKey SANDBOX_POOL_SIZE
"sandbox.pool.size": Set the thread pool size of sandbox executors.

Default value: 10


SANDBOX_RESTRICTED_CLASS

public static final RythmConfigurationKey SANDBOX_RESTRICTED_CLASS
"sandbox.restricted_class": Set restricted classes for sandbox execution. The value should be full name of the classes or packages separated by ;. For example, "foo.bar.Employee;foo.secure;...".

If a class or package name is presented in this setting, then the sandbox executor will raise a SecurityException when the template trying to access the class. Note whatever this setting is configured, Rythm will prevent the access to the following classes/packages:

Default value: ""


SANDBOX_ALLOWED_SYSTEM_PROPERTIES

public static final RythmConfigurationKey SANDBOX_ALLOWED_SYSTEM_PROPERTIES
"sandbox.allowed_system_properties": Set allowed system properties in string separated by ,. By default the following properties are allowed to access by sandbox thread


SANBOX_THREAD_FACTORY_IMPL

public static final RythmConfigurationKey SANBOX_THREAD_FACTORY_IMPL
"sandbox.thread_factory.impl": Configure the thread factory to be used by the sandbox executing service.

Default value: SandboxThreadFactory


SANDBOX_TEMP_IO_ENABLED

public static final RythmConfigurationKey SANDBOX_TEMP_IO_ENABLED
"sandbox.tmp_dir.io.enabled": enable or disable tmp dir IO in sandbox mode When tmp_dir io is enabled, template running in sandbox mode can read/write files in "java.io.tmpdir"

Default value: true


SANDBOX_SECURE_CODE

public static final RythmConfigurationKey SANDBOX_SECURE_CODE
"sandbox.secure_mode": used in sandbox security manager to turn on/off secure zone

Default value: UUID.randomUUID().toString()


EXT_TRANSFORMER

public static final RythmConfigurationKey EXT_TRANSFORMER
"ext.transformer": User defined transformers, should be a list of class names separated by ",". If configured then RythmEngine.registerTransformer will be called to register these user defined transformer classes. Default value: null


EXT_PROP_ACCESSOR

public static final RythmConfigurationKey EXT_PROP_ACCESSOR
"ext.prop_accessor": User defined property accessors, should be a list of class names separated by ",". If configured then RythmEngine.registerPropertyAccessor(org.rythmengine.extension.IPropertyAccessor...) RythmEngine.registerPropertyAccessor} will be called to register these user defined property accessor classes. Default value: null

Method Detail

values

public static RythmConfigurationKey[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (RythmConfigurationKey c : RythmConfigurationKey.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static RythmConfigurationKey valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getKey

public String getKey()
Return the key string

Returns:
the key of the configuration

getDefVal

protected Object getDefVal(Map<String,?> configuration)
Return default value of this setting. The configuration data map is passed in in case the default value be variable depending on another setting. For example, the default value of tmp dir setting depend on the value of mode setting

Parameters:
configuration -
Returns:
return the default value

toString

public String toString()
Calling to this method is equals to calling getKey()

Overrides:
toString in class Enum<RythmConfigurationKey>
Returns:
key of the configuration

getConfiguration

public <T> T getConfiguration(Map<String,?> configuration)
Return configuration value from the configuration data map using the key of this setting instance

Type Parameters:
T -
Parameters:
configuration -
Returns:
return the configuration

getDefaultConfiguration

public <T> T getDefaultConfiguration()
Return default configuration of this item

Type Parameters:
T -
Returns:
default configuration for this item

valueOfIgnoreCase

public static RythmConfigurationKey valueOfIgnoreCase(String s)
Return key enum instance from the string in case insensitive mode

Parameters:
s -
Returns:
configuration key from the string


Copyright © 2013. All Rights Reserved.