View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.portal;
18  
19  //standard java stuff
20  import java.util.Map;
21  
22  //jetspeed support
23  import org.apache.jetspeed.capability.CapabilityMap;
24  import org.apache.jetspeed.om.SecurityReference;
25  import org.apache.jetspeed.util.Config;
26  import org.apache.jetspeed.util.MetaData;
27  
28  /***
29  Defines a configuration for Portlets.  A PortletConfig provides information
30  about the running environment of a given Portlet.
31  
32  @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
33  @version $Id: PortletConfig.java,v 1.50 2004/02/23 04:05:35 jford Exp $
34  */
35  
36  public interface PortletConfig extends Config
37  {
38      
39      /***
40      Init this PortletConfig providing the basic info.
41      */
42      public void init( String url, Map init_params );
43  
44      /***
45      Returns the portlet current PortletSet
46      */
47      public PortletSet getPortletSet();
48  
49      /***
50      Set the context (PortletSet) for this portlet
51      */
52      public void setPortletSet(PortletSet set);
53  
54      /***
55      Returns the portlet current PortletSet
56      */
57      public Map getLayout();
58  
59      /***
60      Set the context (PortletSet) for this portlet
61      */
62      public void setLayout(Map constraints);
63  
64      /***
65       * Returns the current skin mapping.  This method is used for configuration.  Use
66       * getPortletSkin() to find skin use by the Layout engine.
67       *
68       * @return Current skin mapping or null if no skin is defined in PSML.
69       */
70      public Map getSkin();
71  
72      /***
73       * Set the context (PortletSet) for this portlet
74       *
75       * @deprecated use setPortletSkin instead
76       */
77      public void setSkin(Map skin);
78  
79      /***
80      Returns the portlet current PortletSet
81      */
82      public int getPosition();
83  
84      /***
85      Set the context (PortletSet) for this portlet
86      */
87      public void setPosition(int position);
88  
89      /***
90      Returns this Portlet's Metainfo or null it none exists.  The Metainfo can
91      be used to determine an optional title or description for this Portlet.
92      */
93      public MetaData getMetainfo();
94  
95      /***
96      Set the metainfo for the Portlet
97      */
98      public void setMetainfo(MetaData metainfo);
99  
100     /***
101     Portlets can have external configuration information other than just
102     parameters.  A URL can define an external configuration file or HTML file
103     that this Portlet can parse out.
104 
105     The main reason for using setURL/getURL is because the remote URL is cached
106     within Jetspeed so future requests won't have any latency.
107     */
108     public String getURL();
109 
110     /***
111     Used to define a Portlet's URL.
112     */
113     public void setURL(String url);
114 
115     /***
116      * Determines whether to use the URL as part of the unique id to the portlet cache.
117      * This can be used to control the lifetime of the portlet. 
118      * The URL is used in combination with the parameter names and values for this portlet
119      * to uniquely identify to portlet. Parameters may also be optionally included in the cache key.
120      * This value can be set in the portlet registry.
121      *
122      * @return true if the URL is to be part of the cache key.
123      */
124     public boolean isCachedOnURL();
125 
126     /***
127      * Determines whether to use the URL as part of the unique id to the portlet cache.
128      * This can be used to control the lifetime of the portlet. 
129      * The URL is used in combination with the parameter names and values for this portlet
130      * to uniquely identify to portlet. Parameters may also be optionally included in the cache key.
131      * This value can be set in the portlet registry.
132      *
133      * @return cached set to true if want this portlet to be cached based on the url
134      */
135     public void setCachedOnURL(boolean cached);
136 
137 
138     /***
139     Returns a parameter (or defaultValue) that was given to a Portlet.  This can be
140     by a Portlet to obtain further information of itself.
141     The parameter is returned even if it is defined in the context and not directly
142     in the portlet config
143     */
144     public String getLayout(String name, String defaultValue);
145 
146     /***
147     Returns a parameter (or defaultValue) that was given to a Portlet.  This can be
148     by a Portlet to obtain further information of itself.
149     The parameter is returned even if it is defined in the context and not directly
150     in the portlet config
151     */
152     public String getSkin(String name, String defaultValue);
153 
154     /***
155     Sets a skin parameter value in the local config
156     */
157     public void setSkin(String name, String value);
158 
159     /***
160      * Retrieves the Skin object that should be used for this portlet. If 
161      * the current portlet does not have a skin, then skin is retrieve from
162      * the parent portlet set of the system default is now skins are defined
163      * in the portlet set.
164      *
165      * getSkin() can be used for configuration.
166      *
167      * @return the Skin object that should be used.
168      */
169     public PortletSkin getPortletSkin();
170     
171     /***
172      * Sets the PortletSkin to use for this Portlet
173      *
174      * @param skin the new skin to use
175      */
176     public void setPortletSkin(PortletSkin skin);
177     
178     /***
179      * Retrieves the constraints associated with this portlet
180      *
181      * @return the Constraints object
182      */
183     public PortletSet.Constraints getConstraints();
184     
185     /***
186      * Sets the layout constraints in the current portlet set
187      *
188      * @param constraints the constrints object associated with this portlet
189      * in the current set
190      */
191     public void setConstraints(PortletSet.Constraints constraints);
192     
193     /***
194     */
195     public CapabilityMap getCapabilityMap();
196     
197     /***
198     */
199     public void setCapabilityMap( CapabilityMap cm );
200 
201     public void setPortletId(String portletId);
202     public String getPortletId();
203     public void setPageId(String pageId);
204     public String getPageId();
205     
206     /*** Getter for property securityRef.
207      * @return Value of property securityRef.
208      */
209     public SecurityReference getSecurityRef();
210     
211     /*** Setter for property securityRef.
212      * @param securityRef New value of property securityRef.
213      */
214     public void setSecurityRef(SecurityReference securityRef);
215     
216 }