KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > lib > interceptor > credentials > Session


1 /*
2  * CoadunationClient: The client libraries for Coadunation. (RMI/CORBA)
3  * Copyright (C) 2006 Rift IT Contracting
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * Session.java
20  *
21  * This credential object represents and active session for a user.
22  */

23
24 // package path
25
package com.rift.coad.lib.interceptor.credentials;
26
27 // java imports
28
import java.util.Set JavaDoc;
29
30 /**
31  * This credential object represents and active session for a user.
32  *
33  * @author Brett Chaldecott
34  */

35 public class Session extends Credential {
36     
37     // private member variables
38
private String JavaDoc sessionId = null;
39     private Set JavaDoc principals = null;
40     
41     /**
42      * Creates a new instance of Session
43      */

44     public Session() {
45     }
46     
47     
48     /**
49      * This constructor is responsible for setting the session id and principals
50      * information.
51      *
52      * @param username The name of the user.
53      * @param sessionId The id for this session.
54      * @param principals The list of principals.
55      */

56     public Session(String JavaDoc username, String JavaDoc sessionId, Set JavaDoc principals) {
57         super(username);
58         this.sessionId = sessionId;
59         this.principals = principals;
60     }
61     
62     
63     /**
64      * This method returns the id of this session.
65      *
66      * @return The id of this session.
67      */

68     public String JavaDoc getSessionId() {
69         return sessionId;
70     }
71     
72     
73     /**
74      * This method sets the session id.
75      *
76      * @param sessionId The id of the session to set.
77      */

78     public void setSessionId(String JavaDoc sessionId) {
79         this.sessionId = sessionId;
80     }
81     
82     
83     /**
84      * This method returns a list of principals.
85      *
86      * @return The list of principals.
87      */

88     public Set JavaDoc getPrincipals() {
89         return principals;
90     }
91     
92     
93     /**
94      * This method sets the principals for a session
95      *
96      * @param principals The set of principals to apply
97      */

98     public void setPrincipals(Set JavaDoc principals) {
99         this.principals = principals;
100     }
101 }
102
Popular Tags