Source Code Cross Referenced for JEJBRequest.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » rpc » 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 » ow2 easybeans » org.ow2.easybeans.rpc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * EasyBeans
003:         * Copyright (C) 2006 Bull S.A.S.
004:         * Contact: easybeans@ow2.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: JEJBRequest.java 1970 2007-10-16 11:49:25Z benoitf $
023:         * --------------------------------------------------------------------------
024:         */package org.ow2.easybeans.rpc;
025:
026:        import static org.ow2.easybeans.util.marshalling.Serialization.loadObject;
027:        import static org.ow2.easybeans.util.marshalling.Serialization.storeObject;
028:
029:        import java.io.IOException;
030:
031:        import org.ow2.easybeans.rpc.api.EJBRequest;
032:        import org.ow2.easybeans.rpc.api.RPCException;
033:
034:        /**
035:         * Implementation of the EJBRequest interface.
036:         * @author Florent Benoit
037:         */
038:        public class JEJBRequest implements  EJBRequest {
039:
040:            /**
041:             * Id for serializable class.
042:             */
043:            private static final long serialVersionUID = -3588466669344863787L;
044:
045:            /**
046:             * Name of the method.
047:             */
048:            private String methodName = null;
049:
050:            /**
051:             * Hashing of the method.
052:             * @see <a href="http://java.sun.com/j2se/1.5.0/docs/guide/rmi/spec/rmi-stubs24.html">Method hashing of RMI</a>
053:             */
054:            private long methodHash;
055:
056:            /**
057:             * Arguments of the method.
058:             */
059:            private byte[] byteArgs;
060:
061:            /**
062:             * Arguments of the method (not serializable).
063:             */
064:            private transient Object[] args = null;
065:
066:            /**
067:             * Id of the container that will be used on the remote side.
068:             */
069:            private String containerId = null;
070:
071:            /**
072:             * Name of the factory for which is dedicated this request.
073:             */
074:            private String factoryName = null;
075:
076:            /**
077:             * Id of the bean (ie, for stateful).
078:             */
079:            private Long beanId = null;
080:
081:            /**
082:             * Builds a new request that will be sent on remote side.
083:             * @param methodName the name of the method.
084:             * @param methodHash the hash of the method.
085:             * @param args the arguments of the method.
086:             * @param containerId id of the remote container.
087:             * @param factoryName the name of the remote factory.
088:             * @param beanId the bean identifier.
089:             * @throws RPCException if the request cannot be built.
090:             */
091:            public JEJBRequest(final String methodName, final long methodHash,
092:                    final Object[] args, final String containerId,
093:                    final String factoryName, final Long beanId)
094:                    throws RPCException {
095:                this .methodHash = methodHash;
096:                this .methodName = methodName;
097:
098:                try {
099:                    byteArgs = storeObject(args);
100:                } catch (IOException e) {
101:                    throw new RPCException(
102:                            "Cannot serialize the arguments of the request.", e);
103:                }
104:                this .args = args;
105:                this .containerId = containerId;
106:                this .factoryName = factoryName;
107:                this .beanId = beanId;
108:            }
109:
110:            /**
111:             * @return name of the method
112:             */
113:            public String getMethodName() {
114:                return methodName;
115:            }
116:
117:            /**
118:             * @see <a
119:             *      href="http://java.sun.com/j2se/1.5.0/docs/guide/rmi/spec/rmi-stubs24.html">Method
120:             *      hashing of RMI</a>
121:             * @return the hash of this method
122:             */
123:            public long getMethodHash() {
124:                return methodHash;
125:            }
126:
127:            /**
128:             * @return the argument of the request (send by the client).
129:             * @throws IllegalStateException if arguments were serialized and not available.
130:             */
131:            public Object[] getMethodArgs() throws IllegalStateException {
132:                // try to read object from array of bytes
133:                try {
134:                    args = (Object[]) loadObject(byteArgs);
135:                } catch (IOException e) {
136:                    throw new IllegalStateException(
137:                            "Cannot get arguments of the request", e);
138:                } catch (ClassNotFoundException e) {
139:                    throw new IllegalStateException(
140:                            "Cannot get arguments of the request", e);
141:                }
142:                return args;
143:            }
144:
145:            /**
146:             * @return the container id of this request. It will be used to know the
147:             *         container for which this request is sent.
148:             */
149:            public String getContainerId() {
150:                return containerId;
151:            }
152:
153:            /**
154:             * @return the factory name of the container.
155:             */
156:            public String getFactory() {
157:                return factoryName;
158:            }
159:
160:            /**
161:             * @return the id of the bean.
162:             */
163:            public Long getBeanId() {
164:                return beanId;
165:            }
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.