Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml


Classes:
Keyword

Class TParameterModule

TComponent
   |
   --TApplicationComponent
      |
      --TModule
         |
         --TParameterModule

TParameterModule class

TParameterModule enables loading application parameters from external storage other than the application configuration. To load parameters from an XML file, configure the module by setting its ParameterFile property. Note, the property only accepts a file path in namespace format with file extension being '.xml'. The file format is as follows, which is similar to the parameter portion in an application configuration,

  1. <parameters>
  2. <parameter id="param1" value="paramValue1" />
  3. <parameter id="param2" Property1="Value1" Property2="Value2" ... />
  4. </parameters>

In addition, any content enclosed within the module tag is also treated as parameters, e.g.,

  1. <module class="System.Util.TParameterModule">
  2. <parameter id="param1" value="paramValue1" />
  3. <parameter id="param2" Property1="Value1" Property2="Value2" ... />
  4. </module>

If a parameter is defined both in the external file and within the module tag, the former takes precedence.

Since: 3.0
Author: Qiang Xue <qiang.xue@gmail.com>

Method Summary
string
void
init ( TXmlElement $config)
Initializes the module by loading parameters.
protected  void
Loads parameters into application.
void
setParameterFile ( string $value)
Methods Inherited From TModule
TModule::getID(), TModule::init(), TModule::setID()
Methods Inherited From TApplicationComponent
TApplicationComponent::getApplication(), TApplicationComponent::getRequest(), TApplicationComponent::getResponse(), TApplicationComponent::getService(), TApplicationComponent::getSession(), TApplicationComponent::getUser(), TApplicationComponent::publishAsset(), TApplicationComponent::publishFilePath()
Methods Inherited From TComponent
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()

Constant Summary
string PARAM_FILE_EXT

Method Details

getParameterFile

public string getParameterFile ()

Output
string the parameter file path
Exception

init

public void init (TXmlElement $config )

Initializes the module by loading parameters.

Input
TXmlElement$configcontent enclosed within the module tag
Output
Exception

loadParameters

protected void loadParameters (TXmlElement $xmlNode )

Loads parameters into application.

Input
TXmlElement$xmlNodeXML representation of the parameters
Output
Exception
throwsTConfigurationException if the parameter file format is invalid

setParameterFile

public void setParameterFile (string $value )

Input
string$valuethe parameter file path. It must be in namespace format and the file extension is '.xml'.
Output
Exception
throwsTInvalidOperationException if the module is initialized
throwsTConfigurationException if the file is invalid


Constant Details

PARAM_FILE_EXT

Type:

string

Value:

'.xml'