View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.om.portlet.impl;
18  
19  import java.io.IOException;
20  import java.util.Collection;
21  import java.util.Locale;
22  
23  import org.apache.jetspeed.om.common.GenericMetadata;
24  import org.apache.jetspeed.om.common.ParameterComposite;
25  import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
26  import org.apache.jetspeed.om.common.preference.PreferenceComposite;
27  import org.apache.jetspeed.om.common.preference.PreferenceSetComposite;
28  import org.apache.jetspeed.om.page.Fragment;
29  import org.apache.jetspeed.om.preference.impl.FragmentPortletPreferenceSet;
30  import org.apache.pluto.om.common.Description;
31  import org.apache.pluto.om.common.DescriptionSet;
32  import org.apache.pluto.om.common.DisplayName;
33  import org.apache.pluto.om.common.DisplayNameSet;
34  import org.apache.pluto.om.common.Language;
35  import org.apache.pluto.om.common.LanguageSet;
36  import org.apache.pluto.om.common.ObjectID;
37  import org.apache.pluto.om.common.ParameterSet;
38  import org.apache.pluto.om.common.Preference;
39  import org.apache.pluto.om.common.PreferenceSet;
40  import org.apache.pluto.om.common.SecurityRoleRef;
41  import org.apache.pluto.om.common.SecurityRoleRefSet;
42  import org.apache.pluto.om.portlet.ContentType;
43  import org.apache.pluto.om.portlet.ContentTypeSet;
44  import org.apache.pluto.om.portlet.PortletApplicationDefinition;
45  import org.apache.pluto.om.servlet.ServletDefinition;
46  
47  /***
48   * Per-request wrapper for a PortletDefinition that allows for
49   * the supplementaton of psml-based portlet Preferences. 
50   * The Preferences are transparently accessed as default Preferences in
51   * the exact same way default Preferences that are provided via the portelt.xml
52   * are. 
53   * 
54   * @author <href a="mailto:weaver@apache.org">Scott T. Weaver</a>
55   *
56   */
57  public class FragmentPortletDefinition implements PortletDefinitionComposite
58  {
59      private final PortletDefinitionComposite portletDefinition;
60      private final Fragment fragment;
61      
62      public FragmentPortletDefinition(PortletDefinitionComposite portletDefinition, Fragment fragment)
63      {
64          this.portletDefinition = portletDefinition;
65          this.fragment = fragment;
66      }
67  
68      public void addContentType(ContentType cType)
69      {
70          portletDefinition.addContentType(cType);
71      }
72  
73      public void addContentType(String contentType, Collection modes)
74      {
75          portletDefinition.addContentType(contentType, modes);
76      }
77  
78      public void addDescription(Locale locale, String description)
79      {
80          portletDefinition.addDescription(locale, description);
81      }
82  
83      public void addDisplayName(DisplayName displayName)
84      {
85          portletDefinition.addDisplayName(displayName);
86      }
87  
88      public void addDisplayName(Locale locale, String displayName)
89      {
90          portletDefinition.addDisplayName(locale, displayName);
91      }
92  
93      public ParameterComposite addInitParameter(String name, String value, DescriptionSet description)
94      {
95          return portletDefinition.addInitParameter(name, value, description);
96      }
97  
98      public ParameterComposite addInitParameter(String name, String value, String description, Locale locale)
99      {
100         return portletDefinition.addInitParameter(name, value, description, locale);
101     }
102 
103     public ParameterComposite addInitParameter(String name, String value)
104     {
105         return portletDefinition.addInitParameter(name, value);
106     }
107 
108     public void addLanguage(Language lang)
109     {
110         portletDefinition.addLanguage(lang);
111     }
112 
113     public void addLanguage(String title, String shortTitle, String keywords, Locale locale)
114     {
115         portletDefinition.addLanguage(title, shortTitle, keywords, locale);
116     }
117 
118     public void addPreference(Preference preference)
119     {
120         portletDefinition.addPreference(preference);
121     }
122 
123     public PreferenceComposite addPreference(String name, String[] values)
124     {
125         return portletDefinition.addPreference(name, values);
126     }
127 
128     public void addSecurityRoleRef(SecurityRoleRef securityRef)
129     {
130         portletDefinition.addSecurityRoleRef(securityRef);
131     }
132 
133     public SecurityRoleRef addSecurityRoleRef(String roleName, String roleLink)
134     {
135         return portletDefinition.addSecurityRoleRef(roleName, roleLink);
136     }
137 
138     public String getClassName()
139     {
140         return portletDefinition.getClassName();
141     }
142 
143     public ContentTypeSet getContentTypeSet()
144     {
145         return portletDefinition.getContentTypeSet();
146     }
147 
148     public Description getDescription(Locale arg0)
149     {
150         return portletDefinition.getDescription(arg0);
151     }
152 
153     public DescriptionSet getDescriptionSet()
154     {
155         return portletDefinition.getDescriptionSet();
156     }
157 
158     public String getDescriptionText(Locale locale)
159     {
160         return portletDefinition.getDescriptionText(locale);
161     }
162 
163     public DisplayName getDisplayName(Locale arg0)
164     {
165         return portletDefinition.getDisplayName(arg0);
166     }
167 
168     public DisplayNameSet getDisplayNameSet()
169     {
170         return portletDefinition.getDisplayNameSet();
171     }
172 
173     public String getDisplayNameText(Locale locale)
174     {
175         return portletDefinition.getDisplayNameText(locale);
176     }
177 
178     public String getExpirationCache()
179     {
180         return portletDefinition.getExpirationCache();
181     }
182 
183     public ObjectID getId()
184     {
185         return portletDefinition.getId();
186     }
187 
188     public ParameterSet getInitParameterSet()
189     {
190         return portletDefinition.getInitParameterSet();
191     }
192 
193     public SecurityRoleRefSet getInitSecurityRoleRefSet()
194     {
195         return portletDefinition.getInitSecurityRoleRefSet();
196     }
197 
198     public LanguageSet getLanguageSet()
199     {
200         return portletDefinition.getLanguageSet();
201     }
202 
203     public GenericMetadata getMetadata()
204     {
205         return portletDefinition.getMetadata();
206     }
207 
208     public String getName()
209     {
210         return portletDefinition.getName();
211     }
212 
213     public PortletApplicationDefinition getPortletApplicationDefinition()
214     {
215         return portletDefinition.getPortletApplicationDefinition();
216     }
217 
218     public ClassLoader getPortletClassLoader()
219     {
220         return portletDefinition.getPortletClassLoader();
221     }
222 
223     public String getPortletIdentifier()
224     {
225         return portletDefinition.getPortletIdentifier();
226     }
227 
228     public PreferenceSet getPreferenceSet()
229     {
230         return new FragmentPortletPreferenceSet((PreferenceSetComposite) portletDefinition.getPreferenceSet(), fragment);
231     }
232 
233     public String getPreferenceValidatorClassname()
234     {
235         return portletDefinition.getPreferenceValidatorClassname();
236     }
237 
238     public String getResourceBundle()
239     {
240         return portletDefinition.getResourceBundle();
241     }
242 
243     public ServletDefinition getServletDefinition()
244     {
245         return portletDefinition.getServletDefinition();
246     }
247 
248     public Collection getSupportedLocales()
249     {
250         return portletDefinition.getSupportedLocales();
251     }
252 
253     public String getUniqueName()
254     {
255         return portletDefinition.getUniqueName();
256     }
257 
258     public void setClassName(String arg0)
259     {
260         portletDefinition.setClassName(arg0);
261     }
262 
263     public void setContentTypeSet(ContentTypeSet contentTypes)
264     {
265         portletDefinition.setContentTypeSet(contentTypes);
266     }
267 
268     public void setDescriptions(DescriptionSet arg0)
269     {
270         portletDefinition.setDescriptions(arg0);
271     }
272 
273     public void setDisplayNames(DisplayNameSet arg0)
274     {
275         portletDefinition.setDisplayNames(arg0);
276     }
277 
278     public void setExpirationCache(String cache)
279     {
280         portletDefinition.setExpirationCache(cache);
281     }
282 
283     public void setId(String arg0)
284     {
285         portletDefinition.setId(arg0);
286     }
287 
288     public void setInitParameterSet(ParameterSet parameters)
289     {
290         portletDefinition.setInitParameterSet(parameters);
291     }
292 
293     public void setInitSecurityRoleRefSet(SecurityRoleRefSet securityRefs)
294     {
295         portletDefinition.setInitSecurityRoleRefSet(securityRefs);
296     }
297 
298     public void setLanguageSet(LanguageSet languages)
299     {
300         portletDefinition.setLanguageSet(languages);
301     }
302 
303     public void setMetadata(GenericMetadata metadata)
304     {
305         portletDefinition.setMetadata(metadata);
306     }
307 
308     public void setName(String arg0)
309     {
310         portletDefinition.setName(arg0);
311     }
312 
313     public void setPortletApplicationDefinition(PortletApplicationDefinition pad)
314     {
315         portletDefinition.setPortletApplicationDefinition(pad);
316     }
317 
318     public void setPortletClassLoader(ClassLoader arg0)
319     {
320         portletDefinition.setPortletClassLoader(arg0);
321     }
322 
323     public void setPortletIdentifier(String portletIndentifier)
324     {
325         portletDefinition.setPortletIdentifier(portletIndentifier);
326     }
327 
328     public void setPreferenceSet(PreferenceSet preferences)
329     {
330         portletDefinition.setPreferenceSet(preferences);
331     }
332 
333     public void setPreferenceValidatorClassname(String classname)
334     {
335         portletDefinition.setPreferenceValidatorClassname(classname);
336     }
337 
338     public void store() throws IOException
339     {
340         portletDefinition.store();
341     }
342     
343     public String getJetspeedSecurityConstraint()
344     {
345         return portletDefinition.getJetspeedSecurityConstraint();
346     }
347 
348     public void setJetspeedSecurityConstraint(String constraint)
349     {
350         portletDefinition.setJetspeedSecurityConstraint(constraint);
351     }
352     
353 }