com.ail.core.configure
Class Configuration

java.lang.Object
  extended by com.ail.core.Type
      extended by com.ail.core.configure.Component
          extended by com.ail.core.configure.Group
              extended by com.ail.core.configure.Configuration
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Configuration
extends Group

This class represents the top level of the composite. Configuration contains a Types object, and any number of Parameter objects. It also includes a version number - which indicates the version of the properties held, and caching information which is used to detect stale configuration details.

Version:
$Revision: 1.9 $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ail.core.Type
jXPathContext, NOT_PERSISTED
 
Constructor Summary
Configuration()
          Default constructor.
 
Method Summary
 Builder findBuilder(java.lang.String builderName)
          Find a builder by its name.
 Type findType(java.lang.String typeName)
          Find a type by its name.
 Builders getBuilders()
          Get the Builders group associated with this configuration.
 java.util.Date getLoadedAt()
          Get the configuration's loaded date.
 java.lang.String getManager()
          Configurations are generally used only by the owner - i.e.
 java.lang.String getNamespace()
           
 java.util.ArrayList<Group> getOnlyGroups()
          Get just the Groups in this configuration - ignoring Types & Builders.
 java.lang.String getParentNamespace()
          The name of another configuration that this one inherits from.
 java.lang.String getSource()
          Get the source of the configuration.
 int getTimeout()
          Get this configuration's timeout.
 Types getTypes()
          Get the Types group associated with this configuration.
 VersionEffectiveDate getValidFrom()
          Get the date that the configuration is (was) valid from.
 VersionEffectiveDate getValidTo()
          Get this configuration's valid to date.
 java.lang.String getVersion()
          Fetch the configuration's version.
 java.lang.String getWho()
          Get the configuration's modifier
 XMLMapping getXmlMapping()
          Get the XML mapping for this configuration.
 void setBuilders(Builders builders)
          Set the Builders associated with this configuration.
 void setLoadedAt(java.util.Date loadedAt)
          Set the configuration's laoded at property.
 void setManager(java.lang.String manager)
           
 void setNamespace(java.lang.String namespace)
           
 void setOnlyGroups(java.util.ArrayList<Group> groups)
           
 void setParentNamespace(java.lang.String parentNamespace)
          The name of another configuration that this one inherits from.
 void setSource(java.lang.String source)
          Get the source of the configuration.
 void setTimeout(int timeout)
          Set the configuration's timeout.
 void setTypes(Types types)
          Set the Types associated with this configuration.
 void setValidFrom(VersionEffectiveDate validFrom)
          Set the valid from date for this configuration.
 void setValidTo(VersionEffectiveDate validTo)
          Set the valid to date for this configuration.
 void setVersion(java.lang.String version)
          Set the configuration's version string.
 void setWho(java.lang.String who)
          Set the name of the modifier of this configuration.
 void setXmlMapping(XMLMapping xmlMapping)
          Set the XML mapping definition for this configuration.
 
Methods inherited from class com.ail.core.configure.Group
addGroup, addParameter, findGroup, findParameter, findParameterValue, findParameterValue, getGroup, getGroup, getGroupCount, getParameter, getParameter, getParameterCount, removeAllGroup, removeAllParameter, removeGroup, removeParameter, setGroup, setGroup, setParameter, setParameterAt
 
Methods inherited from class com.ail.core.configure.Component
getName, getNameLowerCase, setName
 
Methods inherited from class com.ail.core.Type
addAttribute, clone, deleteLock, deleteSerialVersion, fetchJXPathContext, getAttribute, getAttribute, getAttributeCount, getForeignSystemId, getLock, getSerialVersion, getSystemId, hasLock, hasSerialVersion, hasSystemId, isPersisted, markAsNotPersisted, mergeWithDataFrom, removeAttribute, removeAttribute, setAttribute, setForeignSystemId, setLock, setSerialVersion, setSystemId, xpathGet, xpathGet, xpathIterate, xpathSet
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration()
Default constructor.

Method Detail

setTypes

public void setTypes(Types types)
Set the Types associated with this configuration. There is only ever one Types element in a configuration, and it is stored in as a normal group in the Groups list. This method will either replace an existing Types element with the one specified, of if there isn't a Types element in the Configuration it will create one.

Parameters:
types - The Types to set

getTypes

public Types getTypes()
Get the Types group associated with this configuration. There is only ever one Types group in a configuration.

Returns:
The types group, or null if not such group was defined.

setBuilders

public void setBuilders(Builders builders)
Set the Builders associated with this configuration. There is only ever one Builders element in a configuration, and it is stored in as a normal group in the Groups list. This method will either replace an existing Builders element with the one specified, or if there isn't a Builders element in the Configuration it will create one.

Parameters:
builders - The Builders to set

getBuilders

public Builders getBuilders()
Get the Builders group associated with this configuration. There is only ever one Builders group in a configuration.

Returns:
The types group, or null if not such group was defined.

getOnlyGroups

public java.util.ArrayList<Group> getOnlyGroups()
Get just the Groups in this configuration - ignoring Types & Builders. Types and Builders are both sub-types of Group, so calling getGroups on a configuration will return a List of Groups including Builders and Types. This is not always appropriate. The List returned by this method will exclude the Builder and Type elements, and return only the other groups.

Returns:
A List of Groups

setOnlyGroups

public void setOnlyGroups(java.util.ArrayList<Group> groups)
Parameters:
groups -

