KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > config > PlugInConfig


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

18
19
20 package org.apache.struts.config;
21
22
23 import java.io.Serializable JavaDoc;
24 import java.util.HashMap JavaDoc;
25 import java.util.Map JavaDoc;
26
27
28 /**
29  * <p>A JavaBean representing the configuration information of a
30  * <code>&lt;plug-in&gt;</code> element in a Struts
31  * configuration file.</p>
32  *
33  * @version $Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $
34  * @since Struts 1.1
35  */

36
37 public class PlugInConfig implements Serializable JavaDoc {
38
39
40     // ----------------------------------------------------- Instance Variables
41

42
43     /**
44      * Has this component been completely configured?
45      */

46     protected boolean configured = false;
47
48
49     /**
50      * A <code>Map</code> of the name-value pairs that will be used to
51      * configure the property values of a <code>PlugIn</code> instance.
52      */

53     protected Map JavaDoc properties = new HashMap JavaDoc();
54
55
56     // ------------------------------------------------------------- Properties
57

58
59     /**
60      * The fully qualified Java class name of the <code>PlugIn</code>
61      * implementation class being configured.
62      */

63     protected String JavaDoc className = null;
64
65     public String JavaDoc getClassName() {
66         return (this.className);
67     }
68
69     public void setClassName(String JavaDoc className) {
70         this.className = className;
71     }
72
73
74     // --------------------------------------------------------- Public Methods
75

76
77     /**
78      * Add a new property name and value to the set that will be used to
79      * configure the <code>PlugIn</code> instance.
80      *
81      * @param name Property name
82      * @param value Property value
83      */

84     public void addProperty(String JavaDoc name, String JavaDoc value) {
85
86         if (configured) {
87             throw new IllegalStateException JavaDoc("Configuration is frozen");
88         }
89         properties.put(name, value);
90
91     }
92
93
94     /**
95      * Freeze the configuration of this component.
96      */

97     public void freeze() {
98
99         configured = true;
100
101     }
102
103
104     /**
105      * Return the properties that will be used to configure a
106      * <code>PlugIn</code> instance.
107      */

108     public Map JavaDoc getProperties() {
109
110         return (properties);
111
112     }
113
114
115 }
116
Popular Tags