Package org.eclnt.jsfserver.resources
Class ResourceManager
java.lang.Object
org.eclnt.jsfserver.resources.ResourceManager
Access to default resource management of CaptainCasa Enterprise Client.
The resource management allows to access text (or other) resource
via #{rr.resourceName.key} expression. It internally resolves
a resource bundle. - Via the functions of this class you also
can access the resource management from your program, e.g. for
accessing literals at runtime.
The key methods are:
The configuration is done by accessing configuration file /eclntjsfserver/config/resources.xml. In addition there is a runtime configuration which is done through method
The key methods are:
getRuntimeInstance()
readProperty(String, String)
The configuration is done by accessing configuration file /eclntjsfserver/config/resources.xml. In addition there is a runtime configuration which is done through method
addResourceConfiguration(String, String, String)
.-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addResourceConfiguration
(String resourceName, String packageName, String defaultValue) Runtime configuration interface to add resources dynamically via API.static String
findLiteral
(String resourceName, String literalId) Find text for a resource / literal-id within the current runtime instance.static String
findLiteral
(String resourceName, String literalId, boolean withError) Find text for a resource / literal-id within the current runtime instance.static String
findLiteral
(String resourceName, String literalId, Locale locale) Find text for a resource / literal-id within the current runtime instance.static String
findLiteral
(String resourceName, String literalId, Locale locale, boolean withError) Find text for a resource / literal-id within the current runtime instance.static String
If the text is an id ("#{rr.xxx.yyy}", or "#{rr.xxx['yyy']}") ==> return text, that is defined behind the literal.static ResourceManager
getInstanceViaFileSystem
(String resourcesConfigDirectory) Passes back an instance for a given file name.getResourceReaderExpression
(String resource) static ResourceManager
Passes back the default runtime instance that is used within the current web application.static void
init
(javax.servlet.ServletContext context) Initialization of the runtime instance.static void
readProperty
(String resourceName, String property) Read text for property within the resource bundle.readProperty
(String resourceName, String property, boolean withError) Read text for property within the resource bundle.readProperty
(String resourceName, String property, Locale locale) Read text for property within the resource bundle.readProperty
(String resourceName, String property, Locale locale, boolean withError) Read text for property within the resource bundle.void
setResourceAccess
(IResourceAccess resourceAccess) Set interface that is used for accessing actual resource data.
-
Constructor Details
-
ResourceManager
public ResourceManager()
-
-
Method Details
-
init
public static void init(javax.servlet.ServletContext context) Initialization of the runtime instance. Called at startup of Enterprise Client server environment. -
initForJUnitTest
public static void initForJUnitTest() -
getRuntimeInstance
Passes back the default runtime instance that is used within the current web application. Within the runtime instance resource configuration files are accessed via the web resource reader. -
getInstanceViaFileSystem
Passes back an instance for a given file name. Usage outside the runtime environment, e.g. at design time. -
setResourceAccess
Set interface that is used for accessing actual resource data. -
getResourceAccess
-
readProperty
Read text for property within the resource bundle. -
readProperty
Read text for property within the resource bundle. -
readProperty
Read text for property within the resource bundle. -
readProperty
Read text for property within the resource bundle.- Parameters:
withError
- If set to true then an error will be thrown if there is not property defintion - instead of passing back some default value.
-
getResources
- Returns:
- Map with resources as defined in eclntjsfserver/config/resources.xml. Key = name of resource, Argument = package name of resource.
-
findLiteral
Find text for a resource / literal-id within the current runtime instance. -
findLiteral
Find text for a resource / literal-id within the current runtime instance. -
findLiteral
public static String findLiteral(String resourceName, String literalId, Locale locale, boolean withError) Find text for a resource / literal-id within the current runtime instance. -
findLiteral
Find text for a resource / literal-id within the current runtime instance. -
findText
If the text is an id ("#{rr.xxx.yyy}", or "#{rr.xxx['yyy']}") ==> return text, that is defined behind the literal. If not ("Normal text") then the original text is passed back. -
addResourceConfiguration
Runtime configuration interface to add resources dynamically via API. Resources may be added via configuration, but you can also add configuration information at runtime.- Parameters:
resourceName
- Name of the resource file(s).packageName
- Package in which to look for the resource files.defaultValue
- (maybe passed as null) Default value if a literal is not part of the resource files.
-
getResourceReaderExpression
-