Package org.owasp.esapi.configuration
Class AbstractPrioritizedPropertyLoader
- java.lang.Object
-
- org.owasp.esapi.configuration.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 Summary
Fields Modifier and Type Field Description protected java.lang.String
filename
protected java.util.Properties
properties
-
Constructor Summary
Constructors Constructor Description AbstractPrioritizedPropertyLoader(java.lang.String filename, int priority)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(AbstractPrioritizedPropertyLoader compared)
protected abstract void
loadPropertiesFromFile(java.io.File file)
Method that loads the data from configuration file to properties object.protected void
logSpecial(java.lang.String msg)
Used to log errors to the console during the loading of the properties file itself.protected 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.java.lang.String
name()
int
priority()
Get priority of this property loader.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.owasp.esapi.configuration.EsapiPropertyLoader
getBooleanProp, getByteArrayProp, getIntProp, getStringProp
-
-
-
-
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
-
compareTo
public int compareTo(AbstractPrioritizedPropertyLoader compared)
- Specified by:
compareTo
in interfacejava.lang.Comparable<AbstractPrioritizedPropertyLoader>
-
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 toPrintStream
System.out
. Output is discarded if theSystem
property "org.owasp.esapi.logSpecial.discard" is set totrue
.- 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 toPrintStream
System.out
. Output is discarded if theSystem
property "org.owasp.esapi.logSpecial.discard" is set totrue
.- Parameters:
msg
- The message to log to the console.
-
-