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.om.registry;
18  
19  import java.util.Iterator;
20  
21  /***
22   * This entry describes all the properties that should be present in
23   * a RegistryEntry describing a Portlet.
24   * <p>Each PortletEntry must have a type, which may be:
25   * <dl>
26   *   <dt>abstract</dt><dd>The entry description is unsuitable for instanciating
27   *   a Portlet</dd>
28   *   <dt>instance</dt><dd>This entry may be used to create a Portlet and does not
29   *   depend on any other portlet entries</dd>
30   *   <dt>ref</dt><dd>This entry may be used to instanciate Portlets but depends on
31   *   another PortletEntry definition whose registry name can be retrieved by getParent()
32   *   </dd>
33   * </dl></p>
34   *
35   * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
36   * @version $Id: PortletEntry.java,v 1.5 2004/02/23 03:11:39 jford Exp $
37   */
38  public interface PortletEntry extends PortletInfoEntry
39  {
40  
41      public static final String TYPE_REF        = "ref";
42      public static final String TYPE_INSTANCE   = "instance";
43      public static final String TYPE_ABSTRACT   = "abstract";
44  
45      public final static String DEFAULT_GROUP = "Jetspeed";
46      public final static String DEFAULT_CATEGORY_REF = "General";
47      public final static String DEFAULT_CATEGORY_ABSTRACT = "Abstract";
48  
49      /*** @return the URL associated with this portlet or null */
50      public String getURL();
51  
52      /***
53       * Sets the URL for this PortletEntry
54       * @param url the new PortletEntry URL
55       */
56      public void setURL( String url );
57  
58      /***
59       * Determines whether to use the URL as part of the unique id to the portlet cache.
60       * This can be used to control the lifetime of the portlet.
61       * The URL is used in combination with the parameter names and values for this portlet
62       * to uniquely identify to portlet. Parameters may also be optionally included in the cache key.
63       * This value can be set in the portlet registry.
64       *
65       * @return true if the URL is to be part of the cache key.
66       */
67      public boolean isCachedOnURL();
68  
69      /***
70       * Determines whether to use the URL as part of the unique id to the portlet cache.
71       * This can be used to control the lifetime of the portlet.
72       * The URL is used in combination with the parameter names and values for this portlet
73       * to uniquely identify to portlet. Parameters may also be optionally included in the cache key.
74       * This value can be set in the portlet registry.
75       *
76       * @return cached set to true if want this portlet to be cached based on the url
77       */
78      public void setCachedOnURL(boolean cached);
79  
80      /***
81       * Gets the URL entry record for this portlet entry
82       *
83       * @return ContentURL the URL entry object
84       */
85      public ContentURL getURLEntry();
86  
87      /***
88        * helper to get an instance of a cached parameter.
89        *
90        * @param name The parameter name.
91        * @return The cached parameter entry.
92        */
93      public CachedParameter getCachedParameter( String name );
94  
95      /*** @return the entry name from which this one is derived */
96      public String getParent();
97  
98      /***
99       * Sets the ancestor for this PortletEntry.
100      * @param parent the new ancestor entry name. This name should
101      * be defined in the system registry
102      */
103     public void setParent( String parent );
104 
105     /*** @return true is this entry is only accessible by the
106       * portal administrators.
107       */
108     public boolean isAdmin();
109 
110     /*** @return true is the PortletEntry is marked as an application */
111     public boolean isApplication();
112 
113     /*** Sets the application status of this portlet entry. If an entry
114      *  is maked as application, the associated portlet will only be displayed
115      *  in Maximized mode and can be retrieved specifically
116      *
117      *  @param application the new application status
118      */
119     public void setApplication( boolean application );
120 
121     /*** @return the type of this entry */
122     public String getType();
123 
124     /*** Sets the type of this entry. The type specifies whether it is
125      *  abstract, instance or ref
126      *
127      *  @param type the new type for the PortletEntry
128      */
129     public void setType( String type );
130 
131 
132     /***
133      * Returns a list of the categories
134      *
135      * @return an iterator on the categories
136      */
137     public Iterator listCategories();
138 
139     /***
140      * Test if a given category exists for this entry
141      *
142      * @param name the category name
143      * @return true is the category exists in the default group
144      */
145     public boolean hasCategory(String name);
146 
147     /***
148      * Test if a given category exists for this entry, in the specified group of categories.
149      *
150      * @param name the category name
151      * @param group the category group
152      * @return true is the category exists in the specified group
153      */
154     public boolean hasCategory(String name, String group);
155 
156     /***
157      * Add a new category to this portlet entry in the default group.
158      *
159      * @param name the category name
160      */
161     public void addCategory(String name);
162 
163     /***
164      * Add a new category to this portlet entry.
165      *
166      * @param name the category name
167      * @param group the category group name
168      */
169     public void addCategory(String name, String group);
170 
171     /***
172      * Remove a category from this portlet entry in the default group.
173      *
174      * @param name the category name
175      */
176     public void removeCategory(String name);
177 
178     /***
179      * Remove a category from this portlet entry in the specified group.
180      *
181      * @param name the media type name to remove.
182      * @param group the category group name
183      */
184     public void removeCategory(String name, String group);
185 
186 }
187