001: /*
002: * Enhydra Java Application Server Project
003: *
004: * The contents of this file are subject to the Enhydra Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License on
007: * the Enhydra web site ( http://www.enhydra.org/ ).
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011: * the License for the specific terms governing rights and limitations
012: * under the License.
013: *
014: * The Initial Developer of the Enhydra Application Server is Lutris
015: * Technologies, Inc. The Enhydra Application Server and portions created
016: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017: * All Rights Reserved.
018: *
019: * Contributor(s):
020: *
021: * $Id: Session.java,v 1.2 2006-06-15 13:40:47 sinisa Exp $
022: *
023: * formatted with JxBeauty (c) johann.langhofer@nextra.at
024: */
025:
026: package com.lutris.appserver.server.session;
027:
028: import javax.servlet.http.HttpSession;
029:
030: import com.lutris.appserver.server.user.User;
031:
032: /**
033: * Defines the interface for the Session object expected by the SessionManager..
034: *
035: * @version $Revision: 1.2 $
036: * @author Shawn McMurdo
037: */
038: public interface Session extends java.io.Serializable {
039:
040: /**
041: * Obtain the user associated with this session.
042: *
043: * @return The user object or <CODE>null</CODE> if the
044: * session is not associated with a <CODE>User</CODE> objects.
045: */
046: public User getUser();
047:
048: /**
049: * Set the user associated with this session. This will register the
050: * user with the <CODE>SessionManager</CODE>. <P>
051: *
052: * If it is neccessary to prevent a user from logging on multiple times,
053: * this can be accomplished by synchronizing on the
054: * <CODE>Sessionmanager</CODE> object and enquiring about the number of
055: * users associated with a session. It is then possible to delete other
056: * sessions before adding a new session.
057: *
058: * @param user
059: * The user object to associate with the session.
060: * @exception SessionException
061: * If the user cannot be set.
062: * @see
063: * SessionManager#getSessionKeys(User)
064: */
065: public void setUser(User user) throws SessionException;
066:
067: /**
068: * Remove the user association with this session. This will unregister the
069: * user with the <CODE>SessionManager</CODE>.
070: * @exception SessionException
071: * If the user cannot be cleared.
072: */
073: public void clearUser() throws SessionException;
074:
075: /**
076: * Obtain the unique key associated with this session.
077: *
078: * @return A String containing the key for this session.
079: */
080: public String getSessionKey();
081:
082: /**
083: * Obtain the session manager associated with this session.
084: *
085: * @return The session manager object.
086: */
087: public SessionManager getSessionManager();
088:
089: /**
090: * Obtain the application specific data for this session.
091: *
092: * @return A SessionData object containing application specific
093: * data for this session.
094: */
095: public SessionData getSessionData();
096:
097: /**
098: * Returns true if the session is new. A session is new if it has
099: * been created but a client cookie was never used to reference it.
100: * In other words, the cookie associated with the session was
101: * never submitted by a client.
102: *
103: * @return true if the session is new.
104: */
105: public boolean isNew();
106:
107: /**
108: *
109: *
110: */
111:
112: public HttpSession getHttpSession();
113:
114: public void setHttpSession(HttpSession httpSession);
115:
116: }
|