com.sibvisions.rad.server.config
Class ApplicationZone

java.lang.Object
  extended by com.sibvisions.rad.server.config.UpToDateConfigFile
      extended by com.sibvisions.rad.server.config.Zone
          extended by com.sibvisions.rad.server.config.ApplicationZone
All Implemented Interfaces:
Cloneable

public final class ApplicationZone
extends Zone

The ApplicationZone class encapsulates the access to an application configuration.


Constructor Summary
ApplicationZone(String pApplicationName)
          Creates a new instance of ApplicationZone for an application.
 
Method Summary
 Object clone()
          
 String getName()
          Returns the name of the application.
 XmlNode getNode(String pName)
          Gets the xml node for a property name from the application configuration.
 List<XmlNode> getNodes(String pName)
          Gets the xml node or a list of nodes for a property name from the application configuration.
 List<String> getProperties(String pName)
          Gets a list of values for a property which exists more than once.
 String getProperty(String pName, String pDefault)
          Gets the value of a property from the application configuration file.
 ServerZone getServerZone()
          Gets the current server zone.
 void setUpdateEnabled(boolean pEnabled)
          Sets whether this application zone should be up-to-date.
 
Methods inherited from class com.sibvisions.rad.server.config.Zone
addEncryptedNode, createXmlWorker, getConfig, getDirectory, isValid, removeEncryptedNode
 
Methods inherited from class com.sibvisions.rad.server.config.UpToDateConfigFile
getFile, getProperty, isSaveImmediate, isUpdateEnabled, isValid, reload, save, setContent, setNode, setProperty, setSaveImmediate, update
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationZone

public ApplicationZone(String pApplicationName)
                throws Exception
Creates a new instance of ApplicationZone for an application. The application configuration will be used from the cached zone. The cache for all zones is the Configuration.

Parameters:
pApplicationName - the name of the application
Throws:
Exception - if the configuration is invalid
Method Detail

clone

public Object clone()
             throws CloneNotSupportedException

Overrides:
clone in class UpToDateConfigFile
Throws:
CloneNotSupportedException

getProperty

public String getProperty(String pName,
                          String pDefault)
                   throws Exception
Gets the value of a property from the application configuration file. If the property was not found then the property will be read from the server configuration file.

Overrides:
getProperty in class UpToDateConfigFile
Parameters:
pName - the property name (e.g /application/securitymanager/class)
pDefault - the default value if the property is not available in the application and server configuration
Returns:
the value for the property or pDefault if the property is generally not available
Throws:
Exception - if the configuration(s) is/are invalid

getProperties

public List<String> getProperties(String pName)
                           throws Exception
Gets a list of values for a property which exists more than once. The list will be extended with not already containing server properties.

Overrides:
getProperties in class UpToDateConfigFile
Parameters:
pName - the property name
Returns:
the list of merged values from the application and server configuration or null if the property is generally not available
Throws:
Exception - if the configuration is invalid

getNodes

public List<XmlNode> getNodes(String pName)
                       throws Exception
Gets the xml node or a list of nodes for a property name from the application configuration. The list will be extended if the server configuration contains the same property. The list first contains the server nodes and then the application nodes.

Overrides:
getNodes in class UpToDateConfigFile
Parameters:
pName - the property name
Returns:
the available xml node(s) from the application and server configuration or null if the property is generally not available
Throws:
Exception - if the configuration(s) is/are invalid

getNode

public XmlNode getNode(String pName)
                throws Exception
Gets the xml node for a property name from the application configuration. If the property was not found in the application configuration, then the server configuration will be used.

Overrides:
getNode in class UpToDateConfigFile
Parameters:
pName - the property name
Returns:
the available xml node from the application or server configuration or null if the property is generally not available
Throws:
Exception - if the configuration(s) is/are invalid

setUpdateEnabled

public void setUpdateEnabled(boolean pEnabled)
Sets whether this application zone should be up-to-date.

Overrides:
setUpdateEnabled in class UpToDateConfigFile
Parameters:
pEnabled - true to disable up-to-date configuration properties. This disables the up-to-date option of the server zone too (@see getServerZone().

getName

public String getName()
Returns the name of the application.

Returns:
the application name

getServerZone

public ServerZone getServerZone()
Gets the current server zone. If up-to-date option is disabled, then an frozen copy of the server zone will be returned.

Returns:
the zone of the server or null if the zone has errors
See Also:
ServerZone, setUpdateEnabled(boolean)


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.