Package fr.paris.lutece.util
Class PropertiesService
- java.lang.Object
-
- fr.paris.lutece.util.PropertiesService
-
public class PropertiesService extends java.lang.ObjectThis class provides utility methods to read values of the properties stored in the .properties file of the application.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringRSA_KEY_PREFIX
-
Constructor Summary
Constructors Constructor Description PropertiesService(java.lang.String strRootPath)Constructor should define the base root path for properties files
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertiesDirectory(java.lang.String strRelativePath)Add properties from all files found in a given directoryvoidaddPropertiesFile(java.lang.String strRelativePath, java.lang.String strFilename)Add properties from a properties filejava.util.PropertiesgetProperties()Gets propertiesjava.lang.StringgetProperty(java.lang.String strProperty)Returns the value of a variable defined in the .properties file of the application as a Stringjava.lang.StringgetProperty(java.lang.String strProperty, java.lang.String strDefault)Returns the value of a variable defined in the .properties file of the application as a StringbooleangetPropertyBoolean(java.lang.String strProperty, boolean bDefault)Returns the value of a variable defined in the .properties file of the application as an booleanintgetPropertyInt(java.lang.String strProperty, int nDefault)Returns the value of a variable defined in the .properties file of the application as an intlonggetPropertyLong(java.lang.String strProperty, long lDefault)Returns the value of a variable defined in the .properties file of the application as an longvoidreload(java.lang.String strFilename)Reload a properties file .voidreloadAll()Reload all properties files
-
-
-
Field Detail
-
RSA_KEY_PREFIX
public final java.lang.String RSA_KEY_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
addPropertiesFile
public void addPropertiesFile(java.lang.String strRelativePath, java.lang.String strFilename)Add properties from a properties file- Parameters:
strRelativePath- Relative path from the root pathstrFilename- The filename of the properties file (ie: config.properties)
-
addPropertiesDirectory
public void addPropertiesDirectory(java.lang.String strRelativePath)
Add properties from all files found in a given directory- Parameters:
strRelativePath- Relative path from the root path
-
reload
public void reload(java.lang.String strFilename)
Reload a properties file .- Parameters:
strFilename- The filename of the properties file
-
reloadAll
public void reloadAll()
Reload all properties files
-
getProperty
public java.lang.String getProperty(java.lang.String strProperty)
Returns the value of a variable defined in the .properties file of the application as a String- Parameters:
strProperty- The variable name- Returns:
- The variable value read in the properties file
-
getProperty
public java.lang.String getProperty(java.lang.String strProperty, java.lang.String strDefault)Returns the value of a variable defined in the .properties file of the application as a String- Parameters:
strProperty- The variable namestrDefault- The default value which is returned if no value is found for the variable in the .properties file.- Returns:
- The variable value read in the properties file
-
getPropertyInt
public int getPropertyInt(java.lang.String strProperty, int nDefault)Returns the value of a variable defined in the .properties file of the application as an int- Parameters:
strProperty- The variable namenDefault- The default value which is returned if no value is found for the variable in the .properties file, or if the value is not numeric- Returns:
- The variable value read in the properties file
-
getPropertyLong
public long getPropertyLong(java.lang.String strProperty, long lDefault)Returns the value of a variable defined in the .properties file of the application as an long- Parameters:
strProperty- The variable namelDefault- The default value which is returned if no value is found for the variable in the le downloadFile .properties. .properties file.- Returns:
- The variable value read in the properties file
-
getPropertyBoolean
public boolean getPropertyBoolean(java.lang.String strProperty, boolean bDefault)Returns the value of a variable defined in the .properties file of the application as an boolean- Parameters:
strProperty- The variable namebDefault- The default value which is returned if no value is found for the variable in the le downloadFile .properties. .properties file.- Returns:
- The variable value read in the properties file
-
getProperties
public java.util.Properties getProperties()
Gets properties- Returns:
- All properties
-
-