Author: heiko.braun(a)jboss.com
Date: 2007-07-19 08:59:02 -0400 (Thu, 19 Jul 2007)
New Revision: 3950
Added:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/SPIView.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/DefaultInvocationHandlerJAXRPC.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/DefaultInvocationHandlerJAXWS.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationModelFactory.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationType.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/WebServiceContextInjector.java
Removed:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/BasicEndpointInvocation.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/BasicInvocationContext.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/BasicInvocationHandler.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/InvocationHandlerJSE.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/WebServiceContextInjector.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/SPIProvision.java
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/DefaultSPIProviderResolver.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicDeploymentAspectManager.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicLifecycleHandler.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/EndpointHandlerDeploymentAspect.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/transport/jms/JMSTransportSupport.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/DeploymentModelFactory.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/Invocation.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationContext.java
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationHandler.java
Log:
Introduce InvocationModelFactory
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/ws/integration/ServiceRefHandler.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -46,8 +46,4 @@
void setValue(ServiceRefElement ref, UnmarshallingContext navigator, String
namespaceURI, String localName, String value);
void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile vfsRoot,
ClassLoader loader, ServiceRefMetaData sref) throws NamingException;
-
- void setJaxrpcBinder(ServiceRefBinder binder);
-
- void setJaxwsBinder(ServiceRefBinder binder);
}
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/DefaultSPIProviderResolver.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/DefaultSPIProviderResolver.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/DefaultSPIProviderResolver.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -23,8 +23,12 @@
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.WSFException;
+import org.jboss.wsf.spi.invocation.InvocationModelFactory;
import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
import org.jboss.wsf.framework.deployment.DeploymentModelFactoryImpl;
+import org.jboss.wsf.common.ServiceLoader;
+import org.jboss.logging.Logger;
/**
* @author Heiko.Braun(a)jboss.com
@@ -32,24 +36,49 @@
*/
public class DefaultSPIProviderResolver extends SPIProviderResolver
{
+ private final static SPIProvider DEFAULT_PROVIDER = new Provider();
+
public SPIProvider getProvider()
{
- return new DefaultSPIProvider();
+ return DEFAULT_PROVIDER;
}
- public class DefaultSPIProvider extends SPIProvider
+ static class Provider extends SPIProvider
{
+ // provide logging
+ private static final Logger log = Logger.getLogger(Provider.class);
+
/**
* Gets the specified SPI.
*/
public <T> T getSPI(Class<T> spiType)
{
+ log.debug("provide SPI '"+spiType+"'");
+
+ T returnType = null;
+
if(spiType.equals(DeploymentModelFactory.class))
{
- return (T)new DeploymentModelFactoryImpl();
+ returnType = (T)new DeploymentModelFactoryImpl();
}
+ else if(spiType.equals(InvocationModelFactory.class))
+ {
+ // container integration needs to provide these
+ InvocationModelFactory factory = (InvocationModelFactory )
+ ServiceLoader.loadService(InvocationModelFactory.class.getName(), null);
- return null;
+ if(null == factory)
+ throw new WSFException("Unable to load
spi.invocation.InvocationModelFactory");
+
+ returnType = (T) factory;
+ }
+
+ if(null == returnType)
+ log.debug("Failed to provide SPI
'"+spiType+"'");
+ else
+ log.debug(spiType + " Implementation: " + returnType);
+
+ return returnType;
}
}
}
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicDeploymentAspectManager.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicDeploymentAspectManager.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicDeploymentAspectManager.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -120,7 +120,7 @@
}
for (DeploymentAspect aspect : sortedAspects)
- log.info(name + ": " + aspect);
+ log.debug(name + ": " + aspect);
}
return sortedAspects;
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicLifecycleHandler.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicLifecycleHandler.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/BasicLifecycleHandler.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -47,8 +47,9 @@
InvocationHandler invHandler = ep.getInvocationHandler();
if (invHandler == null)
throw new IllegalStateException("Invocation handler not available");
+
+ invHandler.init(ep);
- invHandler.create(ep);
ep.setState(EndpointState.CREATED);
}
@@ -60,8 +61,6 @@
if (state == EndpointState.UNDEFINED || state == EndpointState.DESTROYED)
throw new IllegalStateException("Cannot start endpoint in state: " +
state);
- ep.getInvocationHandler().start(ep);
-
if (ep.getEndpointMetrics() != null)
ep.getEndpointMetrics().start();
@@ -76,8 +75,6 @@
if (state != EndpointState.STARTED)
throw new IllegalStateException("Cannot stop endpoint in state: " +
state);
- ep.getInvocationHandler().stop(ep);
-
if (ep.getEndpointMetrics() != null)
ep.getEndpointMetrics().stop();
@@ -88,8 +85,6 @@
{
log.debug("Destroy: " + ep.getName());
- ep.getInvocationHandler().destroy(ep);
-
ep.setState(EndpointState.DESTROYED);
}
}
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/EndpointHandlerDeploymentAspect.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/EndpointHandlerDeploymentAspect.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/deployment/EndpointHandlerDeploymentAspect.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -28,6 +28,8 @@
import org.jboss.wsf.spi.invocation.InvocationHandler;
import org.jboss.wsf.spi.invocation.RequestHandler;
+import org.jboss.wsf.spi.invocation.InvocationModelFactory;
+import org.jboss.wsf.spi.invocation.InvocationType;
import org.jboss.wsf.spi.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.wsf.spi.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.wsf.spi.metadata.j2ee.UnifiedMessageDrivenMetaData;
@@ -35,6 +37,8 @@
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.deployment.LifecycleHandler;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.SPIProvider;
/**
* A deployer that assigns the handlers to the Endpoint
@@ -47,6 +51,7 @@
private String requestHandler;
private String lifecycleHandler;
+ // TODO: eleminate the MC registration process, finally this MAP could be removed
private Map<String, String> invocationHandlerMap = new HashMap<String,
String>();
public void setLifecycleHandler(String handler)
@@ -126,20 +131,9 @@
}
}
- InvocationHandler invocationHandler = null;
- String className = invocationHandlerMap.get(key);
- if (className != null)
- {
- try
- {
- Class<?> handlerClass =
dep.getInitialClassLoader().loadClass(className);
- invocationHandler = (InvocationHandler)handlerClass.newInstance();
- }
- catch (Exception e)
- {
- throw new IllegalStateException("Cannot load invocation handler: "
+ className);
- }
- }
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ InvocationType type = InvocationType.valueOf(key);
+ InvocationHandler invocationHandler=
spiProvider.getSPI(InvocationModelFactory.class).createInvocationHandler( type );
return invocationHandler;
}
}
\ No newline at end of file
Deleted:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/BasicEndpointInvocation.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/BasicEndpointInvocation.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/BasicEndpointInvocation.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -1,88 +0,0 @@
-/*
- * 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.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * 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.framework.invocation;
-
-import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.spi.invocation.InvocationContext;
-
-import java.lang.reflect.Method;
-
-//$Id$
-
-/**
- * A general endpoint invocation.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 20-Apr-2007
- */
-public class BasicEndpointInvocation implements Invocation
-{
- private InvocationContext invocationContext;
- private Method javaMethod;
- private Object[] args;
- private Object returnValue;
-
- public BasicEndpointInvocation()
- {
- this.invocationContext = new BasicInvocationContext();
- }
-
- public InvocationContext getInvocationContext()
- {
- return invocationContext;
- }
-
- public void setInvocationContext(InvocationContext invocationContext)
- {
- this.invocationContext = invocationContext;
- }
-
- public Method getJavaMethod()
- {
- return javaMethod;
- }
-
- public void setJavaMethod(Method javaMethod)
- {
- this.javaMethod = javaMethod;
- }
-
- public Object[] getArgs()
- {
- return args;
- }
-
- public void setArgs(Object[] args)
- {
- this.args = args;
- }
-
- public Object getReturnValue()
- {
- return returnValue;
- }
-
- public void setReturnValue(Object returnValue)
- {
- this.returnValue = returnValue;
- }
-}
Deleted:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/BasicInvocationContext.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/BasicInvocationContext.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/BasicInvocationContext.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -1,65 +0,0 @@
-/*
- * 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.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * 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.framework.invocation;
-
-import org.jboss.wsf.spi.invocation.InvocationContext;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A basic invocation context.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 20-Apr-2007
- */
-public class BasicInvocationContext implements InvocationContext
-{
- private Object targetBean;
- private Map<Class, Object> attachments = new HashMap<Class, Object>();
-
- public Object getTargetBean()
- {
- return targetBean;
- }
-
- public void setTargetBean(Object targetBean)
- {
- this.targetBean = targetBean;
- }
-
-
- public <T> T addAttachment(Class<T> key, Object value)
- {
- return (T)attachments.put(key, value);
- }
-
- public <T> T getAttachment(Class<T> key)
- {
- return (T)attachments.get(key);
- }
-
- public <T> T removeAttachment(Class<T> key)
- {
- return (T)attachments.get(key);
- }
-}
Deleted:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/BasicInvocationHandler.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/BasicInvocationHandler.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/BasicInvocationHandler.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -1,120 +0,0 @@
-/*
- * 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.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * 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.framework.invocation;
-
-// $Id$
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.UndeclaredThrowableException;
-
-import javax.management.MBeanException;
-
-import org.jboss.logging.Logger;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.common.JavaUtils;
-import org.jboss.wsf.spi.invocation.InvocationHandler;
-import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.framework.invocation.BasicEndpointInvocation;
-
-/**
- * Handles invocations on endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public abstract class BasicInvocationHandler implements InvocationHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(BasicInvocationHandler.class);
-
- public Invocation createInvocation()
- {
- return new BasicEndpointInvocation();
- }
-
- protected Method getImplMethod(Class implClass, Method seiMethod) throws
ClassNotFoundException, NoSuchMethodException
- {
- String methodName = seiMethod.getName();
- Class[] paramTypes = seiMethod.getParameterTypes();
- for (int i = 0; i < paramTypes.length; i++)
- {
- Class paramType = paramTypes[i];
- if (JavaUtils.isPrimitive(paramType) == false)
- {
- String paramTypeName = paramType.getName();
- paramType = JavaUtils.loadJavaType(paramTypeName);
- paramTypes[i] = paramType;
- }
- }
-
- Method implMethod = implClass.getMethod(methodName, paramTypes);
- return implMethod;
- }
-
- public void create(Endpoint ep)
- {
- log.debug("Create: " + ep.getName());
- }
-
- public void start(Endpoint ep)
- {
- log.debug("Start: " + ep.getName());
- }
-
- public void stop(Endpoint ep)
- {
- log.debug("Stop: " + ep.getName());
- }
-
- public void destroy(Endpoint ep)
- {
- log.debug("Destroy: " + ep.getName());
- }
-
- protected void handleInvocationException(Throwable th) throws Exception
- {
- if (th instanceof MBeanException)
- {
- throw ((MBeanException)th).getTargetException();
- }
-
- if (th instanceof InvocationTargetException)
- {
- // Unwrap the throwable raised by the service endpoint implementation
- Throwable targetEx = ((InvocationTargetException)th).getTargetException();
- handleInvocationException(targetEx);
- }
-
- if (th instanceof Exception)
- {
- throw (Exception)th;
- }
-
- if (th instanceof Error)
- {
- throw (Error)th;
- }
-
- throw new UndeclaredThrowableException(th);
- }
-}
Deleted:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/InvocationHandlerJSE.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/InvocationHandlerJSE.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/InvocationHandlerJSE.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -1,85 +0,0 @@
-/*
- * 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.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * 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.framework.invocation;
-
-// $Id$
-
-import java.lang.reflect.Method;
-
-import javax.xml.ws.WebServiceContext;
-
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.spi.invocation.InvocationContext;
-import org.jboss.wsf.framework.invocation.BasicInvocationHandler;
-
-/**
- * Handles invocations on JSE endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class InvocationHandlerJSE extends BasicInvocationHandler
-{
- protected Object getTargetBean(Endpoint ep, Invocation epInv)
- {
- InvocationContext invCtx = epInv.getInvocationContext();
- Object targetBean = invCtx.getTargetBean();
- if (targetBean == null)
- {
- try
- {
- Class epImpl = ep.getTargetBeanClass();
- targetBean = epImpl.newInstance();
- invCtx.setTargetBean(targetBean);
- }
- catch (Exception ex)
- {
- throw new IllegalStateException("Canot get target bean instance",
ex);
- }
- }
- return targetBean;
- }
-
- public void invoke(Endpoint ep, Invocation epInv) throws Exception
- {
- try
- {
- Object targetBean = getTargetBean(ep, epInv);
-
- InvocationContext invContext = epInv.getInvocationContext();
- WebServiceContext wsContext =
invContext.getAttachment(WebServiceContext.class);
- if (wsContext != null)
- {
- new WebServiceContextInjector().injectContext(targetBean,
(WebServiceContext)wsContext);
- }
-
- Method method = getImplMethod(targetBean.getClass(), epInv.getJavaMethod());
- Object retObj = method.invoke(targetBean, epInv.getArgs());
- epInv.setReturnValue(retObj);
- }
- catch (Exception e)
- {
- handleInvocationException(e);
- }
- }
-}
Deleted:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/WebServiceContextInjector.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/WebServiceContextInjector.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/invocation/WebServiceContextInjector.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -1,82 +0,0 @@
-/*
- * 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.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * 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.framework.invocation;
-
-// $Id$
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import javax.annotation.Resource;
-import javax.xml.ws.WebServiceContext;
-
-import org.jboss.logging.Logger;
-
-/**
- * Inject the JAXWS WebServiceContext
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Jan-2007
- */
-public class WebServiceContextInjector
-{
- // provide logging
- private static Logger log = Logger.getLogger(WebServiceContextInjector.class);
-
- public void injectContext(Object epInstance, WebServiceContext wsContext)
- {
- try
- {
- // scan fields that are marked with @Resource
- Field[] fields = epInstance.getClass().getDeclaredFields();
- for (Field field : fields)
- {
- Class type = field.getType();
- if (type == WebServiceContext.class &&
field.isAnnotationPresent(Resource.class))
- {
- field.setAccessible(true);
- field.set(epInstance, wsContext);
- }
- }
-
- // scan methods that are marked with @Resource
- Method[] methods = epInstance.getClass().getDeclaredMethods();
- for (Method method : methods)
- {
- Class[] paramTypes = method.getParameterTypes();
- if (paramTypes.length == 1 && paramTypes[0] ==
WebServiceContext.class && method.isAnnotationPresent(Resource.class))
- {
- method.setAccessible(true);
- method.invoke(epInstance, new Object[] { wsContext });
- }
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- log.warn("Cannot inject WebServiceContext", ex);
- }
- }
-}
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/transport/jms/JMSTransportSupport.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/transport/jms/JMSTransportSupport.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/framework/transport/jms/JMSTransportSupport.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -23,41 +23,25 @@
// $Id:JMSTransportSupport.java 915 2006-09-08 08:40:45Z thomas.diesler(a)jboss.com $
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.rmi.RemoteException;
+import org.jboss.logging.Logger;
+import org.jboss.util.NestedRuntimeException;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+import org.jboss.wsf.spi.invocation.RequestHandler;
+import org.jboss.wsf.spi.management.EndpointRegistry;
+import org.jboss.wsf.spi.management.EndpointRegistryFactory;
import javax.ejb.EJBException;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
-import javax.jms.BytesMessage;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.QueueSender;
-import javax.jms.QueueSession;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
+import javax.jms.*;
import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.xml.soap.SOAPException;
+import java.io.*;
+import java.lang.IllegalStateException;
+import java.rmi.RemoteException;
-import org.jboss.logging.Logger;
-import org.jboss.util.NestedRuntimeException;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.framework.invocation.BasicInvocationContext;
-import org.jboss.wsf.spi.invocation.RequestHandler;
-import org.jboss.wsf.spi.management.EndpointRegistry;
-import org.jboss.wsf.spi.management.EndpointRegistryFactory;
-
/**
* The abstract base class for MDBs that want to act as web service endpoints.
* A subclass should only need to implement the service endpoint interface.
@@ -151,7 +135,7 @@
try
{
- BasicInvocationContext invContext = new BasicInvocationContext();
+ InvocationContext invContext = new InvocationContext();
invContext.setTargetBean(this);
reqHandler.handleRequest(endpoint, inputStream, outStream, invContext);
Deleted:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/SPIProvision.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/SPIProvision.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/SPIProvision.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -1,33 +0,0 @@
-/*
- * 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.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * 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.spi;
-
-/**
- * Can be consumed thorugh the SPIProvider.
- * It's just a marker interface.
- *
- * @author Heiko.Braun(a)jboss.com
- * Created: Jul 18, 2007
- */
-public interface SPIProvision
-{
-}
Added: branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/SPIView.java
===================================================================
--- branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/SPIView.java
(rev 0)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/SPIView.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * 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.spi;
+
+/**
+ * Marks a specific subset onto the overall SPI.
+ *
+ * @author Heiko.Braun(a)jboss.com
+ * Created: Jul 18, 2007
+ */
+public interface SPIView
+{
+}
Property changes on:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/SPIView.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/DeploymentModelFactory.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/DeploymentModelFactory.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/deployment/DeploymentModelFactory.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -21,13 +21,13 @@
*/
package org.jboss.wsf.spi.deployment;
-import org.jboss.wsf.spi.SPIProvision;
+import org.jboss.wsf.spi.SPIView;
/**
* @author Heiko.Braun(a)jboss.com
* Created: Jul 18, 2007
*/
-public abstract class DeploymentModelFactory implements SPIProvision
+public abstract class DeploymentModelFactory implements SPIView
{
public abstract Deployment createDeployment();
public abstract Service createService();
Added:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/DefaultInvocationHandlerJAXRPC.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/DefaultInvocationHandlerJAXRPC.java
(rev 0)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/DefaultInvocationHandlerJAXRPC.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * 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.spi.invocation;
+
+// $Id$
+
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+import javax.xml.rpc.server.ServiceLifecycle;
+import javax.xml.rpc.server.ServletEndpointContext;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class DefaultInvocationHandlerJAXRPC extends DefaultInvocationHandlerJAXWS
+{
+ @Override
+ public void invoke(Endpoint ep, Invocation epInv) throws Exception
+ {
+ try
+ {
+ Object targetBean = getTargetBean(ep, epInv);
+
+ InvocationContext invContext = epInv.getInvocationContext();
+ if (targetBean instanceof ServiceLifecycle)
+ {
+ ServletEndpointContext sepContext =
invContext.getAttachment(ServletEndpointContext.class);
+ if (sepContext != null)
+ ((ServiceLifecycle)targetBean).init(sepContext);
+ }
+
+ try
+ {
+ super.invoke(ep, epInv);
+ }
+ finally
+ {
+ if (targetBean instanceof ServiceLifecycle)
+ {
+ ((ServiceLifecycle)targetBean).destroy();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+}
Property changes on:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/DefaultInvocationHandlerJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/DefaultInvocationHandlerJAXWS.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/DefaultInvocationHandlerJAXWS.java
(rev 0)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/DefaultInvocationHandlerJAXWS.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * 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.spi.invocation;
+
+// $Id$
+
+import org.jboss.wsf.spi.deployment.Endpoint;
+
+import javax.xml.ws.WebServiceContext;
+import java.lang.reflect.Method;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class DefaultInvocationHandlerJAXWS extends InvocationHandler
+{
+ public Invocation createInvocation()
+ {
+ return new Invocation();
+ }
+
+ public void init(Endpoint ep)
+ {
+
+ }
+
+ protected Object getTargetBean(Endpoint ep, Invocation epInv)
+ {
+ InvocationContext invCtx = epInv.getInvocationContext();
+ Object targetBean = invCtx.getTargetBean();
+ if (targetBean == null)
+ {
+ try
+ {
+ Class epImpl = ep.getTargetBeanClass();
+ targetBean = epImpl.newInstance();
+ invCtx.setTargetBean(targetBean);
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Canot get target bean instance",
ex);
+ }
+ }
+ return targetBean;
+ }
+
+ public void invoke(Endpoint ep, Invocation epInv) throws Exception
+ {
+ try
+ {
+ Object targetBean = getTargetBean(ep, epInv);
+
+ InvocationContext invContext = epInv.getInvocationContext();
+ WebServiceContext wsContext =
invContext.getAttachment(WebServiceContext.class);
+ if (wsContext != null)
+ {
+ new WebServiceContextInjector().injectContext(targetBean,
(WebServiceContext)wsContext);
+ }
+
+ Method method = getImplMethod(targetBean.getClass(), epInv.getJavaMethod());
+ Object retObj = method.invoke(targetBean, epInv.getArgs());
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+}
Property changes on:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/DefaultInvocationHandlerJAXWS.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/Invocation.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/Invocation.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/Invocation.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -23,29 +23,61 @@
import java.lang.reflect.Method;
-//$Id$
-
/**
* A general endpoint invocation.
- *
+ *
* @author Thomas.Diesler(a)jboss.com
- * @since 20-Apr-2007
+ * @since 20-Apr-2007
*/
-public interface Invocation
+public class Invocation
{
- InvocationContext getInvocationContext();
-
- void setInvocationContext(InvocationContext context);
-
- Method getJavaMethod();
-
- void setJavaMethod(Method method);
-
- Object[] getArgs();
-
- void setArgs(Object[] args);
-
- Object getReturnValue();
-
- void setReturnValue(Object ret);
+ private InvocationContext invocationContext;
+ private Method javaMethod;
+ private Object[] args;
+ private Object returnValue;
+
+ public Invocation()
+ {
+ this.invocationContext = new InvocationContext();
+ }
+
+ public InvocationContext getInvocationContext()
+ {
+ return invocationContext;
+ }
+
+ public void setInvocationContext(InvocationContext invocationContext)
+ {
+ this.invocationContext = invocationContext;
+ }
+
+ public Method getJavaMethod()
+ {
+ return javaMethod;
+ }
+
+ public void setJavaMethod(Method javaMethod)
+ {
+ this.javaMethod = javaMethod;
+ }
+
+ public Object[] getArgs()
+ {
+ return args;
+ }
+
+ public void setArgs(Object[] args)
+ {
+ this.args = args;
+ }
+
+ public Object getReturnValue()
+ {
+ return returnValue;
+ }
+
+ public void setReturnValue(Object returnValue)
+ {
+ this.returnValue = returnValue;
+ }
}
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationContext.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationContext.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationContext.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -21,26 +21,43 @@
*/
package org.jboss.wsf.spi.invocation;
-//$Id$
+import java.util.Map;
+import java.util.HashMap;
/**
- * A general endpoint invocation context.
- *
+ * A basic invocation context.
+ *
* @author Thomas.Diesler(a)jboss.com
- * @since 20-Apr-2007
+ * @since 20-Apr-2007
*/
-public interface InvocationContext
+public class InvocationContext
{
- Object getTargetBean();
-
- void setTargetBean(Object targetBean);
-
- /** Add arbitrary attachments */
- <T> T addAttachment(Class<T> key, Object value);
+ private Object targetBean;
+ private Map<Class, Object> attachments = new HashMap<Class, Object>();
- /** Get arbitrary attachments */
- <T> T getAttachment(Class<T> key);
+ public Object getTargetBean()
+ {
+ return targetBean;
+ }
- /** Remove arbitrary attachments */
- <T> T removeAttachment(Class<T> key);
+ public void setTargetBean(Object targetBean)
+ {
+ this.targetBean = targetBean;
+ }
+
+
+ public <T> T addAttachment(Class<T> key, Object value)
+ {
+ return (T)attachments.put(key, value);
+ }
+
+ public <T> T getAttachment(Class<T> key)
+ {
+ return (T)attachments.get(key);
+ }
+
+ public <T> T removeAttachment(Class<T> key)
+ {
+ return (T)attachments.get(key);
+ }
}
Modified:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationHandler.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationHandler.java 2007-07-19
12:22:59 UTC (rev 3949)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationHandler.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -21,33 +21,76 @@
*/
package org.jboss.wsf.spi.invocation;
-//$Id$
-
+import org.jboss.wsf.common.JavaUtils;
import org.jboss.wsf.spi.deployment.Endpoint;
+import javax.management.MBeanException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+
/**
- * A general endpoint invocation handler.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 20-Apr-2007
+ * Handles invocations on endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author Heiko.Braun(a)jboss.com
+ * @since 25-Apr-2007
*/
-public interface InvocationHandler
+public abstract class InvocationHandler
{
- /** Create the default invokation object */
- Invocation createInvocation();
- /** Create the invocation handler */
- void create(Endpoint ep);
+ /** Create a container specific invocation **/
+ public abstract Invocation createInvocation();
- /** Start the invocation handler */
- void start(Endpoint ep);
-
/** Invoke the the service endpoint */
- void invoke(Endpoint ep, Invocation inv) throws Exception;
+ public abstract void invoke(Endpoint ep, Invocation inv) throws Exception;
- /** Stop the invocation handler */
- void stop(Endpoint ep);
+ /** Initilize the invocation handler **/
+ public abstract void init(Endpoint ep);
- /** Destroy the invocation handler */
- void destroy(Endpoint ep);
+ protected Method getImplMethod(Class implClass, Method seiMethod) throws
ClassNotFoundException, NoSuchMethodException
+ {
+ String methodName = seiMethod.getName();
+ Class[] paramTypes = seiMethod.getParameterTypes();
+ for (int i = 0; i < paramTypes.length; i++)
+ {
+ Class paramType = paramTypes[i];
+ if (JavaUtils.isPrimitive(paramType) == false)
+ {
+ String paramTypeName = paramType.getName();
+ paramType = JavaUtils.loadJavaType(paramTypeName);
+ paramTypes[i] = paramType;
+ }
+ }
+
+ Method implMethod = implClass.getMethod(methodName, paramTypes);
+ return implMethod;
+ }
+
+ protected void handleInvocationException(Throwable th) throws Exception
+ {
+ if (th instanceof MBeanException)
+ {
+ throw ((MBeanException)th).getTargetException();
+ }
+
+ if (th instanceof InvocationTargetException)
+ {
+ // Unwrap the throwable raised by the service endpoint implementation
+ Throwable targetEx = ((InvocationTargetException)th).getTargetException();
+ handleInvocationException(targetEx);
+ }
+
+ if (th instanceof Exception)
+ {
+ throw (Exception)th;
+ }
+
+ if (th instanceof Error)
+ {
+ throw (Error)th;
+ }
+
+ throw new UndeclaredThrowableException(th);
+ }
}
Added:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationModelFactory.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationModelFactory.java
(rev 0)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationModelFactory.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * 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.spi.invocation;
+
+import org.jboss.wsf.spi.SPIView;
+
+/**
+ * Creates invocation related artefacts.
+ *
+ * @author Heiko.Braun(a)jboss.com
+ * Created: Jul 19, 2007
+ */
+public abstract class InvocationModelFactory implements SPIView
+{
+ public abstract InvocationHandler createInvocationHandler(InvocationType type);
+ public abstract InvocationContext createInvocationContext(InvocationType type);
+}
Property changes on:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationModelFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationType.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationType.java
(rev 0)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationType.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * 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.spi.invocation;
+
+/**
+ * Known invocation types.
+ *
+ * @author Heiko.Braun(a)jboss.com
+ * Created: Jul 19, 2007
+ */
+public enum InvocationType
+{
+ JAXRPC_JSE, JAXRPC_EJB21, JAXRPC_MDB21, JAXWS_JSE, JAXWS_EJB21, JAXWS_EJB3,
JAXWS_MDB21, JAXWS_MDB3;
+}
Property changes on:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/InvocationType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/WebServiceContextInjector.java
===================================================================
---
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/WebServiceContextInjector.java
(rev 0)
+++
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/WebServiceContextInjector.java 2007-07-19
12:59:02 UTC (rev 3950)
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * 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.spi.invocation;
+
+// $Id$
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import javax.annotation.Resource;
+import javax.xml.ws.WebServiceContext;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Inject the JAXWS WebServiceContext
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Jan-2007
+ */
+public class WebServiceContextInjector
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(WebServiceContextInjector.class);
+
+ WebServiceContextInjector()
+ {
+ }
+
+ public void injectContext(Object epInstance, WebServiceContext wsContext)
+ {
+ try
+ {
+ // scan fields that are marked with @Resource
+ Field[] fields = epInstance.getClass().getDeclaredFields();
+ for (Field field : fields)
+ {
+ Class type = field.getType();
+ if (type == WebServiceContext.class &&
field.isAnnotationPresent(Resource.class))
+ {
+ field.setAccessible(true);
+ field.set(epInstance, wsContext);
+ }
+ }
+
+ // scan methods that are marked with @Resource
+ Method[] methods = epInstance.getClass().getDeclaredMethods();
+ for (Method method : methods)
+ {
+ Class[] paramTypes = method.getParameterTypes();
+ if (paramTypes.length == 1 && paramTypes[0] ==
WebServiceContext.class && method.isAnnotationPresent(Resource.class))
+ {
+ method.setAccessible(true);
+ method.invoke(epInstance, new Object[] { wsContext });
+ }
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ log.warn("Cannot inject WebServiceContext", ex);
+ }
+ }
+}
Property changes on:
branches/hbraun/trunk/integration/spi/src/main/java/org/jboss/wsf/spi/invocation/WebServiceContextInjector.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF