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  import java.util.Iterator;
20  
21  import org.apache.jetspeed.om.profile.Entry;
22  import org.apache.jetspeed.om.profile.PSMLDocument;
23  import org.apache.jetspeed.om.profile.Profile;
24  import org.apache.jetspeed.portal.Portlet;
25  
26  /***
27   * This interface provides an easy, object-oriented approach to modifing 
28   * a portlet instance's persistent attributes.
29   * It provides methods for getting, setting and removing attributes from 
30   * portlet instance persistence storage. 
31   *
32   * In a Jetspeed 1.4x PSML profile, the default XML format for an instance and attribute is:
33   *
34   * <entry>
35   *    <parameter name="someName" value="someValue"/>
36   *
37   * @author <a href="mailto:sweaver@rippe.com">Scott Weaver</a>
38   * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a> 
39   * @version $Id: PortletInstance.java,v 1.3 2004/02/23 04:05:35 jford Exp $
40   */
41  public interface PortletInstance
42  {
43      /***
44       * Retrieves an attributes value associated with a named object from a
45       * portlet instance's persistence storage. 
46       *
47       * @param name The name of the attribute
48       * @param defaultValue The default value if the attribute is not found.
49       * @return String The attribute value, or the defaultValue if not found.
50       */
51      String getAttribute(String name, String defaultValue);
52      
53      /***
54       * Retrieves an attributes value associated with a named object from a
55       * portlet instance's persistence storage. 
56       *
57       * @param name The name of the attribute
58       * @return String The attribute value, or the empty string if not found.
59       */
60      String getAttribute(String name);
61  
62  
63      /***
64       * Sets a portlet instance attribute into persistence storage.
65       *
66       * @param name The name of the attribute.
67       * @param value The value of the attribute.
68       */
69      void setAttribute(String name, String value);
70      
71      /***
72       * Removes a portlet instance attribute from persistence storage.
73       *
74       * @param name The name of the attribute.
75       */
76      void removeAttribute(String name);
77      
78      /***
79       * Removes all portlet instance attributes from persistence storage.
80       *
81       */
82      void removeAllAttributes();
83      
84      /***
85       * Retrieves a list of all of the attributes of this portlet instance
86       *  as <code>org.apache.jetspeed.om.profile.Parameter</code> objects.
87       *
88       * @return java.util.Iterator
89       */
90      Iterator getAttributes();
91      
92      /***
93       * Retrieves a list of all attributes names for all the attributes
94       * contained within this portlet instance.
95       *
96       * @return java.util.Iterator
97       */
98      Iterator getAttributeNames();
99      
100     /***
101      * Returns the PSMLDocument that contains this portlet instance.
102      *
103      * @return org.apache.jetspeed.om.profile.PSMLDocument
104      * 
105      */
106     PSMLDocument getDocument();
107     
108     /***
109      * Returns the Profile instance containing this portlet instance.  
110      *
111      * @return org.apache.jetspeed.om.profile.Profile
112      */
113     Profile getProfile();
114     
115     /***
116      * Returns the PSML OM instance associated with this instance.
117      *
118      * @return org.apache.jetspeed.om.profile.Entry
119      */
120     Entry getEntry();    
121     
122      /***
123       * Returns the parent portlet of this PortletInstance.
124       *
125       * @return org.apache.jetspeed.portal.Portlet 
126       */
127     Portlet getPortlet();    
128     
129     /***
130      * Retrieves the name of the parent portlet as it is defined within the portlet registry.
131      *
132      * @return String The name of the portlet.
133      */
134     String getName();
135     
136     /***
137      * Retrieves the title (if it is defined) of the parent portlet as it is defined 
138      * within the portlet registry.
139      *
140      * @return String The title of the portlet.
141      */
142     String getTitle();
143     
144     /***
145      * Retrieves the description (if it is defined) of the parent portlet as it 
146      * is defined within the portlet registry.
147      * 
148      * @return String The description of the portlet.
149      */
150     String getDescription();   
151     
152 
153 }