Source Code Cross Referenced for AnySession.java in  » Web-Framework » anvil » anvil » core » net » 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 » anvil » anvil.core.net 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: AnySession.java,v 1.24 2002/09/16 08:05:03 jkl Exp $
003:         *
004:         * Copyright (c) 2002 Njet Communications Ltd. All Rights Reserved.
005:         *
006:         * Use is subject to license terms, as defined in
007:         * Anvil Sofware License, Version 1.1. See LICENSE 
008:         * file, or http://njet.org/license-1.1.txt
009:         */
010:        package anvil.core.net;
011:
012:        import anvil.core.Any;
013:        import anvil.core.AnyAbstractClass;
014:        import anvil.core.Array;
015:        import anvil.script.Context;
016:        import anvil.session.Session;
017:        import anvil.java.util.BindingEnumeration;
018:        import java.util.Enumeration;
019:
020:        ///
021:        /// @class Session
022:        /// The session datatype is used for representing a unique
023:        /// user session.
024:        ///
025:        /// @attribute variable
026:        /// Returns a value bound to given name, or undefined 
027:        /// if there was no such binding.
028:        /// @synopsis object <i>session</i>.<i>variable</i>
029:
030:        /// @reference variable
031:        /// Returns a value bound to given name, or undefined 
032:        /// if there was no such binding.
033:        /// @synopsis "object <i>session</i>[<i>variable</i>]"
034:
035:        /**
036:         * class AnySession
037:         *
038:         * @author: Jani Lehtimäki
039:         */
040:        public class AnySession extends AnyAbstractClass {
041:            public static final anvil.script.compiler.NativeClass __class__ = new anvil.script.compiler.NativeClass(
042:                    "Session",
043:                    AnySession.class,
044:                    //DOC{{
045:                    ""
046:                            + "\n"
047:                            + " @class Session\n"
048:                            + "   The session datatype is used for representing a unique\n"
049:                            + "   user session.\n"
050:                            + "\n"
051:                            + " @attribute \"Session <i>session</i>.<i>attribute</i>\"\n"
052:                            + " Attributes stored to session.\n"
053:                            + " @reference \"Session <i>session</i>[<i>attribute</i>]\"\n"
054:                            + " Attributes stored to session.\n"
055:                            + " @method getCitizen\n"
056:                            + " Returns name of the citizen logged in, or null if none.\n"
057:                            + " @synopsis string getCitizen()\n"
058:                            + " @return citizen name\n"
059:                            + " @method getID\n"
060:                            + " Returns the unique ID of this session.\n"
061:                            + " @synopsis string getID()\n"
062:                            + " @method getLastAccessTime\n"
063:                            + " Returns timestamp when this session was last accessed.\n"
064:                            + " @synopsis int getLastAccessTime()\n"
065:                            + " @return timestamp\n"
066:                            + " @method getCreationTime\n"
067:                            + " Returns timestamp when this session was created.\n"
068:                            + " @synopsis int getCreationTime()\n"
069:                            + " @return timestamp\n"
070:                            + " @method touch\n"
071:                            + " Updates time of last access.\n"
072:                            + " @synopsis void touch()\n"
073:                            + " @method invalidate\n"
074:                            + " Invalidates this session, removing it from session container\n"
075:                            + " @synopsis void invalidate()\n"
076:            //}}DOC
077:            );
078:            static {
079:                NetModule.class.getName();
080:            }
081:
082:            private Session _session;
083:
084:            public AnySession(Session session) {
085:                _session = session;
086:            }
087:
088:            public final anvil.script.ClassType classOf() {
089:                return __class__;
090:            }
091:
092:            public Object toObject() {
093:                return _session;
094:            }
095:
096:            public Any getAttribute(Context context, String attribute) {
097:                return Any.create(_session.getAttribute(attribute));
098:            }
099:
100:            public Any setAttribute(Context context, String attribute, Any value) {
101:                _session.setAttribute(attribute, value);
102:                return value;
103:            }
104:
105:            public Any checkAttribute(Context context, String attribute) {
106:                Object value = _session.getAttribute(attribute);
107:                if (value != null) {
108:                    return Any.create(value);
109:                } else {
110:                    return Any.UNDEFINED;
111:                }
112:            }
113:
114:            public boolean deleteAttribute(Context context, String attribute) {
115:                _session.removeAttribute(attribute);
116:                return true;
117:            }
118:
119:            public Any getReference(Context context, Any index) {
120:                return getAttribute(context, index.toString());
121:            }
122:
123:            public Any setReference(Context context, Any index, Any value) {
124:                return setAttribute(context, index.toString(), value);
125:            }
126:
127:            public Any setReference(Context context, Any value) {
128:                return value;
129:            }
130:
131:            public Any checkReference(Context context, Any index) {
132:                return checkAttribute(context, index.toString());
133:            }
134:
135:            public boolean deleteReference(Context context, Any index) {
136:                return deleteAttribute(context, index.toString());
137:            }
138:
139:            public boolean contains(Any value) {
140:                Enumeration e = _session.enumeration();
141:                while (e.hasMoreElements()) {
142:                    Any elem = Any.create(e.nextElement());
143:                    if (elem.equals(value)) {
144:                        return true;
145:                    }
146:                }
147:                return false;
148:            }
149:
150:            public BindingEnumeration enumeration() {
151:                return _session.enumeration();
152:            }
153:
154:            /// @method getCitizen
155:            /// Returns name of the citizen logged in, or null if none.
156:            /// @synopsis string getCitizen()
157:            /// @return citizen name
158:            public Any m_getCitizen() {
159:                return Any.create(_session.getCitizen());
160:            }
161:
162:            /// @method getID
163:            /// Returns the unique ID of this session.
164:            /// @synopsis string getID()
165:            public Any m_getID() {
166:                return Any.create(_session.getId());
167:            }
168:
169:            /// @method getLastAccessTime
170:            /// Returns timestamp when this session was last accessed.
171:            /// @synopsis int getLastAccessTime()
172:            /// @return timestamp
173:            public Any m_getLastAccessTime() {
174:                return Any.create(_session.getLastAccessTime());
175:            }
176:
177:            /// @method getCreationTime
178:            /// Returns timestamp when this session was created.
179:            /// @synopsis int getCreationTime()
180:            /// @return timestamp
181:            public Any m_getCreationTime() {
182:                return Any.create(_session.getCreationTime());
183:            }
184:
185:            /// @method touch
186:            /// Updates time of last access.
187:            /// @synopsis void touch()
188:            public Any m_touch() {
189:                _session.touch();
190:                return this ;
191:            }
192:
193:            /// @method invalidate
194:            /// Invalidates this session, removing it from session container
195:            /// @synopsis void invalidate()
196:            public Any m_invalidate() {
197:                _session.invalidate();
198:                return this;
199:            }
200:
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.