Update of /cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/lookup/resources
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28599/resources
Modified Files:
lookup.xdt
Log Message:
Remove experimental proxy code. It's better handled with MockEJB.
Index: lookup.xdt
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/lookup/resources/lookup.xdt,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** lookup.xdt 5 Aug 2003 09:33:24 -0000 1.10
--- lookup.xdt 26 Jan 2004 01:11:11 -0000 1.11
***************
*** 22,26 ****
private static Object lookupHome(java.util.Hashtable environment, String
jndiName, Class narrowTo) throws javax.naming.NamingException {
- <XDtEjbUtilObj:ifNotGenerateLocalProxy>
// Obtain initial context
javax.naming.InitialContext initialContext = new
javax.naming.InitialContext(environment);
--- 22,25 ----
***************
*** 35,43 ****
initialContext.close();
}
- </XDtEjbUtilObj:ifNotGenerateLocalProxy>
- <XDtEjbUtilObj:ifGenerateLocalProxy>
- return
java.lang.reflect.Proxy.newProxyInstance(<XDtEjb:shortEjbName/>HomeProxy.class.getClassLoader(),
- new Class[] {<XDtEjb:shortEjbName/>Home.class}, new
<XDtEjb:shortEjbName/>HomeProxy());
- </XDtEjbUtilObj:ifGenerateLocalProxy>
}
--- 34,37 ----
***************
*** 167,227 ****
</XDtConfig:ifConfigParamEquals>
- <XDtEjbUtilObj:ifGenerateLocalProxy>
- private static
<XDtClass:classOf><XDtEjbSession:sessionClass/></XDtClass:classOf> singleton = null;
-
- static public Object newConcreteProxyInstance() {
- if (singleton == null) {
- singleton = new
<XDtClass:classOf><XDtEjbSession:sessionClass/></XDtClass:classOf>();
- }
- return
java.lang.reflect.Proxy.newProxyInstance(singleton.getClass().getClassLoader(),
- new Class[] {<XDtEjb:shortEjbName/>.class}, new
<XDtEjb:shortEjbName/>Proxy(singleton));
- }
-
- public static class <XDtEjb:shortEjbName/>HomeProxy implements
java.lang.reflect.InvocationHandler {
- public <XDtEjb:shortEjbName/>HomeProxy() {
- }
-
- public Object invoke(Object proxy, java.lang.reflect.Method m, Object[] args)
- throws Throwable {
- if (m.getName().equals("create") && m.getParameterTypes().length == 0) {
- return newConcreteProxyInstance();
- } else {
- throw new UnsupportedOperationException(m.getName()+": only
no-argument create() method supported");
- }
- }
- }
-
- public static class <XDtEjb:shortEjbName/>Proxy implements
java.lang.reflect.InvocationHandler
- {
- Object real;
- java.util.HashMap methodMap = new java.util.HashMap();
-
- public <XDtEjb:shortEjbName/>Proxy(Object obj)
- {
- real = obj;
- }
-
- public Object invoke(Object proxy, java.lang.reflect.Method m, Object[]
args) throws Throwable
- {
- try {
- // do something
- return getMethod(m, m.getParameterTypes()).invoke(real, args);
- } catch (java.lang.reflect.InvocationTargetException e) {
- throw e.getTargetException();
- } catch (Exception e) {
- throw e;
- }
- }
-
- // this uses the method object as the key to the hash for caching our local
object methods
- private java.lang.reflect.Method getMethod(java.lang.reflect.Method m,
Class[] parameterTypes) throws NoSuchMethodException {
- java.lang.reflect.Method localMethod =
(java.lang.reflect.Method)methodMap.get(m);
- if (localMethod == null) {
- localMethod = real.getClass().getMethod(m.getName(), parameterTypes);
- methodMap.put(m, localMethod);
- }
- return localMethod;
- }
- }
- </XDtEjbUtilObj:ifGenerateLocalProxy>
}
\ No newline at end of file
--- 161,163 ----
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel