|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sourceforge.esw.properties.PropertyUtil
Utilities for use with the Properties framework.
PropertyFactory
Field Summary | |
protected static java.lang.String |
DEFAULT_PROPERTIES
The name of the default ESW framework XML properties file. |
protected static java.lang.String |
DEFAULT_PROPERTIES_FILE
The name and path of the default ESW framework XML properties file. |
static java.lang.String |
SYSTEM_PROPERTIES_NAME
The name of the system property that specifies where properties file is on the file system. |
Constructor Summary | |
PropertyUtil()
|
Method Summary | |
static void |
createFileDictionaryPropertySource(int aRank,
java.lang.String aFilename,
java.lang.String aDelimiter,
boolean bWriteable)
Creates and adds a file based Dictionary IPropertySource
instance to the default IPropertyAggregator instance at the
specified rank. |
static void |
createFileXMLPropertySource(int aRank,
java.lang.String aFilename,
boolean bWriteable)
Creates and adds a file based XML IPropertySource instance
to the default IPropertyAggregator instance at the specified
rank. |
static void |
createJDBCPropertySource(int aRank,
java.lang.String aDriver,
java.lang.String aURL,
java.lang.String aUser,
java.lang.String aPassword,
boolean bWriteable)
Creates and adds a JDBC IPropertySource instance to the
default IPropertyAggregator instance at the specified rank. |
static void |
createSystemPropertySource(int aRank,
boolean bWriteable)
Creates and adds a java.lang.System IPropertySource instance
to the default IPropertyAggregator instance at the specified
rank. |
static void |
createURLDictionaryPropertySource(int aRank,
java.lang.String aURL,
java.lang.String aDelimiter,
boolean bWriteable)
Creates and adds an URL based Dictionary IPropertySource
instance to the default IPropertyAggregator instance at the
specified rank. |
static boolean |
getBooleanProperty(java.lang.String aPropertyName,
boolean aDefaultValue)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name, or the specified default value if no match is found. |
static boolean |
getBooleanPropertyInContext(java.lang.String aContext,
java.lang.String aPropertyName,
boolean aDefaultValue)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name, or the specified default value if no match is found. |
static INode |
getContext(java.lang.String aContext,
java.lang.String aPropertyName)
Returns the first INode instance from the default
IPropertyAggregator instance that matches the specified
property name. |
static double |
getDoubleProperty(java.lang.String aPropertyName,
double aDefaultValue)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name, or the specified default value if no match is found. |
static double |
getDoublePropertyInContext(java.lang.String aContext,
java.lang.String aPropertyName,
double aDefaultValue)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name, or the specified default value if no match is found. |
static float |
getFloatProperty(java.lang.String aPropertyName,
float aDefaultValue)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name, or the specified default value if no match is found. |
static float |
getFloatPropertyInContext(java.lang.String aContext,
java.lang.String aPropertyName,
float aDefaultValue)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name, or the specified default value if no match is found. |
static int |
getIntProperty(java.lang.String aPropertyName,
int aDefaultValue)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name, or the specified default value if no match is found. |
static int |
getIntPropertyInContext(java.lang.String aContext,
java.lang.String aPropertyName,
int aDefaultValue)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name, or the specified default value if no match is found. |
static long |
getLongProperty(java.lang.String aPropertyName,
long aDefaultValue)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name, or the specified default value if no match is found. |
static long |
getLongPropertyInContext(java.lang.String aContext,
java.lang.String aPropertyName,
long aDefaultValue)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name, or the specified default value if no match is found. |
static java.lang.String |
getProperty(java.lang.String aPropertyName)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name. |
static java.lang.String |
getProperty(java.lang.String aPropertyName,
java.lang.String aDefaultValue)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name, or the specified default value if no match is found. |
static java.lang.String |
getPropertyInContext(java.lang.String aContext,
java.lang.String aPropertyName)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name. |
static java.lang.String |
getPropertyInContext(java.lang.String aContext,
java.lang.String aPropertyName,
java.lang.String aDefaultValue)
Returns the first property value from the default IPropertyAggregator instance that matches the specified
property name, or the specified default value if no match is found. |
static void |
setupDefaultPropertySource(IPropertyAggregator aPropertyAggregator)
Creates an IPropertySource instance from the default
properties for the framework, and attaches it to the specified
IPropertyAggregator instance at the 5th ranking. |
static void |
setupSystemPropertySource(IPropertyAggregator aPropertyAggregator)
Creates an IPropertySource instance from the java.lang.system
properties for the framework, and attaches it to the specified
IPropertyAggregator instance at the 10th ranking. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String DEFAULT_PROPERTIES
protected static final java.lang.String DEFAULT_PROPERTIES_FILE
public static final java.lang.String SYSTEM_PROPERTIES_NAME
Constructor Detail |
public PropertyUtil()
Method Detail |
public static void setupDefaultPropertySource(IPropertyAggregator aPropertyAggregator)
IPropertySource
instance from the default
properties for the framework, and attaches it to the specified
IPropertyAggregator
instance at the 5th ranking.aPropertyAggregator
- the IPropertyAggregator
instance
to which to attach the created
IPropertySource
instance.public static void setupSystemPropertySource(IPropertyAggregator aPropertyAggregator)
IPropertySource
instance from the java.lang.system
properties for the framework, and attaches it to the specified
IPropertyAggregator
instance at the 10th ranking.aPropertyAggregator
- the IPropertyAggregator
instance
to which to attach the created
IPropertySource
instance.public static void createFileXMLPropertySource(int aRank, java.lang.String aFilename, boolean bWriteable) throws java.lang.Exception
IPropertySource
instance
to the default IPropertyAggregator
instance at the specified
rank. It also loads the contents of the represented property source into
the created IPropertySource
instance.aRank
- the rank the specifed IPropertySource
instance
should be added.aFilename
- the name of the file to find the XML data source.bWriteable
- if true
, the added
IPropertySource
instance will be created as
being writable, otherwise, the
IPropertySource
instance will be read-only.java.lang.Exception
- if an error occurs during the creation.public static void createSystemPropertySource(int aRank, boolean bWriteable) throws java.lang.Exception
IPropertySource
instance
to the default IPropertyAggregator
instance at the specified
rank. It also loads the contents of the represented property source into
the created IPropertySource
instance.aRank
- the rank the specifed IPropertySource
instance
should be added.bWriteable
- if true
, the added
IPropertySource
instance will be created as
being writable, otherwise, the
IPropertySource
instance will be read-only.java.lang.Exception
- if an error occurs during the creation.public static void createFileDictionaryPropertySource(int aRank, java.lang.String aFilename, java.lang.String aDelimiter, boolean bWriteable) throws java.lang.Exception
IPropertySource
instance to the default IPropertyAggregator
instance at the
specified rank. It also loads the contents of the represented property
source into the created IPropertySource
instance.aRank
- the rank the specifed IPropertySource
instance
should be added.aFilename
- the name of the file to find the Dictionary data source.aDelimiter
- the delimiter for the Dictionary data source. (For
java.land.Properties, '=' is the delimiter).bWriteable
- if true
, the added
IPropertySource
instance will be created as
being writable, otherwise, the
IPropertySource
instance will be read-only.java.lang.Exception
- if an error occurs during the creation.public static void createURLDictionaryPropertySource(int aRank, java.lang.String aURL, java.lang.String aDelimiter, boolean bWriteable) throws java.lang.Exception
IPropertySource
instance to the default IPropertyAggregator
instance at the
specified rank. It also loads the contents of the represented property
source into the created IPropertySource
instance.aRank
- the rank the specifed IPropertySource
instance
should be added.aURL
- the URL of the Dictionary data source.aDelimiter
- the delimiter for the Dictionary data source. (For
java.land.Properties, '=' is the delimiter).bWriteable
- if true
, the added
IPropertySource
instance will be created as
being writable, otherwise, the
IPropertySource
instance will be read-only.java.lang.Exception
- if an error occurs during the creation.public static void createJDBCPropertySource(int aRank, java.lang.String aDriver, java.lang.String aURL, java.lang.String aUser, java.lang.String aPassword, boolean bWriteable) throws java.lang.Exception
IPropertySource
instance to the
default IPropertyAggregator
instance at the specified rank.
It also loads the contents of the represented property source into
the created IPropertySource
instance.aRank
- the rank the specifed IPropertySource
instance
should be added.aDriver
- the fully-qualified JDBC Driver class name.aURL
- the URL for the JDBC driver.aUser
- the authorized user for the JDBC data source.aPassword
- the password for the authoized user.bWriteable
- if true
, the added
IPropertySource
instance will be created as
being writable, otherwise, the
IPropertySource
instance will be read-only.java.lang.Exception
- if an error occurs during the creation.public static java.lang.String getProperty(java.lang.String aPropertyName)
IPropertyAggregator
instance that matches the specified
property name.
This method is for properties that are not hierarchical.
aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance.public static java.lang.String getProperty(java.lang.String aPropertyName, java.lang.String aDefaultValue)
IPropertyAggregator
instance that matches the specified
property name, or the specified default value if no match is found.
This method is for properties that are not hierarchical.
aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance.aDefaultValue
- the default value to return if the specified property
name does not exist in the current set of properties.public static boolean getBooleanProperty(java.lang.String aPropertyName, boolean aDefaultValue)
IPropertyAggregator
instance that matches the specified
property name, or the specified default value if no match is found.
This method attempts to handle any found property value as a boolean type.
That is, if the property value is the String true
, then
true
will be returned. Likewise, the String false
will return the boolean value false
. If the found value is
anything else, the default value is returned. Case is ignored.
This method is for properties that are not hierarchical.
aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance.aDefaultValue
- the default value to return if the specified property
name does not exist in the current set of properties,
or if the found value cannot be intrepreted as a
boolean type.public static double getDoubleProperty(java.lang.String aPropertyName, double aDefaultValue)
IPropertyAggregator
instance that matches the specified
property name, or the specified default value if no match is found.
This method attempts to handle any found property value as a double type.
That is, if the property value can be sucessfully converted via
Double.parseDouble( value )
then the resulting double will be
returned. Otherwise, the default value will be returned.
This method is for properties that are not hierarchical.
aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance.aDefaultValue
- the default value to return if the specified property
name does not exist in the current set of properties,
or if the found value cannot be intrepreted as a
double type.public static float getFloatProperty(java.lang.String aPropertyName, float aDefaultValue)
IPropertyAggregator
instance that matches the specified
property name, or the specified default value if no match is found.
This method attempts to handle any found property value as a float type.
That is, if the property value can be sucessfully converted via
Float.parseFloat( value )
then the resulting float will be
returned. Otherwise, the default value will be returned.
This method is for properties that are not hierarchical.
aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance.aDefaultValue
- the default value to return if the specified property
name does not exist in the current set of properties,
or if the found value cannot be intrepreted as a
float type.public static int getIntProperty(java.lang.String aPropertyName, int aDefaultValue)
IPropertyAggregator
instance that matches the specified
property name, or the specified default value if no match is found.
This method attempts to handle any found property value as a int type.
That is, if the property value can be sucessfully converted via
Integer.parseInt( value )
then the resulting int will be
returned. Otherwise, the default value will be returned.
This method is for properties that are not hierarchical.
aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance.aDefaultValue
- the default value to return if the specified property
name does not exist in the current set of properties,
or if the found value cannot be intrepreted as a
int type.public static long getLongProperty(java.lang.String aPropertyName, long aDefaultValue)
IPropertyAggregator
instance that matches the specified
property name, or the specified default value if no match is found.
This method attempts to handle any found property value as a long type.
That is, if the property value can be sucessfully converted via
Long.parseLong( value )
then the resulting long will be
returned. Otherwise, the default value will be returned.
This method is for properties that are not hierarchical.
aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance.aDefaultValue
- the default value to return if the specified property
name does not exist in the current set of properties,
or if the found value cannot be intrepreted as a
long type.public static java.lang.String getPropertyInContext(java.lang.String aContext, java.lang.String aPropertyName)
IPropertyAggregator
instance that matches the specified
property name.
This method is for properties that are hierarchical to a 2 level depth.
aContext
- the name of the context for the property.aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance with the
specified context.public static java.lang.String getPropertyInContext(java.lang.String aContext, java.lang.String aPropertyName, java.lang.String aDefaultValue)
IPropertyAggregator
instance that matches the specified
property name, or the specified default value if no match is found.
This method is for properties that are hierarchical to a 2 level depth.
aContext
- the name of the context for the property.aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance with the
specified context.aDefaultValue
- the default value to return if the specified property
name does not exist in the current set of properties.public static boolean getBooleanPropertyInContext(java.lang.String aContext, java.lang.String aPropertyName, boolean aDefaultValue)
IPropertyAggregator
instance that matches the specified
property name, or the specified default value if no match is found.
This method attempts to handle any found property value as a boolean type.
That is, if the property value is the String true
, then
true
will be returned. Likewise, the String false
will return the boolean value false
. If the found value is
anything else, the default value is returned. Case is ignored.
This method is for properties that are hierarchical to a 2 level depth.
aContext
- the name of the context for the property.aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance with the
specified context.aDefaultValue
- the default value to return if the specified property
name does not exist in the current set of properties,
or if the found value cannot be intrepreted as a
boolean type.public static double getDoublePropertyInContext(java.lang.String aContext, java.lang.String aPropertyName, double aDefaultValue)
IPropertyAggregator
instance that matches the specified
property name, or the specified default value if no match is found.
This method attempts to handle any found property value as a double type.
That is, if the property value can be sucessfully converted via
Double.parseDouble( value )
then the resulting double will be
returned. Otherwise, the default value will be returned.
This method is for properties that are hierarchical to a 2 level depth.
aContext
- the name of the context for the property.aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance with the
specified context.aDefaultValue
- the default value to return if the specified property
name does not exist in the current set of properties,
or if the found value cannot be intrepreted as a
double type.public static float getFloatPropertyInContext(java.lang.String aContext, java.lang.String aPropertyName, float aDefaultValue)
IPropertyAggregator
instance that matches the specified
property name, or the specified default value if no match is found.
This method attempts to handle any found property value as a float type.
That is, if the property value can be sucessfully converted via
Float.parseFloat( value )
then the resulting float will be
returned. Otherwise, the default value will be returned.
This method is for properties that are hierarchical to a 2 level depth.
aContext
- the name of the context for the property.aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance with the
specified context.aDefaultValue
- the default value to return if the specified property
name does not exist in the current set of properties,
or if the found value cannot be intrepreted as a
float type.public static int getIntPropertyInContext(java.lang.String aContext, java.lang.String aPropertyName, int aDefaultValue)
IPropertyAggregator
instance that matches the specified
property name, or the specified default value if no match is found.
This method attempts to handle any found property value as a int type.
That is, if the property value can be sucessfully converted via
Integer.parseInt( value )
then the resulting int will be
returned. Otherwise, the default value will be returned.
This method is for properties that are hierarchical to a 2 level depth.
aContext
- the name of the context for the property.aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance with the
specified context.aDefaultValue
- the default value to return if the specified property
name does not exist in the current set of properties,
or if the found value cannot be intrepreted as a
int type.public static long getLongPropertyInContext(java.lang.String aContext, java.lang.String aPropertyName, long aDefaultValue)
IPropertyAggregator
instance that matches the specified
property name, or the specified default value if no match is found.
This method attempts to handle any found property value as a long type.
That is, if the property value can be sucessfully converted via
Long.parseLong( value )
then the resulting long will be
returned. Otherwise, the default value will be returned.
This method is for properties that are hierarchical to a 2 level depth.
aContext
- the name of the context for the property.aPropertyName
- the name of the property to search for in the default
IPropertyAggregator
instance with the
specified context.aDefaultValue
- the default value to return if the specified property
name does not exist in the current set of properties,
or if the found value cannot be intrepreted as a
long type.public static INode getContext(java.lang.String aContext, java.lang.String aPropertyName)
INode
instance from the default
IPropertyAggregator
instance that matches the specified
property name.
This method is for properties that are hierarchical to a 2 level depth.
aContext
- the name of the context for the property.aPropertyName
- the name of the INode
to search for in
the default IPropertyAggregator
instance
with the specified context.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |