Class ResourceManager

java.lang.Object
org.eclnt.jsfserver.resources.ResourceManager

public class ResourceManager extends Object
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:
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).
  • 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

      public static ResourceManager 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

      public static ResourceManager getInstanceViaFileSystem(String resourcesConfigDirectory)
      Passes back an instance for a given file name. Usage outside the runtime environment, e.g. at design time.
    • setResourceAccess

      public void setResourceAccess(IResourceAccess resourceAccess)
      Set interface that is used for accessing actual resource data.
    • getResourceAccess

      public IResourceAccess getResourceAccess()
    • readProperty

      public String readProperty(String resourceName, String property, Locale locale)
      Read text for property within the resource bundle.
    • readProperty

      public String readProperty(String resourceName, String property, Locale locale, boolean withError)
      Read text for property within the resource bundle.
    • readProperty

      public String readProperty(String resourceName, String property)
      Read text for property within the resource bundle.
    • readProperty

      public String readProperty(String resourceName, String property, boolean withError)
      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

      public Map<String,String> getResources()
      Returns:
      Map with resources as defined in eclntjsfserver/config/resources.xml. Key = name of resource, Argument = package name of resource.
    • findLiteral

      public static String findLiteral(String resourceName, String literalId)
      Find text for a resource / literal-id within the current runtime instance.
    • findLiteral

      public static String findLiteral(String resourceName, String literalId, boolean withError)
      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

      public static String findLiteral(String resourceName, String literalId, Locale locale)
      Find text for a resource / literal-id within the current runtime instance.
    • findText

      public static String findText(String text)
      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

      public void addResourceConfiguration(String resourceName, String packageName, String defaultValue)
      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

      public String getResourceReaderExpression(String resource)