getTimeout

public int getTimeout()
Get this configuration's timeout. The timeout specifies the number of millisecond that can be allowed to elapse between when the configuration was read from persistence, and when it becomes stale and needs to be read again. The configuration system uses this setting to ensure that the configuration is kept up to date, but at the same time allows the administrator some flexibility in reducing system load.

Returns:
Timeout in milliseconds.

setTimeout

public void setTimeout(int timeout)
Set the configuration's timeout.

Parameters:
timeout - Number of milliseconds before configuration becomes stale.
See Also:
getTimeout()

getVersion

public java.lang.String getVersion()
Fetch the configuration's version. This version number generally originates from the source file that held the version when it was under version control.

Returns:
The version description string.

setVersion

public void setVersion(java.lang.String version)
Set the configuration's version string.

Parameters:
version - The version string.
See Also:
getVersion()

getLoadedAt

public java.util.Date getLoadedAt()
Get the configuration's loaded date. This date indicates when the configuration was loaded by the configuration loader, and is used in conjunction with timeout to determine when a reload is needed.

Returns:
The date that the configuration was loaded.

setLoadedAt

public void setLoadedAt(java.util.Date loadedAt)
Set the configuration's laoded at property.

Parameters:
loadedAt - The date the configuration was loaded.
See Also:
getLoadedAt()

getValidFrom

public VersionEffectiveDate getValidFrom()
Get the date that the configuration is (was) valid from. Configuration information is maintained in a version safe fashion. This allows the core system to select the historically correct version of any given configuration to match the user's versionEffectiveDate. The validFrom and validTo properties define the date range between which the configuration is valid.

Returns:
The valid from date for this configuration.

setValidFrom

public void setValidFrom(VersionEffectiveDate validFrom)
Set the valid from date for this configuration.

Parameters:
validFrom - The valid from date for this configuration.
See Also:
getValidFrom()

setValidTo

public void setValidTo(VersionEffectiveDate validTo)
Set the valid to date for this configuration.

Parameters:
validTo - This configuration's valid to date.
See Also:
getValidFrom()

getValidTo

public VersionEffectiveDate getValidTo()
Get this configuration's valid to date.

Returns:
This configuration valid to date.
See Also:
getValidFrom()

setWho

public void setWho(java.lang.String who)
Set the name of the modifier of this configuration. Depending on the system's configuration this may be a user or a system.

Parameters:
who - The name of the modifier.

getWho

public java.lang.String getWho()
Get the configuration's modifier

Returns:
The modifier
See Also:
setWho(String)

setXmlMapping

public void setXmlMapping(XMLMapping xmlMapping)
Set the XML mapping definition for this configuration. Each configuration can define its own mapping between XML and java objects. The format of this mapping is dependent upon the XML service being used, but this property is used to define mappings where they can be expressed in string form (e.g. castor XML mappings).

Parameters:
xmlMapping - The mapping to use.

getXmlMapping

public XMLMapping getXmlMapping()
Get the XML mapping for this configuration.

Returns:
The mapping for this configuration.
See Also:
setXmlMapping(com.ail.core.configure.XMLMapping)

findType

public Type findType(java.lang.String typeName)
Find a type by its name.

Parameters:
typeName -
Returns:
The type, or null if it cannot be found.

findBuilder

public Builder findBuilder(java.lang.String builderName)
Find a builder by its name.

Parameters:
builderName -
Returns:
The builder, or null if it cannot be found.

getManager

public java.lang.String getManager()
Configurations are generally used only by the owner - i.e. the class responsible for managing the configuration is also the only class that reads it. However, a given configuration may be shared by many classes if each of the classes returns the same namespace when their getNamespace() method is called. In this case, one of the classes must be elected as the manager. This class will be used to load/save and otherwise manage the configuration.
If handler is not set, the value of name is returned instead.

Returns:
The name of this configuration's handling class.

setManager

public void setManager(java.lang.String manager)
Parameters:
handler - The name of this configuration's handling class.
See Also:
getManager()

getNamespace

public java.lang.String getNamespace()

setNamespace

public void setNamespace(java.lang.String namespace)

getParentNamespace

public java.lang.String getParentNamespace()
The name of another configuration that this one inherits from. All configuration have com.ail.core.Core as their implicit base parent - i.e. it sits at the top of the namespace hierarchy.

Returns:
parent's namespace, or null if none is specified.

setParentNamespace

public void setParentNamespace(java.lang.String parentNamespace)
The name of another configuration that this one inherits from. All configuration have com.ail.core.Core as their implicit base parent - i.e. it sits at the top of the namespace hierarchy.

Parameters:
parentNamespace - parent's namespace, or null if none is specified.

getSource

public java.lang.String getSource()

Get the source of the configuration. The configuration loader may use this property to store details of how the configuration was loaded, and from where.

This will be a class resource URL for all the configurations reset from *DefaultConfig.xml files in the package hierarchy; or for configs from CMS it'll be the URL of the CMS file.

Returns:
A string describing the source from which configuration was loaded.

setSource

public void setSource(java.lang.String source)

Get the source of the configuration. The configuration loader may use this property to store details of how the configuration was loaded, and from where.

This will be a class resource URL for all the configurations reset from *DefaultConfig.xml files in the package hierarchy; or for configs from CMS it'll be the URL of the CMS file.

Parameters:
source - A string describing the source from which configuration was loaded.