Author: richard.opalka(a)jboss.com
Date: 2008-11-27 10:34:43 -0500 (Thu, 27 Nov 2008)
New Revision: 8807
Modified:
container/jboss42/branches/jboss422/src/main/java/org/jboss/wsf/container/jboss42/DefaultInvocationHandler.java
container/jboss42/branches/jboss423/src/main/java/org/jboss/wsf/container/jboss42/InvocationHandlerJSE.java
container/jboss42/trunk/src/main/java/org/jboss/wsf/container/jboss42/InvocationHandlerJSE.java
Log:
[JBWS-2268] call post construct for JSE endpoints
Modified:
container/jboss42/branches/jboss422/src/main/java/org/jboss/wsf/container/jboss42/DefaultInvocationHandler.java
===================================================================
---
container/jboss42/branches/jboss422/src/main/java/org/jboss/wsf/container/jboss42/DefaultInvocationHandler.java 2008-11-27
15:25:51 UTC (rev 8806)
+++
container/jboss42/branches/jboss422/src/main/java/org/jboss/wsf/container/jboss42/DefaultInvocationHandler.java 2008-11-27
15:34:43 UTC (rev 8807)
@@ -1,8 +1,8 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
@@ -19,15 +19,15 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.wsf.container.jboss42;
+package org.jboss.wsf.container.jboss50;
-// $Id$
-
import java.lang.reflect.Method;
import javax.xml.ws.WebServiceContext;
import org.jboss.wsf.common.JavaUtils;
+import org.jboss.wsf.common.javax.JavaxAnnotationHelper;
+import org.jboss.wsf.common.javax.PreDestroyHolder;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -41,6 +41,7 @@
* Handles invocations on JSE endpoints.
*
* @author Thomas.Diesler(a)jboss.org
+ * @author richard.opalka(a)jboss.com
* @since 25-Apr-2007
*/
public class DefaultInvocationHandler extends InvocationHandler
@@ -63,7 +64,7 @@
{
}
- protected Object getTargetBean(Endpoint ep, Invocation epInv)
+ protected Object getTargetBean(Endpoint ep, Invocation epInv) throws Exception
{
InvocationContext invCtx = epInv.getInvocationContext();
Object targetBean = invCtx.getTargetBean();
@@ -71,18 +72,22 @@
{
try
{
- Class epImpl = ep.getTargetBeanClass();
+ Class<?> epImpl = ep.getTargetBeanClass();
targetBean = epImpl.newInstance();
invCtx.setTargetBean(targetBean);
}
catch (Exception ex)
{
- throw new IllegalStateException("Canot get target bean instance",
ex);
+ throw new IllegalStateException("Cannot get target bean instance",
ex);
}
+
+ JavaxAnnotationHelper.callPostConstructMethod(targetBean,
targetBean.getClass().getClassLoader());
+ ep.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
}
+
return targetBean;
}
-
+
public void invoke(Endpoint ep, Invocation epInv) throws Exception
{
try
@@ -93,7 +98,6 @@
WebServiceContext wsContext =
invContext.getAttachment(WebServiceContext.class);
if (wsContext != null)
{
-
ResourceInjector injector = resourceInjectorFactory.newResourceInjector();
injector.inject(targetBean, wsContext);
}
@@ -108,13 +112,13 @@
}
}
- protected Method getImplMethod(Class implClass, Method seiMethod) throws
ClassNotFoundException, NoSuchMethodException
+ protected Method getImplMethod(Class<?> implClass, Method seiMethod) throws
ClassNotFoundException, NoSuchMethodException
{
String methodName = seiMethod.getName();
- Class[] paramTypes = seiMethod.getParameterTypes();
+ Class<?>[] paramTypes = seiMethod.getParameterTypes();
for (int i = 0; i < paramTypes.length; i++)
{
- Class paramType = paramTypes[i];
+ Class<?> paramType = paramTypes[i];
if (JavaUtils.isPrimitive(paramType) == false)
{
String paramTypeName = paramType.getName();
Modified:
container/jboss42/branches/jboss423/src/main/java/org/jboss/wsf/container/jboss42/InvocationHandlerJSE.java
===================================================================
---
container/jboss42/branches/jboss423/src/main/java/org/jboss/wsf/container/jboss42/InvocationHandlerJSE.java 2008-11-27
15:25:51 UTC (rev 8806)
+++
container/jboss42/branches/jboss423/src/main/java/org/jboss/wsf/container/jboss42/InvocationHandlerJSE.java 2008-11-27
15:34:43 UTC (rev 8807)
@@ -19,13 +19,15 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.wsf.container.jboss42;
+package org.jboss.wsf.container.jboss50;
import java.lang.reflect.Method;
import javax.xml.ws.WebServiceContext;
import org.jboss.wsf.common.JavaUtils;
+import org.jboss.wsf.common.javax.JavaxAnnotationHelper;
+import org.jboss.wsf.common.javax.PreDestroyHolder;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -39,6 +41,7 @@
* Handles invocations on JSE endpoints.
*
* @author Thomas.Diesler(a)jboss.org
+ * @author richard.opalka(a)jboss.com
* @since 25-Apr-2007
*/
public class InvocationHandlerJSE extends InvocationHandler
@@ -61,7 +64,7 @@
{
}
- protected Object getTargetBean(Endpoint ep, Invocation epInv)
+ protected Object getTargetBean(Endpoint ep, Invocation epInv) throws Exception
{
InvocationContext invCtx = epInv.getInvocationContext();
Object targetBean = invCtx.getTargetBean();
@@ -69,7 +72,7 @@
{
try
{
- Class epImpl = ep.getTargetBeanClass();
+ Class<?> epImpl = ep.getTargetBeanClass();
targetBean = epImpl.newInstance();
invCtx.setTargetBean(targetBean);
}
@@ -77,10 +80,14 @@
{
throw new IllegalStateException("Cannot get target bean instance",
ex);
}
+
+ JavaxAnnotationHelper.callPostConstructMethod(targetBean,
targetBean.getClass().getClassLoader());
+ ep.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
}
+
return targetBean;
}
-
+
public void invoke(Endpoint ep, Invocation epInv) throws Exception
{
try
@@ -91,7 +98,6 @@
WebServiceContext wsContext =
invContext.getAttachment(WebServiceContext.class);
if (wsContext != null)
{
-
ResourceInjector injector = resourceInjectorFactory.newResourceInjector();
injector.inject(targetBean, wsContext);
}
@@ -106,13 +112,13 @@
}
}
- protected Method getImplMethod(Class implClass, Method seiMethod) throws
ClassNotFoundException, NoSuchMethodException
+ protected Method getImplMethod(Class<?> implClass, Method seiMethod) throws
ClassNotFoundException, NoSuchMethodException
{
String methodName = seiMethod.getName();
- Class[] paramTypes = seiMethod.getParameterTypes();
+ Class<?>[] paramTypes = seiMethod.getParameterTypes();
for (int i = 0; i < paramTypes.length; i++)
{
- Class paramType = paramTypes[i];
+ Class<?> paramType = paramTypes[i];
if (JavaUtils.isPrimitive(paramType) == false)
{
String paramTypeName = paramType.getName();
Modified:
container/jboss42/trunk/src/main/java/org/jboss/wsf/container/jboss42/InvocationHandlerJSE.java
===================================================================
---
container/jboss42/trunk/src/main/java/org/jboss/wsf/container/jboss42/InvocationHandlerJSE.java 2008-11-27
15:25:51 UTC (rev 8806)
+++
container/jboss42/trunk/src/main/java/org/jboss/wsf/container/jboss42/InvocationHandlerJSE.java 2008-11-27
15:34:43 UTC (rev 8807)
@@ -19,13 +19,15 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.wsf.container.jboss42;
+package org.jboss.wsf.container.jboss50;
import java.lang.reflect.Method;
import javax.xml.ws.WebServiceContext;
import org.jboss.wsf.common.JavaUtils;
+import org.jboss.wsf.common.javax.JavaxAnnotationHelper;
+import org.jboss.wsf.common.javax.PreDestroyHolder;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -39,6 +41,7 @@
* Handles invocations on JSE endpoints.
*
* @author Thomas.Diesler(a)jboss.org
+ * @author richard.opalka(a)jboss.com
* @since 25-Apr-2007
*/
public class InvocationHandlerJSE extends InvocationHandler
@@ -61,7 +64,7 @@
{
}
- protected Object getTargetBean(Endpoint ep, Invocation epInv)
+ protected Object getTargetBean(Endpoint ep, Invocation epInv) throws Exception
{
InvocationContext invCtx = epInv.getInvocationContext();
Object targetBean = invCtx.getTargetBean();
@@ -69,7 +72,7 @@
{
try
{
- Class epImpl = ep.getTargetBeanClass();
+ Class<?> epImpl = ep.getTargetBeanClass();
targetBean = epImpl.newInstance();
invCtx.setTargetBean(targetBean);
}
@@ -77,10 +80,14 @@
{
throw new IllegalStateException("Cannot get target bean instance",
ex);
}
+
+ JavaxAnnotationHelper.callPostConstructMethod(targetBean,
targetBean.getClass().getClassLoader());
+ ep.addAttachment(PreDestroyHolder.class, new PreDestroyHolder(targetBean));
}
+
return targetBean;
}
-
+
public void invoke(Endpoint ep, Invocation epInv) throws Exception
{
try
@@ -91,7 +98,6 @@
WebServiceContext wsContext =
invContext.getAttachment(WebServiceContext.class);
if (wsContext != null)
{
-
ResourceInjector injector = resourceInjectorFactory.newResourceInjector();
injector.inject(targetBean, wsContext);
}
@@ -106,13 +112,13 @@
}
}
- protected Method getImplMethod(Class implClass, Method seiMethod) throws
ClassNotFoundException, NoSuchMethodException
+ protected Method getImplMethod(Class<?> implClass, Method seiMethod) throws
ClassNotFoundException, NoSuchMethodException
{
String methodName = seiMethod.getName();
- Class[] paramTypes = seiMethod.getParameterTypes();
+ Class<?>[] paramTypes = seiMethod.getParameterTypes();
for (int i = 0; i < paramTypes.length; i++)
{
- Class paramType = paramTypes[i];
+ Class<?> paramType = paramTypes[i];
if (JavaUtils.isPrimitive(paramType) == false)
{
String paramTypeName = paramType.getName();