KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > core > config > node > link > ConfigurationDocumentLinkImpl


1 /*
2  * The contents of this file are subject to the Sapient Public License
3  * Version 1.0 (the "License"); you may not use this file except in compliance
4  * with the License. You may obtain a copy of the License at
5  * http://carbon.sf.net/License.html.
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is The Carbon Component Framework.
12  *
13  * The Initial Developer of the Original Code is Sapient Corporation
14  *
15  * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
16  */

17
18 package org.sape.carbon.core.config.node.link;
19
20 import org.sape.carbon.core.config.Configuration;
21 import org.sape.carbon.core.config.format.ConfigurationFormatException;
22 import org.sape.carbon.core.config.format.ConfigurationFormatService;
23 import org.sape.carbon.core.config.node.ConfigurationDocument;
24 import org.sape.carbon.core.config.node.NodeCreationException;
25 import org.sape.carbon.core.config.node.NodeFactory;
26 import org.sape.carbon.core.config.node.NodeIOException;
27 import org.sape.carbon.core.config.node.event.NodeEventListener;
28
29 /**
30  * Implementation of <code>ConfigurationDocumentLink</code>. This is
31  * probably the only implementation that will ever be needed. It does not
32  * contain any logic specific to a data store so a new implementation should
33  * not be required when new data stores are introduced. The only thing that
34  * should be variable is which factory is used to create a link.
35  *
36  * Copyright 2002 Sapient
37  * @since carbon 1.0
38  * @author Douglas Voet, March 2002
39  * @version $Revision: 1.6 $($Author: dvoet $ / $Date: 2003/05/05 21:21:19 $)
40  */

41 public class ConfigurationDocumentLinkImpl
42     extends AbstractLinkNode
43     implements ConfigurationDocumentLink {
44
45     /**
46      * Constructor for ConfigurationDocumentLinkImpl.
47      *
48      * @param linkConfigurationDocument used to implement the
49      * <code>LinkNode</code> interface
50      * @param targetConfigurationDocument used to implement the
51      * <code>ConfigurationDocument</code> interface
52      */

53     public ConfigurationDocumentLinkImpl(
54         ConfigurationDocument linkConfigurationDocument,
55         ConfigurationDocument targetConfigurationDocument) {
56
57         super(linkConfigurationDocument, targetConfigurationDocument);
58     }
59
60     /**
61      * @see ConfigurationDocument#readConfiguration()
62      */

63     public Configuration readConfiguration()
64         throws NodeIOException, ConfigurationFormatException {
65
66         return ((ConfigurationDocument) super.targetNode).
67             readConfiguration();
68     }
69
70     /**
71      * @see ConfigurationDocument#writeConfiguration(Configuration)
72      */

73     public void writeConfiguration(Configuration config)
74         throws NodeIOException, ConfigurationFormatException {
75
76         ((ConfigurationDocument) super.targetNode).
77             writeConfiguration(config);
78     }
79
80     /**
81      * @see org.sape.carbon.core.config.node.ConfigurationDocument#addNestedConfigurationDocument
82      */

83     public ConfigurationDocument addNestedConfigurationDocument(
84         String JavaDoc name, Configuration config)
85         throws NodeCreationException {
86
87         return ((ConfigurationDocument) super.targetNode).
88             addNestedConfigurationDocument(name, config);
89     }
90
91     /**
92      * @see org.sape.carbon.core.config.node.ConfigurationDocument#getFormatService()
93      */

94     public ConfigurationFormatService getFormatService() {
95         return ((ConfigurationDocument) super.targetNode).getFormatService();
96     }
97
98     /**
99      * @see org.sape.carbon.core.config.node.Node#addNodeListener(NodeEventListener)
100      */

101     public void addNodeListener(NodeEventListener listener) {
102         super.linkConfigurationDocument.addNodeListener(listener);
103         super.targetNode.addNodeListener(listener);
104     }
105
106     /**
107      * @see org.sape.carbon.core.config.node.ConfigurationDocument#getNestedNodeFactory()
108      */

109     public NodeFactory getNestedNodeFactory() {
110         return ((ConfigurationDocument)
111             super.targetNode).getNestedNodeFactory();
112     }
113
114 }
115
Popular Tags