|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.arch4j.property.PropertyManagerImpl
This class manages the reading and caching of property files. It takes * the name of a property domain and tries to find an associated * property file in the designated property file directory by appending * .properties to the domain. * *
For example, the property manager
* will search for the properties in the "user" domain in user.properties.
* If the special property key CACHE
is found and the value is
* Y, then the collection of properties will be cached and used on
* future lookups. The cache can be cleared by calling clearCache()
.
*
* @author Russ Brown
* @author Ross E. Greinke
* @version 2.0
Constructor Summary | |
PropertyManagerImpl()
Constructs a PropertyManagerImpl , set to look for property
* files in the current directory. |
|
PropertyManagerImpl(File directoryFile)
Constructs a PropertyManagerImpl , set to look for property
* files in the given directory. |
|
PropertyManagerImpl(String directoryName)
Constructs a PropertyManagerImpl , set to look for property
* files in the given directory. |
Method Summary | |
static void |
clearCache()
Clears the property cache. |
Properties |
getProperties(String forDomain)
Returns all the Properties associated with a given domain. |
String |
getProperty(String forDomain,
String propertyName)
Searches for the property with the specified property name within the * given domain. |
String |
getProperty(String forDomain,
String propertyName,
String defaultValue)
Searches for the property with the specified property name within the * given domain. |
File |
getPropertyDirectory()
Returns the property directory where property files are stored. |
void |
setProperty(String forDomain,
String propertyName,
String propertyValue)
This method changes a given property. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PropertyManagerImpl()
PropertyManagerImpl
, set to look for property
* files in the current directory.
public PropertyManagerImpl(String directoryName)
PropertyManagerImpl
, set to look for property
* files in the given directory.
* @param directoryName The directory in which to look for property files.
public PropertyManagerImpl(File directoryFile)
PropertyManagerImpl
, set to look for property
* files in the given directory.
* @param directoryFile The directory file in which to look for property files.
Method Detail |
public File getPropertyDirectory()
File
.
getPropertyDirectory
in interface PropertyManager
File
.public Properties getProperties(String forDomain)
Properties
associated with a given domain.
* @param forDomain The domain name.
* @return The properties associated with domain.
* @exception EnvironmentalException If the file doesn't exist or cannot be parsed.
getProperties
in interface PropertyManager
forDomain
- The domain name.
public String getProperty(String forDomain, String propertyName)
null
if the
* property is not found.
* @param forDomain The domain name.
* @param propertyName The key to search for.
* @return The property value for the property name (key) or null.
getProperty
in interface PropertyManager
forDomain
- The domain name.propertyName
- The key to search for.
public String getProperty(String forDomain, String propertyName, String defaultValue)
getProperty
in interface PropertyManager
forDomain
- The domain name.propertyName
- The key to search for.defaultValue
- The value to return if the property key is not found.
public void setProperty(String forDomain, String propertyName, String propertyValue)
setProperty
in interface PropertyManager
forDomain
- The domain name.propertyName
- The key to search for.propertyValue
- The new value for the property name (key) or null.public static void clearCache()
|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |