View Javadoc

1   /*
2    *
3    * Copyright 1999-2004 The Apache Software Foundation.
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  /** ------------------------------------
18   * SweetDEV RIA library
19   * Copyright [2006 - 2010] [Ideo Technologies]
20   * ------------------------------------
21   *
22   * Licensed under the Apache License, Version 2.0 (the "License");
23   * you may not use this file except in compliance with the License.
24   * You may obtain a copy of the License at
25   *
26   * 		http://www.apache.org/licenses/LICENSE-2.0
27   *
28   * Unless required by applicable law or agreed to in writing, software
29   * distributed under the License is distributed on an "AS IS" BASIS,
30   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31   * See the License for the specific language governing permissions and
32   * limitations under the License.
33   *
34   *
35   * For more information, please contact us at:
36   *         Ideo Technologies S.A
37   *        124 rue de Verdun
38   *        92800 Puteaux - France
39   *
40   *      France & Europe Phone : +33 1.46.25.09.60
41   *
42   *
43   *        web : http://www.ideotechnologies.com
44   *        email : SweetDEV-RIA@ideotechnologies.com
45   *
46   *
47   * @version ${pom.version}
48   * @author Ideo Technologies
49   */
50  
51  package com.ideo.sweetdevria.config.elements;
52  
53  
54  import java.io.Serializable;
55  import java.util.HashMap;
56  import java.util.Map;
57  
58  /**
59   * <p>A JavaBean representing the configuration information of a
60   * <code>&lt;plug-in&gt;</code> element in a ria configuration file.</p>
61   */
62  public class PlugInConfig implements Serializable {
63  
64      /**
65  	 * Generated serial version UID.
66  	 */
67  	private static final long serialVersionUID = -8542536540045295426L;
68  
69  	/**
70       * Has this component been completely configured?
71       */
72      protected boolean configured = false;
73  
74      /**
75       * A <code>Map</code> of the name-value pairs that will be used to
76       * configure the property values of a <code>PlugIn</code> instance.
77       */
78      protected Map properties = new HashMap();
79  
80      /**
81       * The fully qualified Java class name of the <code>PlugIn</code>
82       * implementation class being configured.
83       */
84      protected String className = null;
85  
86      public String getClassName() {
87          return (this.className);
88      }
89  
90      public void setClassName(String className) {
91          this.className = className;
92      }
93  
94      /**
95       * Add a new property name and value to the set that will be used to
96       * configure the <code>PlugIn</code> instance.
97       *
98       * @param name Property name
99       * @param value Property value
100      */
101     public void addProperty(String name, String value) {
102 
103         if (configured) {
104             throw new IllegalStateException("Configuration is frozen");
105         }
106         properties.put(name, value);
107 
108     }
109 
110     /**
111      * Freeze the configuration of this component.
112      */
113     public void freeze() {
114 
115         configured = true;
116 
117     }
118 
119     /**
120      * Return the properties that will be used to configure a
121      * <code>PlugIn</code> instance.
122      */
123     public Map getProperties() {
124 
125         return (properties);
126 
127     }
128 }