Source Code Cross Referenced for StateInterceptor.java in  » Sevlet-Container » jetty-extras » org » mortbay » j2ee » session » 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 » Sevlet Container » jetty extras » org.mortbay.j2ee.session 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //========================================================================
002:        //$Id: StateInterceptor.java,v 1.4 2004/05/09 20:30:47 gregwilkins Exp $
003:        //Copyright 2002-2004 Mort Bay Consulting Pty. Ltd.
004:        //------------------------------------------------------------------------
005:        //Licensed under the Apache License, Version 2.0 (the "License");
006:        //you may not use this file except in compliance with the License.
007:        //You may obtain a copy of the License at 
008:        //http://www.apache.org/licenses/LICENSE-2.0
009:        //Unless required by applicable law or agreed to in writing, software
010:        //distributed under the License is distributed on an "AS IS" BASIS,
011:        //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012:        //See the License for the specific language governing permissions and
013:        //limitations under the License.
014:        //========================================================================
015:
016:        package org.mortbay.j2ee.session;
017:
018:        //----------------------------------------
019:
020:        import java.rmi.RemoteException;
021:        import java.util.Enumeration;
022:        import java.util.Map;
023:
024:        import javax.servlet.http.HttpSession;
025:
026:        //----------------------------------------
027:        /**
028:         * Superlass for StateInterceptors - objects which
029:         * wrap-n-delegate/decorate a State instance. A stack of
030:         * StateInterceptors form a StateContainer.
031:         *
032:         * @author <a href="mailto:jules@mortbay.com">Jules Gosnell</a>
033:         * @version 1.0
034:         */
035:        public class StateInterceptor implements  State, Cloneable {
036:            //   protected final ThreadLocal _state  =new ThreadLocal();
037:            //   protected State       getState   ()                   {return (State)_state.get();}
038:            //   protected void        setState(State state)           {_state.set(state);}
039:            //
040:            private final static ThreadLocal _manager = new ThreadLocal();
041:
042:            protected Manager getManager() {
043:                return (Manager) _manager.get();
044:            }
045:
046:            protected void setManager(Manager manager) {
047:                _manager.set(manager);
048:            }
049:
050:            private final static ThreadLocal _session = new ThreadLocal();
051:
052:            protected HttpSession getSession() {
053:                return (HttpSession) _session.get();
054:            }
055:
056:            protected void setSession(HttpSession session) {
057:                _session.set(session);
058:            }
059:
060:            // management of this attribute needs to move into the container...
061:            private State _state;
062:
063:            protected State getState() {
064:                return _state;
065:            }
066:
067:            protected void setState(State state) {
068:                _state = state;
069:            }
070:
071:            //   protected HttpSession _session;
072:            //   protected HttpSession getSession ()                   {return _session;}
073:            //   protected void        setSession(HttpSession session) {_session=session;}
074:
075:            //----------------------------------------
076:            // 'StateInterceptor' API
077:            //----------------------------------------
078:
079:            // lifecycle
080:            public void start() {
081:            }
082:
083:            public void stop() {
084:            }
085:
086:            // misc
087:            public String toString() {
088:                return "<" + getClass() + "->" + getState() + ">";
089:            }
090:
091:            //----------------------------------------
092:            // wrapped-n-delegated-to 'State' API
093:            //----------------------------------------
094:            // invariant field accessors
095:            public String getId() throws RemoteException {
096:                return getState().getId();
097:            }
098:
099:            public int getActualMaxInactiveInterval() throws RemoteException {
100:                return getState().getActualMaxInactiveInterval();
101:            }
102:
103:            public long getCreationTime() throws RemoteException {
104:                return getState().getCreationTime();
105:            }
106:
107:            // variant field accessors
108:            public Map getAttributes() throws RemoteException {
109:                return getState().getAttributes();
110:            }
111:
112:            public void setAttributes(Map attributes) throws RemoteException {
113:                getState().setAttributes(attributes);
114:            }
115:
116:            public long getLastAccessedTime() throws RemoteException {
117:                return getState().getLastAccessedTime();
118:            }
119:
120:            public void setLastAccessedTime(long time) throws RemoteException {
121:                getState().setLastAccessedTime(time);
122:            }
123:
124:            public int getMaxInactiveInterval() throws RemoteException {
125:                return getState().getMaxInactiveInterval();
126:            }
127:
128:            public void setMaxInactiveInterval(int interval)
129:                    throws RemoteException {
130:                getState().setMaxInactiveInterval(interval);
131:            }
132:
133:            // compound fn-ality
134:            public Object getAttribute(String name) throws RemoteException {
135:                return getState().getAttribute(name);
136:            }
137:
138:            public Object setAttribute(String name, Object value,
139:                    boolean returnValue) throws RemoteException {
140:                return getState().setAttribute(name, value, returnValue);
141:            }
142:
143:            public Object removeAttribute(String name, boolean returnValue)
144:                    throws RemoteException {
145:                return getState().removeAttribute(name, returnValue);
146:            }
147:
148:            public Enumeration getAttributeNameEnumeration()
149:                    throws RemoteException {
150:                return getState().getAttributeNameEnumeration();
151:            }
152:
153:            public String[] getAttributeNameStringArray()
154:                    throws RemoteException {
155:                return getState().getAttributeNameStringArray();
156:            }
157:
158:            public boolean isValid() throws RemoteException {
159:                return getState().isValid();
160:            }
161:
162:            public Object clone() {
163:                Object tmp = null;
164:                try {
165:                    tmp = getClass().newInstance();
166:                } catch (Exception e) {
167:                    //	_log.error("could not clone "+getClass().getName(),e); - TODO
168:                }
169:
170:                return tmp;
171:            }
172:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.