KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > portal > pluto > om > common > DescriptionImpl


1 /*
2  * Copyright 2004,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.pluto.om.common;
17
18 import java.util.Locale JavaDoc;
19
20 import org.apache.pluto.om.common.Description;
21 import org.apache.pluto.util.StringUtils;
22
23 /**
24  *
25  *
26  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
27  *
28  * @version CVS $Id: DescriptionImpl.java 123407 2004-12-27 13:51:59Z cziegeler $
29  */

30 public class DescriptionImpl implements Description, java.io.Serializable JavaDoc, Support {
31
32     private String JavaDoc description;
33     private Locale JavaDoc locale; // default locale;
34
private String JavaDoc castorLocale;
35
36     public DescriptionImpl() {
37         // nothing to do
38
}
39
40     // Description implementation.
41
public String JavaDoc getDescription() {
42         return description;
43     }
44
45     public Locale JavaDoc getLocale() {
46         return locale;
47     }
48
49     /* (non-Javadoc)
50      * @see org.apache.cocoon.portal.pluto.om.common.Support#postBuild(java.lang.Object)
51      */

52     public void postBuild(Object JavaDoc parameter) throws Exception JavaDoc {
53         // nothing to do
54
}
55
56     /* (non-Javadoc)
57      * @see org.apache.cocoon.portal.pluto.om.common.Support#postLoad(java.lang.Object)
58      */

59     public void postLoad(Object JavaDoc parameter) throws Exception JavaDoc {
60         if (castorLocale == null) {
61             locale = Locale.ENGLISH;
62         } else {
63             locale = new Locale JavaDoc(castorLocale, "");
64         }
65     }
66     /* (non-Javadoc)
67      * @see org.apache.cocoon.portal.pluto.om.common.Support#postStore(java.lang.Object)
68      */

69     public void postStore(Object JavaDoc parameter) throws Exception JavaDoc {
70         // nothing to do
71
}
72
73     public void preBuild(Object JavaDoc parameter) throws Exception JavaDoc {
74         // nothing to do
75
}
76
77     public void preStore(Object JavaDoc parameter) throws Exception JavaDoc {
78         // nothing to do
79
}
80
81     /* (non-Javadoc)
82      * @see java.lang.Object#toString()
83      */

84     public String JavaDoc toString() {
85         return toString(0);
86     }
87
88     public String JavaDoc toString(int indent) {
89         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(50);
90         StringUtils.newLine(buffer,indent);
91         buffer.append(getClass().toString());
92         buffer.append(": description='");
93         buffer.append(description);
94         buffer.append("', locale='");
95         buffer.append(locale);
96         buffer.append("'");
97         return buffer.toString();
98     }
99
100
101     public void setDescription(String JavaDoc description) {
102         this.description = description;
103     }
104
105     public void setLocale(Locale JavaDoc locale) {
106         this.locale = locale;
107     }
108
109
110     // end castor methods
111

112     /**
113      * Returns the castorLocale.
114      * @return String
115      */

116     public String JavaDoc getCastorLocale() {
117         return castorLocale;
118     }
119
120     /**
121      * Sets the castorLocale.
122      * @param castorLocale The castorLocale to set
123      */

124     public void setCastorLocale(String JavaDoc castorLocale) {
125         this.castorLocale = castorLocale;
126     }
127
128 }
129
Popular Tags