Project

General

Profile

1
/**
2
 *  '$RCSfile$'
3
 *    Purpose: A Class that stores user session information 
4
 *  Copyright: 2008 Regents of the University of California and the
5
 *             National Center for Ecological Analysis and Synthesis
6
 *    Authors: Michael Daigle
7
 * 
8
 *   '$Author: leinfelder $'
9
 *     '$Date: 2008-09-26 15:43:57 -0700 (Fri, 26 Sep 2008) $'
10
 * '$Revision: 4399 $'
11
 *
12
 * This program is free software; you can redistribute it and/or modify
13
 * it under the terms of the GNU General Public License as published by
14
 * the Free Software Foundation; either version 2 of the License, or
15
 * (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
 */
26

    
27
package edu.ucsb.nceas.metacat.util;
28

    
29
import java.util.Calendar;
30
import java.util.Date;
31

    
32
import javax.naming.AuthenticationException;
33
import javax.naming.NamingException;
34

    
35
import javax.servlet.http.Cookie;
36
import javax.servlet.http.HttpServletRequest;
37
import javax.servlet.http.HttpSession;
38

    
39
import org.apache.log4j.Logger;
40

    
41
import edu.ucsb.nceas.metacat.AuthLdap;
42
import edu.ucsb.nceas.metacat.MetaCatServlet;
43
import edu.ucsb.nceas.metacat.cart.DocumentCart;
44

    
45
public class SessionData {
46
	
47
	private String id = null;
48
	private String userName = null;
49
	private String[] groupNames = null;
50
	private String password = null;
51
	private final Calendar creationTime = Calendar.getInstance();
52
	private Calendar lastAccessedTime = Calendar.getInstance();
53
	private DocumentCart documentCart = null;
54
	
55
	private Logger logMetacat = Logger.getLogger(SessionData.class);
56
	
57
	/**
58
	 * 
59
	 * @param userName
60
	 * @param groupNames
61
	 * @param password
62
	 */
63
	public SessionData(String id, String userName, String[] groupNames, String password) {
64
		this.id = id;
65
		this.userName = userName;
66
		this.groupNames = groupNames;
67
		this.password = password;
68
	}
69
	
70
	public String getId() {
71
		return id;
72
	}
73
	
74
	public String getUserName() {
75
		return userName;
76
	}
77
	
78
	public void setUserName(String userName) {
79
		this.userName = userName;
80
	}
81
	
82
	public String[] getGroupNames() {
83
		return groupNames;
84
	}
85
	
86
	public void setGroupNames(String[] groupNames) {
87
		this.groupNames = groupNames;
88
	}
89
	
90
	public String getPassword() {
91
		return password;
92
	}
93
	
94
	public void setPassword(String password) {
95
		this.password = password;
96
	}
97
	
98
	public Calendar getLastAccessedTime() {
99
		return lastAccessedTime;
100
	}
101
	
102
	public void setLastAccessedTime() {
103
		lastAccessedTime.setTime(new Date());
104
	}
105
	
106
	public Calendar getCreationTime() {
107
		return creationTime;
108
	}
109

    
110
	public DocumentCart getDocumentCart() {
111
		if (documentCart == null) {
112
			documentCart = new DocumentCart();
113
		}
114
		return documentCart;
115
	}
116

    
117
	public void setDocumentCart(DocumentCart documentCart) {
118
		this.documentCart = documentCart;
119
	}
120
}
(8-8/11)