KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > framework > configuration > MutableConfiguration


1 /*
2  * Copyright 1997-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.avalon.framework.configuration;
17
18 /**
19  * A read/write extension of the Configuration interface.
20  *
21  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
22  * @version CVS $Revision: 1.2 $ $Date: 2004/03/28 02:55:36 $
23  * @since 4.1.6
24  */

25 public interface MutableConfiguration extends Configuration
26 {
27     /**
28      * Set the value of this <code>Configuration</code> object to the specified string.
29      *
30      * @param value a <code>String</code> value
31      */

32     public void setValue( final String JavaDoc value );
33     
34     /**
35      * Set the value of this <code>Configuration</code> object to the specified int.
36      *
37      * @param value a <code>int</code> value
38      */

39     public void setValue( final int value );
40     
41     /**
42      * Set the value of this <code>Configuration</code> object to the specified long.
43      *
44      * @param value a <code>long</code> value
45      */

46     public void setValue( final long value );
47     
48     /**
49      * Set the value of this <code>Configuration</code> object to the specified boolean.
50      *
51      * @param value a <code>boolean</code> value
52      */

53     public void setValue( final boolean value );
54     
55     /**
56      * Set the value of this <code>Configuration</code> object to the specified float.
57      *
58      * @param value a <code>float</code> value
59      */

60     public void setValue( final float value );
61     
62     /**
63      * Set the value of the specified attribute to the specified string.
64      *
65      * @param name name of the attribute to set
66      * @param value a <code>String</code> value. If null, the attribute is removed.
67      */

68     public void setAttribute( final String JavaDoc name, final String JavaDoc value );
69     
70     /**
71      * Set the value of the specified attribute to the specified int.
72      *
73      * @param name name of the attribute to set
74      * @param value an <code>int</code> value
75      */

76     public void setAttribute( final String JavaDoc name, final int value );
77     
78     /**
79      * Set the value of the specified attribute to the specified long.
80      *
81      * @param name name of the attribute to set
82      * @param value an <code>long</code> value
83      */

84     public void setAttribute( final String JavaDoc name, final long value );
85     
86     /**
87      * Set the value of the specified attribute to the specified boolean.
88      *
89      * @param name name of the attribute to set
90      * @param value an <code>boolean</code> value
91      */

92     public void setAttribute( final String JavaDoc name, final boolean value );
93     
94     /**
95      * Set the value of the specified attribute to the specified float.
96      *
97      * @param name name of the attribute to set
98      * @param value an <code>float</code> value
99      */

100     public void setAttribute( final String JavaDoc name, final float value );
101     
102     /**
103      * Add a child <code>Configuration</code> to this configuration element.
104      * @param configuration a <code>Configuration</code> value
105      */

106     public void addChild( final Configuration configuration );
107     
108     /**
109      * Add all the attributes, children and value
110      * from specified configuration element to current
111      * configuration element.
112      *
113      * @param other the {@link Configuration} element
114      */

115     public void addAll( final Configuration other );
116     
117     /**
118      * Add all attributes from specified configuration
119      * element to current configuration element.
120      *
121      * @param other the {@link Configuration} element
122      */

123     public void addAllAttributes( final Configuration other );
124     
125     /**
126      * Add all child <code>Configuration</code> objects from specified
127      * configuration element to current configuration element.
128      *
129      * @param other the other {@link Configuration} value
130      */

131     public void addAllChildren( final Configuration other );
132     
133     /**
134      * Remove a child <code>Configuration</code> to this configuration element.
135      * @param configuration a <code>Configuration</code> value
136      */

137     public void removeChild( final Configuration configuration );
138     
139     /**
140      * Equivalent to <code>getMutableChild( name, true )</code>
141      */

142     public MutableConfiguration getMutableChild( final String JavaDoc name ) throws ConfigurationException;
143     
144     /**
145      * Gets a child node of this configuration. If a mutable child with the
146      * given name exists, it is returned. If an immutable child with the
147      * given name exists, it is converted into a mutable child and returned.
148      * In this case, the immutable child will be replaced with the mutable
149      * child in this configuration (that is, it will be as if the child
150      * node always had been mutable).
151      * If no child with the given name exists, and <code>autoCreate</code>
152      * is <code>true</code>, a new mutable child is created and added to
153      * this configuration before being returned.
154      *
155      * @return the child MutableConfiguration, or <code>null</code> if <code>autoCreate</code>
156      * was false and no child by the given name existed.
157      * @param name the name of the child.
158      * @param autoCreate set to true to create the child node if it doesn't exist.
159      * @throws ConfigurationException if an error occurrs.
160      */

161     public MutableConfiguration getMutableChild( final String JavaDoc name, boolean autoCreate ) throws ConfigurationException;
162     
163     /**
164      * Returns an array of mutable children. Immutable children
165      * are converted just as for <code>getMutableChild</code>.
166      * @throws ConfigurationException if an error occurrs.
167      */

168     public MutableConfiguration[] getMutableChildren() throws ConfigurationException;
169     
170     /**
171      * Returns an array of mutable children with the given name. Immutable children
172      * are converted just as for <code>getMutableChild</code>.
173      * @throws ConfigurationException if an error occurrs.
174      */

175     public MutableConfiguration[] getMutableChildren( final String JavaDoc name ) throws ConfigurationException;
176 }
177
178
Popular Tags