The Carbon Java Framework  

The Carbon Core Config Subsystem

Configuration Hierarchy Design

Author: Douglas Voet (dvoet at sapient.com)
Version: $Revision: 1.2 $($Author: araman $ / $Date: 2003/05/05 07:59:09 $)
Created: May 2003

Introduction

This document details the design of the configuration hierarchy system. This system defines the naming service in which all Carbon Configurations exist. All relevant classes used to implement this can be found in the org.sape.carbon.core.config.node package.

Nodes

At its most fundamental level, the configuration hierarchy system is a tree-graph of nodes. There are 2 main types of nodes, Folders and ConfigurationDocuments (see Node Interfaces Class Diagram below). Folders can contain children that are other Folders or ConfigurationDocuments. ConfigurationDocuments can contain children that are NestedConfigurationDocuments. ConfigurationDocuments also contain the actual configuration data.

The basic functions of the nodes are implemented in a set of abstract classes: AbstractNode, AbstractFolder, AbstractConfigurationDocument (see Node Implementations Class Diagram below). These classes are extended to implement functionality that is specific to particular configuration storage mechanisms. As of Carbon 2.0 existing storage mechanisms include file system, jars, classloader, and JNDI.

Link Nodes

Link nodes allow links within the configuration hierarchy (e.g. /foo points to /bar) or to other configuration hierarchies (e.g. /jndi points to a hierarchy of JNDI nodes). The LinkNode interface extends the Node interface by adding methods to read and write the ConfigurationDocument that defines the target of the link. The LinkNode interface is further extended by FolderLink and ConfigurationDocumentLink. These 2 interfaces allow links to be manipulated as if they were their targets. The only exception to this pass-through behavior is node removal. Calling remove on a link node removes the link, not the target.

Link Implementations

The actual implementations of link nodes are independent of the technology in which the nodes are stored. LinkNodes are implemented as aggregations of the target node and the link's ConfigurationDocument which are already specific to the storage technology. The target node is in the technology of the target system while the link ConfigurationDocument is in the technology of the system that contains the link. The implementation classes are AbstractLinkNode, FolderLinkImpl and ConfigurationDocumentLinkImpl (see Node Implementations Class Diagram below) in the org.sape.carbon.core.config.node.link package.

Node Interfaces Class Diagram

Node Implementations Class Diagram

Node Creation

All nodes are created by node factories. The root of the configuration hierarchy is itself a link. It is created by a LinkNodeFactory. The LinkNodeFactory determines the factories that are used to create sub-nodes. That is, until another link is encountered, at which time that link determines which factories will be used to create sub-nodes. These factories are specific to the storage mechanism (e.g. file system, jndi, etc.) of the nodes. It is in this fashion that links control the specific implementations of nodes that are instantiated for sub-nodes.


Copyright © 2001-2003, Sapient Corporation