View Javadoc

1   /*
2    * $Id: Session.java 106 2004-10-17 15:41:10Z josem $
3    *
4    * Tarsis
5    * Copyright (C) 2002 Talika Open Source Group
6    *
7    * This program is free software; you can redistribute it and/or modify
8    * it under the terms of the GNU General Public License as published by
9    * the Free Software Foundation; either version 2 of the License, or
10   * (at your option) any later version.
11   *
12   * This program is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Public License for more details.
16   *
17   * You should have received a copy of the GNU General Public License
18   * along with this program; if not, write to the Free Software
19   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20   *
21   */
22  
23  package org.talika.tarsis.command;
24  
25  /**
26   * Interface that defines a user session in Tarsis MVC Framework.<br>
27   * <br>
28   * <code>Session</code> object provides a way to identify a user across more than one
29   * request and to store information about that user.<code>Session</code> is intended
30   * to decouple Tarsis commands layer from Servlet layer.<br>
31   *
32   * @author  Jose M. Palomar
33   * @version $Revision: 106 $
34   */
35  public interface Session {
36  
37      // Constants
38  
39      // Methods
40      /**
41       * Returns a string containing the unique identifier assigned to this session.
42       *
43       * @return String string containing the unique identifier assigned to this
44       * session.
45       */
46      String getId();
47  
48      /**
49       * Binds an object to this session, using the name specified. If an object of
50       * the same name is already bound to the session, the object is replaced.
51       *
52       * @param name String the name to which the object is bound; cannot be
53       * <code>null</code>.
54       * @param value Object the object to be bound.
55       * @see javax.servlet.http.HttpSession#setAttribute(String, Object)
56       */
57      void setAttribute(String name, Object value);
58  
59      /**
60       * Returns the object bound with the specified name in this session, or
61       * <code>null</code> if no object is bound under the name.
62       *
63       * @param name String a string specifying the name of the object.
64       * @return Object the object with the specified name.
65       * @see javax.servlet.http.HttpSession#getAttribute(String)
66       */
67      Object getAttribute(String name);
68  
69      /**
70       * Removes the object bound with the specified name from this session. If the
71       * session does not have an object bound with the specified name, this method
72       * does nothing.
73       *
74       * @param name String the name of the object to remove from this session.
75       * @see javax.servlet.http.HttpSession#removeAttribute(String)
76       */
77      void removeAttribute(String name);
78  
79  }