Application properties files should be stored in a folder called "properties" inside the classpath. Not mandatory but its a project practice. Otherwise the manager looks in the classpath for file properties
Implements singleton pattern. Use getManager method to get access to the application resource manager
Propertie file can contain fields that begin with $. These fields are replaced when loaded by system property first that PropertiesManager property For exemple if you define in the propery file the following property : if system user.dir is /home/application myproperty=$user.dir/somepath/file The property loaded will be myproperty=/home/application/somepath/file
Definition at line 55 of file PropertiesManager.java.
Public Member Functions | |
void | removeAllProperties () |
remove all resource manager properties | |
java.io.InputStream | getRessourceAsStream (String name) throws java.io.IOException |
void | addPropertiesFile (String filename) throws IOException |
load a property file inside the classpath. | |
void | addPropertiesFileFromFilePath (String filename) throws java.io.IOException |
load a property file from the file system If not found throw IOException | |
java.util.Properties | getProperties (String prop_file) throws java.io.IOException |
read the property file inside the classpath. | |
java.util.Properties | getPropertiesFromPath (String prop_file) throws java.io.IOException |
read the property file from the file system Does not load it | |
java.util.Properties | getProperties () |
return all the loaded properties | |
String | getProperty (String key, String defaultValue) |
return the property with specified key from loaded properties. | |
String | getProperty (String key) |
return the property with specified key from loaded properties. | |
void | addProperty (String key, String value) |
add the specified key,value to the manager properties | |
Static Public Member Functions | |
static PropertiesManager | getManager () |
main method to get ResourceManager | |
static void | registerInstance (PropertiesManager manager) |
Use to register another ResourceManager. | |
Public Attributes | |
Properties | globalProperties = new java.util.Properties() |
Static Public Attributes | |
static PropertiesManager | instance = null |
Protected Member Functions | |
PropertiesManager () | |
InputStream | convertPropertiesFile (InputStream inStream) throws java.io.IOException |
|
load a property file inside the classpath. if the path is /org/openmobileis/file.properties First look in the classpath for /properties/org/openmobileis/file.properties then in /org/openmobileis/file.properties. If not found throw IOException
Definition at line 120 of file PropertiesManager.java. References org.openmobileis.common.util.PropertiesManager.convertPropertiesFile(), and org.openmobileis.common.util.PropertiesManager.globalProperties. |
|
load a property file from the file system If not found throw IOException
Definition at line 142 of file PropertiesManager.java. References org.openmobileis.common.util.PropertiesManager.convertPropertiesFile(), and org.openmobileis.common.util.PropertiesManager.globalProperties. |
|
add the specified key,value to the manager properties
Definition at line 237 of file PropertiesManager.java. References org.openmobileis.common.util.PropertiesManager.globalProperties. |
|
main method to get ResourceManager
Definition at line 76 of file PropertiesManager.java. References org.openmobileis.common.util.PropertiesManager.instance, and org.openmobileis.common.util.PropertiesManager.PropertiesManager(). Referenced by org.openmobileis.common.util.PropertiesManager.registerInstance(). |
|
return all the loaded properties
Definition at line 204 of file PropertiesManager.java. References org.openmobileis.common.util.PropertiesManager.globalProperties. |
|
read the property file inside the classpath. Does not load it if the path is /org/openmobileis/file.properties First looks in the classpath for /properties/org/openmobileis/file.properties then for /org/openmobileis/file.properties. If not found throw IOException
Definition at line 163 of file PropertiesManager.java. References org.openmobileis.common.util.PropertiesManager.convertPropertiesFile(). |
|
read the property file from the file system Does not load it
Definition at line 187 of file PropertiesManager.java. References org.openmobileis.common.util.PropertiesManager.convertPropertiesFile(). |
|
return the property with specified key from loaded properties. return null if not found.
Definition at line 227 of file PropertiesManager.java. References org.openmobileis.common.util.PropertiesManager.globalProperties. |
|
return the property with specified key from loaded properties. return default value if not found.
Definition at line 216 of file PropertiesManager.java. References org.openmobileis.common.util.PropertiesManager.globalProperties. |
|
Use to register another ResourceManager.
Definition at line 94 of file PropertiesManager.java. References org.openmobileis.common.util.PropertiesManager.getManager(), and org.openmobileis.common.util.PropertiesManager.instance. |