KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > layout > AbstractParameters


1 /*
2  * Copyright 1999-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.cocoon.portal.layout;
17
18 import java.util.Map JavaDoc;
19 import java.util.Iterator JavaDoc;
20 import java.util.HashSet JavaDoc;
21 import java.util.Set JavaDoc;
22
23 import org.apache.commons.collections.map.LinkedMap;
24 import org.apache.pluto.om.common.Parameter;
25 import org.apache.cocoon.portal.pluto.om.common.ParameterImpl;
26
27 /**
28  *
29  * @author <a HREF="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
30  * @author <a HREF="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
31  *
32  * @version CVS $Id: AbstractParameters.java 123289 2004-12-24 10:47:49Z cziegeler $
33  */

34 public abstract class AbstractParameters
35     implements Parameters, Cloneable JavaDoc {
36
37     protected Map JavaDoc parameters = new LinkedMap();
38      
39     /* (non-Javadoc)
40      * @see org.apache.cocoon.portal.layout.Parameters#getParameters()
41      */

42     public final Map JavaDoc getParameters() {
43         return parameters;
44     }
45
46     public final Set JavaDoc getCastorParameters() {
47         Set JavaDoc set = new HashSet JavaDoc(this.parameters.size());
48         Iterator JavaDoc iterator = this.parameters.entrySet().iterator();
49         Map.Entry JavaDoc entry;
50         while (iterator.hasNext())
51         {
52             entry = (Map.Entry JavaDoc) iterator.next();
53             ParameterImpl param = new ParameterImpl();
54             param.setName((String JavaDoc)entry.getKey());
55             param.setValue((String JavaDoc)entry.getValue());
56             set.add(param);
57         }
58         return set;
59     }
60
61     public void addParameter(Parameter parameter) {
62         parameters.put(parameter.getName(), parameter.getValue());
63     }
64
65     /* (non-Javadoc)
66      * @see java.lang.Object#clone()
67      */

68     protected Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
69         AbstractParameters clone = (AbstractParameters)super.clone();
70         
71         clone.parameters = new LinkedMap(this.parameters);
72         
73         return clone;
74     }
75 }
76
Popular Tags