com.elasticpath.persistence.impl
Class PropertiesDaoImpl

java.lang.Object
  extended by com.elasticpath.persistence.impl.PropertiesDaoImpl
All Implemented Interfaces:
PropertiesDao

public class PropertiesDaoImpl
extends java.lang.Object
implements PropertiesDao

Reads properties files from the property file folder (Currently Resources) Adapted from EP4 PropertiesDaoImpl.


Field Summary
static java.lang.String PROPERTIES_SUFFIX
          File name suffix for properties files.
 
Constructor Summary
PropertiesDaoImpl()
           
 
Method Summary
 ElasticPath getElasticPath()
          Get the ElasticPath instance.
 java.util.Properties getPropertiesFile(java.lang.String propertyFileName)
          Get the properties of the given filename, takes filename with properties extension or without extension.
 java.util.Map loadProperties()
          Go through the resources directory and load all the .properties file into the hashMap with the filename (without ".properties") as the key.
 void setElasticPath(ElasticPath elasticPath)
          Set the ElasticPath instance.
 void setPropertiesDir(java.lang.String propertiesDir)
          Set the name of the alternative properties directory.
 void storePropertiesFile(java.util.Properties property, java.lang.String propertyFileName)
          Persist the properties object to file, takes filename with properties extension or without extension.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTIES_SUFFIX

public static final java.lang.String PROPERTIES_SUFFIX
File name suffix for properties files.

See Also:
Constant Field Values
Constructor Detail

PropertiesDaoImpl

public PropertiesDaoImpl()
Method Detail

getElasticPath

public ElasticPath getElasticPath()
Get the ElasticPath instance.

Specified by:
getElasticPath in interface PropertiesDao
Returns:
ElasticPath instance.

getPropertiesFile

public java.util.Properties getPropertiesFile(java.lang.String propertyFileName)
Get the properties of the given filename, takes filename with properties extension or without extension.

Specified by:
getPropertiesFile in interface PropertiesDao
Parameters:
propertyFileName - the filename of the properties file
Returns:
the properties object of the provided file

loadProperties

public java.util.Map loadProperties()
                             throws EpPersistenceException
Go through the resources directory and load all the .properties file into the hashMap with the filename (without ".properties") as the key. For example, countries_fr_CA.properties will be loaded with key "countries_fr_CA". Returns a properties map where the keys are properties file names and the values are Properties objects.

Specified by:
loadProperties in interface PropertiesDao
Returns:
the Map of properties file names (without the file extension) to Properties objects
Throws:
EpPersistenceException - TODO

setElasticPath

public void setElasticPath(ElasticPath elasticPath)
Set the ElasticPath instance.

Specified by:
setElasticPath in interface PropertiesDao
Parameters:
elasticPath - the instance of ElasticPath

setPropertiesDir

public void setPropertiesDir(java.lang.String propertiesDir)
Set the name of the alternative properties directory. If it is not set, the default one -- "WEB-INF/conf/resources" will be used.

Specified by:
setPropertiesDir in interface PropertiesDao
Parameters:
propertiesDir - the directory containing properties files

storePropertiesFile

public void storePropertiesFile(java.util.Properties property,
                                java.lang.String propertyFileName)
Persist the properties object to file, takes filename with properties extension or without extension.

Specified by:
storePropertiesFile in interface PropertiesDao
Parameters:
property - the properties object to store to file
propertyFileName - the filename for the properties