Source Code Cross Referenced for HAServerInterceptor.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » ha » interceptor » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.ha.interceptor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * High Availability Service (HA) for JOnAS
003:         *
004:         * Copyright (C) 2006 Distributed Systems Lab.
005:         * Universidad Polit??cnica de Madrid (Spain)
006:         * Contact: http://lsd.ls.fi.upm.es/lsd
007:         *
008:         * This library is free software; you can redistribute it and/or
009:         * modify it under the terms of the GNU Lesser General Public
010:         * License as published by the Free Software Foundation; either
011:         * version 2.1 of the License, or any later version.
012:         *
013:         * This library is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016:         * Lesser General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU Lesser General Public
019:         * License along with this library; if not, write to the Free Software
020:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
021:         * USA
022:         *
023:         * --------------------------------------------------------------------------
024:         * $Id: HAServerInterceptor.java 9280 2006-08-01 10:15:24Z japaz $
025:         * --------------------------------------------------------------------------
026:         */package org.objectweb.jonas.ha.interceptor;
027:
028:        import java.io.IOException;
029:        import java.util.Stack;
030:
031:        import org.objectweb.carol.cmi.DistributedEquiv;
032:        import org.objectweb.carol.cmi.configuration.TraceCmi;
033:        import org.objectweb.carol.cmi.ha.Constants;
034:        import org.objectweb.carol.cmi.ha.ViewIdWrapper;
035:        import org.objectweb.carol.rmi.jrmp.interceptor.JServerRequestInfo;
036:        import org.objectweb.carol.rmi.jrmp.interceptor.JServerRequestInterceptor;
037:        import org.omg.PortableInterceptor.ForwardRequest;
038:        import org.omg.PortableInterceptor.ServerRequestInfo;
039:
040:        /**
041:         * This class represents the server side of the interceptor mechanism
042:         * implemented to transfer replication related information between client
043:         * and server sides
044:         * @author Francisco Perez-Sorrosal (fpsorrosal@no-spam@fi.upm.es)
045:         * @author Alberto Paz-Jimenez (apaz@no-spam@fi.upm.es)
046:         */
047:        public class HAServerInterceptor implements  JServerRequestInterceptor {
048:
049:            /**
050:             * Interceptor name
051:             */
052:            private String interceptorName = "HAServerInterceptor";
053:
054:            /**
055:             * Constructor
056:             */
057:            public HAServerInterceptor() {
058:            }
059:
060:            /**
061:             * Get the name of this interceptor
062:             * @return name
063:             */
064:            public String name() {
065:                return interceptorName;
066:            }
067:
068:            /**
069:             * Analyzes the HAContext received and constructs the required
070:             * context on the HA current context (the thread associated class) on
071:             * the server side.
072:             */
073:            public void receive_request(JServerRequestInfo jri)
074:                    throws IOException {
075:                TraceCmi.debugCmiHA("----------------------------------");
076:                TraceCmi.debugCmiHA("HAServerInterceptor: receive_request");
077:                // Get the HAContext from the received info
078:                HAContext receivedCtx = (HAContext) jri
079:                        .get_request_service_context(Constants.HA_CTX_ID);
080:                if (TraceCmi.isDebugCmiHA()) {
081:                    TraceCmi.debugCmiHA(receivedCtx.toString());
082:                }
083:                // Get the current Thread/HAContext association class
084:                HACurrentDelegateImpl current = HACurrentDelegateImpl
085:                        .getCurrent();
086:
087:                Stack requests = receivedCtx.getRequests();
088:                current.setRequests(requests);
089:                current.pushViewIdWrapper(receivedCtx.getViewIdWrapper());
090:
091:                boolean onFailover = receivedCtx.isOnFailover();
092:                current.setOnFailover(onFailover);
093:
094:                TraceCmi.debugCmiHA("HACtx asocciated to Thread");
095:                TraceCmi.debugCmiHA("----------------------------------");
096:            }
097:
098:            public void send_reply(JServerRequestInfo jri) throws IOException {
099:                if (TraceCmi.isDebugCmiHA()) {
100:                    TraceCmi.debugCmiHA("----------------------------------");
101:                    TraceCmi.debugCmiHA("HAClientInterceptor: send_reply");
102:                }
103:                putHAContext(jri);
104:                if (TraceCmi.isDebugCmiHA()) {
105:                    TraceCmi.debugCmiHA("----------------------------------");
106:                }
107:            }
108:
109:            public void destroy() {
110:
111:            }
112:
113:            public void receive_request_service_contexts(ServerRequestInfo ri)
114:                    throws ForwardRequest {
115:            }
116:
117:            public void send_exception(JServerRequestInfo jri)
118:                    throws IOException {
119:                if (TraceCmi.isDebugCmiHA()) {
120:                    TraceCmi.debugCmiHA("----------------------------------");
121:                    TraceCmi.debugCmiHA("HAClientInterceptor: send_exception");
122:                }
123:                putHAContext(jri);
124:                if (TraceCmi.isDebugCmiHA()) {
125:                    TraceCmi.debugCmiHA("----------------------------------");
126:                }
127:            }
128:
129:            public void send_other(JServerRequestInfo jri) throws IOException {
130:                if (TraceCmi.isDebugCmiHA()) {
131:                    TraceCmi.debugCmiHA("----------------------------------");
132:                    TraceCmi.debugCmiHA("HAClientInterceptor: send_other");
133:                }
134:                putHAContext(jri);
135:                if (TraceCmi.isDebugCmiHA()) {
136:                    TraceCmi.debugCmiHA("----------------------------------");
137:                }
138:            }
139:
140:            private void putHAContext(JServerRequestInfo jri) {
141:                // invoke the viewId checking
142:                DistributedEquiv.doViewIdChecking();
143:
144:                // Get the current HA Context info associated to the thread
145:                HACurrentDelegateImpl current = HACurrentDelegateImpl
146:                        .getCurrent();
147:                // Create the new HAContext to propagate between interceptors
148:                HAContext newHACtx = new HAContext();
149:
150:                Stack requests = current.getRequests();
151:                newHACtx.setRequests(requests);
152:                ViewIdWrapper wrapper = current.getViewIdWrapper();
153:                newHACtx.setViewIdWrapper(wrapper);
154:
155:                if (TraceCmi.isDebugCmiHA()) {
156:                    TraceCmi.debugCmiHA("newHACtx: " + newHACtx);
157:                }
158:                // Finally, include the new HAContext created to be propagated through
159:                // the interceptor
160:                jri.add_reply_service_context(newHACtx);
161:            }
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.