Source Code Cross Referenced for Proxy.java in  » J2EE » openejb3 » org » apache » openejb » util » proxy » 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.util.proxy 
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.util.proxy;
017:
018:        import java.lang.reflect.Method;
019:
020:        public abstract class Proxy implements  java.io.Serializable {
021:
022:            public InvocationHandler handler;
023:
024:            public InvocationHandler getInvocationHandler() {
025:                return handler;
026:            }
027:
028:            public InvocationHandler setInvocationHandler(
029:                    InvocationHandler newHandler) {
030:                InvocationHandler oldHandler = handler;
031:                handler = newHandler;
032:                return oldHandler;
033:            }
034:
035:            protected static final Class[] NO_ARGS_C = new Class[0];
036:
037:            protected static final Object[] NO_ARGS_O = new Object[0];
038:
039:            protected final void _proxyMethod$throws_default$returns_void(
040:                    int methodNumber, String methodName, Class[] argTypes,
041:                    Object[] args) throws java.rmi.RemoteException {
042:                _proxyMethod$throws_default$returns_Object(methodNumber,
043:                        methodName, argTypes, args);
044:                return;
045:            }
046:
047:            protected final Object _proxyMethod$throws_default$returns_Object(
048:                    int methodNumber, String methodName, Class[] argTypes,
049:                    Object[] args) throws java.rmi.RemoteException {
050:                java.lang.reflect.Method method = _proxyMethod$lookupMethod(
051:                        methodNumber, methodName, argTypes);
052:                try {
053:                    return handler.invoke(this , method, args);
054:                } catch (Throwable t) {
055:
056:                    if (t instanceof  java.rmi.RemoteException)
057:                        throw (java.rmi.RemoteException) t;
058:                    if (t instanceof  java.lang.RuntimeException)
059:                        throw (java.lang.RuntimeException) t;
060:                    else
061:                        throw _proxyError$(t);
062:                }
063:            }
064:
065:            protected final void _proxyMethod$throws_AppException$returns_void(
066:                    int methodNumber, String methodName, Class[] argTypes,
067:                    Object[] args) throws java.rmi.RemoteException,
068:                    org.apache.openejb.ApplicationException {
069:                _proxyMethod$throws_AppException$returns_Object(methodNumber,
070:                        methodName, argTypes, args);
071:                return;
072:            }
073:
074:            protected final Object _proxyMethod$throws_AppException$returns_Object(
075:                    int methodNumber, String methodName, Class[] argTypes,
076:                    Object[] args) throws java.rmi.RemoteException,
077:                    org.apache.openejb.ApplicationException {
078:                java.lang.reflect.Method method = _proxyMethod$lookupMethod(
079:                        methodNumber, methodName, argTypes);
080:                try {
081:                    return handler.invoke(this , method, args);
082:                } catch (Throwable t) {
083:
084:                    if (t instanceof  java.rmi.RemoteException)
085:                        throw (java.rmi.RemoteException) t;
086:                    if (t instanceof  java.lang.RuntimeException)
087:                        throw (java.lang.RuntimeException) t;
088:                    if (t instanceof  org.apache.openejb.ApplicationException)
089:                        throw (org.apache.openejb.ApplicationException) t;
090:                    else
091:                        throw _proxyError$(t);
092:
093:                }
094:            }
095:
096:            protected final int _proxyMethod$throws_default$returns_int(
097:                    int methodNumber, String methodName, Class[] argTypes,
098:                    Object[] args) throws java.rmi.RemoteException {
099:                Integer retval = (Integer) _proxyMethod$throws_default$returns_Object(
100:                        methodNumber, methodName, argTypes, args);
101:                return retval.intValue();
102:            }
103:
104:            protected final double _proxyMethod$throws_default$returns_double(
105:                    int methodNumber, String methodName, Class[] argTypes,
106:                    Object[] args) throws java.rmi.RemoteException {
107:                Double retval = (Double) _proxyMethod$throws_default$returns_Object(
108:                        methodNumber, methodName, argTypes, args);
109:                return retval.doubleValue();
110:            }
111:
112:            protected final long _proxyMethod$throws_default$returns_long(
113:                    int methodNumber, String methodName, Class[] argTypes,
114:                    Object[] args) throws java.rmi.RemoteException {
115:                Long retval = (Long) _proxyMethod$throws_default$returns_Object(
116:                        methodNumber, methodName, argTypes, args);
117:                return retval.longValue();
118:            }
119:
120:            protected final boolean _proxyMethod$throws_default$returns_boolean(
121:                    int methodNumber, String methodName, Class[] argTypes,
122:                    Object[] args) throws java.rmi.RemoteException {
123:                Boolean retval = (Boolean) _proxyMethod$throws_default$returns_Object(
124:                        methodNumber, methodName, argTypes, args);
125:                return retval.booleanValue();
126:            }
127:
128:            protected final float _proxyMethod$throws_default$returns_float(
129:                    int methodNumber, String methodName, Class[] argTypes,
130:                    Object[] args) throws java.rmi.RemoteException {
131:                Float retval = (Float) _proxyMethod$throws_default$returns_Object(
132:                        methodNumber, methodName, argTypes, args);
133:                return retval.floatValue();
134:            }
135:
136:            protected final char _proxyMethod$throws_default$returns_char(
137:                    int methodNumber, String methodName, Class[] argTypes,
138:                    Object[] args) throws java.rmi.RemoteException {
139:                Character retval = (Character) _proxyMethod$throws_default$returns_Object(
140:                        methodNumber, methodName, argTypes, args);
141:                return retval.charValue();
142:            }
143:
144:            protected final byte _proxyMethod$throws_default$returns_byte(
145:                    int methodNumber, String methodName, Class[] argTypes,
146:                    Object[] args) throws java.rmi.RemoteException {
147:                Byte retval = (Byte) _proxyMethod$throws_default$returns_Object(
148:                        methodNumber, methodName, argTypes, args);
149:                return retval.byteValue();
150:            }
151:
152:            protected final short _proxyMethod$throws_default$returns_short(
153:                    int methodNumber, String methodName, Class[] argTypes,
154:                    Object[] args) throws java.rmi.RemoteException {
155:                Short retval = (Short) _proxyMethod$throws_default$returns_Object(
156:                        methodNumber, methodName, argTypes, args);
157:                return retval.shortValue();
158:            }
159:
160:            protected final int _proxyMethod$throws_AppException$returns_int(
161:                    int methodNumber, String methodName, Class[] argTypes,
162:                    Object[] args) throws java.rmi.RemoteException,
163:                    org.apache.openejb.ApplicationException {
164:                Integer retval = (Integer) _proxyMethod$throws_AppException$returns_Object(
165:                        methodNumber, methodName, argTypes, args);
166:                return retval.intValue();
167:            }
168:
169:            protected final double _proxyMethod$throws_AppException$returns_double(
170:                    int methodNumber, String methodName, Class[] argTypes,
171:                    Object[] args) throws java.rmi.RemoteException,
172:                    org.apache.openejb.ApplicationException {
173:                Double retval = (Double) _proxyMethod$throws_AppException$returns_Object(
174:                        methodNumber, methodName, argTypes, args);
175:                return retval.doubleValue();
176:            }
177:
178:            protected final long _proxyMethod$throws_AppException$returns_long(
179:                    int methodNumber, String methodName, Class[] argTypes,
180:                    Object[] args) throws java.rmi.RemoteException,
181:                    org.apache.openejb.ApplicationException {
182:                Long retval = (Long) _proxyMethod$throws_AppException$returns_Object(
183:                        methodNumber, methodName, argTypes, args);
184:                return retval.longValue();
185:            }
186:
187:            protected final boolean _proxyMethod$throws_AppException$returns_boolean(
188:                    int methodNumber, String methodName, Class[] argTypes,
189:                    Object[] args) throws java.rmi.RemoteException,
190:                    org.apache.openejb.ApplicationException {
191:                Boolean retval = (Boolean) _proxyMethod$throws_AppException$returns_Object(
192:                        methodNumber, methodName, argTypes, args);
193:                return retval.booleanValue();
194:            }
195:
196:            protected final float _proxyMethod$throws_AppException$returns_float(
197:                    int methodNumber, String methodName, Class[] argTypes,
198:                    Object[] args) throws java.rmi.RemoteException,
199:                    org.apache.openejb.ApplicationException {
200:                Float retval = (Float) _proxyMethod$throws_AppException$returns_Object(
201:                        methodNumber, methodName, argTypes, args);
202:                return retval.floatValue();
203:            }
204:
205:            protected final char _proxyMethod$throws_AppException$returns_char(
206:                    int methodNumber, String methodName, Class[] argTypes,
207:                    Object[] args) throws java.rmi.RemoteException,
208:                    org.apache.openejb.ApplicationException {
209:                Character retval = (Character) _proxyMethod$throws_AppException$returns_Object(
210:                        methodNumber, methodName, argTypes, args);
211:                return retval.charValue();
212:            }
213:
214:            protected final byte _proxyMethod$throws_AppException$returns_byte(
215:                    int methodNumber, String methodName, Class[] argTypes,
216:                    Object[] args) throws java.rmi.RemoteException,
217:                    org.apache.openejb.ApplicationException {
218:                Byte retval = (Byte) _proxyMethod$throws_AppException$returns_Object(
219:                        methodNumber, methodName, argTypes, args);
220:                return retval.byteValue();
221:            }
222:
223:            protected final short _proxyMethod$throws_AppException$returns_short(
224:                    int methodNumber, String methodName, Class[] argTypes,
225:                    Object[] args) throws java.rmi.RemoteException,
226:                    org.apache.openejb.ApplicationException {
227:                Short retval = (Short) _proxyMethod$throws_AppException$returns_Object(
228:                        methodNumber, methodName, argTypes, args);
229:                return retval.shortValue();
230:            }
231:
232:            protected abstract Method _proxyMethod$lookupMethod(int index,
233:                    String methodName, Class[] argTypes);
234:
235:            protected final Method _proxyMethod$lookupMethod(Class interfce,
236:                    Method[] methodMap, int index, String methodName,
237:                    Class[] argTypes) {
238:
239:                java.lang.reflect.Method method = methodMap[index];
240:                if (method == null) {
241:                    try {
242:                        method = interfce.getMethod(methodName, argTypes);
243:                        methodMap[index] = method;
244:                    } catch (NoSuchMethodException nsme) {
245:                        throw new RuntimeException("Method not found:  "
246:                                + nsme.getMessage(), nsme);
247:                    }
248:                }
249:                return method;
250:            }
251:
252:            protected final java.rmi.RemoteException _proxyError$(
253:                    Throwable throwable) {
254:                return new java.rmi.RemoteException("[OpenEJB]  Proxy Error: ",
255:                        throwable);
256:            }
257:
258:            protected final java.rmi.RemoteException _proxyError$(
259:                    org.apache.openejb.ApplicationException ae) {
260:                return new java.rmi.RemoteException(
261:                        "[OpenEJB]  Proxy Error: The returned application exception is not defined in the throws clause.  ",
262:                        ae.getRootCause());
263:            }
264:
265:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.