Source Code Cross Referenced for SessionBean.java in  » Web-Framework » helma » helma » framework » core » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » helma » helma.framework.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Helma License Notice
003:         *
004:         * The contents of this file are subject to the Helma License
005:         * Version 2.0 (the "License"). You may not use this file except in
006:         * compliance with the License. A copy of the License is available at
007:         * http://adele.helma.org/download/helma/license.txt
008:         *
009:         * Copyright 1998-2003 Helma Software. All Rights Reserved.
010:         *
011:         * $RCSfile$
012:         * $Author: root $
013:         * $Revision: 8604 $
014:         * $Date: 2007-09-28 15:16:38 +0200 (Fre, 28 Sep 2007) $
015:         */
016:
017:        package helma.framework.core;
018:
019:        import helma.objectmodel.INode;
020:        import helma.framework.UploadStatus;
021:
022:        import java.io.Serializable;
023:        import java.util.Date;
024:
025:        /**
026:         * The SessionBean wraps a <code>Session</code> object and
027:         * exposes it to the scripting framework.
028:         */
029:        public class SessionBean implements  Serializable {
030:            // the wrapped session object
031:            Session session;
032:
033:            /**
034:             * Creates a new SessionBean around a Session object.
035:             *
036:             * @param session ...
037:             */
038:            public SessionBean(Session session) {
039:                this .session = session;
040:            }
041:
042:            /**
043:             *
044:             *
045:             * @return ...
046:             */
047:            public String toString() {
048:                return session.toString();
049:            }
050:
051:            /**
052:             * Attempts to log in a user with the given username/password credentials.
053:             * If username and password match, the user node is associated with the session
054:             * and bound to the session.user property.
055:             *
056:             * @param username the username
057:             * @param password the password
058:             *
059:             * @return true if the user exists and the password matches the user's password property.
060:             */
061:            public boolean login(String username, String password) {
062:                return session.login(username, password);
063:            }
064:
065:            /**
066:             * Directly associates the session with a user object without requiring
067:             * a username/password pair. This is for applications that use their own
068:             * authentication mechanism.
069:             *
070:             * @param userNode the HopObject node representing the user.
071:             */
072:            public void login(INode userNode) {
073:                session.login(userNode);
074:            }
075:
076:            /**
077:             * Disassociate this session from any user object it may have been associated with.
078:             */
079:            public void logout() {
080:                session.logout();
081:            }
082:
083:            /**
084:             * Touching the session marks it as active, avoiding session timeout.
085:             * Usually, sessions are touched when the user associated with it sends
086:             * a request. This method may be used to artificially keep a session alive.
087:             */
088:            public void touch() {
089:                session.touch();
090:            }
091:
092:            /**
093:             * Returns the time this session was last touched.
094:             *
095:             * @return ...
096:             */
097:            public Date lastActive() {
098:                return new Date(session.lastTouched());
099:            }
100:
101:            /**
102:             * Returns the time this session was created.
103:             *
104:             * @return ...
105:             */
106:            public Date onSince() {
107:                return new Date(session.onSince());
108:            }
109:
110:            // property-related methods:
111:
112:            /**
113:             * Get the cache/data node for this session. This object may be used
114:             * to store transient per-session data. It is reflected to the scripting
115:             * environment as session.data.
116:             */
117:            public INode getData() {
118:                return session.getCacheNode();
119:            }
120:
121:            /**
122:             * Gets the user object for this session. This method returns null unless
123:             * one of the session.login methods was previously invoked.
124:             *
125:             * @return ...
126:             */
127:            public INode getUser() {
128:                return session.getUserNode();
129:            }
130:
131:            /**
132:             * Returns the unique identifier for a session object (session cookie).
133:             *
134:             * @return ...
135:             */
136:            public String get_id() {
137:                return session.getSessionId();
138:            }
139:
140:            /**
141:             * Returns the unique identifier for a session object (session cookie).
142:             *
143:             * @return ...
144:             */
145:            public String getCookie() {
146:                return session.getSessionId();
147:            }
148:
149:            /**
150:             * Returns the time this session was last touched.
151:             *
152:             * @return ...
153:             */
154:            public Date getLastActive() {
155:                return new Date(session.lastTouched());
156:            }
157:
158:            /**
159:             * Returns a date object representing the time a user's session was started.
160:             *
161:             * @return ...
162:             */
163:            public Date getOnSince() {
164:                return new Date(session.onSince());
165:            }
166:
167:            /**
168:             * Gets the date at which the session was created or a login or
169:             * logout was performed the last time.
170:             *
171:             * @return ...
172:             */
173:            public Date getLastModified() {
174:                return new Date(session.lastModified());
175:            }
176:
177:            /**
178:             * Sets the date at which the session was created or a login or
179:             * logout was performed the last time.
180:             *
181:             * @param date ...
182:             */
183:            public void setLastModified(Date date) {
184:                session.setLastModified(date);
185:            }
186:
187:            /**
188:             * Return the message that is to be displayed upon the next
189:             * request within this session.
190:             *
191:             * @return the message, or null if none was set.
192:             */
193:            public String getMessage() {
194:                return session.message;
195:            }
196:
197:            /**
198:             * Set a message to be displayed to this session's user. This
199:             * can be used to save a message over to the next request when
200:             * the current request can't be used to display a user visible
201:             * message.
202:             *
203:             * @param msg
204:             */
205:            public void setMessage(String msg) {
206:                session.message = msg;
207:            }
208:
209:            /**
210:             * Get an upload status for the current user session.
211:             * @param uploadId the upload id
212:             * @return the upload status
213:             */
214:            public UploadStatus getUploadStatus(String uploadId) {
215:                return session.getUpload(uploadId);
216:            }
217:
218:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.