KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > portlet > PortletSession


1 /* ====================================================================
2  * The Apache Software License, Version 1.1
3  *
4  * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
5  * reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in
16  * the documentation and/or other materials provided with the
17  * distribution.
18  *
19  * 3. The end-user documentation included with the redistribution,
20  * if any, must include the following acknowledgment:
21  * "This product includes software developed by the
22  * Apache Software Foundation (http://www.apache.org/)."
23  * Alternately, this acknowledgment may appear in the software itself,
24  * if and wherever such third-party acknowledgments normally appear.
25  *
26  * 4. The names "Apache" and "Apache Software Foundation" and
27  * "Apache Jetspeed" must not be used to endorse or promote products
28  * derived from this software without prior written permission. For
29  * written permission, please contact apache@apache.org.
30  *
31  * 5. Products derived from this software may not be called "Apache" or
32  * "Apache Jetspeed", nor may "Apache" appear in their name, without
33  * prior written permission of the Apache Software Foundation.
34  *
35  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46  * SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of the Apache Software Foundation. For more
51  * information on the Apache Software Foundation, please see
52  * <http://www.apache.org/>.
53  */

54
55 package org.apache.jetspeed.portlet;
56
57 import org.apache.jetspeed.portlet.event.MessageEvent;
58 import org.apache.jetspeed.portlet.event.MessageListener;
59
60 import java.io.InputStream JavaDoc;
61 import java.io.IOException JavaDoc;
62
63 import java.util.Date JavaDoc;
64 import java.util.Locale JavaDoc;
65 import java.util.Enumeration JavaDoc;
66
67 /**
68  ** The <CODE>PortletSession</CODE> holds the user-specific data that
69  ** the portlet needs to personalize the one global portlet instance.
70  ** Together with the portlet, the portlet session constitutes the
71  ** virtual instance of the portlet.
72  **
73  ** @see Portlet
74  **
75  ** @author <A HREF="mailto:tboehme@us.ibm.com">Thomas F. Boehme</A>
76  **/

77
78 public interface PortletSession
79 {
80     /**
81      ** Returns the user object. The user object contains useful
82      ** information about the user and his or her preferences.
83      **
84      ** @return the user profile
85      **/

86
87     public User getUser ();
88
89     /**
90      ** Returns the point of time that this session was created. Essentially,
91      ** this will also be the time when the user logged in. The time is
92      ** returned as the number of milliseconds since January 1, 1970 GMT.
93      **
94      ** @return the time of creation
95      **/

96
97     public long getCreationTime ();
98
99     /**
100      ** Returns the point of time that this session was last accessed. The
101      ** time is returned as the number of milliseconds since
102      ** January 1, 1970 GMT.
103      **
104      ** @return the time of the last access
105      **/

106
107     public long getLastAccessedTime ();
108
109     /**
110      ** Associates an attribute with the given name and value
111      ** with this session. If a portlet needs to communicate
112      ** information to embedded servlets or JSP, this methods
113      ** can used carry the information along.
114      **
115      ** <P>
116      ** The portlet provider should take care that the
117      ** the namespace of attribute names is not unnecessarily
118      ** polluted. It is recommended to prefix all attributes
119      ** the package and class name of the portlet that
120      ** makes use of this method.
121      **
122      ** @param name
123      ** the attribute name
124      ** @param value
125      ** the attribute value
126      **/

127
128     public void setAttribute (String JavaDoc name, Object JavaDoc value);
129
130     /**
131      ** Returns the value of the attribute with the given name,
132      ** or <CODE>null</CODE> if no attribute with the given name exists.
133      **
134      ** @param name
135      ** the attribute name
136      **
137      ** @return the attribute value
138      **/

139
140     public Object JavaDoc getAttribute (String JavaDoc name);
141
142     /**
143      ** Returns an enumeration of names of all attributes available to
144      ** this session. This method returns an empty enumeration if the
145      ** session has no attributes available to it.
146      **
147      ** @return an enumeration of attribute names
148      **/

149
150     public Enumeration JavaDoc getAttributeNames ();
151
152     /**
153      ** Removes the attribute with the given name.
154      **
155      ** @param name
156      ** the name of attribute to be removed
157      **/

158
159     public void removeAttribute (String JavaDoc name);
160 }
161
Popular Tags