001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.cocoon.portal.pluto.om.common;
018:
019: import java.util.Locale;
020:
021: import org.apache.pluto.om.common.Description;
022: import org.apache.pluto.util.StringUtils;
023:
024: /**
025: *
026: *
027: * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
028: *
029: * @version CVS $Id: DescriptionImpl.java 433543 2006-08-22 06:22:54Z crossley $
030: */
031: public class DescriptionImpl implements Description,
032: java.io.Serializable, Support {
033:
034: private String description;
035: private Locale locale; // default locale;
036: private String castorLocale;
037:
038: public DescriptionImpl() {
039: // nothing to do
040: }
041:
042: // Description implementation.
043: public String getDescription() {
044: return description;
045: }
046:
047: public Locale getLocale() {
048: return locale;
049: }
050:
051: /* (non-Javadoc)
052: * @see org.apache.cocoon.portal.pluto.om.common.Support#postBuild(java.lang.Object)
053: */
054: public void postBuild(Object parameter) throws Exception {
055: // nothing to do
056: }
057:
058: /* (non-Javadoc)
059: * @see org.apache.cocoon.portal.pluto.om.common.Support#postLoad(java.lang.Object)
060: */
061: public void postLoad(Object parameter) throws Exception {
062: if (castorLocale == null) {
063: locale = Locale.ENGLISH;
064: } else {
065: locale = new Locale(castorLocale, "");
066: }
067: }
068:
069: /* (non-Javadoc)
070: * @see org.apache.cocoon.portal.pluto.om.common.Support#postStore(java.lang.Object)
071: */
072: public void postStore(Object parameter) throws Exception {
073: // nothing to do
074: }
075:
076: public void preBuild(Object parameter) throws Exception {
077: // nothing to do
078: }
079:
080: public void preStore(Object parameter) throws Exception {
081: // nothing to do
082: }
083:
084: /* (non-Javadoc)
085: * @see java.lang.Object#toString()
086: */
087: public String toString() {
088: return toString(0);
089: }
090:
091: public String toString(int indent) {
092: StringBuffer buffer = new StringBuffer(50);
093: StringUtils.newLine(buffer, indent);
094: buffer.append(getClass().toString());
095: buffer.append(": description='");
096: buffer.append(description);
097: buffer.append("', locale='");
098: buffer.append(locale);
099: buffer.append("'");
100: return buffer.toString();
101: }
102:
103: public void setDescription(String description) {
104: this .description = description;
105: }
106:
107: public void setLocale(Locale locale) {
108: this .locale = locale;
109: }
110:
111: // end castor methods
112:
113: /**
114: * Returns the castorLocale.
115: * @return String
116: */
117: public String getCastorLocale() {
118: return castorLocale;
119: }
120:
121: /**
122: * Sets the castorLocale.
123: * @param castorLocale The castorLocale to set
124: */
125: public void setCastorLocale(String castorLocale) {
126: this.castorLocale = castorLocale;
127: }
128:
129: }
|