001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.cocoon.components;
018:
019: import org.apache.avalon.framework.configuration.Configuration;
020: import org.apache.avalon.framework.configuration.ConfigurationException;
021:
022: /**
023: * This configuration object is used for {@link SitemapConfigurable}
024: * components. It 'extends' {@link Configuration} by a parent.
025: *
026: * @since 2.1
027: * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
028: * @version $Id: ChainedConfiguration.java 433543 2006-08-22 06:22:54Z crossley $
029: */
030: public final class ChainedConfiguration implements Configuration {
031:
032: private Configuration wrappedConfiguration;
033:
034: private ChainedConfiguration parentConfiguration;
035:
036: /**
037: * Constructor
038: */
039: public ChainedConfiguration(Configuration wrapped,
040: ChainedConfiguration parent) {
041: this .wrappedConfiguration = wrapped;
042: this .parentConfiguration = parent;
043: }
044:
045: /**
046: * Get the parent configuration
047: * @return the parent configuration or null.
048: */
049: public ChainedConfiguration getParent() {
050: return this .parentConfiguration;
051: }
052:
053: /* (non-Javadoc)
054: * @see org.apache.avalon.framework.configuration.Configuration#getAttribute(java.lang.String, java.lang.String)
055: */
056: public String getAttribute(String arg0, String arg1) {
057: return this .wrappedConfiguration.getAttribute(arg0, arg1);
058: }
059:
060: /* (non-Javadoc)
061: * @see org.apache.avalon.framework.configuration.Configuration#getAttribute(java.lang.String)
062: */
063: public String getAttribute(String arg0)
064: throws ConfigurationException {
065: return this .wrappedConfiguration.getAttribute(arg0);
066: }
067:
068: /* (non-Javadoc)
069: * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsBoolean(java.lang.String, boolean)
070: */
071: public boolean getAttributeAsBoolean(String arg0, boolean arg1) {
072: return this .wrappedConfiguration.getAttributeAsBoolean(arg0,
073: arg1);
074: }
075:
076: /* (non-Javadoc)
077: * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsBoolean(java.lang.String)
078: */
079: public boolean getAttributeAsBoolean(String arg0)
080: throws ConfigurationException {
081: return this .wrappedConfiguration.getAttributeAsBoolean(arg0);
082: }
083:
084: /* (non-Javadoc)
085: * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsFloat(java.lang.String, float)
086: */
087: public float getAttributeAsFloat(String arg0, float arg1) {
088: return this .wrappedConfiguration
089: .getAttributeAsFloat(arg0, arg1);
090: }
091:
092: /* (non-Javadoc)
093: * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsFloat(java.lang.String)
094: */
095: public float getAttributeAsFloat(String arg0)
096: throws ConfigurationException {
097: return this .wrappedConfiguration.getAttributeAsFloat(arg0);
098: }
099:
100: /* (non-Javadoc)
101: * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsInteger(java.lang.String, int)
102: */
103: public int getAttributeAsInteger(String arg0, int arg1) {
104: return this .wrappedConfiguration.getAttributeAsInteger(arg0,
105: arg1);
106: }
107:
108: /* (non-Javadoc)
109: * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsInteger(java.lang.String)
110: */
111: public int getAttributeAsInteger(String arg0)
112: throws ConfigurationException {
113: return this .wrappedConfiguration.getAttributeAsInteger(arg0);
114: }
115:
116: /* (non-Javadoc)
117: * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsLong(java.lang.String, long)
118: */
119: public long getAttributeAsLong(String arg0, long arg1) {
120: return this .wrappedConfiguration.getAttributeAsLong(arg0, arg1);
121: }
122:
123: /* (non-Javadoc)
124: * @see org.apache.avalon.framework.configuration.Configuration#getAttributeAsLong(java.lang.String)
125: */
126: public long getAttributeAsLong(String arg0)
127: throws ConfigurationException {
128: return this .wrappedConfiguration.getAttributeAsLong(arg0);
129: }
130:
131: /* (non-Javadoc)
132: * @see org.apache.avalon.framework.configuration.Configuration#getAttributeNames()
133: */
134: public String[] getAttributeNames() {
135: return this .wrappedConfiguration.getAttributeNames();
136: }
137:
138: /* (non-Javadoc)
139: * @see org.apache.avalon.framework.configuration.Configuration#getChild(java.lang.String, boolean)
140: */
141: public Configuration getChild(String arg0, boolean arg1) {
142: return this .wrappedConfiguration.getChild(arg0, arg1);
143: }
144:
145: /* (non-Javadoc)
146: * @see org.apache.avalon.framework.configuration.Configuration#getChild(java.lang.String)
147: */
148: public Configuration getChild(String arg0) {
149: return this .wrappedConfiguration.getChild(arg0);
150: }
151:
152: /* (non-Javadoc)
153: * @see org.apache.avalon.framework.configuration.Configuration#getChildren()
154: */
155: public Configuration[] getChildren() {
156: return this .wrappedConfiguration.getChildren();
157: }
158:
159: /* (non-Javadoc)
160: * @see org.apache.avalon.framework.configuration.Configuration#getChildren(java.lang.String)
161: */
162: public Configuration[] getChildren(String arg0) {
163: return this .wrappedConfiguration.getChildren(arg0);
164: }
165:
166: /* (non-Javadoc)
167: * @see org.apache.avalon.framework.configuration.Configuration#getLocation()
168: */
169: public String getLocation() {
170: return this .wrappedConfiguration.getLocation();
171: }
172:
173: /* (non-Javadoc)
174: * @see org.apache.avalon.framework.configuration.Configuration#getName()
175: */
176: public String getName() {
177: return this .wrappedConfiguration.getName();
178: }
179:
180: /* (non-Javadoc)
181: * @see org.apache.avalon.framework.configuration.Configuration#getNamespace()
182: */
183: public String getNamespace() throws ConfigurationException {
184: return this .wrappedConfiguration.getNamespace();
185: }
186:
187: /* (non-Javadoc)
188: * @see org.apache.avalon.framework.configuration.Configuration#getValue()
189: */
190: public String getValue() throws ConfigurationException {
191: return this .wrappedConfiguration.getValue();
192: }
193:
194: /* (non-Javadoc)
195: * @see org.apache.avalon.framework.configuration.Configuration#getValue(java.lang.String)
196: */
197: public String getValue(String arg0) {
198: return this .wrappedConfiguration.getValue(arg0);
199: }
200:
201: /* (non-Javadoc)
202: * @see org.apache.avalon.framework.configuration.Configuration#getValueAsBoolean()
203: */
204: public boolean getValueAsBoolean() throws ConfigurationException {
205: return this .wrappedConfiguration.getValueAsBoolean();
206: }
207:
208: /* (non-Javadoc)
209: * @see org.apache.avalon.framework.configuration.Configuration#getValueAsBoolean(boolean)
210: */
211: public boolean getValueAsBoolean(boolean arg0) {
212: return this .wrappedConfiguration.getValueAsBoolean(arg0);
213: }
214:
215: /* (non-Javadoc)
216: * @see org.apache.avalon.framework.configuration.Configuration#getValueAsFloat()
217: */
218: public float getValueAsFloat() throws ConfigurationException {
219: return this .wrappedConfiguration.getValueAsFloat();
220: }
221:
222: /* (non-Javadoc)
223: * @see org.apache.avalon.framework.configuration.Configuration#getValueAsFloat(float)
224: */
225: public float getValueAsFloat(float arg0) {
226: return this .wrappedConfiguration.getValueAsFloat(arg0);
227: }
228:
229: /* (non-Javadoc)
230: * @see org.apache.avalon.framework.configuration.Configuration#getValueAsInteger()
231: */
232: public int getValueAsInteger() throws ConfigurationException {
233: return this .wrappedConfiguration.getValueAsInteger();
234: }
235:
236: /* (non-Javadoc)
237: * @see org.apache.avalon.framework.configuration.Configuration#getValueAsInteger(int)
238: */
239: public int getValueAsInteger(int arg0) {
240: return this .wrappedConfiguration.getValueAsInteger(arg0);
241: }
242:
243: /* (non-Javadoc)
244: * @see org.apache.avalon.framework.configuration.Configuration#getValueAsLong()
245: */
246: public long getValueAsLong() throws ConfigurationException {
247: return this .wrappedConfiguration.getValueAsLong();
248: }
249:
250: /* (non-Javadoc)
251: * @see org.apache.avalon.framework.configuration.Configuration#getValueAsLong(long)
252: */
253: public long getValueAsLong(long arg0) {
254: return this .wrappedConfiguration.getValueAsLong(arg0);
255: }
256:
257: public double getAttributeAsDouble(String name)
258: throws ConfigurationException {
259: return this .wrappedConfiguration.getAttributeAsDouble(name);
260: }
261:
262: public double getValueAsDouble() throws ConfigurationException {
263: return this .wrappedConfiguration.getValueAsDouble();
264: }
265:
266: public double getValueAsDouble(double value) {
267: return this .wrappedConfiguration.getValueAsDouble(value);
268: }
269:
270: public double getAttributeAsDouble(String name, double value) {
271: return this.wrappedConfiguration.getAttributeAsDouble(name,
272: value);
273: }
274: }
|