Author: thomas.diesler(a)jboss.com
Date: 2007-05-16 08:10:39 -0400 (Wed, 16 May 2007)
New Revision: 3105
Added:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB21.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB3.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerJSE.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/BasicInvocationContext.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/HandlerCallback.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/WebServiceContextInjector.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java
Removed:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/java/
branches/tdiesler/trunk/integration/sunri-jboss50/src/main/java/org/jboss/ws/integration/jboss50/sunri/InvocationHandlerJSE.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerCallback.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextInjector.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/AbstractInvocationHandler.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/InvocationHandlerJSE.java
Modified:
branches/tdiesler/trunk/build/build.xml
branches/tdiesler/trunk/build/version.properties
branches/tdiesler/trunk/integration/jboss50/.classpath
branches/tdiesler/trunk/integration/jboss50/ant-import/build-thirdparty.xml
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml
branches/tdiesler/trunk/integration/spi/.classpath
branches/tdiesler/trunk/integration/spi/ant-import/build-thirdparty.xml
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/BasicEndpoint.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/Endpoint.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationContext.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationHandler.java
branches/tdiesler/trunk/jbossws/ant-import/build-thirdparty.xml
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/EndpointNameDeployer.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/EventingDeployer.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/UnifiedMetaDataAssociationDeployer.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ContextServlet.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/LifecycleHandlerImpl.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ManagedEndpointRegistry.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/PortComponentLinkServlet.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/RequestHandlerImpl.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointServlet.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServletRequestContext.java
branches/tdiesler/trunk/jbossws/version.properties
branches/tdiesler/trunk/testsuite/ant-import/build-testsuite.xml
branches/tdiesler/trunk/testsuite/build.xml
Log:
restructure
Modified: branches/tdiesler/trunk/build/build.xml
===================================================================
--- branches/tdiesler/trunk/build/build.xml 2007-05-16 11:58:54 UTC (rev 3104)
+++ branches/tdiesler/trunk/build/build.xml 2007-05-16 12:10:39 UTC (rev 3105)
@@ -42,7 +42,7 @@
<ant antfile="${testsuite.dir}/build.xml" target="clean"
inheritall="false"/>
<ant antfile="${int.jboss50.dir}/build.xml" target="clean"
inheritall="false"/>
<ant antfile="${int.jboss42.dir}/build.xml" target="clean"
inheritall="false"/>
- <ant antfile="${int.sunri.dir}/build.xml" target="clean"
inheritall="false"/>
+ <ant antfile="${int.sunri50.dir}/build.xml" target="clean"
inheritall="false"/>
</target>
<target name="clobber" depends="prepare"
description="Cleans up all generated files.">
@@ -51,7 +51,7 @@
<ant antfile="${testsuite.dir}/build.xml" target="clobber"
inheritall="false"/>
<ant antfile="${int.jboss50.dir}/build.xml" target="clobber"
inheritall="false"/>
<ant antfile="${int.jboss42.dir}/build.xml" target="clobber"
inheritall="false"/>
- <ant antfile="${int.sunri.dir}/build.xml" target="clobber"
inheritall="false"/>
+ <ant antfile="${int.sunri50.dir}/build.xml" target="clobber"
inheritall="false"/>
</target>
<target name="main" description="Executes the default target
(most)." depends="jars">
@@ -67,7 +67,7 @@
<ant antfile="${testsuite.dir}/build.xml" target="most"
inheritall="false"/>
<ant antfile="${int.jboss50.dir}/build.xml" target="most"
inheritall="false"/>
<ant antfile="${int.jboss42.dir}/build.xml" target="most"
inheritall="false"/>
- <ant antfile="${int.sunri.dir}/build.xml" target="most"
inheritall="false"/>
+ <ant antfile="${int.sunri50.dir}/build.xml" target="most"
inheritall="false"/>
</target>
<target name="all" description="Create a distribution zip file"
depends="most,build-bin-dist,build-src-dist">
Modified: branches/tdiesler/trunk/build/version.properties
===================================================================
--- branches/tdiesler/trunk/build/version.properties 2007-05-16 11:58:54 UTC (rev 3104)
+++ branches/tdiesler/trunk/build/version.properties 2007-05-16 12:10:39 UTC (rev 3105)
@@ -22,5 +22,6 @@
jboss-microcontainer=2.0.0.Beta3
junit=3.8.1
sun-jaf=1.1
+sun-jaxrpc=1.1
sun-jaxws=2.1.1
sun-servlet=2.5
Modified: branches/tdiesler/trunk/integration/jboss50/.classpath
===================================================================
--- branches/tdiesler/trunk/integration/jboss50/.classpath 2007-05-16 11:58:54 UTC (rev
3104)
+++ branches/tdiesler/trunk/integration/jboss50/.classpath 2007-05-16 12:10:39 UTC (rev
3105)
@@ -6,5 +6,6 @@
<classpathentry kind="lib"
path="/spi/thirdparty/jaxws-api.jar"/>
<classpathentry kind="lib"
path="/spi/thirdparty/jsr181-api.jar"/>
<classpathentry kind="con"
path="org.eclipse.jdt.USER_LIBRARY/jboss-5.0.x"/>
+ <classpathentry kind="lib"
path="/spi/thirdparty/jaxrpc-api.jar"/>
<classpathentry kind="output" path="output-eclipse"/>
</classpath>
Modified: branches/tdiesler/trunk/integration/jboss50/ant-import/build-thirdparty.xml
===================================================================
--- branches/tdiesler/trunk/integration/jboss50/ant-import/build-thirdparty.xml 2007-05-16
11:58:54 UTC (rev 3104)
+++ branches/tdiesler/trunk/integration/jboss50/ant-import/build-thirdparty.xml 2007-05-16
12:10:39 UTC (rev 3105)
@@ -34,15 +34,20 @@
<path id="jbws50.integration.classpath">
<pathelement location="${spi.dir}/output/lib/jbossws-spi.jar"/>
<pathelement location="${spi.dir}/thirdparty/jaxws-api.jar"/>
+ <pathelement location="${spi.dir}/thirdparty/jaxrpc-api.jar"/>
<pathelement location="${spi.dir}/thirdparty/jsr181-api.jar"/>
<pathelement location="${jboss50.lib}/jboss-aop-jdk50.jar"/>
<pathelement location="${jboss50.lib}/jboss-common-core.jar"/>
<pathelement location="${jboss50.lib}/jboss-deployers.jar"/>
<pathelement location="${jboss50.lib}/jboss-logging-spi.jar"/>
+ <pathelement location="${jboss50.lib}/jboss-j2se.jar"/>
+ <pathelement location="${jboss50.lib}/jboss-system.jar"/>
+ <pathelement location="${jboss50.lib}/jboss-system-jmx.jar"/>
<pathelement location="${jboss50.lib}/jboss-vfs.jar"/>
<pathelement location="${jboss50.lib}/jboss-xml-binding.jar"/>
<pathelement location="${jboss50.server.lib}/jboss.jar"/>
<pathelement location="${jboss50.server.lib}/jboss-javaee.jar"/>
+ <pathelement location="${jboss50.server.lib}/jbosssx.jar"/>
<pathelement
location="${jboss50.server.deployers}/ejb3.deployer/jboss-ejb3.jar"/>
</path>
Added:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB21.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB21.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB21.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -0,0 +1,169 @@
+/*
+ * 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.ws.integration.jboss50;
+
+// $Id$
+
+import java.lang.reflect.Method;
+import java.security.Principal;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.ejb.EjbModule;
+import org.jboss.ejb.Interceptor;
+import org.jboss.ejb.StatelessSessionContainer;
+import org.jboss.ejb.plugins.AbstractInterceptor;
+import org.jboss.invocation.Invocation;
+import org.jboss.invocation.InvocationType;
+import org.jboss.invocation.PayloadKey;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.security.SecurityAssociation;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.invocation.HandlerCallback;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.utils.ObjectNameFactory;
+
+/**
+ * Handles invocations on EJB3 endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerEJB21 implements InvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(InvocationHandlerEJB21.class);
+
+ private String jndiName;
+ private MBeanServer server;
+ private ObjectName objectName;
+
+ public void create(Endpoint endpoint)
+ {
+ server = MBeanServerLocator.locateJBoss();
+
+ String ejbName =
endpoint.getName().getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+ if (ejbName == null)
+ throw new WebServiceException("Cannot obtain ejb-link from port
component");
+
+ UnifiedDeploymentInfo udi =
endpoint.getService().getDeployment().getContext().getAttachment(UnifiedDeploymentInfo.class);
+ UnifiedApplicationMetaData applMetaData =
(UnifiedApplicationMetaData)udi.metaData;
+ UnifiedBeanMetaData beanMetaData =
(UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
+ if (beanMetaData == null)
+ throw new WebServiceException("Cannot obtain ejb meta data for: " +
ejbName);
+
+ // get the bean's JNDI name
+ jndiName = beanMetaData.getContainerObjectNameJndiName();
+ if (jndiName == null)
+ throw new WebServiceException("Cannot obtain JNDI name for: " +
ejbName);
+
+ objectName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + jndiName +
",service=EJB");
+
+ // Dynamically add the service endpoint interceptor
+ //
http://jira.jboss.org/jira/browse/JBWS-758
+ try
+ {
+ EjbModule ejbModule = (EjbModule)server.getAttribute(objectName,
"EjbModule");
+ StatelessSessionContainer container =
(StatelessSessionContainer)ejbModule.getContainer(ejbName);
+
+ boolean injectionPointFound = false;
+ Interceptor prev = container.getInterceptor();
+ while (prev != null && prev.getNext() != null)
+ {
+ Interceptor next = prev.getNext();
+ if (next.getNext() == null)
+ {
+ log.debug("Inject service endpoint interceptor after: " +
prev.getClass().getName());
+ AbstractInterceptor sepInterceptor =
endpoint.getAttachment(AbstractInterceptor.class);
+ if (sepInterceptor == null)
+ throw new IllegalStateException("Cannot obtain endpoint
interceptor");
+
+ prev.setNext(sepInterceptor);
+ sepInterceptor.setNext(next);
+ injectionPointFound = true;
+ }
+ prev = next;
+ }
+ if (injectionPointFound == false)
+ log.warn("Cannot service endpoint interceptor injection point");
+ }
+ catch (Exception ex)
+ {
+ log.warn("Cannot add service endpoint interceptor", ex);
+ }
+
+ if (server.isRegistered(objectName) == false)
+ throw new WebServiceException("Cannot find service endpoint target: "
+ objectName);
+
+ }
+
+ public void start(Endpoint ep)
+ {
+ }
+
+ public Object getTargetBean(Endpoint ep) throws InstantiationException,
IllegalAccessException
+ {
+ return null;
+ }
+
+ public Object invoke(Endpoint ep, Object targetBean, Method method, Object[] args,
InvocationContext context) throws Exception
+ {
+ // these are provided by the ServerLoginHandler
+ Principal principal = SecurityAssociation.getPrincipal();
+ Object credential = SecurityAssociation.getCredential();
+
+ Invocation inv = new Invocation(null, method, args, null, principal, credential);
+
+ //inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
+ //inv.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getSOAPMessage());
+ inv.setType(InvocationType.SERVICE_ENDPOINT);
+
+ HandlerCallback callback = ep.getAttachment(HandlerCallback.class);
+ if (callback == null)
+ throw new IllegalStateException("Cannot obtain handler callback");
+
+ inv.setValue(HandlerCallback.class.getName(), callback, PayloadKey.TRANSIENT);
+ inv.setValue(InvocationContext.class.getName(), context, PayloadKey.TRANSIENT);
+
+ String[] sig = { Invocation.class.getName() };
+ Object retObj = server.invoke(objectName, "invoke", new Object[] { inv },
sig);
+
+ return retObj;
+ }
+
+ public void stop(Endpoint ep)
+ {
+ // Nothing to do
+ }
+
+ public void destroy(Endpoint ep)
+ {
+ // Nothing to do
+ }
+}
Property changes on:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB21.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB3.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB3.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB3.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -0,0 +1,158 @@
+/*
+ * 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.ws.integration.jboss50;
+
+// $Id$
+
+import java.lang.reflect.Method;
+
+import javax.ejb.EJBContext;
+import javax.management.ObjectName;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.aop.Dispatcher;
+import org.jboss.aop.MethodInfo;
+import org.jboss.ejb3.BeanContext;
+import org.jboss.ejb3.BeanContextLifecycleCallback;
+import org.jboss.ejb3.EJBContainerInvocation;
+import org.jboss.ejb3.stateless.StatelessBeanContext;
+import org.jboss.ejb3.stateless.StatelessContainer;
+import org.jboss.injection.lang.reflect.BeanProperty;
+import org.jboss.logging.Logger;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+import org.jboss.ws.utils.ObjectNameFactory;
+
+/**
+ * Handles invocations on EJB3 endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerEJB3 implements InvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(InvocationHandlerEJB3.class);
+
+ private ObjectName objectName;
+
+ public void create(Endpoint endpoint)
+ {
+ String ejbName =
endpoint.getName().getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+ if (ejbName == null)
+ throw new WebServiceException("Cannot obtain ejb-link");
+
+ UnifiedDeploymentInfo udi =
endpoint.getService().getDeployment().getContext().getAttachment(UnifiedDeploymentInfo.class);
+ String nameStr = "jboss.j2ee:name=" + ejbName +
",service=EJB3,jar=" + udi.simpleName;
+ if (udi.parent != null)
+ {
+ nameStr += ",ear=" + udi.parent.simpleName;
+ }
+
+ objectName = ObjectNameFactory.create(nameStr.toString());
+ }
+
+ public void start(Endpoint ep)
+ {
+ Dispatcher dispatcher = Dispatcher.singleton;
+ if (dispatcher.getRegistered(objectName.getCanonicalName()) == null)
+ throw new WebServiceException("Cannot find service endpoint target: "
+ objectName);
+ }
+
+ public Object getTargetBean(Endpoint ep) throws InstantiationException,
IllegalAccessException
+ {
+ return null;
+ }
+
+ public Object invoke(Endpoint ep, Object targetBean, Method method, Object[] args,
InvocationContext context) throws Exception
+ {
+ Dispatcher dispatcher = Dispatcher.singleton;
+ StatelessContainer container =
(StatelessContainer)dispatcher.getRegistered(objectName.getCanonicalName());
+
+ MethodInfo info = container.getMethodInfo(method);
+
+ EJBContainerInvocation<StatelessContainer, StatelessBeanContext> ejb3Inv =
new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
+ ejb3Inv.setAdvisor(container);
+ ejb3Inv.setArguments(args);
+ ejb3Inv.setContextCallback(new ContextCallback(context));
+
+ Object retObj;
+ try
+ {
+ retObj = ejb3Inv.invokeNext();
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ catch (Throwable ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ return retObj;
+ }
+
+ public void stop(Endpoint ep)
+ {
+ // Nothing to do
+ }
+
+ public void destroy(Endpoint ep)
+ {
+ // Nothing to do
+ }
+
+ class ContextCallback implements BeanContextLifecycleCallback
+ {
+ private WebServiceContext wsContext;
+
+ public ContextCallback(InvocationContext context)
+ {
+ if (context instanceof WebServiceContext)
+ this.wsContext = (WebServiceContext)context;
+ }
+
+ public void attached(BeanContext beanCtx)
+ {
+ StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
+
+ BeanProperty beanProp = sbc.getWebServiceContextProperty();
+ if (beanProp != null && wsContext instanceof WebServiceContext)
+ {
+ EJBContext ejbCtx = beanCtx.getEJBContext();
+ beanProp.set(beanCtx.getInstance(), wsContext);
+ }
+ }
+
+ public void released(BeanContext beanCtx)
+ {
+ StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
+
+ BeanProperty beanProp = sbc.getWebServiceContextProperty();
+ if (beanProp != null)
+ beanProp.set(beanCtx.getInstance(), null);
+ }
+ }
+}
Property changes on:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB3.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerJSE.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerJSE.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerJSE.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -0,0 +1,78 @@
+/*
+ * 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.ws.integration.jboss50;
+
+// $Id$
+
+import java.lang.reflect.Method;
+
+import javax.xml.ws.WebServiceContext;
+
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+import org.jboss.ws.integration.invocation.WebServiceContextInjector;
+
+/**
+ * Handles invocations on JSE endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class InvocationHandlerJSE implements InvocationHandler
+{
+ public void create(Endpoint ep)
+ {
+ // Nothing to do
+ }
+
+ public void start(Endpoint endpoint)
+ {
+ // Nothing to do
+ }
+
+ public void stop(Endpoint endpoint)
+ {
+ // Nothing to do
+ }
+
+ public void destroy(Endpoint ep)
+ {
+ // Nothing to do
+ }
+
+ public Object getTargetBean(Endpoint endpoint) throws InstantiationException,
IllegalAccessException
+ {
+ Class epImpl = endpoint.getEndpointImpl();
+ Object targetBean = epImpl.newInstance();
+ return targetBean;
+ }
+
+ public Object invoke(Endpoint endpoint, Object targetBean, Method method, Object[]
args, InvocationContext context) throws Exception
+ {
+ if (context instanceof WebServiceContext)
+ new WebServiceContextInjector().injectContext(targetBean,
(WebServiceContext)context);
+
+ Object retObj = method.invoke(targetBean, args);
+ return retObj;
+ }
+}
Property changes on:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerJSE.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
===================================================================
---
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
(rev 0)
+++
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -0,0 +1,103 @@
+/*
+ * 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.ws.integration.jboss50;
+
+// $Id$
+
+import javax.xml.rpc.handler.MessageContext;
+
+import org.jboss.ejb.plugins.AbstractInterceptor;
+import org.jboss.invocation.Invocation;
+import org.jboss.invocation.InvocationKey;
+import org.jboss.logging.Logger;
+import org.jboss.ws.integration.invocation.HandlerCallback;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
+
+/**
+ * This Interceptor does the ws4ee handler processing.
+ *
+ * According to the ws4ee spec the handler logic must be invoked after the container
+ * applied method level security to the invocation.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 21-Sep-2005
+ */
+public class ServiceEndpointInterceptor extends AbstractInterceptor
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ServiceEndpointInterceptor.class);
+
+ // Interceptor implementation --------------------------------------
+
+ /** Before and after we call the service endpoint bean, we process the handler
chains.
+ */
+ public Object invoke(final Invocation mi) throws Exception
+ {
+ // If no msgContext, it's not for us
+ MessageContext msgContext =
(MessageContext)mi.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
+ if (msgContext == null)
+ {
+ return getNext().invoke(mi);
+ }
+
+ // Get the handler callback
+ HandlerCallback callback =
(HandlerCallback)mi.getValue(HandlerCallback.class.getName());
+
+ // Handlers need to be Tx. Therefore we must invoke the handler chain after the
TransactionInterceptor.
+ if (callback != null)
+ {
+ try
+ {
+ // call the request handlers
+ boolean handlersPass =
callback.callRequestHandlerChain(HandlerType.ENDPOINT);
+ handlersPass = handlersPass &&
callback.callRequestHandlerChain(HandlerType.POST);
+
+ Object resObj = getNext().invoke(mi);
+
+ // call the response handlers
+ handlersPass = callback.callResponseHandlerChain(HandlerType.POST);
+ handlersPass = handlersPass &&
callback.callResponseHandlerChain(HandlerType.ENDPOINT);
+
+ return resObj;
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ // call the fault handlers
+ boolean handlersPass = callback.callFaultHandlerChain(HandlerType.POST,
ex);
+ handlersPass = handlersPass &&
callback.callFaultHandlerChain(HandlerType.ENDPOINT, ex);
+ }
+ catch (Exception subEx)
+ {
+ log.warn("Cannot process handlerChain.handleFault, ignoring: ",
subEx);
+ }
+ throw ex;
+ }
+ }
+ else
+ {
+ log.warn("Handler callback not available");
+ return getNext().invoke(mi);
+ }
+ }
+}
Property changes on:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB21.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -1,267 +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.ws.integration.jboss42.jbossws;
-
-// $Id$
-
-import java.lang.reflect.Method;
-import java.security.Principal;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.ejb.EjbModule;
-import org.jboss.ejb.Interceptor;
-import org.jboss.ejb.StatelessSessionContainer;
-import org.jboss.invocation.Invocation;
-import org.jboss.invocation.InvocationKey;
-import org.jboss.invocation.InvocationType;
-import org.jboss.invocation.PayloadKey;
-import org.jboss.logging.Logger;
-import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.security.SecurityAssociation;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.handler.HandlerCallback;
-import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.core.server.AbstractInvocationHandler;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.invocation.InvocationContext;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
-import org.jboss.ws.utils.ObjectNameFactory;
-
-/**
- * Handles invocations on EJB21 endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class InvocationHandlerEJB21 extends AbstractInvocationHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(InvocationHandlerEJB21.class);
-
- private String jndiName;
- private MBeanServer server;
- private ObjectName objectName;
-
- /** Initialize the service endpoint */
- @Override
- public void create(Endpoint endpoint)
- {
- super.create(endpoint);
-
- server = MBeanServerLocator.locateJBoss();
-
- ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- String ejbName = sepMetaData.getLinkName();
- if (ejbName == null)
- throw new WSException("Cannot obtain ejb-link from port component");
-
- UnifiedDeploymentInfo udi =
endpoint.getService().getDeployment().getContext().getAttachment(UnifiedDeploymentInfo.class);
- UnifiedApplicationMetaData applMetaData =
(UnifiedApplicationMetaData)udi.metaData;
- UnifiedBeanMetaData beanMetaData =
(UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
- if (beanMetaData == null)
- throw new WSException("Cannot obtain ejb meta data for: " + ejbName);
-
- // verify the service endpoint
- String seiName = sepMetaData.getServiceEndpointInterfaceName();
- if (sepMetaData.getType() == Type.JAXRPC && seiName != null)
- {
- String bmdSEI = beanMetaData.getServiceEndpointInterface();
- if (seiName.equals(bmdSEI) == false)
- throw new WSException("Endpoint meta data defines SEI '" +
seiName + "', <service-endpoint> in ejb-jar.xml defines '" +
bmdSEI + "'");
- }
-
- // get the bean's JNDI name
- jndiName = beanMetaData.getContainerObjectNameJndiName();
- if (jndiName == null)
- throw new WSException("Cannot obtain JNDI name for: " + ejbName);
-
- objectName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + jndiName +
",service=EJB");
-
- // Dynamically add the service endpoint interceptor
- //
http://jira.jboss.org/jira/browse/JBWS-758
- try
- {
- EjbModule ejbModule = (EjbModule)server.getAttribute(objectName,
"EjbModule");
- StatelessSessionContainer container =
(StatelessSessionContainer)ejbModule.getContainer(ejbName);
-
- boolean injectionPointFound = false;
- Interceptor prev = container.getInterceptor();
- while (prev != null && prev.getNext() != null)
- {
- Interceptor next = prev.getNext();
- if (next.getNext() == null)
- {
- log.debug("Inject service endpoint interceptor after: " +
prev.getClass().getName());
- ServiceEndpointInterceptor sepInterceptor = new
ServiceEndpointInterceptor();
- prev.setNext(sepInterceptor);
- sepInterceptor.setNext(next);
- injectionPointFound = true;
- }
- prev = next;
- }
- if (injectionPointFound == false)
- log.warn("Cannot service endpoint interceptor injection point");
- }
- catch (Exception ex)
- {
- log.warn("Cannot add service endpoint interceptor", ex);
- }
- }
-
- /** Load the SEI implementation bean if necessary
- */
- public Class loadServiceEndpoint()
- {
- if (server.isRegistered(objectName) == false)
- throw new WSException("Cannot find service endpoint target: " +
objectName);
-
- return null;
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- @Override
- protected Object createServiceEndpointInstance(Class seiImplClass, InvocationContext
context) throws Exception
- {
- return null;
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv)
throws Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
-
- // these are provided by the ServerLoginHandler
- Principal principal = SecurityAssociation.getPrincipal();
- Object credential = SecurityAssociation.getCredential();
-
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
-
- // invoke on the container
- try
- {
- // setup the invocation
- Method method = epInv.getJavaMethod();
- Object[] args = epInv.getRequestPayload();
- Invocation inv = new Invocation(null, method, args, null, principal,
credential);
-
- // EJB2.1 endpoints will only get an JAXRPC context
- if ((msgContext instanceof javax.xml.rpc.handler.MessageContext) == false)
- msgContext = new SOAPMessageContextJAXRPC(msgContext);
-
- inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
- inv.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getSOAPMessage());
- inv.setType(InvocationType.SERVICE_ENDPOINT);
-
- // Set the handler callback and endpoint invocation
- ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
- inv.setValue(HandlerCallback.class.getName(), new
HandlerCallbackImpl(sepMetaData), PayloadKey.TRANSIENT);
- inv.setValue(EndpointInvocation.class.getName(), epInv, PayloadKey.TRANSIENT);
-
- String[] sig = { Invocation.class.getName() };
- Object retObj = server.invoke(objectName, "invoke", new Object[] { inv
}, sig);
- epInv.setReturnValue(retObj);
- }
- catch (Exception e)
- {
- handleInvocationException(e);
- }
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpointInstance(Object seiImpl)
- {
- // do nothing
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- @Override
- public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type)
- {
- if (type == HandlerType.PRE)
- return delegate.callRequestHandlerChain(sepMetaData, type);
- else return true;
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type)
- {
- if (type == HandlerType.PRE)
- return delegate.callResponseHandlerChain(sepMetaData, type);
- else return true;
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type, Exception ex)
- {
- if (type == HandlerType.PRE)
- return delegate.callFaultHandlerChain(sepMetaData, type, ex);
- else return true;
- }
-
- // The ServiceEndpointInterceptor calls the methods in this callback
- public class HandlerCallbackImpl implements HandlerCallback
- {
- private ServerEndpointMetaData sepMetaData;
-
- public HandlerCallbackImpl(ServerEndpointMetaData sepMetaData)
- {
- this.sepMetaData = sepMetaData;
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- public boolean callRequestHandlerChain(HandlerType type)
- {
- if (type == HandlerType.PRE)
- return true;
- else return delegate.callRequestHandlerChain(sepMetaData, type);
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- public boolean callResponseHandlerChain(HandlerType type)
- {
- if (type == HandlerType.PRE)
- return true;
- else return delegate.callResponseHandlerChain(sepMetaData, type);
- }
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- public boolean callFaultHandlerChain(HandlerType type, Exception ex)
- {
- if (type == HandlerType.PRE)
- return true;
- else return delegate.callFaultHandlerChain(sepMetaData, type, ex);
- }
- }
-}
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/InvocationHandlerEJB3.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -1,192 +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.ws.integration.jboss42.jbossws;
-
-// $Id$
-
-import java.lang.reflect.Method;
-
-import javax.ejb.EJBContext;
-import javax.management.ObjectName;
-
-import org.jboss.aop.Dispatcher;
-import org.jboss.aop.MethodInfo;
-import org.jboss.ejb3.BeanContext;
-import org.jboss.ejb3.BeanContextLifecycleCallback;
-import org.jboss.ejb3.EJBContainerInvocation;
-import org.jboss.ejb3.stateless.StatelessBeanContext;
-import org.jboss.ejb3.stateless.StatelessContainer;
-import org.jboss.injection.lang.reflect.BeanProperty;
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.core.jaxws.WebServiceContextEJB;
-import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.server.AbstractInvocationHandler;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.deployment.UnifiedDeploymentInfo;
-import org.jboss.ws.integration.invocation.InvocationContext;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-import org.jboss.ws.utils.ObjectNameFactory;
-
-/**
- * Handles invocations on EJB3 endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class InvocationHandlerEJB3 extends AbstractInvocationHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(InvocationHandlerEJB3.class);
-
- private ObjectName objectName;
-
- /** Initialize the service endpoint */
- @Override
- public void create(Endpoint endpoint)
- {
- super.create(endpoint);
-
- ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- String ejbName = sepMetaData.getLinkName();
- if (ejbName == null)
- throw new WSException("Cannot obtain ejb-link from port component");
-
- UnifiedDeploymentInfo udi =
endpoint.getService().getDeployment().getContext().getAttachment(UnifiedDeploymentInfo.class);
- String nameStr = "jboss.j2ee:name=" + ejbName +
",service=EJB3,jar=" + udi.simpleName;
- if (udi.parent != null)
- {
- nameStr += ",ear=" + udi.parent.simpleName;
- }
-
- objectName = ObjectNameFactory.create(nameStr.toString());
- }
-
- /** Load the SEI implementation bean if necessary
- */
- public Class loadServiceEndpoint()
- {
- Dispatcher dispatcher = Dispatcher.singleton;
- if (dispatcher.getRegistered(objectName.getCanonicalName()) == null)
- throw new WSException("Cannot find service endpoint target: " +
objectName);
-
- return null;
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- @Override
- protected Object createServiceEndpointInstance(Class seiImplClass, InvocationContext
context) throws Exception
- {
- return null;
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv)
throws Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
-
- // invoke on the container
- try
- {
- // setup the invocation
- Method seiMethod = epInv.getJavaMethod();
- Object[] args = epInv.getRequestPayload();
-
- Dispatcher dispatcher = Dispatcher.singleton;
- StatelessContainer container =
(StatelessContainer)dispatcher.getRegistered(objectName.getCanonicalName());
- Class beanClass = container.getBeanClass();
-
- Method implMethod = getImplMethod(beanClass, seiMethod);
- MethodInfo info = container.getMethodInfo(implMethod);
-
- EJBContainerInvocation<StatelessContainer, StatelessBeanContext> ejb3Inv =
new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
- ejb3Inv.setAdvisor(container);
- ejb3Inv.setArguments(args);
- ejb3Inv.setContextCallback(new ContextCallback());
-
- Object retObj = ejb3Inv.invokeNext();
-
- epInv.setReturnValue(retObj);
- }
- catch (Throwable th)
- {
- handleInvocationException(th);
- }
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpointInstance(Object seiImpl)
- {
- // do nothing
- }
-
- class ContextCallback implements BeanContextLifecycleCallback
- {
- private SOAPMessageContextJAXWS jaxwsMessageContext;
- private SOAPMessageContextJAXRPC jaxrpcMessageContext;
-
- public ContextCallback()
- {
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- if (msgContext instanceof SOAPMessageContextJAXRPC)
- {
- jaxrpcMessageContext = (SOAPMessageContextJAXRPC)msgContext;
- jaxwsMessageContext = new SOAPMessageContextJAXWS(msgContext);
- }
- else if (msgContext instanceof SOAPMessageContextJAXWS)
- {
- jaxwsMessageContext = (SOAPMessageContextJAXWS)msgContext;
- jaxrpcMessageContext = new SOAPMessageContextJAXRPC(msgContext);
- }
- }
-
- public void attached(BeanContext beanCtx)
- {
- StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
- sbc.setMessageContextJAXRPC(jaxrpcMessageContext);
-
- BeanProperty beanProp = sbc.getWebServiceContextProperty();
- if (beanProp != null)
- {
- EJBContext ejbCtx = beanCtx.getEJBContext();
- beanProp.set(beanCtx.getInstance(), new
WebServiceContextEJB(jaxwsMessageContext, ejbCtx));
- }
- }
-
- public void released(BeanContext beanCtx)
- {
- StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
- sbc.setMessageContextJAXRPC(null);
-
- BeanProperty beanProp = sbc.getWebServiceContextProperty();
- if (beanProp != null)
- beanProp.set(beanCtx.getInstance(), null);
- }
- }
-}
Modified:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -71,7 +71,7 @@
Class<?> epBean = loader.loadClass(beanName);
ep.setEndpointImpl(epBean);
- ServerEndpointMetaData sepMetaData =
ep.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData sepMetaData =
ep.getAttachment(ServerEndpointMetaData.class);
sepMetaData.setServiceEndpointImplName(beanName);
}
catch (ClassNotFoundException ex)
Deleted:
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ServiceEndpointInterceptor.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -1,145 +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.ws.integration.jboss42.jbossws;
-
-// $Id$
-
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ejb.plugins.AbstractInterceptor;
-import org.jboss.invocation.Invocation;
-import org.jboss.invocation.InvocationKey;
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.CommonBindingProvider;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
-import org.jboss.ws.core.jaxrpc.handler.HandlerCallback;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-
-/**
- * This Interceptor does the ws4ee handler processing.
- *
- * According to the ws4ee spec the handler logic must be invoked after the container
- * applied method level security to the invocation.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 21-Sep-2005
- */
-public class ServiceEndpointInterceptor extends AbstractInterceptor
-{
- // provide logging
- private static Logger log = Logger.getLogger(ServiceEndpointInterceptor.class);
-
- // Interceptor implementation --------------------------------------
-
- /** Before and after we call the service endpoint bean, we process the handler
chains.
- */
- public Object invoke(final Invocation mi) throws Exception
- {
- // If no msgContext, it's not for us
- CommonMessageContext msgContext =
(CommonMessageContext)mi.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
- if (msgContext == null)
- {
- return getNext().invoke(mi);
- }
-
- // Get the endpoint invocation
- EndpointInvocation epInv =
(EndpointInvocation)mi.getValue(EndpointInvocation.class.getName());
- OperationMetaData opMetaData = epInv.getOperationMetaData();
-
- // Get the handler callback
- HandlerCallback callback =
(HandlerCallback)mi.getValue(HandlerCallback.class.getName());
-
- // Handlers need to be Tx. Therefore we must invoke the handler chain after the
TransactionInterceptor.
- if (callback != null && epInv != null)
- {
- try
- {
- // call the request handlers
- boolean handlersPass =
callback.callRequestHandlerChain(HandlerType.ENDPOINT);
- handlersPass = handlersPass &&
callback.callRequestHandlerChain(HandlerType.POST);
-
- // Call the next interceptor in the chain
- if (handlersPass)
- {
- CommonBindingProvider bindingProvider = new
CommonBindingProvider(opMetaData.getEndpointMetaData());
- CommonBinding binding = bindingProvider.getCommonBinding();
-
- // Verify that the the message has not been mofified
- CommonMessageContext messageContext =
MessageContextAssociation.peekMessageContext();
- if (messageContext.isModified())
- {
- log.debug("Handler modified payload, unbind message and update
invocation args");
- epInv =
bindingProvider.getCommonBinding().unbindRequestMessage(opMetaData,
messageContext.getMessageAbstraction());
- }
-
- // The SOAPContentElements stored in the EndpointInvocation might have
changed after
- // handler processing. Get the updated request payload. This should be a
noop if request
- // handlers did not modify the incomming SOAP message.
- Object[] reqParams = epInv.getRequestPayload();
- mi.setArguments(reqParams);
- Object resObj = getNext().invoke(mi);
- epInv.setReturnValue(resObj);
-
- // Bind the response message
- SOAPMessage resMessage =
(SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
- msgContext.setSOAPMessage(resMessage);
- }
-
- // call the response handlers
- handlersPass = callback.callResponseHandlerChain(HandlerType.POST);
- handlersPass = handlersPass &&
callback.callResponseHandlerChain(HandlerType.ENDPOINT);
-
- // update the return value after response handler processing
- Object resObj = epInv.getReturnValue();
-
- return resObj;
- }
- catch (Exception ex)
- {
- try
- {
- SOAPMessage faultMessage =
SOAPFaultHelperJAXRPC.exceptionToFaultMessage(ex);
- msgContext.setSOAPMessage(faultMessage);
-
- // call the fault handlers
- boolean handlersPass = callback.callFaultHandlerChain(HandlerType.POST,
ex);
- handlersPass = handlersPass &&
callback.callFaultHandlerChain(HandlerType.ENDPOINT, ex);
- }
- catch (Exception subEx)
- {
- log.warn("Cannot process handlerChain.handleFault, ignoring: ",
subEx);
- }
- throw ex;
- }
- }
- else
- {
- log.warn("Handler callback not available");
- return getNext().invoke(mi);
- }
- }
-}
Modified:
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml
===================================================================
---
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-16
12:10:39 UTC (rev 3105)
@@ -135,10 +135,10 @@
<property
name="lifecycleHandler">org.jboss.ws.core.server.LifecycleHandlerImpl</property>
<property name="invocationHandler">
<map keyClass="java.lang.String"
valueClass="java.lang.String">
-
<entry><key>JAXRPC_JSE</key><value>org.jboss.ws.core.server.InvocationHandlerJSE</value></entry>
-
<entry><key>JAXRPC_EJB21</key><value>org.jboss.ws.integration.jboss50.jbossws.InvocationHandlerEJB21</value></entry>
-
<entry><key>JAXWS_JSE</key><value>org.jboss.ws.core.server.InvocationHandlerJSE</value></entry>
-
<entry><key>JAXWS_EJB3</key><value>org.jboss.ws.integration.jboss50.jbossws.InvocationHandlerEJB3</value></entry>
+
<entry><key>JAXRPC_JSE</key><value>org.jboss.ws.integration.jboss50.InvocationHandlerJSE</value></entry>
+
<entry><key>JAXRPC_EJB21</key><value>org.jboss.ws.integration.jboss50.InvocationHandlerEJB21</value></entry>
+
<entry><key>JAXWS_JSE</key><value>org.jboss.ws.integration.jboss50.InvocationHandlerJSE</value></entry>
+
<entry><key>JAXWS_EJB3</key><value>org.jboss.ws.integration.jboss50.InvocationHandlerEJB3</value></entry>
</map>
</property>
</bean>
Modified: branches/tdiesler/trunk/integration/spi/.classpath
===================================================================
--- branches/tdiesler/trunk/integration/spi/.classpath 2007-05-16 11:58:54 UTC (rev 3104)
+++ branches/tdiesler/trunk/integration/spi/.classpath 2007-05-16 12:10:39 UTC (rev 3105)
@@ -16,5 +16,7 @@
<classpathentry kind="lib"
path="thirdparty/servlet-api.jar"/>
<classpathentry kind="lib" path="thirdparty/junit.jar"/>
<classpathentry kind="lib" path="thirdparty/activation.jar"/>
+ <classpathentry kind="lib"
path="thirdparty/jboss-javaee.jar"/>
+ <classpathentry kind="lib" path="thirdparty/jaxrpc-api.jar"/>
<classpathentry kind="output" path="output-eclipse"/>
</classpath>
Modified: branches/tdiesler/trunk/integration/spi/ant-import/build-thirdparty.xml
===================================================================
--- branches/tdiesler/trunk/integration/spi/ant-import/build-thirdparty.xml 2007-05-16
11:58:54 UTC (rev 3104)
+++ branches/tdiesler/trunk/integration/spi/ant-import/build-thirdparty.xml 2007-05-16
12:10:39 UTC (rev 3105)
@@ -55,6 +55,7 @@
<get src="${jboss.repository}/sun-jaf/${sun-jaf}/lib/activation.jar"
dest="${thirdparty.dir}/activation.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/sun-jaxws/${sun-jaxws}/lib/jaxws-api.jar"
dest="${thirdparty.dir}/jaxws-api.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/sun-jaxws/${sun-jaxws}/lib/jsr181-api.jar"
dest="${thirdparty.dir}/jsr181-api.jar" usetimestamp="true"
verbose="true"/>
+ <get
src="${jboss.repository}/sun-jaxrpc/${sun-jaxrpc}/lib/jaxrpc-api.jar"
dest="${thirdparty.dir}/jaxrpc-api.jar" usetimestamp="true"
verbose="true"/>
<get
src="${jboss.repository}/sun-servlet/${sun-servlet}/lib/servlet-api.jar"
dest="${thirdparty.dir}/servlet-api.jar" usetimestamp="true"
verbose="true"/>
<checksum file="${build.dir}/version.properties"
fileext=".md5"/>
@@ -72,6 +73,7 @@
<pathelement
location="${thirdparty.dir}/jboss-microcontainer.jar"/>
<pathelement location="${thirdparty.dir}/jboss-xml-binding.jar"/>
<pathelement location="${thirdparty.dir}/jaxws-api.jar"/>
+ <pathelement location="${thirdparty.dir}/jaxrpc-api.jar"/>
<pathelement location="${thirdparty.dir}/jsr181-api.jar"/>
<pathelement location="${thirdparty.dir}/servlet-api.jar"/>
</path>
Modified:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/BasicEndpoint.java
===================================================================
---
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/BasicEndpoint.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/BasicEndpoint.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -154,17 +154,17 @@
this.invocationHandler = handler;
}
- public <T> T addMetaData(Class<T> key, Object value)
+ public <T> T addAttachment(Class<T> key, Object value)
{
return (T)metaData.put(key, value);
}
- public <T> T getMetaData(Class<T> key)
+ public <T> T getAttachment(Class<T> key)
{
return (T)metaData.get(key);
}
- public <T> T removeMetaData(Class<T> key)
+ public <T> T removeAttachment(Class<T> key)
{
return (T)metaData.get(key);
}
Modified:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/Endpoint.java
===================================================================
---
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/Endpoint.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/Endpoint.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -120,12 +120,12 @@
/** Set the endpoint bean invoker */
void setInvocationHandler(InvocationHandler invoker);
- /** Add arbitrary meta data */
- <T> T addMetaData(Class<T> key, Object value);
+ /** Add arbitrary attachments */
+ <T> T addAttachment(Class<T> key, Object value);
- /** Get arbitrary meta data */
- <T> T getMetaData(Class<T> key);
+ /** Get arbitrary attachments */
+ <T> T getAttachment(Class<T> key);
- /** Remove arbitrary meta data */
- <T> T removeMetaData(Class<T> key);
+ /** Remove arbitrary attachments */
+ <T> T removeAttachment(Class<T> key);
}
Added:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/BasicInvocationContext.java
===================================================================
---
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/BasicInvocationContext.java
(rev 0)
+++
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/BasicInvocationContext.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -0,0 +1,85 @@
+/*
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (
http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Tomcat", and "Apache
Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache(a)apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <
http://www.apache.org/>.
+ */
+package org.jboss.ws.integration.invocation;
+
+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 Map<Class, Object> attachments = new HashMap<Class, Object>();
+
+ 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);
+ }
+}
Property changes on:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/BasicInvocationContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/HandlerCallback.java
(from rev 3095,
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerCallback.java)
===================================================================
---
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/HandlerCallback.java
(rev 0)
+++
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/HandlerCallback.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -0,0 +1,44 @@
+/*
+* 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.ws.integration.invocation;
+
+// $Id$
+
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
+
+/**
+ * A handler callback for the EJB21 Invoker
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 26-Apr-2007
+ */
+public interface HandlerCallback
+{
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ boolean callRequestHandlerChain(HandlerType type);
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ boolean callResponseHandlerChain(HandlerType type);
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ boolean callFaultHandlerChain(HandlerType type, Exception ex);
+}
\ No newline at end of file
Modified:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationContext.java
===================================================================
---
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationContext.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationContext.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -55,8 +55,6 @@
*/
package org.jboss.ws.integration.invocation;
-import javax.xml.ws.handler.MessageContext;
-
//$Id$
/**
@@ -67,6 +65,12 @@
*/
public interface InvocationContext
{
- /** Get the message context */
- MessageContext getMessageContext();
+ /** Add arbitrary attachments */
+ <T> T addAttachment(Class<T> key, Object value);
+
+ /** Get arbitrary attachments */
+ <T> T getAttachment(Class<T> key);
+
+ /** Remove arbitrary attachments */
+ <T> T removeAttachment(Class<T> key);
}
Modified:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationHandler.java
===================================================================
---
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationHandler.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationHandler.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -59,6 +59,8 @@
import java.lang.reflect.Method;
+import javax.xml.ws.WebServiceContext;
+
import org.jboss.ws.integration.Endpoint;
/**
@@ -69,21 +71,21 @@
*/
public interface InvocationHandler
{
- /** Initialize the invocation handler */
+ /** Create the invocation handler */
void create(Endpoint ep);
- /** Initialize the invocation handler */
+ /** Start the invocation handler */
void start(Endpoint ep);
/** Get an instance of the target bean */
Object getTargetBean(Endpoint ep) throws InstantiationException,
IllegalAccessException;
/** Invoke the the service ep */
- Object invoke(Endpoint ep, Object targetBean, Method method, Object[] args,
InvocationContext invContext) throws Exception;
+ Object invoke(Endpoint ep, Object targetBean, Method method, Object[] args,
InvocationContext context) throws Exception;
- /** Initialize the invocation handler */
+ /** Stop the invocation handler */
void stop(Endpoint ep);
- /** Initialize the invocation handler */
+ /** Destroy the invocation handler */
void destroy(Endpoint ep);
}
Copied:
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/WebServiceContextInjector.java
(from rev 3095,
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextInjector.java)
===================================================================
---
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/WebServiceContextInjector.java
(rev 0)
+++
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/WebServiceContextInjector.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -0,0 +1,82 @@
+/*
+ * 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.ws.integration.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);
+ }
+ }
+}
Deleted:
branches/tdiesler/trunk/integration/sunri-jboss50/src/main/java/org/jboss/ws/integration/jboss50/sunri/InvocationHandlerJSE.java
===================================================================
---
branches/tdiesler/trunk/integration/sunri-jboss50/src/main/java/org/jboss/ws/integration/jboss50/sunri/InvocationHandlerJSE.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/integration/sunri-jboss50/src/main/java/org/jboss/ws/integration/jboss50/sunri/InvocationHandlerJSE.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -1,76 +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.ws.integration.jboss50.sunri;
-
-// $Id$
-
-import java.lang.reflect.Method;
-
-import javax.xml.ws.handler.MessageContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.invocation.InvocationHandler;
-
-/**
- * Handles invocations on JSE endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class InvocationHandlerJSE implements InvocationHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(InvocationHandlerJSE.class);
-
- private Endpoint endpoint;
-
- /** Initialize the service endpoint */
- public void create(Endpoint endpoint)
- {
- this.endpoint = endpoint;
- }
-
- public void start(Endpoint endpoint)
- {
- }
-
- public Object getTargetBean(Endpoint endpoint)
- {
- throw new NotImplementedException();
- }
-
- /** Invoke the the service endpoint */
- public Object invoke(Endpoint endpoint, Object targetBean, Method method, Object[]
args, MessageContext msgContext) throws Exception
- {
- throw new NotImplementedException();
- }
-
- public void stop(Endpoint endpoint)
- {
- }
-
- public void destroy(Endpoint endpoint)
- {
- }
-}
Modified: branches/tdiesler/trunk/jbossws/ant-import/build-thirdparty.xml
===================================================================
--- branches/tdiesler/trunk/jbossws/ant-import/build-thirdparty.xml 2007-05-16 11:58:54
UTC (rev 3104)
+++ branches/tdiesler/trunk/jbossws/ant-import/build-thirdparty.xml 2007-05-16 12:10:39
UTC (rev 3105)
@@ -85,6 +85,7 @@
<get
src="${jboss.repository}/oswego-concurrent/${oswego-concurrent}/lib/concurrent.jar"
dest="${thirdparty.dir}/concurrent.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/qdox/${qdox}/lib/qdox.jar"
dest="${thirdparty.dir}/qdox.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/stax-api/${stax-api}/lib/stax-api.jar"
dest="${thirdparty.dir}/stax-api.jar" usetimestamp="true"
verbose="true"/>
+ <get src="${jboss.repository}/sun-jaf/${sun-jaf}/lib/activation.jar"
dest="${thirdparty.dir}/activation.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/sun-javamail/${sun-javamail}/lib/mail.jar"
dest="${thirdparty.dir}/mail.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/sun-jaxb/${sun-jaxb}/lib/jaxb-api.jar"
dest="${thirdparty.dir}/jaxb-api.jar" usetimestamp="true"
verbose="true"/>
<get src="${jboss.repository}/sun-jaxb/${sun-jaxb}/lib/jaxb-impl.jar"
dest="${thirdparty.dir}/jaxb-impl.jar" usetimestamp="true"
verbose="true"/>
Modified:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/EndpointNameDeployer.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/EndpointNameDeployer.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/EndpointNameDeployer.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -43,7 +43,7 @@
{
for (Endpoint ep : dep.getService().getEndpoints())
{
- ServerEndpointMetaData sepMetaData =
ep.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData sepMetaData =
ep.getAttachment(ServerEndpointMetaData.class);
if (sepMetaData == null)
throw new IllegalStateException("Cannot obtain endpoint meta
data");
Modified:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/EventingDeployer.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/EventingDeployer.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/EventingDeployer.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -47,7 +47,7 @@
{
for (Endpoint ep : dep.getService().getEndpoints())
{
- ServerEndpointMetaData sepMetaData =
ep.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData sepMetaData =
ep.getAttachment(ServerEndpointMetaData.class);
if (sepMetaData == null)
throw new IllegalStateException("Cannot obtain endpoint meta
data");
@@ -76,7 +76,7 @@
{
for (Endpoint ep : dep.getService().getEndpoints())
{
- ServerEndpointMetaData sepMetaData =
ep.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData sepMetaData =
ep.getAttachment(ServerEndpointMetaData.class);
if (sepMetaData == null)
throw new IllegalStateException("Cannot obtain endpoint meta
data");
Modified:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/UnifiedMetaDataAssociationDeployer.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/UnifiedMetaDataAssociationDeployer.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/UnifiedMetaDataAssociationDeployer.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -50,11 +50,11 @@
for (Endpoint ep : dep.getService().getEndpoints())
{
- ServerEndpointMetaData sepMetaData =
ep.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData sepMetaData =
ep.getAttachment(ServerEndpointMetaData.class);
if (sepMetaData == null)
{
sepMetaData = getEndpointMetaData(umd, ep.getName());
- ep.addMetaData(ServerEndpointMetaData.class, sepMetaData);
+ ep.addAttachment(ServerEndpointMetaData.class, sepMetaData);
Class targetBean = ep.getEndpointImpl();
if (targetBean != null)
Modified:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxrpc/client/ServiceObjectFactoryJAXRPC.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -187,7 +187,7 @@
if (endpoint == null)
throw new WSException("Cannot resolve port-component-link: "
+ pcLink);
- ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData sepMetaData =
endpoint.getAttachment(ServerEndpointMetaData.class);
endpointAddress = sepMetaData.getEndpointAddress();
}
catch (Throwable ex)
Deleted:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerCallback.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerCallback.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerCallback.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -1,45 +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.ws.core.jaxrpc.handler;
-
-// $Id$
-
-import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-
-/**
- * A handler callback for the EJB21 Invoker
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 26-Apr-2007
- */
-public interface HandlerCallback
-{
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- public abstract boolean callRequestHandlerChain(HandlerType type);
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- public abstract boolean callResponseHandlerChain(HandlerType type);
-
- /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
- public abstract boolean callFaultHandlerChain(HandlerType type, Exception ex);
-
-}
\ No newline at end of file
Deleted:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextInjector.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextInjector.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextInjector.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -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.ws.core.jaxws;
-
-// $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);
- }
- }
-}
Deleted:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/AbstractInvocationHandler.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/AbstractInvocationHandler.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/AbstractInvocationHandler.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -1,430 +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.ws.core.server;
-
-// $Id$
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.util.HashMap;
-
-import javax.activation.DataHandler;
-import javax.management.MBeanException;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPBodyElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.ws.http.HTTPBinding;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.core.CommonBinding;
-import org.jboss.ws.core.CommonBindingProvider;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.CommonSOAPBinding;
-import org.jboss.ws.core.DirectionHolder;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.DirectionHolder.Direction;
-import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
-import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
-import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
-import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
-import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.core.utils.JavaUtils;
-import org.jboss.ws.extensions.xop.XOPContext;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.invocation.InvocationContext;
-import org.jboss.ws.integration.invocation.InvocationHandler;
-import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-
-/** An implementation handles invocations on the endpoint
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public abstract class AbstractInvocationHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(AbstractInvocationHandler.class);
-
- protected Endpoint endpoint;
- protected CommonBindingProvider bindingProvider;
- protected ServerHandlerDelegate delegate;
-
- /** Initialize the service endpoint */
- public void create(Endpoint endpoint)
- {
- this.endpoint = endpoint;
-
- ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- if (sepMetaData.getType() == EndpointMetaData.Type.JAXRPC)
- {
- bindingProvider = new CommonBindingProvider(sepMetaData);
- delegate = new HandlerDelegateJAXRPC(sepMetaData);
- }
- else
- {
- bindingProvider = new BindingProviderImpl(sepMetaData);
- delegate = new HandlerDelegateJAXWS(sepMetaData);
- }
- }
-
- /** Load the SEI implementation bean if necessary */
- protected abstract Class loadServiceEndpoint() throws ClassNotFoundException;
-
- /** Create the instance of the SEI implementation bean if necessary */
- protected abstract Object createServiceEndpointInstance(Class seiImplClass,
InvocationContext context) throws Exception;
-
- /** Invoke the instance of the SEI implementation bean */
- protected abstract void invokeServiceEndpointInstance(Object seiImpl,
EndpointInvocation epInv) throws Exception;
-
- /** Destroy the instance of the SEI implementation bean if necessary */
- protected abstract void destroyServiceEndpointInstance(Object seiImpl);
-
- public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type)
- {
- return delegate.callRequestHandlerChain(sepMetaData, type);
- }
-
- public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type)
- {
- return delegate.callResponseHandlerChain(sepMetaData, type);
- }
-
- public void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
- {
- delegate.closeHandlerChain(sepMetaData, type);
- }
-
- public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type, Exception ex)
- {
- return delegate.callFaultHandlerChain(sepMetaData, type, ex);
- }
-
- /** Invoke the the service endpoint */
- public void invoke(ServletRequestContext reqContext) throws Exception
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- ServerEndpointMetaData sepMetaData =
(ServerEndpointMetaData)msgContext.getEndpointMetaData();
- MessageAbstraction reqMessage = msgContext.getMessageAbstraction();
-
- // The direction of the message
- DirectionHolder direction = new DirectionHolder(Direction.InBound);
-
- // Get the order of pre/post handlerchains
- HandlerType[] handlerType = delegate.getHandlerTypeOrder();
- HandlerType[] faultType = delegate.getHandlerTypeOrder();
-
- // Set the required inbound context properties
- setInboundContextProperties();
-
- try
- {
- boolean oneway = false;
- EndpointInvocation epInv = null;
- OperationMetaData opMetaData = null;
- CommonBinding binding = bindingProvider.getCommonBinding();
- binding.setHeaderSource(delegate);
-
- // call the request handler chain
- boolean handlersPass = callRequestHandlerChain(sepMetaData, handlerType[0]);
-
- // Unbind the request message
- if (handlersPass)
- {
- // Get the operation meta data from the SOAP message
- opMetaData = getDispatchDestination(sepMetaData, reqMessage);
- msgContext.setOperationMetaData(opMetaData);
- oneway = opMetaData.isOneWay();
-
- /*
- * From JAX-WS 10.2.1 - "7. If the node does not understand how to
process
- * the message, then neither handlers nor the endpoint
- * are invoked and instead the binding generates a SOAP must
- * understand exception"
- *
- * Therefore, this must precede the ENDPOINT chain; however, The PRE
- * chain still must happen first since the message may be encrypted, in
which
- * case the operation is still not known. Without knowing the operation, it
- * is not possible to determine what headers are understood by the endpoint.
- */
- if (binding instanceof CommonSOAPBinding)
- ((CommonSOAPBinding)binding).checkMustUnderstand(opMetaData);
-
- // Unbind the request message
- epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
- }
-
- handlersPass = handlersPass && callRequestHandlerChain(sepMetaData,
handlerType[1]);
- handlersPass = handlersPass && callRequestHandlerChain(sepMetaData,
handlerType[2]);
-
- if (handlersPass)
- {
- msgContext.put(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
- try
- {
- // Check if protocol handlers modified the payload
- if (msgContext.isModified())
- {
- log.debug("Handler modified payload, unbind message again");
- reqMessage = msgContext.getMessageAbstraction();
- epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
- }
-
- InvocationHandler invHandler = endpoint.getInvocationHandler();
- Object targetBean = invHandler.getTargetBean(endpoint);
-
- Class implClass = endpoint.getEndpointImpl();
- Method seiMethod = epInv.getJavaMethod();
- Method implMethod = getImplMethod(implClass, seiMethod);
-
- Object[] args = epInv.getRequestPayload();
- Object retObj = invHandler.invoke(endpoint, targetBean, implMethod, args,
reqContext);
- epInv.setReturnValue(retObj);
- }
- finally
- {
- msgContext.remove(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
- }
-
- // Reverse the message direction
- msgContext = processPivotInternal(msgContext, direction);
-
- // Set the required outbound context properties
- setOutboundContextProperties();
-
- if (binding instanceof CommonSOAPBinding)
- XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled());
-
- // Bind the response message
- MessageAbstraction resMessage = binding.bindResponseMessage(opMetaData,
epInv);
- msgContext.setMessageAbstraction(resMessage);
- }
- else
- {
- // Reverse the message direction without calling the endpoint
- MessageAbstraction resMessage = msgContext.getMessageAbstraction();
- msgContext = processPivotInternal(msgContext, direction);
- msgContext.setMessageAbstraction(resMessage);
- }
-
- if (oneway == false)
- {
- // call the response handler chain, removing the fault type entry will not
call handleFault for that chain
- handlersPass = callResponseHandlerChain(sepMetaData, handlerType[2]);
- faultType[2] = null;
- handlersPass = handlersPass && callResponseHandlerChain(sepMetaData,
handlerType[1]);
- faultType[1] = null;
- handlersPass = handlersPass && callResponseHandlerChain(sepMetaData,
handlerType[0]);
- faultType[0] = null;
- }
- }
- catch (RuntimeException ex)
- {
- // Reverse the message direction
- processPivotInternal(msgContext, direction);
-
- try
- {
- CommonBinding binding = bindingProvider.getCommonBinding();
- binding.bindFaultMessage(ex);
-
- // call the fault handler chain
- boolean handlersPass = true;
- if (faultType[2] != null)
- handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
faultType[2], ex);
- if (faultType[1] != null)
- handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
faultType[1], ex);
- if (faultType[0] != null)
- handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
faultType[0], ex);
- }
- catch (RuntimeException subEx)
- {
- log.warn("Exception while processing handleFault: ", ex);
- ex = subEx;
- }
- throw ex;
- }
- finally
- {
- closeHandlerChain(sepMetaData, handlerType[2]);
- closeHandlerChain(sepMetaData, handlerType[1]);
- closeHandlerChain(sepMetaData, handlerType[0]);
- }
- }
-
- protected void setInboundContextProperties()
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext instanceof MessageContextJAXWS)
- {
- // Map of attachments to a message for the outbound message, key is the MIME
Content-ID, value is a DataHandler
- msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new
HashMap<String, DataHandler>());
- }
- }
-
- protected void setOutboundContextProperties()
- {
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext instanceof MessageContextJAXWS)
- {
- // Map of attachments to a message for the outbound message, key is the MIME
Content-ID, value is a DataHandler
- msgContext.put(MessageContextJAXWS.OUTBOUND_MESSAGE_ATTACHMENTS, new
HashMap<String, DataHandler>());
- }
- }
-
- private CommonMessageContext processPivotInternal(CommonMessageContext msgContext,
DirectionHolder direction)
- {
- if (direction.getDirection() == Direction.InBound)
- {
- EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
- if (epMetaData.getType() == EndpointMetaData.Type.JAXRPC)
- {
- msgContext = MessageContextJAXRPC.processPivot(msgContext);
- }
- else
- {
- msgContext = MessageContextJAXWS.processPivot(msgContext);
- }
- direction.setDirection(Direction.OutBound);
- }
- return msgContext;
- }
-
- private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData,
MessageAbstraction reqMessage) throws SOAPException
- {
- OperationMetaData opMetaData;
-
- String bindingID = epMetaData.getBindingId();
- if (HTTPBinding.HTTP_BINDING.equals(bindingID))
- {
- if (epMetaData.getOperations().size() != 1)
- throw new IllegalStateException("Multiple operations not supported for
HTTP binding");
-
- opMetaData = epMetaData.getOperations().get(0);
- }
- else
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
-
- opMetaData = soapMessage.getOperationMetaData(epMetaData);
- SOAPHeader soapHeader = soapMessage.getSOAPHeader();
-
- // Report a MustUnderstand fault
- if (opMetaData == null)
- {
- String faultString;
- SOAPBody soapBody = soapMessage.getSOAPBody();
- if (soapBody.getChildElements().hasNext())
- {
- SOAPBodyElement soapBodyElement =
(SOAPBodyElement)soapBody.getChildElements().next();
- Name soapName = soapBodyElement.getElementName();
- faultString = "Endpoint " + epMetaData.getPortName() + "
does not contain operation meta data for: " + soapName;
- }
- else
- {
- faultString = "Endpoint " + epMetaData.getPortName() + "
does not contain operation meta data for empty soap body";
- }
-
- // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL
description, it SHOULD generate a soap:Fault
- // with a faultcode of "Client", unless a
"MustUnderstand" or "VersionMismatch" fault is generated.
- if (soapHeader != null &&
soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
- else
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
- }
- }
- return opMetaData;
- }
-
- 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;
- }
-
- /** handle invocation exceptions */
- public void handleInvocationException(Throwable th) throws Exception
- {
- if (th instanceof InvocationTargetException)
- {
- // unwrap the throwable raised by the service endpoint implementation
- Throwable targetEx = ((InvocationTargetException)th).getTargetException();
- handleInvocationThrowable(targetEx);
- }
-
- if (th instanceof MBeanException)
- {
- throw ((MBeanException)th).getTargetException();
- }
-
- handleInvocationThrowable(th);
- }
-
- private void handleInvocationThrowable(Throwable th) throws Exception
- {
- if (th instanceof Exception)
- {
- throw (Exception)th;
- }
- else if (th instanceof Error)
- {
- throw (Error)th;
- }
- else
- {
- throw new UndeclaredThrowableException(th);
- }
- }
-}
Modified:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ContextServlet.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ContextServlet.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ContextServlet.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -93,7 +93,7 @@
for (ObjectName oname : endpoints)
{
Endpoint ep = epRegistry.getEndpoint(oname);
- ServerEndpointMetaData sepMetaData =
ep.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData sepMetaData =
ep.getAttachment(ServerEndpointMetaData.class);
writer.print("<tr>");
writer.print(" <td>ServiceEndpointID</td>");
Deleted:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/InvocationHandlerJSE.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/InvocationHandlerJSE.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/InvocationHandlerJSE.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -1,173 +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.ws.core.server;
-
-// $Id$
-
-import java.lang.reflect.Method;
-
-import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.server.ServiceLifecycle;
-import javax.xml.rpc.server.ServletEndpointContext;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.ws.WebServiceContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.EndpointInvocation;
-import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl;
-import org.jboss.ws.core.jaxws.WebServiceContextInjector;
-import org.jboss.ws.core.jaxws.WebServiceContextJSE;
-import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.integration.Endpoint;
-import org.jboss.ws.integration.invocation.InvocationContext;
-import org.jboss.ws.integration.invocation.InvocationHandler;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
-
-/**
- * Handles invocations on JSE endpoints.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Apr-2007
- */
-public class InvocationHandlerJSE implements InvocationHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(InvocationHandlerJSE.class);
-
- public void create(Endpoint ep)
- {
- // noting to do
- }
-
- public void destroy(Endpoint endpoint)
- {
- }
-
- public Object getTargetBean(Endpoint ep) throws InstantiationException,
IllegalAccessException
- {
- Class epClass = ep.getEndpointImpl();
- Object targetBean = epClass.newInstance();
- return targetBean;
- }
-
- public Object invoke(Endpoint endpoint, Object targetBean, Method method, Object[]
args, InvocationContext invContext) throws Exception
- {
- if (targetBean instanceof ServiceLifecycle && context != null)
- {
- try
- {
- ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)seiImpl);
- ServletEndpointContext servletEndpointContext = new
ServletEndpointContextImpl((ServletRequestContext)context);
- serviceLifecycle.init(servletEndpointContext);
- }
- catch (ServiceException ex)
- {
- throw new WSException(ex);
- }
- }
- return null;
- }
-
- public void start(Endpoint endpoint)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void stop(Endpoint endpoint)
- {
- // TODO Auto-generated method stub
-
- }
-
- /** Load the SEI implementation bean if necessary */
- public Class loadServiceEndpoint() throws ClassNotFoundException
- {
- ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
- if (sepMetaData == null)
- throw new IllegalStateException("Cannot obtain endpoint meta data");
-
- ClassLoader cl = sepMetaData.getClassLoader();
- String seiImplName = sepMetaData.getServiceEndpointImplName();
- Class seiImplClass = cl.loadClass(seiImplName);
- return seiImplClass;
- }
-
- /** Create an instance of the SEI implementation bean if necessary */
- public Object createServiceEndpointInstance(Class seiImplClass, InvocationContext
context) throws IllegalAccessException, InstantiationException
- {
- Object seiImpl = seiImplClass.newInstance();
- if (seiImpl instanceof ServiceLifecycle && context != null)
- {
- try
- {
- ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)seiImpl);
- ServletEndpointContext servletEndpointContext = new
ServletEndpointContextImpl((ServletRequestContext)context);
- serviceLifecycle.init(servletEndpointContext);
- }
- catch (ServiceException ex)
- {
- throw new WSException(ex);
- }
- }
- return seiImpl;
- }
-
- /** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpointInstance(Object seiImpl, EndpointInvocation epInv)
throws SOAPFaultException, Exception
- {
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
- try
- {
- CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
- if (msgContext instanceof SOAPMessageContextJAXWS)
- {
- WebServiceContext wsContext = new
WebServiceContextJSE((SOAPMessageContextJAXWS)msgContext);
- new WebServiceContextInjector().injectContext(seiImpl, wsContext);
- }
-
- Class implClass = seiImpl.getClass();
- Method seiMethod = epInv.getJavaMethod();
- Method implMethod = getImplMethod(implClass, seiMethod);
-
- Object[] args = epInv.getRequestPayload();
- Object retObj = implMethod.invoke(seiImpl, args);
- epInv.setReturnValue(retObj);
- }
- catch (Exception e)
- {
- handleInvocationException(e);
- }
- }
-
- /** Destroy an instance of the SEI implementation bean if necessary */
- public void destroyServiceEndpointInstance(Object seiImpl)
- {
- if (seiImpl instanceof ServiceLifecycle)
- {
- ((ServiceLifecycle)seiImpl).destroy();
- }
- }
-}
Modified:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/LifecycleHandlerImpl.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/LifecycleHandlerImpl.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/LifecycleHandlerImpl.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -49,7 +49,7 @@
private String getEndpointAddress(Endpoint ep)
{
- ServerEndpointMetaData sepMetaData = ep.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData sepMetaData =
ep.getAttachment(ServerEndpointMetaData.class);
if (sepMetaData == null)
throw new IllegalStateException("Cannot obtain endpoint meta data");
Modified:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ManagedEndpointRegistry.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ManagedEndpointRegistry.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ManagedEndpointRegistry.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -75,7 +75,7 @@
for (ObjectName sepID : getEndpoints())
{
Endpoint auxEndpoint = getEndpoint(sepID);
- ServerEndpointMetaData sepMetaData =
auxEndpoint.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData sepMetaData =
auxEndpoint.getAttachment(ServerEndpointMetaData.class);
if (pcName.equals(sepMetaData.getPortComponentName()))
{
if (endpoint != null)
Modified:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/PortComponentLinkServlet.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/PortComponentLinkServlet.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/PortComponentLinkServlet.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -83,7 +83,7 @@
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
- ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData sepMetaData =
endpoint.getAttachment(ServerEndpointMetaData.class);
String endpointAddress = sepMetaData.getEndpointAddress();
out.println(endpointAddress);
Modified:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/RequestHandlerImpl.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/RequestHandlerImpl.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/RequestHandlerImpl.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -77,6 +77,7 @@
import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.RequestHandler;
import org.jboss.ws.integration.Endpoint.EndpointState;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
import org.jboss.ws.integration.invocation.InvocationContext;
import org.jboss.ws.integration.invocation.InvocationHandler;
import org.jboss.ws.integration.management.ServerConfig;
@@ -184,7 +185,7 @@
{
log.debug("handleRequest: " + endpoint.getName());
- ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData sepMetaData =
endpoint.getAttachment(ServerEndpointMetaData.class);
if (sepMetaData == null)
throw new IllegalStateException("Cannot obtain endpoint meta data");
@@ -309,7 +310,7 @@
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- ServerEndpointMetaData sepMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData sepMetaData =
endpoint.getAttachment(ServerEndpointMetaData.class);
if (sepMetaData == null)
throw new IllegalStateException("Cannot obtain endpoint meta data");
@@ -356,12 +357,30 @@
ClassLoader classLoader = sepMetaData.getClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
- AbstractInvocationHandler invHandler =
endpoint.getMetaData(AbstractInvocationHandler.class);
- if (invHandler == null)
- throw new IllegalStateException("Cannot obtain invocation
handler");
-
+ // Get the Invoker
+ ServiceEndpointInvoker epInvoker =
endpoint.getAttachment(ServiceEndpointInvoker.class);
+ if (epInvoker == null)
+ {
+ DeploymentType depType = endpoint.getService().getDeployment().getType();
+ if (depType == DeploymentType.JAXRPC_EJB21)
+ {
+ epInvoker = new ServiceEndpointInvokerEJB21();
+ }
+ else
+ {
+ epInvoker = new ServiceEndpointInvoker();
+ }
+ epInvoker.init(endpoint);
+
+ // TODO: proper invoker lifecycle handling, possibly
+ // called from endpoint lifecycle method
+ InvocationHandler invHandler = endpoint.getInvocationHandler();
+ invHandler.create(endpoint);
+ invHandler.start(endpoint);
+ }
+
// Invoke the service endpoint
- invHandler.invoke(reqContext);
+ epInvoker.invoke(reqContext);
// Get the response message context
msgContext = MessageContextAssociation.peekMessageContext();
@@ -459,7 +478,7 @@
{
log.debug("handleWSDLRequest: " + endpoint.getName());
- ServerEndpointMetaData epMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData epMetaData =
endpoint.getAttachment(ServerEndpointMetaData.class);
if (epMetaData == null)
throw new IllegalStateException("Cannot obtain endpoint meta data");
Added:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
(rev 0)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -0,0 +1,478 @@
+/*
+ * 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.ws.core.server;
+
+// $Id$
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.HashMap;
+
+import javax.activation.DataHandler;
+import javax.management.MBeanException;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.server.ServiceLifecycle;
+import javax.xml.rpc.server.ServletEndpointContext;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.CommonSOAPBinding;
+import org.jboss.ws.core.DirectionHolder;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.DirectionHolder.Direction;
+import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl;
+import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
+import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
+import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.core.jaxws.WebServiceContextJSE;
+import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
+import org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS;
+import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.extensions.xop.XOPContext;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/** An implementation handles invocations on the endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class ServiceEndpointInvoker
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ServiceEndpointInvoker.class);
+
+ protected Endpoint endpoint;
+ protected CommonBindingProvider bindingProvider;
+ protected ServerHandlerDelegate delegate;
+
+ /** Initialize the service endpoint */
+ public void init(Endpoint endpoint)
+ {
+ this.endpoint = endpoint;
+
+ ServerEndpointMetaData sepMetaData =
endpoint.getAttachment(ServerEndpointMetaData.class);
+ if (sepMetaData == null)
+ throw new IllegalStateException("Cannot obtain endpoint meta data");
+
+ if (sepMetaData.getType() == EndpointMetaData.Type.JAXRPC)
+ {
+ bindingProvider = new CommonBindingProvider(sepMetaData);
+ delegate = new HandlerDelegateJAXRPC(sepMetaData);
+ }
+ else
+ {
+ bindingProvider = new BindingProviderImpl(sepMetaData);
+ delegate = new HandlerDelegateJAXWS(sepMetaData);
+ }
+ }
+
+ public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type)
+ {
+ return delegate.callRequestHandlerChain(sepMetaData, type);
+ }
+
+ public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type)
+ {
+ return delegate.callResponseHandlerChain(sepMetaData, type);
+ }
+
+ public void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
+ {
+ delegate.closeHandlerChain(sepMetaData, type);
+ }
+
+ public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type, Exception ex)
+ {
+ return delegate.callFaultHandlerChain(sepMetaData, type, ex);
+ }
+
+ /** Invoke the the service endpoint */
+ public void invoke(InvocationContext invContext) throws Exception
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ ServerEndpointMetaData sepMetaData =
(ServerEndpointMetaData)msgContext.getEndpointMetaData();
+ MessageAbstraction reqMessage = msgContext.getMessageAbstraction();
+
+ // The direction of the message
+ DirectionHolder direction = new DirectionHolder(Direction.InBound);
+
+ // Get the order of pre/post handlerchains
+ HandlerType[] handlerType = delegate.getHandlerTypeOrder();
+ HandlerType[] faultType = delegate.getHandlerTypeOrder();
+
+ // Set the required inbound context properties
+ setInboundContextProperties();
+
+ try
+ {
+ boolean oneway = false;
+ EndpointInvocation epInv = null;
+ OperationMetaData opMetaData = null;
+ CommonBinding binding = bindingProvider.getCommonBinding();
+ binding.setHeaderSource(delegate);
+
+ // call the request handler chain
+ boolean handlersPass = callRequestHandlerChain(sepMetaData, handlerType[0]);
+
+ // Unbind the request message
+ if (handlersPass)
+ {
+ // Get the operation meta data from the SOAP message
+ opMetaData = getDispatchDestination(sepMetaData, reqMessage);
+ msgContext.setOperationMetaData(opMetaData);
+ oneway = opMetaData.isOneWay();
+
+ /*
+ * From JAX-WS 10.2.1 - "7. If the node does not understand how to
process
+ * the message, then neither handlers nor the endpoint
+ * are invoked and instead the binding generates a SOAP must
+ * understand exception"
+ *
+ * Therefore, this must precede the ENDPOINT chain; however, The PRE
+ * chain still must happen first since the message may be encrypted, in
which
+ * case the operation is still not known. Without knowing the operation, it
+ * is not possible to determine what headers are understood by the endpoint.
+ */
+ if (binding instanceof CommonSOAPBinding)
+ ((CommonSOAPBinding)binding).checkMustUnderstand(opMetaData);
+
+ // Unbind the request message
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
+
+ handlersPass = handlersPass && callRequestHandlerChain(sepMetaData,
handlerType[1]);
+ handlersPass = handlersPass && callRequestHandlerChain(sepMetaData,
handlerType[2]);
+
+ if (handlersPass)
+ {
+ msgContext.put(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
+ try
+ {
+ // Check if protocol handlers modified the payload
+ if (msgContext.isModified())
+ {
+ log.debug("Handler modified payload, unbind message again");
+ reqMessage = msgContext.getMessageAbstraction();
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
+
+ /** Invoke an instance of the SEI implementation bean */
+ Object targetBean = getTargetBean(endpoint, invContext);
+ invokeTargetBean(endpoint, targetBean, epInv, invContext);
+ }
+ finally
+ {
+ msgContext.remove(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
+ }
+
+ // Reverse the message direction
+ msgContext = processPivotInternal(msgContext, direction);
+
+ // Set the required outbound context properties
+ setOutboundContextProperties();
+
+ if (binding instanceof CommonSOAPBinding)
+ XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled());
+
+ // Bind the response message
+ MessageAbstraction resMessage = binding.bindResponseMessage(opMetaData,
epInv);
+ msgContext.setMessageAbstraction(resMessage);
+ }
+ else
+ {
+ // Reverse the message direction without calling the endpoint
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ msgContext = processPivotInternal(msgContext, direction);
+ msgContext.setMessageAbstraction(resMessage);
+ }
+
+ if (oneway == false)
+ {
+ // call the response handler chain, removing the fault type entry will not
call handleFault for that chain
+ handlersPass = callResponseHandlerChain(sepMetaData, handlerType[2]);
+ faultType[2] = null;
+ handlersPass = handlersPass && callResponseHandlerChain(sepMetaData,
handlerType[1]);
+ faultType[1] = null;
+ handlersPass = handlersPass && callResponseHandlerChain(sepMetaData,
handlerType[0]);
+ faultType[0] = null;
+ }
+ }
+ catch (RuntimeException ex)
+ {
+ // Reverse the message direction
+ processPivotInternal(msgContext, direction);
+
+ try
+ {
+ CommonBinding binding = bindingProvider.getCommonBinding();
+ binding.bindFaultMessage(ex);
+
+ // call the fault handler chain
+ boolean handlersPass = true;
+ if (faultType[2] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
faultType[2], ex);
+ if (faultType[1] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
faultType[1], ex);
+ if (faultType[0] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
faultType[0], ex);
+ }
+ catch (RuntimeException subEx)
+ {
+ log.warn("Exception while processing handleFault: ", ex);
+ ex = subEx;
+ }
+ throw ex;
+ }
+ finally
+ {
+ closeHandlerChain(sepMetaData, handlerType[2]);
+ closeHandlerChain(sepMetaData, handlerType[1]);
+ closeHandlerChain(sepMetaData, handlerType[0]);
+ }
+ }
+
+ protected void invokeTargetBean(Endpoint endpoint, Object targetBean,
EndpointInvocation epInv, InvocationContext invContext) throws Exception
+ {
+ // Set the the ServletEndpointContext on a JSE endpoint
+ if (targetBean instanceof ServiceLifecycle && invContext instanceof
ServletRequestContext)
+ {
+ try
+ {
+ ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)targetBean);
+ ServletEndpointContext servletEndpointContext = new
ServletEndpointContextImpl((ServletRequestContext)invContext);
+ serviceLifecycle.init(servletEndpointContext);
+ }
+ catch (ServiceException ex)
+ {
+ throw new WSException(ex);
+ }
+ }
+
+ try
+ {
+ Method implMethod = getImplMethod(endpoint, epInv);
+
+ Object[] args = epInv.getRequestPayload();
+
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof SOAPMessageContextJAXWS)
+ {
+ WebServiceContext wsContext = new
WebServiceContextJSE((SOAPMessageContextJAXWS)msgContext);
+ invContext.addAttachment(WebServiceContext.class, wsContext);
+ }
+ if (msgContext instanceof SOAPMessageContextJAXRPC)
+ {
+ invContext.addAttachment(javax.xml.rpc.handler.MessageContext.class,
msgContext);
+ }
+
+ InvocationHandler invHandler = endpoint.getInvocationHandler();
+ Object retObj = invHandler.invoke(endpoint, targetBean, implMethod, args,
invContext);
+
+ epInv.setReturnValue(retObj);
+ }
+ finally
+ {
+ if (targetBean instanceof ServiceLifecycle)
+ {
+ ((ServiceLifecycle)targetBean).destroy();
+ }
+ }
+ }
+
+ protected Object getTargetBean(Endpoint endpoint, InvocationContext invContext) throws
InstantiationException, IllegalAccessException
+ {
+ InvocationHandler invHandler = endpoint.getInvocationHandler();
+ Object targetBean = invHandler.getTargetBean(endpoint);
+ return targetBean;
+ }
+
+ protected void setInboundContextProperties()
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof MessageContextJAXWS)
+ {
+ // Map of attachments to a message for the outbound message, key is the MIME
Content-ID, value is a DataHandler
+ msgContext.put(MessageContextJAXWS.INBOUND_MESSAGE_ATTACHMENTS, new
HashMap<String, DataHandler>());
+ }
+ }
+
+ protected void setOutboundContextProperties()
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof MessageContextJAXWS)
+ {
+ // Map of attachments to a message for the outbound message, key is the MIME
Content-ID, value is a DataHandler
+ msgContext.put(MessageContextJAXWS.OUTBOUND_MESSAGE_ATTACHMENTS, new
HashMap<String, DataHandler>());
+ }
+ }
+
+ private CommonMessageContext processPivotInternal(CommonMessageContext msgContext,
DirectionHolder direction)
+ {
+ if (direction.getDirection() == Direction.InBound)
+ {
+ EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
+ if (epMetaData.getType() == EndpointMetaData.Type.JAXRPC)
+ {
+ msgContext = MessageContextJAXRPC.processPivot(msgContext);
+ }
+ else
+ {
+ msgContext = MessageContextJAXWS.processPivot(msgContext);
+ }
+ direction.setDirection(Direction.OutBound);
+ }
+ return msgContext;
+ }
+
+ private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData,
MessageAbstraction reqMessage) throws SOAPException
+ {
+ OperationMetaData opMetaData;
+
+ String bindingID = epMetaData.getBindingId();
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
+ {
+ if (epMetaData.getOperations().size() != 1)
+ throw new IllegalStateException("Multiple operations not supported for
HTTP binding");
+
+ opMetaData = epMetaData.getOperations().get(0);
+ }
+ else
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
+
+ opMetaData = soapMessage.getOperationMetaData(epMetaData);
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+
+ // Report a MustUnderstand fault
+ if (opMetaData == null)
+ {
+ String faultString;
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+ if (soapBody.getChildElements().hasNext())
+ {
+ SOAPBodyElement soapBodyElement =
(SOAPBodyElement)soapBody.getChildElements().next();
+ Name soapName = soapBodyElement.getElementName();
+ faultString = "Endpoint " + epMetaData.getPortName() + "
does not contain operation meta data for: " + soapName;
+ }
+ else
+ {
+ faultString = "Endpoint " + epMetaData.getPortName() + "
does not contain operation meta data for empty soap body";
+ }
+
+ // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL
description, it SHOULD generate a soap:Fault
+ // with a faultcode of "Client", unless a
"MustUnderstand" or "VersionMismatch" fault is generated.
+ if (soapHeader != null &&
soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ else
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ }
+ }
+ return opMetaData;
+ }
+
+ protected Method getImplMethod(Endpoint endpoint, EndpointInvocation epInv) throws
ClassNotFoundException, NoSuchMethodException
+ {
+ Class implClass = endpoint.getEndpointImpl();
+ Method seiMethod = epInv.getJavaMethod();
+
+ 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;
+ }
+
+ /** handle invocation exceptions */
+ public void handleInvocationException(Throwable th) throws Exception
+ {
+ if (th instanceof InvocationTargetException)
+ {
+ // unwrap the throwable raised by the service endpoint implementation
+ Throwable targetEx = ((InvocationTargetException)th).getTargetException();
+ handleInvocationThrowable(targetEx);
+ }
+
+ if (th instanceof MBeanException)
+ {
+ throw ((MBeanException)th).getTargetException();
+ }
+
+ handleInvocationThrowable(th);
+ }
+
+ private void handleInvocationThrowable(Throwable th) throws Exception
+ {
+ if (th instanceof Exception)
+ {
+ throw (Exception)th;
+ }
+ else if (th instanceof Error)
+ {
+ throw (Error)th;
+ }
+ else
+ {
+ throw new UndeclaredThrowableException(th);
+ }
+ }
+}
Property changes on:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java
(rev 0)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -0,0 +1,135 @@
+/*
+ * 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.ws.core.server;
+
+// $Id$
+
+import java.lang.reflect.Method;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.invocation.HandlerCallback;
+import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+
+/**
+ * Handles invocations on EJB21 endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class ServiceEndpointInvokerEJB21 extends ServiceEndpointInvoker
+{
+ // provide logging
+ private static final Logger log =
Logger.getLogger(ServiceEndpointInvokerEJB21.class);
+
+ @Override
+ protected void invokeTargetBean(Endpoint endpoint, Object targetBean,
EndpointInvocation epInv, InvocationContext invContext) throws Exception
+ {
+ log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+
+ try
+ {
+ // setup the invocation
+ Method method = getImplMethod(endpoint, epInv);
+ Object[] args = epInv.getRequestPayload();
+
+ // Set the handler callback and endpoint invocation
+ ServerEndpointMetaData sepMetaData =
endpoint.getAttachment(ServerEndpointMetaData.class);
+ endpoint.addAttachment(HandlerCallback.class, new
HandlerCallbackImpl(sepMetaData));
+
+ InvocationHandler invHandler = endpoint.getInvocationHandler();
+ Object retObj = invHandler.invoke(endpoint, targetBean, method, args,
invContext);
+
+ epInv.setReturnValue(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ @Override
+ public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type)
+ {
+ if (type == HandlerType.PRE)
+ return delegate.callRequestHandlerChain(sepMetaData, type);
+ else return true;
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ @Override
+ public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return delegate.callResponseHandlerChain(sepMetaData, type);
+ else return true;
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ @Override
+ public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type, Exception ex)
+ {
+ if (type == HandlerType.PRE)
+ return delegate.callFaultHandlerChain(sepMetaData, type, ex);
+ else return true;
+ }
+
+ // The ServiceEndpointInterceptor calls the methods in this callback
+ public class HandlerCallbackImpl implements HandlerCallback
+ {
+ private ServerEndpointMetaData sepMetaData;
+
+ public HandlerCallbackImpl(ServerEndpointMetaData sepMetaData)
+ {
+ this.sepMetaData = sepMetaData;
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ public boolean callRequestHandlerChain(HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return true;
+ else return delegate.callRequestHandlerChain(sepMetaData, type);
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ public boolean callResponseHandlerChain(HandlerType type)
+ {
+ if (type == HandlerType.PRE)
+ return true;
+ else return delegate.callResponseHandlerChain(sepMetaData, type);
+ }
+
+ /** Handlers are beeing called through the HandlerCallback from the EJB interceptor
*/
+ public boolean callFaultHandlerChain(HandlerType type, Exception ex)
+ {
+ if (type == HandlerType.PRE)
+ return true;
+ else return delegate.callFaultHandlerChain(sepMetaData, type, ex);
+ }
+ }
+}
Property changes on:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointServlet.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointServlet.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointServlet.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -51,7 +51,7 @@
String configFile = ctx.getInitParameter("jbossws-config-file");
if (configName != null || configFile != null)
{
- ServerEndpointMetaData epMetaData =
endpoint.getMetaData(ServerEndpointMetaData.class);
+ ServerEndpointMetaData epMetaData =
endpoint.getAttachment(ServerEndpointMetaData.class);
if (epMetaData == null)
throw new IllegalStateException("Cannot obtain endpoint meta
data");
Modified:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServletRequestContext.java
===================================================================
---
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServletRequestContext.java 2007-05-16
11:58:54 UTC (rev 3104)
+++
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServletRequestContext.java 2007-05-16
12:10:39 UTC (rev 3105)
@@ -27,17 +27,15 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import javax.xml.rpc.handler.MessageContext;
-import org.jboss.ws.core.soap.MessageContextAssociation;
-import org.jboss.ws.integration.invocation.InvocationContext;
+import org.jboss.ws.integration.invocation.BasicInvocationContext;
/**
* Implementation of ServletEndpointContext
*
* @author Thomas.Diesler(a)jboss.org
*/
-public class ServletRequestContext implements InvocationContext
+public class ServletRequestContext extends BasicInvocationContext
{
private ServletContext context;
private HttpServletRequest request;
@@ -55,11 +53,6 @@
return request.getSession(false);
}
- public MessageContext getMessageContext()
- {
- return (MessageContext)MessageContextAssociation.peekMessageContext();
- }
-
public ServletContext getServletContext()
{
return context;
Modified: branches/tdiesler/trunk/jbossws/version.properties
===================================================================
--- branches/tdiesler/trunk/jbossws/version.properties 2007-05-16 11:58:54 UTC (rev 3104)
+++ branches/tdiesler/trunk/jbossws/version.properties 2007-05-16 12:10:39 UTC (rev 3105)
@@ -27,7 +27,7 @@
jboss-remoting=2.0.0.GA
jboss-security=4.0.5.GA
jboss-vfs=2.0.0.Beta2
-jbossas-core-libs=4.0.5.GA
+jbossas-core-libs=4.2.0.GA
oswego-concurrent=1.3.4
qdox=1.4
sun-hudson=1.93
Modified: branches/tdiesler/trunk/testsuite/ant-import/build-testsuite.xml
===================================================================
--- branches/tdiesler/trunk/testsuite/ant-import/build-testsuite.xml 2007-05-16 11:58:54
UTC (rev 3104)
+++ branches/tdiesler/trunk/testsuite/ant-import/build-testsuite.xml 2007-05-16 12:10:39
UTC (rev 3105)
@@ -10,7 +10,7 @@
<!--
Init the various classpaths
-->
- <target name="tests-init"
depends="tests-prepare,spi-thirdparty">
+ <target name="tests-init" depends="tests-prepare">
<!-- The combined compile classpath -->
<path id="javac.classpath">
@@ -44,8 +44,10 @@
<copy-test-resources srcdir="${basedir}/src"/>
</target>
- <target name="tests-main"
depends="tests-compile,tests-copy-resources" description="Build the
deployments.">
+ <target name="tests-jars"
depends="tests-compile,tests-copy-resources" description="Build the
deployments.">
<ant antfile="${testsuite.dir}/ant-import/build-jars-jaxws.xml"
target="build-jars-jaxws" inheritall="true"/>
</target>
+ <target name="tests-main" depends="tests-jars"
description="Build the deployments."/>
+
</project>
Modified: branches/tdiesler/trunk/testsuite/build.xml
===================================================================
--- branches/tdiesler/trunk/testsuite/build.xml 2007-05-16 11:58:54 UTC (rev 3104)
+++ branches/tdiesler/trunk/testsuite/build.xml 2007-05-16 12:10:39 UTC (rev 3105)
@@ -22,6 +22,9 @@
<delete dir="${testsuite.dir}/output-tests"/>
</target>
+ <target name="clobber" depends="clean" description="Cleans
up all generated files.">
+ </target>
+
<target name="main" description="Builds almost everything."
depends="tests-main"/>
<target name="most" description="Builds almost everything."
depends="main"/>