Author: richard.opalka(a)jboss.com
Date: 2008-11-28 01:16:19 -0500 (Fri, 28 Nov 2008)
New Revision: 8809
Modified:
stack/native/trunk/.classpath
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java
Log:
[JBWS-2268] use new helper
Modified: stack/native/trunk/.classpath
===================================================================
--- stack/native/trunk/.classpath 2008-11-27 15:37:58 UTC (rev 8808)
+++ stack/native/trunk/.classpath 2008-11-28 06:16:19 UTC (rev 8809)
@@ -12,7 +12,7 @@
<classpathentry combineaccessrules="false" kind="src"
path="/jbossws-common"/>
<classpathentry combineaccessrules="false" kind="src"
path="/jbossws-framework"/>
<classpathentry combineaccessrules="false" kind="src"
path="/jbossws-spi"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.USER_LIBRARY/jboss-5.0.0.GA"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.USER_LIBRARY/junit"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.USER_LIBRARY/JBOSS500GA"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.USER_LIBRARY/JUNIT"/>
<classpathentry kind="output" path="target/eclipse-classes"/>
</classpath>
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java 2008-11-27
15:37:58 UTC (rev 8808)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java 2008-11-28
06:16:19 UTC (rev 8809)
@@ -21,8 +21,6 @@
*/
package org.jboss.ws.core.jaxws.handler;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -30,8 +28,6 @@
import java.util.Map;
import java.util.Set;
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
import javax.xml.namespace.QName;
import javax.xml.ws.handler.Handler;
import javax.xml.ws.handler.HandlerResolver;
@@ -41,7 +37,6 @@
import javax.xml.ws.soap.SOAPBinding;
import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
import org.jboss.ws.metadata.umdm.EndpointConfigMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData;
@@ -49,6 +44,7 @@
import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.wsf.common.handler.GenericHandler;
import org.jboss.wsf.common.handler.GenericSOAPHandler;
+import org.jboss.wsf.common.javax.JavaxAnnotationHelper;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
/**
@@ -169,11 +165,11 @@
if (handler instanceof GenericSOAPHandler)
((GenericSOAPHandler)handler).setHeaders(soapHeaders);
- // Inject resources
- injectResources(handler);
+ // Inject resources
+ JavaxAnnotationHelper.injectResources(handler);
// Call @PostConstruct
- callPostConstruct(handler);
+ JavaxAnnotationHelper.callPostConstructMethod(handler);
addHandler(jaxwsMetaData, handler, type);
}
@@ -187,55 +183,6 @@
}
}
- private void injectResources(Handler handler)
- {
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- ctxLoader.loadClass("javax.annotation.Resource");
- }
- catch (Throwable th)
- {
- log.debug("Cannot inject resources: " + th.toString());
- return;
- }
-
- Class<? extends Handler> handlerClass = handler.getClass();
- for (Field field : handlerClass.getFields())
- {
- if (field.isAnnotationPresent(Resource.class))
- throw new NotImplementedException("@Resource not implemented for
handler: " + handlerClass.getName());
- }
- for (Method method : handlerClass.getMethods())
- {
- if (method.isAnnotationPresent(Resource.class))
- throw new NotImplementedException("@Resource not implemented for
handler: " + handlerClass.getName());
- }
- }
-
- private void callPostConstruct(Handler handler) throws Exception
- {
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- ctxLoader.loadClass("javax.annotation.PostConstruct");
- }
- catch (Throwable th)
- {
- log.debug("Cannot call post construct: " + th.toString());
- return;
- }
-
- Class<? extends Handler> handlerClass = handler.getClass();
- for (Method method : handlerClass.getMethods())
- {
- if (method.isAnnotationPresent(PostConstruct.class))
- {
- method.invoke(handler, new Object[] {});
- }
- }
- }
-
private boolean addHandler(HandlerMetaDataJAXWS hmd, Handler handler, HandlerType
type)
{
log.debug("addHandler: " + hmd);
Show replies by date