ilog.rules.util.prefs

Class IlrPropertyManager

  • java.lang.Object
    • ilog.rules.util.prefs.IlrPropertyManager
  • Direct Known Subclasses:
    IlrMessages, IlrPreferences

    Deprecated. 
    As of IBM ODM 8.9, the Classic Rule Engine is deprecated.

    public abstract class IlrPropertyManager
    extends java.lang.Object
    A manager of property files.

    A IlrPropertyManager manages a hierarchy of IlrPropertyBundle. Each property bundle corresponds to a directory and a set of files under this directory. Each file is structured as a list of key=value couples. The name of the files is given by the pattern: <slashedPrefix>/<slashedFullname>/<baseClassname>_<suffix>.properties.

    • <slashedPrefix> is one of the prefix returned by the getPrefixes() method but with the "." character replaced by the "/" character. The two default prefixes are "ilog.rules" and "".
    • <slashedFullname> is the fully qualified name of the property bundle with the "/" character used as name separator. For instance, if a property bundle "b2" has for parent the property bundle "b1" and if "b1" has for parent the root bundle called "", then the full name of "b2" will be "b1.b2". "b1" will b
    • <baseClassname> is specific of the property manager instances and is given by getBaseClassName() method. The base class name of the messages manager is "messages" while the base class name of the preferences manager is "preferences".
    • <suffix> is one of the suffix returned by the getSuffixes() method. The default only suffix is "".

    A property bundle loads the property files using the java.util.property.getBundle(String, Locale, ClassLoader) method in the order given by the double sorting criteria: suffixes order + prefix order. The content of each file is added to a common table. The properties of a file loaded later replace the same properties of a file loaded earlier.

    For instance, if we set the prefixes and the suffixes of a property manager to {"ilog.rules", "appli", ""} and {"", "dev"} respectively, the loading of the b1.b2 preferences bundle will load the associated files in the following order:

    ilog/rules/b1/b2/preferences.properties
    appli/b1/b2/preferences.properties
    b1/b2/preferences.properties
    ilog/rules/b1/b2/preferences_dev.properties
    appli/b1/b2/preferences_dev.properties
    b1/b2/preferences_dev.properties

    When there is more than one suffix, a file with the first suffix must be found before carrying on with the other suffixes.

    Once loaded, the property bundle contains a set of key and their associated value. A property key is composed of a list of name separated by the "." character. To retrieve the value associated to a key, the property manager queries the property bundles starting from the root bundle and following the path given by the name list of the key. For instance, if the key is "b1.b2.key", the search will be:

    • On the root bundle, the key "b1.b2.key" is queried
    • On the "b1" bundle, the key "b2.key" is queried
    • On the "b1.b2" bundle, the key "key" is queried

    The search stops as soon as the key is found. By default, the depth of the search is limited to the bundles of depth 2.

    The modification of the property manager properties (prefixes, suffixes, class loader, locale, maximum search depth) will reset the property manager: the cache will be cleared and the property bundles will be reloaded on demand.

    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected IlrPropertyManager()
      Deprecated. 
      Sole constructor
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addPrefix(java.lang.String prefix)
      Deprecated. 
      Add the specified prefix at the end of the prefix list.
      void addSuffix(java.lang.String suffix)
      Deprecated. 
      Add the specified suffix at the end of the prefix list.
      IlrPropertyBundle findPropertyBundle(java.lang.String key)
      Deprecated. 
      Return the property bundle that contains the key name.
      IlrPropertyBundle findPropertyBundle(java.lang.String key, java.util.Locale locale)
      Deprecated. 
      Return the property bundle that contains the key name.
      protected abstract java.lang.String getBaseClassName()
      Deprecated. 
      Returns the resource bundle base class name.
      java.lang.ClassLoader getClassLoader()
      Deprecated. 
      Returns the class loader used to load the java.util.ResourceBundle instances
      java.util.Locale getLocale()
      Deprecated. 
      Returns the locale used to load the java.util.ResourceBundle instances
      int getMaximumDepth()
      Deprecated. 
      Returns the maximum key search depth.
      java.lang.String[] getPrefixes()
      Deprecated. 
      Returns an array containing all the prefixes in their order of use.
      IlrPropertyBundle getPropertyBundle(java.lang.String bundleName)
      Deprecated. 
      Returns the property bundle named name.
      IlrPropertyBundle getPropertyBundle(java.lang.String bundleName, java.util.Locale locale)
      Deprecated. 
      Returns the property bundle named name.
      java.lang.String[] getSuffixes()
      Deprecated. 
      Returns an array containing all the suffixes in their order of use.
      java.lang.String getValue(java.lang.String key)
      Deprecated. 
      Return the String associated to the key key or nullValue if the key is not found
      java.lang.String getValue(java.lang.String key, java.util.Locale locale)
      Deprecated. 
      Return the String associated to the key key or nullValue if the key is not found
      java.lang.String getValue(java.lang.String key, java.lang.String defaultValue)
      Deprecated. 
      Return the String associated to the key key or defaultValue if the key is not found
      java.lang.String getValue(java.lang.String key, java.lang.String defaultValue, java.util.Locale locale)
      Deprecated. 
      Return the String associated to the key key or defaultValue if the key is not found
      void insertPrefixAt(java.lang.String prefix, int index)
      Deprecated. 
      Insert the specified prefix to the specified position.
      void insertSuffixAt(java.lang.String suffix, int index)
      Deprecated. 
      Insert the specified suffix to the specified position.
      void removePrefixAt(int index)
      Deprecated. 
      Remove the prefix at the specified position in the prefix list.
      void removeSuffixAt(int index)
      Deprecated. 
      Remove the suffix at the specified position in the suffix list.
      void setClassLoader(java.lang.ClassLoader cl)
      Deprecated. 
      Sets the class loader to load the java.util.ResourceBundle instances.
      void setLocale(java.util.Locale locale)
      Deprecated. 
      Sets the locale to use to load the ResourceBundle.
      void setMaximumDepth(int maxDepth)
      Deprecated. 
      Sets the maximum key search depth.
      void setPrefixes(java.lang.String[] prefixes)
      Deprecated. 
      Set the prefixes to use.
      void setSuffixes(java.lang.String[] suffixes)
      Deprecated. 
      Set the suffixes to use.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IlrPropertyManager

        protected IlrPropertyManager()
        Deprecated. 
        Sole constructor
    • Method Detail

      • getPrefixes

        public java.lang.String[] getPrefixes()
        Deprecated. 
        Returns an array containing all the prefixes in their order of use.
        Returns:
        An array containing all the prefixes in their order of use.
      • setPrefixes

        public void setPrefixes(java.lang.String[] prefixes)
        Deprecated. 
        Set the prefixes to use.
        Parameters:
        prefixes - An sorted array containing the prefixes to use.
      • insertPrefixAt

        public void insertPrefixAt(java.lang.String prefix,
                          int index)
        Deprecated. 
        Insert the specified prefix to the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
        Parameters:
        prefix - Prefix to be inserted.
        index - Index at which the specified prefix is to be inserted.
      • addPrefix

        public void addPrefix(java.lang.String prefix)
        Deprecated. 
        Add the specified prefix at the end of the prefix list.
        Parameters:
        prefix - Prefix to be added.
      • removePrefixAt

        public void removePrefixAt(int index)
        Deprecated. 
        Remove the prefix at the specified position in the prefix list.
        Parameters:
        index - The index of the prefix to be removed.
      • getSuffixes

        public java.lang.String[] getSuffixes()
        Deprecated. 
        Returns an array containing all the suffixes in their order of use.
      • setSuffixes

        public void setSuffixes(java.lang.String[] suffixes)
        Deprecated. 
        Set the suffixes to use.
        Parameters:
        suffixes - An sorted array containing the suffixes to use.
      • insertSuffixAt

        public void insertSuffixAt(java.lang.String suffix,
                          int index)
        Deprecated. 
        Insert the specified suffix to the specified position.
        Parameters:
        suffix - Suffix to be inserted.
        index - Index at which the specified suffix is to be inserted.
      • addSuffix

        public void addSuffix(java.lang.String suffix)
        Deprecated. 
        Add the specified suffix at the end of the prefix list.
        Parameters:
        suffix - Suffix to be added.
      • removeSuffixAt

        public void removeSuffixAt(int index)
        Deprecated. 
        Remove the suffix at the specified position in the suffix list.
        Parameters:
        index - The index of the suffix to be removed.
      • getMaximumDepth

        public int getMaximumDepth()
        Deprecated. 
        Returns the maximum key search depth. The default value is 2.
        Returns:
        The maximum key search depth.
      • setMaximumDepth

        public void setMaximumDepth(int maxDepth)
        Deprecated. 
        Sets the maximum key search depth.
        Parameters:
        maxDepth - The maximum depth to set.
      • getLocale

        public java.util.Locale getLocale()
        Deprecated. 
        Returns the locale used to load the java.util.ResourceBundle instances
      • setLocale

        public void setLocale(java.util.Locale locale)
        Deprecated. 
        Sets the locale to use to load the ResourceBundle.
        Parameters:
        locale - The new locale.
      • getBaseClassName

        protected abstract java.lang.String getBaseClassName()
        Deprecated. 
        Returns the resource bundle base class name.
      • getClassLoader

        public java.lang.ClassLoader getClassLoader()
        Deprecated. 
        Returns the class loader used to load the java.util.ResourceBundle instances
      • setClassLoader

        public void setClassLoader(java.lang.ClassLoader cl)
        Deprecated. 
        Sets the class loader to load the java.util.ResourceBundle instances.
        Parameters:
        cl - The new class loader.
      • getPropertyBundle

        public IlrPropertyBundle getPropertyBundle(java.lang.String bundleName)
        Deprecated. 
        Returns the property bundle named name.
      • getPropertyBundle

        public IlrPropertyBundle getPropertyBundle(java.lang.String bundleName,
                                          java.util.Locale locale)
        Deprecated. 
        Returns the property bundle named name.
      • findPropertyBundle

        public IlrPropertyBundle findPropertyBundle(java.lang.String key)
        Deprecated. 
        Return the property bundle that contains the key name.
      • findPropertyBundle

        public IlrPropertyBundle findPropertyBundle(java.lang.String key,
                                           java.util.Locale locale)
        Deprecated. 
        Return the property bundle that contains the key name.
      • getValue

        public java.lang.String getValue(java.lang.String key,
                                java.lang.String defaultValue)
        Deprecated. 
        Return the String associated to the key key or defaultValue if the key is not found
      • getValue

        public java.lang.String getValue(java.lang.String key,
                                java.lang.String defaultValue,
                                java.util.Locale locale)
        Deprecated. 
        Return the String associated to the key key or defaultValue if the key is not found
      • getValue

        public java.lang.String getValue(java.lang.String key)
        Deprecated. 
        Return the String associated to the key key or nullValue if the key is not found
      • getValue

        public java.lang.String getValue(java.lang.String key,
                                java.util.Locale locale)
        Deprecated. 
        Return the String associated to the key key or nullValue if the key is not found

© Copyright IBM Corp. 1987, 2017