KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > riotfamily > riot > security > session > SessionMetaData


1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1
3  * The contents of this file are subject to the Mozilla Public License Version
4  * 1.1 (the "License"); you may not use this file except in compliance with
5  * the License. You may obtain a copy of the License at
6  * http://www.mozilla.org/MPL/
7  *
8  * Software distributed under the License is distributed on an "AS IS" basis,
9  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10  * for the specific language governing rights and limitations under the
11  * License.
12  *
13  * The Original Code is Riot.
14  *
15  * The Initial Developer of the Original Code is
16  * Neteye GmbH.
17  * Portions created by the Initial Developer are Copyright (C) 2006
18  * the Initial Developer. All Rights Reserved.
19  *
20  * Contributor(s):
21  * Felix Gnass [fgnass at neteye dot de]
22  *
23  * ***** END LICENSE BLOCK ***** */

24 package org.riotfamily.riot.security.session;
25
26 import java.io.Serializable JavaDoc;
27 import java.util.Date JavaDoc;
28
29 /**
30  * Class that holds meta data about the last and current session.
31  *
32  * @author Felix Gnass [fgnass at neteye dot de]
33  */

34 public class SessionMetaData implements Serializable JavaDoc {
35
36     private String JavaDoc userId;
37     
38     private String JavaDoc userName;
39     
40     private Date JavaDoc loginDate;
41     
42     private Date JavaDoc lastLoginDate;
43     
44     private String JavaDoc loginIP;
45     
46     private String JavaDoc lastLoginIP;
47
48     
49     public SessionMetaData() {
50     }
51
52     public SessionMetaData(String JavaDoc userId) {
53         this.userId = userId;
54     }
55     
56     void sessionStarted(String JavaDoc userName, String JavaDoc loginIP) {
57         this.userName = userName;
58         this.loginIP = loginIP;
59         this.loginDate = new Date JavaDoc();
60     }
61     
62     void sessionEnded() {
63         lastLoginDate = loginDate;
64         lastLoginIP = loginIP;
65     }
66     
67     public String JavaDoc getUserId() {
68         return userId;
69     }
70
71     public void setUserId(String JavaDoc userId) {
72         this.userId = userId;
73     }
74
75     public String JavaDoc getUserName() {
76         return userName;
77     }
78
79     public void setUserName(String JavaDoc userName) {
80         this.userName = userName;
81     }
82
83     public Date JavaDoc getLastLoginDate() {
84         return lastLoginDate;
85     }
86
87     public void setLastLoginDate(Date JavaDoc lastLoginDate) {
88         this.lastLoginDate = lastLoginDate;
89     }
90
91     public String JavaDoc getLastLoginIP() {
92         return lastLoginIP;
93     }
94
95     public void setLastLoginIP(String JavaDoc lastLoginIP) {
96         this.lastLoginIP = lastLoginIP;
97     }
98     
99 }
100
Popular Tags