org.sape.carbon.core.bootstrap
Class BootConfigurationDocument

java.lang.Object
  |
  +--org.sape.carbon.core.bootstrap.BootConfigurationDocument
All Implemented Interfaces:
ConfigurationDocument, Node

class BootConfigurationDocument
extends Object
implements ConfigurationDocument

An implementation of ConfigurationDocument that provides functionality specific to retrieving the configuration required to boot the Carbon Core. This ConfigurationDocument is read-only. Calls to writeConfiguration or remove will throw an UnsupportedOperationException.

package protected because this implementation need not be visible outside of bootstrap, it can be referenced by its interface.

Copyright 2002 Sapient

Since:
carbon 1.0
Version:
$Revision: 1.30 $($Author: dvoet $ / $Date: 2003/12/11 18:43:31 $)
Author:
Douglas Voet, March 2002

Field Summary
private  LinkNodeConfiguration config
          The system property key used to define the name of the /** internal configuration object
private static String DEFAULT_ROOT_LINK
          Contains a complete Xml Configuration file.
private  ConfigurationFormatService formatter
          the default configuration formatter service.
private  org.apache.commons.logging.Log log
          The handle to Apache-commons logger
private static String ROOT_LINK_PROPERTY_NAME
          Config property for the root link.
static String ROOT_LINK_RESOURCE_NAME
          The name of the resource that contains the information for the link to the root of the configuration servie
 
Fields inherited from interface org.sape.carbon.core.config.node.Node
DELIMITER
 
Constructor Summary
(package private) BootConfigurationDocument()
          This constructor loads the BootStrapperConfiguration for the system.
 
Method Summary
 ConfigurationDocument addNestedConfigurationDocument(String name, Configuration config)
          Adds a nested configuration object within this document with the name given by name and the value given by config.
 void addNodeListener(ConfigurationEventListener listener)
          Method addNodeListener.
 void addNodeListener(NodeEventListener listener)
          Method addNodeListener.
 boolean containsChild(String childName)
          Checks if this Folder contains the child specified by childName
 Node fetchChild(String childName)
          Returns a child Node of the current Node as defined by childName.
 Node[] fetchChildren()
          Returns an array of all children nodes, including standard ConfigurationDocuments and Folder.
 String getAbsoluteName()
          Returns the absolute name of the node within the node heirarchy.
 boolean getAllowsChildren()
          This implementation does not support children
 ConfigurationFormatService getFormatService()
          Method getFormatService.
 String getName()
          Returns the name of this node.
 NodeFactory getNestedNodeFactory()
          Returns the nested node factory for the configuration.
 Node getParent()
          Gets the parent folder of the node.
private  InputStream getRootLinkInputStream()
          Loads the configuration root link.
 boolean isRemoved()
          Used to tell whether or not the backing data of a node has been removed.
 Configuration readConfiguration()
          Gets the configuration object loaded in the constructor
 void refresh()
          This implementation cannot be refreshed
 int remove()
          Not supported by this implementation
 void writeConfiguration(Configuration config)
          Not supported by this implementation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private org.apache.commons.logging.Log log
The handle to Apache-commons logger


ROOT_LINK_PROPERTY_NAME

private static final String ROOT_LINK_PROPERTY_NAME
Config property for the root link.

See Also:
Constant Field Values

DEFAULT_ROOT_LINK

private static final String DEFAULT_ROOT_LINK
Contains a complete Xml Configuration file. Used as the default root link if none can be found.

See Also:
Constant Field Values

ROOT_LINK_RESOURCE_NAME

public static final String ROOT_LINK_RESOURCE_NAME
The name of the resource that contains the information for the link to the root of the configuration servie

See Also:
Constant Field Values

config

private LinkNodeConfiguration config
The system property key used to define the name of the /** internal configuration object


formatter

private ConfigurationFormatService formatter
the default configuration formatter service.

Constructor Detail

BootConfigurationDocument

BootConfigurationDocument()
This constructor loads the BootStrapperConfiguration for the system. If the system property defined by BOOT_CONFIG_PROPERTY is specified on the command line, its value is used as a path to a file that contains the configuration information. If the system property is not specified, the first instance of the file named by BOOT_CONFIG_FILE_NAME found in the classpath is used.

package protected because only the bootstrap subsystem should instantiate it

Method Detail

readConfiguration

public Configuration readConfiguration()
                                throws NodeIOException,
                                       ConfigurationFormatException
Gets the configuration object loaded in the constructor

Specified by:
readConfiguration in interface ConfigurationDocument
Returns:
the Configuration object representing the configurable information required by the bootstrap subsystem.
Throws:
NodeIOException - when there is an exception in dealing with the configuration backing store
ConfigurationFormatException - when the configuration document to be read has an invalid format or inproper data
See Also:
ConfigurationService.fetchConfiguration(String)

writeConfiguration

public void writeConfiguration(Configuration config)
                        throws NodeIOException,
                               ConfigurationFormatException
Not supported by this implementation

Specified by:
writeConfiguration in interface ConfigurationDocument
Parameters:
config - not supported
Throws:
NodeIOException - not supported
ConfigurationFormatException - not supported
See Also:
ConfigurationService.storeConfiguration(String, Configuration)

getAllowsChildren

public boolean getAllowsChildren()
This implementation does not support children

Specified by:
getAllowsChildren in interface Node
Returns:
false always

remove

public int remove()
           throws NodeRemovalException
Not supported by this implementation

Specified by:
remove in interface Node
Returns:
not supported
Throws:
NodeRemovalException - not supported

refresh

public void refresh()
This implementation cannot be refreshed

Specified by:
refresh in interface Node
See Also:
Node.refresh()

addNestedConfigurationDocument

public ConfigurationDocument addNestedConfigurationDocument(String name,
                                                            Configuration config)
                                                     throws NodeCreationException
Description copied from interface: ConfigurationDocument
Adds a nested configuration object within this document with the name given by name and the value given by config. If config represents an existing ConfigurationDocument, a reference to that document is created, otherwise, the configuration is embedded within this document.

Specified by:
addNestedConfigurationDocument in interface ConfigurationDocument
Parameters:
name - the name of the configuration to add. This should not use indexed notation. If the property is indexed, config will be added to the end of the list. Retrieval then needs to use the indexed notation.
config - the config object to add. If this object belongs to another configuration document, a reference is created to that document. Otherwise, the config is embedded within this document.
Returns:
ConfigurationDocument the added document
Throws:
NodeCreationException - if there is a problem creating the nested document.
See Also:
ConfigurationDocument.addNestedConfigurationDocument(java.lang.String, org.sape.carbon.core.config.Configuration)

containsChild

public boolean containsChild(String childName)
Description copied from interface: Node
Checks if this Folder contains the child specified by childName

Specified by:
containsChild in interface Node
Parameters:
childName - the name of the child Node
Returns:
boolean true if the child exists, false otherwise.
See Also:
Node.containsChild(String)

fetchChild

public Node fetchChild(String childName)
                throws NodeNotFoundException
Description copied from interface: Node
Returns a child Node of the current Node as defined by childName.

Specified by:
fetchChild in interface Node
Parameters:
childName - The name of the child node to be returned.
Returns:
A child Node of the current node.
Throws:
NodeNotFoundException - when childName does not exist in the backing data store
See Also:
Node.fetchChild(String)

fetchChildren

public Node[] fetchChildren()
Description copied from interface: Node
Returns an array of all children nodes, including standard ConfigurationDocuments and Folder. If this particular node does not have any children, an array of length zero is be returned.

Specified by:
fetchChildren in interface Node
Returns:
Array of child Nodes. Never null.
See Also:
Node.fetchChildren()

getAbsoluteName

public String getAbsoluteName()
Description copied from interface: Node
Returns the absolute name of the node within the node heirarchy. This value always begins with a '/' with each node's name in the heirarchy seperated by a '/' unless this is the root node in which case it returns an empty String("").

Specified by:
getAbsoluteName in interface Node
Returns:
Absolute name of the node.
See Also:
Node.getAbsoluteName()

getName

public String getName()
Description copied from interface: Node
Returns the name of this node. The name should not include the node's relation to the node heirarchy. The name can not contain a '/'. The name of the root node is an empty String("").

Specified by:
getName in interface Node
Returns:
name of the node
See Also:
Node.getName()

getParent

public Node getParent()
Description copied from interface: Node
Gets the parent folder of the node.

Specified by:
getParent in interface Node
Returns:
Folder the parent folder, null if this node is the root
See Also:
Node.getParent()

isRemoved

public boolean isRemoved()
Description copied from interface: Node
Used to tell whether or not the backing data of a node has been removed.

Specified by:
isRemoved in interface Node
Returns:
true if the backing data of a node has been removed
See Also:
Node.isRemoved()

getFormatService

public ConfigurationFormatService getFormatService()
Description copied from interface: ConfigurationDocument
Method getFormatService.

Specified by:
getFormatService in interface ConfigurationDocument
Returns:
ConfigurationFormatService
See Also:
ConfigurationDocument.getFormatService()

addNodeListener

public void addNodeListener(NodeEventListener listener)
Description copied from interface: Node
Method addNodeListener.

Specified by:
addNodeListener in interface Node
Parameters:
listener - lister for the node
See Also:
Node.addNodeListener(NodeEventListener)

addNodeListener

public void addNodeListener(ConfigurationEventListener listener)
Description copied from interface: Node
Method addNodeListener.

Specified by:
addNodeListener in interface Node
Parameters:
listener - lister for the node
See Also:
Node.addNodeListener(ConfigurationEventListener)

getRootLinkInputStream

private InputStream getRootLinkInputStream()
Loads the configuration root link. The configuration root link is located in the following order
      Load the config root link specifed in the deployment property carbon.config.RootLink
      Load the config root link CarbonConfigRoot.link from the classloader
      if everything fails load the deault config root link specified in this document

Returns:
input stream to the root link document

getNestedNodeFactory

public NodeFactory getNestedNodeFactory()
Description copied from interface: ConfigurationDocument
Returns the nested node factory for the configuration.

Specified by:
getNestedNodeFactory in interface ConfigurationDocument
Returns:
the nested node factory
See Also:
ConfigurationDocument.getNestedNodeFactory()


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.