Source Code Cross Referenced for SessionMessageImpl.java in  » Sevlet-Container » apache-tomcat-6.0.14 » org » apache » catalina » ha » 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 » apache tomcat 6.0.14 » org.apache.catalina.ha.session 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.catalina.ha.session;
018:
019:        import org.apache.catalina.ha.ClusterMessageBase;
020:
021:        /**
022:         * Session cluster message
023:         * 
024:         * @author Filip Hanik
025:         * @author Peter Rossbach
026:         * 
027:         * @version $Revision: 531471 $ $Date: 2007-04-23 16:11:44 +0200 (lun., 23 avr. 2007) $
028:         */
029:        public class SessionMessageImpl extends ClusterMessageBase implements 
030:                SessionMessage, java.io.Serializable {
031:
032:            public SessionMessageImpl() {
033:            }
034:
035:            /*
036:
037:             * Private serializable variables to keep the messages state
038:             */
039:            private int mEvtType = -1;
040:            private byte[] mSession;
041:            private String mSessionID;
042:
043:            private String mContextName;
044:            private long serializationTimestamp;
045:            private boolean timestampSet = false;
046:            private String uniqueId;
047:
048:            private SessionMessageImpl(String contextName, int eventtype,
049:                    byte[] session, String sessionID) {
050:                mEvtType = eventtype;
051:                mSession = session;
052:                mSessionID = sessionID;
053:                mContextName = contextName;
054:                uniqueId = sessionID;
055:            }
056:
057:            /**
058:             * Creates a session message. Depending on what event type you want this
059:             * message to represent, you populate the different parameters in the constructor<BR>
060:             * The following rules apply dependent on what event type argument you use:<BR>
061:             * <B>EVT_SESSION_CREATED</B><BR>
062:             *    The parameters: session, sessionID must be set.<BR>
063:             * <B>EVT_SESSION_EXPIRED</B><BR>
064:             *    The parameters: sessionID must be set.<BR>
065:             * <B>EVT_SESSION_ACCESSED</B><BR>
066:             *    The parameters: sessionID must be set.<BR>
067:             * <B>EVT_SESSION_EXPIRED_XXXX</B><BR>
068:             *    The parameters: sessionID must be set.<BR>
069:             * <B>EVT_SESSION_DELTA</B><BR>
070:             *    Send attribute delta (add,update,remove attribute or principal, ...).<BR>
071:             * <B>EVT_ALL_SESSION_DATA</B><BR>
072:             *    Send complete serializes session list<BR>
073:             * <B>EVT_ALL_SESSION_TRANSFERCOMPLETE</B><BR>
074:             *    send that all session state information are transfered
075:             *    after GET_ALL_SESSION received from this sender.<BR>
076:             * @param contextName - the name of the context (application
077:             * @param eventtype - one of the 8 event type defined in this class
078:             * @param session - the serialized byte array of the session itself
079:             * @param sessionID - the id that identifies this session
080:             * @param uniqueID - the id that identifies this message
081:             */
082:            public SessionMessageImpl(String contextName, int eventtype,
083:                    byte[] session, String sessionID, String uniqueID) {
084:                this (contextName, eventtype, session, sessionID);
085:                uniqueId = uniqueID;
086:            }
087:
088:            /**
089:             * returns the event type
090:             * @return one of the event types EVT_XXXX
091:             */
092:            public int getEventType() {
093:                return mEvtType;
094:            }
095:
096:            /**
097:             * @return the serialized data for the session
098:             */
099:            public byte[] getSession() {
100:                return mSession;
101:            }
102:
103:            /**
104:             * @return the session ID for the session
105:             */
106:            public String getSessionID() {
107:                return mSessionID;
108:            }
109:
110:            /**
111:             * set message send time but only the first setting works (one shot)
112:             */
113:            public void setTimestamp(long time) {
114:                synchronized (this ) {
115:                    if (!timestampSet) {
116:                        serializationTimestamp = time;
117:                        timestampSet = true;
118:                    }
119:                }
120:            }
121:
122:            public long getTimestamp() {
123:                return serializationTimestamp;
124:            }
125:
126:            /**
127:             * clear text event type name (for logging purpose only) 
128:             * @return the event type in a string representating, useful for debugging
129:             */
130:            public String getEventTypeString() {
131:                switch (mEvtType) {
132:                case EVT_SESSION_CREATED:
133:                    return "SESSION-MODIFIED";
134:                case EVT_SESSION_EXPIRED:
135:                    return "SESSION-EXPIRED";
136:                case EVT_SESSION_ACCESSED:
137:                    return "SESSION-ACCESSED";
138:                case EVT_GET_ALL_SESSIONS:
139:                    return "SESSION-GET-ALL";
140:                case EVT_SESSION_DELTA:
141:                    return "SESSION-DELTA";
142:                case EVT_ALL_SESSION_DATA:
143:                    return "ALL-SESSION-DATA";
144:                case EVT_ALL_SESSION_TRANSFERCOMPLETE:
145:                    return "SESSION-STATE-TRANSFERED";
146:                default:
147:                    return "UNKNOWN-EVENT-TYPE";
148:                }
149:            }
150:
151:            public String getContextName() {
152:                return mContextName;
153:            }
154:
155:            public String getUniqueId() {
156:                return uniqueId;
157:            }
158:
159:            public void setUniqueId(String uniqueId) {
160:                this .uniqueId = uniqueId;
161:            }
162:
163:            public String toString() {
164:                return getEventTypeString() + "#" + getContextName() + "#"
165:                        + getSessionID();
166:            }
167:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.