Class AbstractPrioritizedPropertyLoader

  • All Implemented Interfaces:
    java.lang.Comparable<AbstractPrioritizedPropertyLoader>, EsapiPropertyLoader
    Direct Known Subclasses:
    StandardEsapiPropertyLoader, XmlEsapiPropertyLoader

    public abstract class AbstractPrioritizedPropertyLoader
    extends java.lang.Object
    implements EsapiPropertyLoader, java.lang.Comparable<AbstractPrioritizedPropertyLoader>
    Abstrace class that supports two "levels" of priorities for ESAPI properties. The higher level is the property file supported by an "operations" team and the lower level is the property file intended to be supported by the "development" team. ESAPI properties defined in the lower level properties file cannot supersede properties defined in the higher level properties file. The intent os to place ESAPI properties related to enterprise-wide security policy (e.g., the minimum sized encryption key, Encryptor.MinEncryptionKeyLength in the higher level so the development team cannot dumb down the policy, either accidentally or intentionally. (This of course requires that the developers don't provide the operations team the properties file for them to use. :) This is also good for allowing the productions operations team to select property values for properties such as Encryptor.MasterKey and Encryptor.MasterSalt so that they are only on a "need-to-know" basis and don't accidentally get committed to the development team's SCM repository.
    Since:
    2.2
    • Field Detail

      • filename

        protected final java.lang.String filename
      • properties

        protected java.util.Properties properties
    • Constructor Detail

      • AbstractPrioritizedPropertyLoader

        public AbstractPrioritizedPropertyLoader​(java.lang.String filename,
                                                 int priority)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • priority

        public int priority()
        Get priority of this property loader. If two and more loaders can return value for the same property key, the one with highest priority will be chosen.
        Returns:
        priority of this property loader
      • name

        public java.lang.String name()
      • loadPropertiesFromFile

        protected abstract void loadPropertiesFromFile​(java.io.File file)
        Method that loads the data from configuration file to properties object.
        Parameters:
        file -
      • logSpecial

        protected final void logSpecial​(java.lang.String msg,
                                        java.lang.Throwable t)
        Used to log errors to the console during the loading of the properties file itself. Can't use standard logging in this case, since the Logger may not be initialized yet. Output is sent to PrintStream System.out. Output is discarded if the System property "org.owasp.esapi.logSpecial.discard" is set to true.
        Parameters:
        msg - The message to log to the console.
        t - Associated exception that was caught.
      • logSpecial

        protected final void logSpecial​(java.lang.String msg)
        Used to log errors to the console during the loading of the properties file itself. Can't use standard logging in this case, since the Logger may not be initialized yet. Output is sent to PrintStream System.out. Output is discarded if the System property "org.owasp.esapi.logSpecial.discard" is set to true.
        Parameters:
        msg - The message to log to the console.