org.pentaho.platform.engine.core.system
Class SystemSettings

java.lang.Object
  extended by org.pentaho.platform.engine.core.system.PentahoBase
      extended by org.pentaho.platform.engine.core.system.SystemSettings
All Implemented Interfaces:
Serializable, ILogger, ISystemSettings
Direct Known Subclasses:
PathBasedSystemSettings, XmlSimpleSystemSettings

public class SystemSettings
extends PentahoBase
implements ISystemSettings

Provides system settings data for system configuration files located in the system folder of the repository. System settings for PentahoSystem are hardcoded to exist in /system/pentaho.xml. Provides a settings cache so that settings are read from the file once, and the associated DOM document is cached in memory for future lookups.

Author:
unknown
See Also:
Serialized Form

Field Summary
static String PENTAHOSETTINGSFILENAME
          This constant is for the overall system settings file name.
 
Fields inherited from class org.pentaho.platform.engine.core.system.PentahoBase
EMPTYLOGID, LOGID_MASK1, LOGID_MASK2, LOGID_SEPARATOR
 
Fields inherited from interface org.pentaho.platform.api.engine.ILogger
ACTIVITY_LOG, DEBUG, ERROR, FATAL, INFO, INSTANCE_LOG, SESSION_LOG, SOLUTION_LOG, TRACE, UNKNOWN, WARN
 
Constructor Summary
SystemSettings()
           
 
Method Summary
 org.apache.commons.logging.Log getLogger()
           
 org.dom4j.Document getSettingsDocumentFromFile(File f)
           
 String getSystemCfgSourceName()
          Gets the name of the source of the system configurations.
 String getSystemSetting(String settingName, String defaultValue)
          Gets a system setting from the system configuration file
 String getSystemSetting(String path, String settingName, String defaultValue)
          Gets a system setting from the system path
 List getSystemSettings(String settingName)
          Gets a section from the system system configuration file
 List getSystemSettings(String path, String settingName)
          Gets a section from the specified settings document
 org.dom4j.Document getSystemSettingsDocument(String actionPath)
          Get the DOM document initialized by the file specified in the actionPath parameter.
 Properties getSystemSettingsProperties(String path)
          Gets a properties file from the solution.
 void resetSettingsCache()
          The SystemSettings object caches each settings document once it's read in.
 
Methods inherited from class org.pentaho.platform.engine.core.system.PentahoBase
debug, debug, error, error, fatal, fatal, genLogIdFromInfo, genLogIdFromInfo, genLogIdFromSession, getLoggingLevel, getLogId, getObjectName, info, info, setLoggingLevel, setLogId, trace, trace, warn, warn
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PENTAHOSETTINGSFILENAME

public static final String PENTAHOSETTINGSFILENAME
This constant is for the overall system settings file name.

See Also:
Constant Field Values
Constructor Detail

SystemSettings

public SystemSettings()
Method Detail

getSystemSetting

public String getSystemSetting(String path,
                               String settingName,
                               String defaultValue)
Description copied from interface: ISystemSettings
Gets a system setting from the system path

Specified by:
getSystemSetting in interface ISystemSettings
Parameters:
path - relative to the "system" directory, go to this document
settingName - the setting name to get
defaultValue - the value to use if the setting isn't specified in the setting document
Returns:
the setting requested, or the default value if not found

getSystemSetting

public String getSystemSetting(String settingName,
                               String defaultValue)
Description copied from interface: ISystemSettings
Gets a system setting from the system configuration file

Specified by:
getSystemSetting in interface ISystemSettings
Parameters:
settingName - the setting name to get
defaultValue - the value to use if the setting isn't specified in the setting document
Returns:
the setting requested, or the default value if not found

getSystemSettings

public List getSystemSettings(String path,
                              String settingName)
Description copied from interface: ISystemSettings
Gets a section from the specified settings document

Specified by:
getSystemSettings in interface ISystemSettings
Parameters:
path - relative to the system directory, go to this document
settingName - the section is the document to retrieve
Returns:
the list of settings in the specified section of the document

getSystemSettings

public List getSystemSettings(String settingName)
Description copied from interface: ISystemSettings
Gets a section from the system system configuration file

Specified by:
getSystemSettings in interface ISystemSettings
Parameters:
settingName - the section to retrieve
Returns:
the list of elements in the section of the document.

getSettingsDocumentFromFile

public org.dom4j.Document getSettingsDocumentFromFile(File f)
                                               throws IOException,
                                                      org.dom4j.DocumentException
Throws:
IOException
org.dom4j.DocumentException

getSystemSettingsDocument

public org.dom4j.Document getSystemSettingsDocument(String actionPath)
Get the DOM document initialized by the file specified in the actionPath parameter. If this is the first time the document associated with actionPath has been requested, cache the DOM document. If this is not the first time the document has been requested, return the document from the cache.

Specified by:
getSystemSettingsDocument in interface ISystemSettings
Parameters:
actionPath - The XML document relative to the solution that contains the settings desired
Returns:
Document Parsed XML document.

getLogger

public org.apache.commons.logging.Log getLogger()
Specified by:
getLogger in class PentahoBase

resetSettingsCache

public void resetSettingsCache()
Description copied from interface: ISystemSettings
The SystemSettings object caches each settings document once it's read in. If the system gets a refresh event, this should be called to make sure that the system settings get refreshed.

Specified by:
resetSettingsCache in interface ISystemSettings

getSystemSettingsProperties

public Properties getSystemSettingsProperties(String path)
Description copied from interface: ISystemSettings
Gets a properties file from the solution.

Specified by:
getSystemSettingsProperties in interface ISystemSettings
Parameters:
path - Relative path to the properties file within the solution
Returns:
Properties object containing the properties.

getSystemCfgSourceName

public String getSystemCfgSourceName()
Description copied from interface: ISystemSettings
Gets the name of the source of the system configurations. For system configurations that are stored in a file, it should return the filename. Other implementations should return a name that is relevant to the implementation (possibly a URL, or a database sql query, etc.) Often this will be pentaho.xml

Specified by:
getSystemCfgSourceName in interface ISystemSettings
Returns:
String containing a name that identifies the source of the system configuration