View Javadoc

1   /*
2    * Copyright 2003,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  /* 
17  
18   */
19  
20  package org.apache.pluto.portalImpl.om.common.impl;
21  
22  import java.util.Collection;
23  import java.util.Locale;
24  
25  import org.apache.pluto.om.common.Description;
26  import org.apache.pluto.om.common.DescriptionSet;
27  import org.apache.pluto.om.common.Parameter;
28  import org.apache.pluto.om.common.ParameterCtrl;
29  import org.apache.pluto.util.StringUtils;
30  
31  public class ParameterImpl implements Parameter, ParameterCtrl, java.io.Serializable
32  {
33  
34      private String name;
35      private String value;
36      private DescriptionSet descriptions;
37  
38      public ParameterImpl()
39      {
40          descriptions = new org.apache.pluto.portalImpl.om.common.impl.DescriptionSetImpl();
41      }
42  
43      // Parameter implementation.
44  
45      public String getName()
46      {
47          return name;
48      }
49  
50      public String getValue()
51      {
52          return value;
53      }
54  
55      /* (non-Javadoc)
56       * @see org.apache.pluto.om.common.Parameter#getDescription(Locale)
57       */
58      public Description getDescription(Locale locale)
59      {
60          return descriptions.get(locale);
61      }
62  
63      // ParameterCtrl implementation.
64  
65      public void setName(String name)
66      {
67          this.name = name;
68      }
69  
70      public void setValue(String value)
71      {
72          this.value = value;
73      }
74  
75      /* (non-Javadoc)
76       * @see org.apache.pluto.om.common.ParameterCtrl#setDescriptionSet(DescriptionSet)
77       */
78      public void setDescriptionSet(DescriptionSet descriptions)
79      {
80          this.descriptions = descriptions;
81      }
82  
83      // additional methods.
84  
85      public String toString()
86      {
87          return toString(0);
88      }
89  
90      public String toString(int indent)
91      {
92          StringBuffer buffer = new StringBuffer(50);
93          StringUtils.newLine(buffer,indent);
94          buffer.append(getClass().toString());
95          buffer.append(": name='");
96          buffer.append(name);
97          buffer.append("', value='");
98          buffer.append(value);
99          buffer.append("', descriptions='");
100         buffer.append(((DescriptionSetImpl) descriptions).toString());
101         buffer.append("'");
102         return buffer.toString();
103     }
104 
105     public Collection getCastorDescriptions()
106     {
107         return(DescriptionSetImpl)descriptions;
108     }
109 
110     public void setCastorDescriptions(DescriptionSet castorDescriptions)
111     {
112         this.descriptions = castorDescriptions;
113     }
114 }