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.jetspeed.om.portlet.impl;
018:
019: import java.io.IOException;
020: import java.util.Collection;
021: import java.util.Locale;
022:
023: import org.apache.jetspeed.om.common.GenericMetadata;
024: import org.apache.jetspeed.om.common.ParameterComposite;
025: import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
026: import org.apache.jetspeed.om.common.preference.PreferenceComposite;
027: import org.apache.jetspeed.om.common.preference.PreferenceSetComposite;
028: import org.apache.jetspeed.om.page.Fragment;
029: import org.apache.jetspeed.om.preference.impl.FragmentPortletPreferenceSet;
030: import org.apache.pluto.om.common.Description;
031: import org.apache.pluto.om.common.DescriptionSet;
032: import org.apache.pluto.om.common.DisplayName;
033: import org.apache.pluto.om.common.DisplayNameSet;
034: import org.apache.pluto.om.common.Language;
035: import org.apache.pluto.om.common.LanguageSet;
036: import org.apache.pluto.om.common.ObjectID;
037: import org.apache.pluto.om.common.ParameterSet;
038: import org.apache.pluto.om.common.Preference;
039: import org.apache.pluto.om.common.PreferenceSet;
040: import org.apache.pluto.om.common.SecurityRoleRef;
041: import org.apache.pluto.om.common.SecurityRoleRefSet;
042: import org.apache.pluto.om.portlet.ContentType;
043: import org.apache.pluto.om.portlet.ContentTypeSet;
044: import org.apache.pluto.om.portlet.PortletApplicationDefinition;
045: import org.apache.pluto.om.servlet.ServletDefinition;
046:
047: /**
048: * Per-request wrapper for a PortletDefinition that allows for
049: * the supplementaton of psml-based portlet Preferences.
050: * The Preferences are transparently accessed as default Preferences in
051: * the exact same way default Preferences that are provided via the portelt.xml
052: * are.
053: *
054: * @author <href a="mailto:weaver@apache.org">Scott T. Weaver</a>
055: *
056: */
057: public class FragmentPortletDefinition implements
058: PortletDefinitionComposite {
059: private final PortletDefinitionComposite portletDefinition;
060: private final Fragment fragment;
061:
062: public FragmentPortletDefinition(
063: PortletDefinitionComposite portletDefinition,
064: Fragment fragment) {
065: this .portletDefinition = portletDefinition;
066: this .fragment = fragment;
067: }
068:
069: public void addContentType(ContentType cType) {
070: portletDefinition.addContentType(cType);
071: }
072:
073: public void addContentType(String contentType, Collection modes) {
074: portletDefinition.addContentType(contentType, modes);
075: }
076:
077: public void addDescription(Locale locale, String description) {
078: portletDefinition.addDescription(locale, description);
079: }
080:
081: public void addDisplayName(DisplayName displayName) {
082: portletDefinition.addDisplayName(displayName);
083: }
084:
085: public void addDisplayName(Locale locale, String displayName) {
086: portletDefinition.addDisplayName(locale, displayName);
087: }
088:
089: public ParameterComposite addInitParameter(String name,
090: String value, DescriptionSet description) {
091: return portletDefinition.addInitParameter(name, value,
092: description);
093: }
094:
095: public ParameterComposite addInitParameter(String name,
096: String value, String description, Locale locale) {
097: return portletDefinition.addInitParameter(name, value,
098: description, locale);
099: }
100:
101: public ParameterComposite addInitParameter(String name, String value) {
102: return portletDefinition.addInitParameter(name, value);
103: }
104:
105: public void addLanguage(Language lang) {
106: portletDefinition.addLanguage(lang);
107: }
108:
109: public void addLanguage(String title, String shortTitle,
110: String keywords, Locale locale) {
111: portletDefinition.addLanguage(title, shortTitle, keywords,
112: locale);
113: }
114:
115: public void addPreference(Preference preference) {
116: portletDefinition.addPreference(preference);
117: }
118:
119: public PreferenceComposite addPreference(String name,
120: String[] values) {
121: return portletDefinition.addPreference(name, values);
122: }
123:
124: public void addSecurityRoleRef(SecurityRoleRef securityRef) {
125: portletDefinition.addSecurityRoleRef(securityRef);
126: }
127:
128: public SecurityRoleRef addSecurityRoleRef(String roleName,
129: String roleLink) {
130: return portletDefinition.addSecurityRoleRef(roleName, roleLink);
131: }
132:
133: public String getClassName() {
134: return portletDefinition.getClassName();
135: }
136:
137: public ContentTypeSet getContentTypeSet() {
138: return portletDefinition.getContentTypeSet();
139: }
140:
141: public Description getDescription(Locale arg0) {
142: return portletDefinition.getDescription(arg0);
143: }
144:
145: public DescriptionSet getDescriptionSet() {
146: return portletDefinition.getDescriptionSet();
147: }
148:
149: public String getDescriptionText(Locale locale) {
150: return portletDefinition.getDescriptionText(locale);
151: }
152:
153: public DisplayName getDisplayName(Locale arg0) {
154: return portletDefinition.getDisplayName(arg0);
155: }
156:
157: public DisplayNameSet getDisplayNameSet() {
158: return portletDefinition.getDisplayNameSet();
159: }
160:
161: public String getDisplayNameText(Locale locale) {
162: return portletDefinition.getDisplayNameText(locale);
163: }
164:
165: public String getExpirationCache() {
166: return portletDefinition.getExpirationCache();
167: }
168:
169: public ObjectID getId() {
170: return portletDefinition.getId();
171: }
172:
173: public ParameterSet getInitParameterSet() {
174: return portletDefinition.getInitParameterSet();
175: }
176:
177: public SecurityRoleRefSet getInitSecurityRoleRefSet() {
178: return portletDefinition.getInitSecurityRoleRefSet();
179: }
180:
181: public LanguageSet getLanguageSet() {
182: return portletDefinition.getLanguageSet();
183: }
184:
185: public GenericMetadata getMetadata() {
186: return portletDefinition.getMetadata();
187: }
188:
189: public String getName() {
190: return portletDefinition.getName();
191: }
192:
193: public PortletApplicationDefinition getPortletApplicationDefinition() {
194: return portletDefinition.getPortletApplicationDefinition();
195: }
196:
197: public ClassLoader getPortletClassLoader() {
198: return portletDefinition.getPortletClassLoader();
199: }
200:
201: public String getPortletIdentifier() {
202: return portletDefinition.getPortletIdentifier();
203: }
204:
205: public PreferenceSet getPreferenceSet() {
206: return new FragmentPortletPreferenceSet(
207: (PreferenceSetComposite) portletDefinition
208: .getPreferenceSet(), fragment);
209: }
210:
211: public String getPreferenceValidatorClassname() {
212: return portletDefinition.getPreferenceValidatorClassname();
213: }
214:
215: public String getResourceBundle() {
216: return portletDefinition.getResourceBundle();
217: }
218:
219: public ServletDefinition getServletDefinition() {
220: return portletDefinition.getServletDefinition();
221: }
222:
223: public Collection getSupportedLocales() {
224: return portletDefinition.getSupportedLocales();
225: }
226:
227: public String getUniqueName() {
228: return portletDefinition.getUniqueName();
229: }
230:
231: public void setClassName(String arg0) {
232: portletDefinition.setClassName(arg0);
233: }
234:
235: public void setContentTypeSet(ContentTypeSet contentTypes) {
236: portletDefinition.setContentTypeSet(contentTypes);
237: }
238:
239: public void setDescriptions(DescriptionSet arg0) {
240: portletDefinition.setDescriptions(arg0);
241: }
242:
243: public void setDisplayNames(DisplayNameSet arg0) {
244: portletDefinition.setDisplayNames(arg0);
245: }
246:
247: public void setExpirationCache(String cache) {
248: portletDefinition.setExpirationCache(cache);
249: }
250:
251: public void setId(String arg0) {
252: portletDefinition.setId(arg0);
253: }
254:
255: public void setInitParameterSet(ParameterSet parameters) {
256: portletDefinition.setInitParameterSet(parameters);
257: }
258:
259: public void setInitSecurityRoleRefSet(
260: SecurityRoleRefSet securityRefs) {
261: portletDefinition.setInitSecurityRoleRefSet(securityRefs);
262: }
263:
264: public void setLanguageSet(LanguageSet languages) {
265: portletDefinition.setLanguageSet(languages);
266: }
267:
268: public void setMetadata(GenericMetadata metadata) {
269: portletDefinition.setMetadata(metadata);
270: }
271:
272: public void setName(String arg0) {
273: portletDefinition.setName(arg0);
274: }
275:
276: public void setPortletApplicationDefinition(
277: PortletApplicationDefinition pad) {
278: portletDefinition.setPortletApplicationDefinition(pad);
279: }
280:
281: public void setPortletClassLoader(ClassLoader arg0) {
282: portletDefinition.setPortletClassLoader(arg0);
283: }
284:
285: public void setPortletIdentifier(String portletIndentifier) {
286: portletDefinition.setPortletIdentifier(portletIndentifier);
287: }
288:
289: public void setPreferenceSet(PreferenceSet preferences) {
290: portletDefinition.setPreferenceSet(preferences);
291: }
292:
293: public void setPreferenceValidatorClassname(String classname) {
294: portletDefinition.setPreferenceValidatorClassname(classname);
295: }
296:
297: public void store() throws IOException {
298: portletDefinition.store();
299: }
300:
301: public String getJetspeedSecurityConstraint() {
302: return portletDefinition.getJetspeedSecurityConstraint();
303: }
304:
305: public void setJetspeedSecurityConstraint(String constraint) {
306: portletDefinition.setJetspeedSecurityConstraint(constraint);
307: }
308:
309: }
|