Source Code Cross Referenced for JNDIResponse.java in  » J2EE » openejb3 » org » apache » openejb » client » 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 » openejb3 » org.apache.openejb.client 
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:         */package org.apache.openejb.client;
017:
018:        import java.io.IOException;
019:        import java.io.ObjectInput;
020:        import java.io.ObjectOutput;
021:
022:        public class JNDIResponse implements  ClusterableResponse {
023:
024:            private transient int responseCode = -1;
025:            private transient Object result;
026:            private transient ServerMetaData server;
027:
028:            public JNDIResponse() {
029:            }
030:
031:            public JNDIResponse(int code, Object obj) {
032:                responseCode = code;
033:                result = obj;
034:            }
035:
036:            public int getResponseCode() {
037:                return responseCode;
038:            }
039:
040:            public Object getResult() {
041:                return result;
042:            }
043:
044:            public void setResponseCode(int responseCode) {
045:                this .responseCode = responseCode;
046:            }
047:
048:            public void setResult(Object result) {
049:                this .result = result;
050:            }
051:
052:            public void setServer(ServerMetaData server) {
053:                this .server = server;
054:            }
055:
056:            public ServerMetaData getServer() {
057:                return server;
058:            }
059:
060:            public void readExternal(ObjectInput in) throws IOException,
061:                    ClassNotFoundException {
062:                byte version = in.readByte(); // future use
063:
064:                boolean readServer = in.readBoolean();
065:                if (readServer) {
066:                    server = new ServerMetaData();
067:                    server.readExternal(in);
068:                }
069:
070:                responseCode = in.readByte();
071:
072:                switch (responseCode) {
073:                case ResponseCodes.JNDI_BUSINESS_OBJECT:
074:                case ResponseCodes.JNDI_OK:
075:                case ResponseCodes.JNDI_NAMING_EXCEPTION:
076:                case ResponseCodes.JNDI_RUNTIME_EXCEPTION:
077:                case ResponseCodes.JNDI_ERROR:
078:                case ResponseCodes.JNDI_RESOURCE:
079:                    result = in.readObject();
080:                    break;
081:                case ResponseCodes.JNDI_CONTEXT:
082:                case ResponseCodes.JNDI_NOT_FOUND:
083:                    break;
084:                case ResponseCodes.JNDI_EJBHOME:
085:                    EJBMetaDataImpl m = new EJBMetaDataImpl();
086:                    m.readExternal(in);
087:                    result = m;
088:                    break;
089:                case ResponseCodes.JNDI_DATA_SOURCE:
090:                    DataSourceMetaData ds = new DataSourceMetaData();
091:                    ds.readExternal(in);
092:                    result = ds;
093:                    break;
094:                case ResponseCodes.JNDI_INJECTIONS:
095:                    InjectionMetaData imd = new InjectionMetaData();
096:                    imd.readExternal(in);
097:                    result = imd;
098:                    break;
099:                case ResponseCodes.JNDI_WEBSERVICE:
100:                    WsMetaData ws = (WsMetaData) in.readObject();
101:                    result = ws;
102:                    break;
103:                case ResponseCodes.JNDI_ENUMERATION:
104:                    NameClassPairEnumeration ncpe = new NameClassPairEnumeration();
105:                    ncpe.readExternal(in);
106:                    result = ncpe;
107:                    break;
108:                }
109:            }
110:
111:            public void writeExternal(ObjectOutput out) throws IOException {
112:                // write out the version of the serialized data for future use
113:                out.writeByte(1);
114:
115:                if (null != server) {
116:                    out.writeBoolean(true);
117:                    server.writeExternal(out);
118:                } else {
119:                    out.writeBoolean(false);
120:                }
121:
122:                out.writeByte((byte) responseCode);
123:
124:                switch (responseCode) {
125:                case ResponseCodes.JNDI_BUSINESS_OBJECT:
126:                case ResponseCodes.JNDI_OK:
127:                case ResponseCodes.JNDI_NAMING_EXCEPTION:
128:                case ResponseCodes.JNDI_RUNTIME_EXCEPTION:
129:                case ResponseCodes.JNDI_ERROR:
130:                case ResponseCodes.JNDI_RESOURCE:
131:                    out.writeObject(result);
132:                    break;
133:                case ResponseCodes.JNDI_CONTEXT:
134:                case ResponseCodes.JNDI_NOT_FOUND:
135:                    break;
136:                case ResponseCodes.JNDI_EJBHOME:
137:                    EJBMetaDataImpl m = (EJBMetaDataImpl) result;
138:                    m.writeExternal(out);
139:                    break;
140:                case ResponseCodes.JNDI_DATA_SOURCE:
141:                    DataSourceMetaData ds = (DataSourceMetaData) result;
142:                    ds.writeExternal(out);
143:                    break;
144:                case ResponseCodes.JNDI_INJECTIONS:
145:                    InjectionMetaData imd = (InjectionMetaData) result;
146:                    imd.writeExternal(out);
147:                    break;
148:                case ResponseCodes.JNDI_WEBSERVICE:
149:                    WsMetaData ws = (WsMetaData) result;
150:                    out.writeObject(ws);
151:                    break;
152:                case ResponseCodes.JNDI_ENUMERATION:
153:                    NameClassPairEnumeration ncpe = (NameClassPairEnumeration) result;
154:                    ncpe.writeExternal(out);
155:                    break;
156:                }
157:            }
158:
159:            public String toString() {
160:                StringBuilder sb = new StringBuilder(100);
161:
162:                switch (responseCode) {
163:                case ResponseCodes.JNDI_BUSINESS_OBJECT:
164:                    sb.append("JNDI_BUSINESS_OBJECT:");
165:                    break;
166:                case ResponseCodes.JNDI_OK:
167:                    sb.append("JNDI_OK:");
168:                    break;
169:                case ResponseCodes.JNDI_NAMING_EXCEPTION:
170:                    sb.append("JNDI_NAMING_EXCEPTION:");
171:                    break;
172:                case ResponseCodes.JNDI_RUNTIME_EXCEPTION:
173:                    sb.append("JNDI_RUNTIME_EXCEPTION:");
174:                    break;
175:                case ResponseCodes.JNDI_ERROR:
176:                    sb.append("JNDI_ERROR:");
177:                    break;
178:                case ResponseCodes.JNDI_RESOURCE:
179:                    sb.append("JNDI_RESOURCE:");
180:                    break;
181:                case ResponseCodes.JNDI_CONTEXT:
182:                    sb.append("JNDI_CONTEXT:");
183:                    break;
184:                case ResponseCodes.JNDI_NOT_FOUND:
185:                    sb.append("JNDI_NOT_FOUND:");
186:                    break;
187:                case ResponseCodes.JNDI_EJBHOME:
188:                    sb.append("JNDI_EJBHOME:");
189:                    break;
190:                case ResponseCodes.JNDI_DATA_SOURCE:
191:                    sb.append("JNDI_DATA_SOURCE:");
192:                    break;
193:                case ResponseCodes.JNDI_INJECTIONS:
194:                    sb.append("JNDI_INJECTIONS:");
195:                    break;
196:                }
197:                sb.append(this.getResult());
198:                return sb.toString();
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.