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.pluto.descriptors.portlet;
018:
019: import java.util.List;
020: import java.util.ArrayList;
021:
022: /**
023: * Bare bones implementation of the Portlet descriptor.
024: *
025: * FIXME: Hmmm... What do you mean, David? --ZHENG Zhong
026: *
027: * Eventually this should be flushed out :), but for the sake of timing I'll be lazy for now.
028: *
029: *
030: * @since Mar 6, 2005
031: */
032: public class PortletDD {
033:
034: // Private Member Variables ------------------------------------------------
035:
036: /** The unique name of the portlet. */
037: private String portletName = null;
038:
039: /** The display name of the portlet. */
040: private List displayNames = new ArrayList();
041:
042: /** The descriptions of the portlet. */
043: private List descriptions = new ArrayList();
044:
045: private int expirationCache = 0;
046:
047: /** The class which implements the portlet interface. */
048: private String portletClass = null;
049:
050: private String resourceBundle = null;
051:
052: private PortletInfoDD portletInfo = null;
053:
054: private PortletPreferencesDD portletPreferences = new PortletPreferencesDD();
055:
056: private List initParams = new ArrayList();
057:
058: private List supports = new ArrayList();
059:
060: private List supportedLocales = new ArrayList();
061:
062: /** All security role references. */
063: private List securityRoleRefs = new ArrayList();
064:
065: // Constructor -------------------------------------------------------------
066:
067: /**
068: * Default no-arg constructor.
069: */
070: public PortletDD() {
071: // Do nothing.
072: }
073:
074: // Public Methods ----------------------------------------------------------
075:
076: /**
077: * Retrieve the unique name of the portlet.
078: * @return
079: */
080: public String getPortletName() {
081: return portletName;
082: }
083:
084: /**
085: * Set the unique name of the portlet.
086: * @param portletName Value of the portlet-name element for this portlet in portlet.xml.
087: * @throws IllegalArgumentException if the name has a period since it is used
088: * to create the portlet ID in <code>PortletWindowConfig.createPortletId()</code>
089: * using a dot to separate the context path from the portlet name.
090: */
091: public void setPortletName(String portletName) {
092: if (portletName.indexOf('.') != -1) {
093: throw new IllegalArgumentException(
094: "Portlet name must not have a dot(period). Please remove the dot from the value of the portlet-name element ("
095: + portletName + ") in portlet.xml");
096: }
097: this .portletName = portletName;
098: }
099:
100: public List getDisplayNames() {
101: return displayNames;
102: }
103:
104: public void setDisplayNames(List displayNames) {
105: this .displayNames = displayNames;
106: }
107:
108: public List getDescriptions() {
109: return descriptions;
110: }
111:
112: public void setDescriptions(List descriptions) {
113: this .descriptions = descriptions;
114: }
115:
116: public int getExpirationCache() {
117: return expirationCache;
118: }
119:
120: public void setExpirationCache(int expirationCache) {
121: this .expirationCache = expirationCache;
122: }
123:
124: /**
125: * Retrieve the name of the portlet class.
126: * @return the fully qualified portlet class name.
127: */
128: public String getPortletClass() {
129: return portletClass;
130: }
131:
132: /**
133: * Set the name of the portlet class.
134: * @param portletClass
135: */
136: public void setPortletClass(String portletClass) {
137: this .portletClass = portletClass;
138: }
139:
140: public String getResourceBundle() {
141: return resourceBundle;
142: }
143:
144: public void setResourceBundle(String resourceBundle) {
145: this .resourceBundle = resourceBundle;
146: }
147:
148: public PortletInfoDD getPortletInfo() {
149: return portletInfo;
150: }
151:
152: public void setPortletInfo(PortletInfoDD portletInfo) {
153: this .portletInfo = portletInfo;
154: }
155:
156: public List getSupports() {
157: return supports;
158: }
159:
160: public void setSupports(List supports) {
161: this .supports = supports;
162: }
163:
164: public List getSupportedLocales() {
165: return supportedLocales;
166: }
167:
168: public void setSupportedLocales(List supportedLocales) {
169: this .supportedLocales = supportedLocales;
170: }
171:
172: public List getInitParams() {
173: return initParams;
174: }
175:
176: public void setInitParams(List initParams) {
177: this .initParams = initParams;
178: }
179:
180: public PortletPreferencesDD getPortletPreferences() {
181: return portletPreferences;
182: }
183:
184: public void setPortletPreferences(
185: PortletPreferencesDD portletPreferences) {
186: this .portletPreferences = portletPreferences;
187: }
188:
189: /**
190: * Retrieve the security role references for this portlet.
191: * @return
192: */
193: public List getSecurityRoleRefs() {
194: return securityRoleRefs;
195: }
196:
197: /**
198: * Set the security role references for this portlet.
199: * @param securityRoleRefs
200: */
201: public void setSecurityRoleRefs(List securityRoleRefs) {
202: this .securityRoleRefs = securityRoleRefs;
203: }
204:
205: // Object Methods ----------------------------------------------------------
206:
207: /**
208: * Returns a string representation of this instance.
209: * FIXME: more info!
210: * @return a string representation of this instance.
211: */
212: public String toString() {
213: StringBuffer buffer = new StringBuffer();
214: buffer.append(getClass().getName());
215: buffer.append("[portletName=").append(portletName);
216: buffer.append(",portletClass=").append(portletClass);
217: // TODO:
218: return buffer.toString();
219: }
220:
221: /**
222: * Returns the hash code for this instance.
223: * @return the hash code for this instance.
224: */
225: public int hashCode() {
226: return toString().hashCode();
227: }
228:
229: }
|