001: /*
002: * Copyright 2006 Pentaho Corporation. All rights reserved.
003: * This software was developed by Pentaho Corporation and is provided under the terms
004: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
005: * this file except in compliance with the license. If you need a copy of the license,
006: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
007: * BI Platform. The Initial Developer is Pentaho Corporation.
008: *
009: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
011: * the license for the specific language governing your rights and limitations.
012: *
013: * @created Jul 19, 2005
014: * @author James Dixon
015: *
016: */
017:
018: package org.pentaho.core.system;
019:
020: import java.util.List;
021: import java.util.Properties;
022:
023: import org.dom4j.Document;
024:
025: /**
026: * The SystemSettings manages the platform's overall configuration settings.
027: * These settings by default can be found in the system tree in an xml file
028: * named "pentaho.xml."
029: */
030:
031: public interface ISystemSettings {
032:
033: /**
034: * Gets the name of the source of the system configurations. For system configurations
035: * that are stored in a file, it should return the filename. Other implementations
036: * should return a name that is relevant to the implementation
037: * (possibly a URL, or a database sql query, etc.)
038: * Often this will be pentaho.xml
039: *
040: * @return String containing a name that identifies the source
041: * of the system configuration
042: */
043: public String getSystemCfgSourceName();
044:
045: /**
046: * Gets a system setting from the system path
047: *
048: * @param path
049: * relative to the "system" directory, go to this document
050: * @param settingName
051: * the setting name to get
052: * @param defaultValue
053: * the value to use if the setting isn't specified in the setting
054: * document
055: * @return the setting requested, or the default value if not found
056: */
057: public String getSystemSetting(String path, String settingName,
058: String defaultValue);
059:
060: /**
061: * Gets a system setting from the system configuration file
062: *
063: * @param settingName
064: * the setting name to get
065: * @param defaultValue
066: * the value to use if the setting isn't specified in the setting
067: * document
068: * @return the setting requested, or the default value if not found
069: */
070: public String getSystemSetting(String settingName,
071: String defaultValue);
072:
073: /**
074: * Gets a section from the specified settings document
075: *
076: * @param path
077: * relative to the system directory, go to this document
078: * @param settingSection
079: * the section is the document to retrieve
080: * @return the list of settings in the specified section of the document
081: */
082: public List getSystemSettings(String path, String settingSection);
083:
084: /**
085: * Gets a section from the system system configuration file
086: *
087: * @param settingSection
088: * the section to retrieve
089: * @return the list of elements in the section of the document.
090: */
091: public List getSystemSettings(String settingSection);
092:
093: /**
094: * The SystemSettings object caches each settings document once it's read
095: * in. If the system gets a refresh event, this should be called to make
096: * sure that the system settings get refreshed.
097: */
098: public void resetSettingsCache();
099:
100: /**
101: * Returns a Document object containing the settings document within the
102: * path specified by actionPath.
103: *
104: * @param actionPath
105: * The XML document relative to the solution that contains the
106: * settings desired
107: * @return Document Parsed XML document.
108: */
109: public Document getSystemSettingsDocument(String actionPath);
110:
111: /**
112: * Gets a properties file from the solution.
113: * @param path Relative path to the properties file within the solution
114: * @return <tt>Properties</tt> object containing the properties.
115: */
116: public Properties getSystemSettingsProperties(String path);
117:
118: }
|