|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectisc.util.AppProperties
public class AppProperties
Abstraction class for managing properties.
Field Summary | |
---|---|
protected java.lang.String |
cfgFile
Config file name default |
protected static java.util.Properties |
globalProperties
|
protected static boolean |
initialized
|
protected static java.io.FileInputStream |
inStream
|
Constructor Summary | |
---|---|
AppProperties()
Create a new AppProperties |
|
AppProperties(java.lang.String fname)
Create a new AppProperties with default configuration filename |
Method Summary | |
---|---|
java.lang.String |
getConfigFName()
Get the name of the current config file |
java.util.Properties |
getProperties()
Get all of the properties currently set |
java.lang.String |
getProperty(java.lang.String key)
Return the property associated with the key |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String value)
Return the property associated with the key or default value |
protected void |
initialize()
Initialize this class as static |
boolean |
isLoaded()
Check whether this config file has been load into memory |
void |
load()
Load the default config file nae |
void |
load(java.lang.String fname)
Loads a specified filename containing the properties |
void |
put(java.lang.String s1,
java.lang.String s2)
Set a property |
protected void |
setInStream()
Open the config file |
void |
setLoggingProperty(java.lang.String s1,
java.lang.String s2)
Set/reset a log4j property. |
protected void |
setSystemProperties()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.util.Properties globalProperties
protected static boolean initialized
protected java.lang.String cfgFile
protected static java.io.FileInputStream inStream
Constructor Detail |
---|
public AppProperties()
public AppProperties(java.lang.String fname)
Method Detail |
---|
public void load(java.lang.String fname) throws java.lang.Exception
fname
- Name of the config file
java.lang.Exception
- if not a valid filepublic void load() throws java.lang.Exception
java.lang.Exception
- if the file does not existpublic java.lang.String getProperty(java.lang.String key)
key
- Key of the property
public java.lang.String getProperty(java.lang.String key, java.lang.String value)
key
- Key of the propertyValue
- Default Value if key does not exist
public boolean isLoaded()
public java.lang.String getConfigFName()
protected void setInStream() throws java.io.FileNotFoundException
java.io.FileNotFoundException
- if the file does not existprotected void initialize() throws java.lang.Exception
java.lang.Exception
- if it could not be initializedpublic void put(java.lang.String s1, java.lang.String s2)
s1
- Hash key of the propertys2
- property valuepublic void setLoggingProperty(java.lang.String s1, java.lang.String s2)
s1
- Hash key of the log4j propertys2
- value of the propertypublic java.util.Properties getProperties()
protected void setSystemProperties()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |