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.common.portlet;
018:
019: import java.io.Serializable;
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.preference.PreferenceComposite;
026: import org.apache.pluto.om.common.DescriptionSet;
027: import org.apache.pluto.om.common.DisplayName;
028: import org.apache.pluto.om.common.DisplayNameSet;
029: import org.apache.pluto.om.common.Language;
030: import org.apache.pluto.om.common.LanguageSet;
031: import org.apache.pluto.om.common.ParameterSet;
032: import org.apache.pluto.om.common.Preference;
033: import org.apache.pluto.om.common.PreferenceSet;
034: import org.apache.pluto.om.common.SecurityRoleRef;
035: import org.apache.pluto.om.common.SecurityRoleRefSet;
036: import org.apache.pluto.om.portlet.ContentType;
037: import org.apache.pluto.om.portlet.ContentTypeSet;
038: import org.apache.pluto.om.portlet.PortletApplicationDefinition;
039: import org.apache.pluto.om.portlet.PortletDefinition;
040: import org.apache.pluto.om.portlet.PortletDefinitionCtrl;
041:
042: /**
043: *
044: * PortletDefinitionComposite
045: *
046: * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
047: * @version $Id: PortletDefinitionComposite.java 516448 2007-03-09 16:25:47Z ate $
048: *
049: */
050: public interface PortletDefinitionComposite extends PortletDefinition,
051: PortletDefinitionCtrl, Serializable {
052: public static final String PORTLETS_PREFS_ROOT = "portlets";
053:
054: GenericMetadata getMetadata();
055:
056: void setMetadata(GenericMetadata metadata);
057:
058: void addLanguage(Language lang);
059:
060: void addLanguage(String title, String shortTitle, String keywords,
061: Locale locale);
062:
063: void addContentType(ContentType cType);
064:
065: void addContentType(String contentType, Collection modes);
066:
067: void setLanguageSet(LanguageSet languages);
068:
069: String getResourceBundle();
070:
071: Collection getSupportedLocales();
072:
073: /**
074: * The PreferenceSet is a collection user-defineable preferences
075: * that this portlet can use to process its logic.
076: *
077: * @param preferences
078: */
079: void setPreferenceSet(PreferenceSet preferences);
080:
081: void setInitParameterSet(ParameterSet parameters);
082:
083: void setContentTypeSet(ContentTypeSet contentTypes);
084:
085: void setInitSecurityRoleRefSet(SecurityRoleRefSet securityRefs);
086:
087: /**
088: * Convenience method for directly adding init parameters
089: * to this <code>PortletDefinition.</code>. This has the
090: * same affect as
091: * <code>((ParameterSetCtrl)PortletDefinition.getInitParamaterSet()).add()</code>
092: * @param name Name of parameter to set
093: * @param value new value of said parameter
094: * @return ParameterComposite newly created parameter
095: */
096: ParameterComposite addInitParameter(String name, String value);
097:
098: /**
099: * Same as <code>setInitParameter(name, title) plus allows a
100: * description to inlcuded.
101: * @see org.apache.jetspeed.om.common.portlet.PortletApplicationComposite#addInitParameter(java.lang.String, java.lang.String)
102: * @param name Name of parameter to set
103: * @param value new value of the parameter
104: * @param DescriptionSet containing locale-specific descriptions of the parameter
105: * @return ParameterComposite newly created parameter
106: */
107: ParameterComposite addInitParameter(String name, String value,
108: DescriptionSet description);
109:
110: /**
111: * Same as <code>setInitParameter(name, title) plus allows you
112: * to define one initial localized desription.
113: *
114: * @see org.apache.jetspeed.om.common.portlet.PortletApplicationComposite#addInitParameter(java.lang.String, java.lang.String)
115: * @param name Name of parameter to set
116: * @param value new value of the parameter
117: * @param description A description for this parameter
118: * @param locale The locale the description
119: * @return ParameterComposite newly created parameter
120: */
121: ParameterComposite addInitParameter(String name, String value,
122: String description, Locale locale);
123:
124: /**
125: * Setter for setting expiration cache time for this portlet
126: */
127: void setExpirationCache(String cache);
128:
129: void setPortletApplicationDefinition(
130: PortletApplicationDefinition pad);
131:
132: PreferenceComposite addPreference(String name, String[] values);
133:
134: void addPreference(Preference preference);
135:
136: void setPortletIdentifier(String portletIndentifier);
137:
138: String getPortletIdentifier();
139:
140: /**
141: * A portlet's unique name is a string formed by the combination of a portlet's
142: * unique within it's parent application plus the parent application's
143: * unique name within the portlet container using ":" as a delimiter.
144: * <br/>
145: * <strong>FORMAT: </strong> <i>application name</i>:<i>portlet name</i>
146: * <br/>
147: * <strong>EXAMPLE: </strong> com.myapp.portletApp1:weather-portlet
148: *
149:
150: * @return Name that uniquely indetifies this portlet within the container. If
151: * either the name of the portlet is <code>null</code> or this portlet has not
152: * yet been assigned to an portlet application, <code>null</code> is returned.
153: */
154: String getUniqueName();
155:
156: /**
157: * Returns localized text of this PortletDefinitions display name.
158: *
159: * @param locale Locale to get the display name for
160: * @return Localized text string of the display name or <code>null</code>
161: * if no DisplayName exists for this locale
162: */
163: String getDisplayNameText(Locale locale);
164:
165: /**
166: * Returns localized text of this PortletDefinitions description.
167: *
168: * @param locale Locale to get the description for
169: * @return Localized text string of the display name or <code>null</code>
170: * if no Description exists for this locale
171: */
172: String getDescriptionText(Locale locale);
173:
174: void addDescription(Locale locale, String description);
175:
176: DescriptionSet getDescriptionSet();
177:
178: void addDisplayName(Locale locale, String displayName);
179:
180: /**
181: *
182: * <p>
183: * addDisplayName
184: * </p>
185: *
186: * @param displayName
187: *
188: */
189: void addDisplayName(DisplayName displayName);
190:
191: DisplayNameSet getDisplayNameSet();
192:
193: String getPreferenceValidatorClassname();
194:
195: void setPreferenceValidatorClassname(String classname);
196:
197: /**
198: *
199: * <p>
200: * addSecurityRoleRef
201: * </p>
202: *
203: * Adds the <code>securityRef</code> to the existing
204: * set of SecurityRoleRefs of this PortletDefinition
205: *
206: * @param securityRef SecurityRoleRef to add.
207: *
208: */
209: void addSecurityRoleRef(SecurityRoleRef securityRef);
210:
211: SecurityRoleRef addSecurityRoleRef(String roleName, String roleLink);
212:
213: /**
214: * <p>
215: * Get the Jetspeed Security Constraint reference for this portlet.
216: * This security constraint name references a Jetspeed-specific Security Constraint.
217: * Security Constraints are not Java Security Permissions, but a
218: * Jetspeed specific way of securing portlets, also known as PSML constraints.
219: * See the <i>page.security</i> file for examples of defining security constraint definitions.
220: * If a Jetspeed Security Constraint is not defined for a portlet, the constraint
221: * applied will then fallback to the constraint defined for the portlet application.
222: * If the portlet application does not define a constraint, then no security constraints
223: * will be applied to this portlet. Security constraints for a portlet are normally
224: * checking during the render process of a portlet.
225: * </p>
226: *
227: * @return The name of the Security Definition applied to this portlet, defined in
228: * the Jetspeed Security Constraints
229: */
230: String getJetspeedSecurityConstraint();
231:
232: /**
233: * <p>
234: * Set the Jetspeed Security Constraint reference for this portlet.
235: * This security constraint name references a Jetspeed-specific Security Constraint.
236: * Security Constraints are not Java Security Permissions, but a
237: * Jetspeed specific way of securing portlets, also known as PSML constraints.
238: * See the <i>page.security</i> file for examples of defining security constraint definitions.
239: * If the portlet application does not define a constraint, then no security constraints
240: * will be applied to this portlet. Security constraints for a portlet are normally
241: * checking during the render process of a portlet.
242: * </p>
243: *
244: * @param constraint The name of the Security Definition defined in
245: * the Jetspeed Security Constraints
246: */
247: void setJetspeedSecurityConstraint(String constraint);
248: }
|