JBossWS SVN: r3115 - in branches/tdiesler/trunk: integration/jboss50/ant-import and 12 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-05-16 18:47:19 -0400 (Wed, 16 May 2007)
New Revision: 3115
Added:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/AbstractInvocationHandler.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/core/utils/JavaUtils.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/AbstractWebServiceContext.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/BasicInvocation.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/Invocation.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/WebServiceContextEJB.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/WebServiceContextJSE.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/ServiceEndpointInvokerDeployer.java
Removed:
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/AbstractWebServiceContext.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextEJB.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextJSE.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/utils/JavaUtils.java
Modified:
branches/tdiesler/trunk/integration/jboss50/.classpath
branches/tdiesler/trunk/integration/jboss50/ant-import/build-thirdparty.xml
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/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml
branches/tdiesler/trunk/integration/spi/ant-import/build-thirdparty.xml
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/BasicLifecycleHandler.java
branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationHandler.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/EndpointInvocation.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/ServiceEndpointInvoker.java
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java
branches/tdiesler/trunk/jbossws/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointNoInjectEJB.java
Log:
restructure
Modified: branches/tdiesler/trunk/integration/jboss50/.classpath
===================================================================
--- branches/tdiesler/trunk/integration/jboss50/.classpath 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/integration/jboss50/.classpath 2007-05-16 22:47:19 UTC (rev 3115)
@@ -7,5 +7,6 @@
<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="lib" path="/spi/thirdparty/saaj-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 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/integration/jboss50/ant-import/build-thirdparty.xml 2007-05-16 22:47:19 UTC (rev 3115)
@@ -36,6 +36,7 @@
<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="${spi.dir}/thirdparty/saaj-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"/>
Added: branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/AbstractInvocationHandler.java
===================================================================
--- branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/AbstractInvocationHandler.java (rev 0)
+++ branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/AbstractInvocationHandler.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -0,0 +1,119 @@
+/*
+ * 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.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+
+import javax.management.MBeanException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.utils.JavaUtils;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.invocation.InvocationHandler;
+
+/**
+ * Handles invocations on endpoints.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public abstract class AbstractInvocationHandler implements InvocationHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(AbstractInvocationHandler.class);
+
+ protected Method getImplMethod(Class implClass, Method seiMethod) throws ClassNotFoundException, NoSuchMethodException
+ {
+ String methodName = seiMethod.getName();
+ Class[] paramTypes = seiMethod.getParameterTypes();
+ for (int i = 0; i < paramTypes.length; i++)
+ {
+ Class paramType = paramTypes[i];
+ if (JavaUtils.isPrimitive(paramType) == false)
+ {
+ String paramTypeName = paramType.getName();
+ paramType = JavaUtils.loadJavaType(paramTypeName);
+ paramTypes[i] = paramType;
+ }
+ }
+
+ Method implMethod = implClass.getMethod(methodName, paramTypes);
+ return implMethod;
+ }
+
+ protected void handleInvocationException(Throwable th) throws Exception
+ {
+ if (th instanceof 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);
+ }
+ }
+
+ public void create(Endpoint ep)
+ {
+ log.debug("Create: " + ep.getName());
+ }
+
+ public void start(Endpoint ep)
+ {
+ log.debug("Start: " + ep.getName());
+ }
+
+ public void stop(Endpoint ep)
+ {
+ log.debug("Stop: " + ep.getName());
+ }
+
+ public void destroy(Endpoint ep)
+ {
+ log.debug("Destroy: " + ep.getName());
+ }
+}
Property changes on: branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/AbstractInvocationHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: 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 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB21.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -28,13 +28,15 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
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.InvocationKey;
import org.jboss.invocation.InvocationType;
import org.jboss.invocation.PayloadKey;
import org.jboss.logging.Logger;
@@ -43,8 +45,7 @@
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.integration.invocation.Invocation;
import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
import org.jboss.ws.utils.ObjectNameFactory;
@@ -55,7 +56,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 25-Apr-2007
*/
-public class InvocationHandlerEJB21 implements InvocationHandler
+public class InvocationHandlerEJB21 extends AbstractInvocationHandler
{
// provide logging
private static final Logger log = Logger.getLogger(InvocationHandlerEJB21.class);
@@ -64,15 +65,16 @@
private MBeanServer server;
private ObjectName objectName;
- public void create(Endpoint endpoint)
+ public void create(Endpoint ep)
{
- server = MBeanServerLocator.locateJBoss();
+ super.create(ep);
- String ejbName = endpoint.getName().getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+ ObjectName epName = ep.getName();
+ String ejbName = epName.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);
+ UnifiedDeploymentInfo udi = ep.getService().getDeployment().getContext().getAttachment(UnifiedDeploymentInfo.class);
UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData)udi.metaData;
UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
if (beanMetaData == null)
@@ -83,7 +85,10 @@
if (jndiName == null)
throw new WebServiceException("Cannot obtain JNDI name for: " + ejbName);
+ server = MBeanServerLocator.locateJBoss();
objectName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + jndiName + ",service=EJB");
+ if (server.isRegistered(objectName) == false)
+ throw new WebServiceException("Cannot find service endpoint target: " + objectName);
// Dynamically add the service endpoint interceptor
// http://jira.jboss.org/jira/browse/JBWS-758
@@ -100,7 +105,7 @@
if (next.getNext() == null)
{
log.debug("Inject service endpoint interceptor after: " + prev.getClass().getName());
- AbstractInterceptor sepInterceptor = endpoint.getAttachment(AbstractInterceptor.class);
+ AbstractInterceptor sepInterceptor = ep.getAttachment(AbstractInterceptor.class);
if (sepInterceptor == null)
throw new IllegalStateException("Cannot obtain endpoint interceptor");
@@ -118,52 +123,46 @@
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 void invoke(Endpoint ep, Invocation epInv) throws Exception
{
- }
+ log.debug("Invoke: " + epInv.getJavaMethod().getName());
- 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);
+ // invoke on the container
+ try
+ {
+ // setup the invocation
+ Method method = epInv.getJavaMethod();
+ Object[] args = epInv.getArgs();
+ org.jboss.invocation.Invocation inv = new org.jboss.invocation.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);
+ // EJB2.1 endpoints will only get an JAXRPC context
+ MessageContext msgContext = epInv.getInvocationContext().getAttachment(MessageContext.class);
+ if (msgContext == null)
+ throw new IllegalStateException("Cannot obtain MessageContext");
+
+ HandlerCallback callback = epInv.getInvocationContext().getAttachment(HandlerCallback.class);
+ if (callback == null)
+ throw new IllegalStateException("Cannot obtain HandlerCallback");
+
+ inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
+ inv.setValue(InvocationKey.SOAP_MESSAGE, ((SOAPMessageContext)msgContext).getMessage());
+ inv.setType(InvocationType.SERVICE_ENDPOINT);
+ inv.setValue(HandlerCallback.class.getName(), callback, PayloadKey.TRANSIENT);
+ inv.setValue(Invocation.class.getName(), epInv, PayloadKey.TRANSIENT);
- 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;
+ String[] sig = { Invocation.class.getName() };
+ Object retObj = server.invoke(objectName, "invoke", new Object[] { inv }, sig);
+ epInv.setReturn(retObj);
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
}
-
- public void stop(Endpoint ep)
- {
- // Nothing to do
- }
-
- public void destroy(Endpoint ep)
- {
- // Nothing to do
- }
}
Modified: 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 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerEJB3.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -27,7 +27,6 @@
import javax.ejb.EJBContext;
import javax.management.ObjectName;
-import javax.xml.ws.WebServiceContext;
import javax.xml.ws.WebServiceException;
import org.jboss.aop.Dispatcher;
@@ -38,11 +37,10 @@
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.integration.invocation.Invocation;
+import org.jboss.ws.integration.invocation.WebServiceContextEJB;
import org.jboss.ws.utils.ObjectNameFactory;
/**
@@ -51,20 +49,19 @@
* @author Thomas.Diesler(a)jboss.org
* @since 25-Apr-2007
*/
-public class InvocationHandlerEJB3 implements InvocationHandler
+public class InvocationHandlerEJB3 extends AbstractInvocationHandler
{
- // provide logging
- private static final Logger log = Logger.getLogger(InvocationHandlerEJB3.class);
-
private ObjectName objectName;
- public void create(Endpoint endpoint)
+ public void create(Endpoint ep)
{
- String ejbName = endpoint.getName().getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+ super.create(ep);
+
+ String ejbName = ep.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);
+ UnifiedDeploymentInfo udi = ep.getService().getDeployment().getContext().getAttachment(UnifiedDeploymentInfo.class);
String nameStr = "jboss.j2ee:name=" + ejbName + ",service=EJB3,jar=" + udi.simpleName;
if (udi.parent != null)
{
@@ -76,83 +73,72 @@
public void start(Endpoint ep)
{
+ super.start(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
+ public void invoke(Endpoint ep, Invocation epInv) throws Exception
{
- return null;
- }
+ try
+ {
+ Dispatcher dispatcher = Dispatcher.singleton;
+ StatelessContainer container = (StatelessContainer)dispatcher.getRegistered(objectName.getCanonicalName());
+ Class beanClass = container.getBeanClass();
- 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());
+ Method method = getImplMethod(beanClass, epInv.getJavaMethod());
+ Object[] args = epInv.getArgs();
- MethodInfo info = container.getMethodInfo(method);
+ MethodInfo info = container.getMethodInfo(method);
+ EJBContainerInvocation<StatelessContainer, StatelessBeanContext> ejb3Inv = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
+ ejb3Inv.setAdvisor(container);
+ ejb3Inv.setArguments(args);
+ ejb3Inv.setContextCallback(new CallbackImpl(epInv));
- EJBContainerInvocation<StatelessContainer, StatelessBeanContext> ejb3Inv = new EJBContainerInvocation<StatelessContainer, StatelessBeanContext>(info);
- ejb3Inv.setAdvisor(container);
- ejb3Inv.setArguments(args);
- ejb3Inv.setContextCallback(new ContextCallback(context));
+ Object retObj = ejb3Inv.invokeNext();
- Object retObj;
- try
- {
- retObj = ejb3Inv.invokeNext();
+ epInv.setReturn(retObj);
}
- catch (Exception ex)
+ catch (Throwable th)
{
- throw ex;
+ handleInvocationException(th);
}
- catch (Throwable ex)
- {
- throw new RuntimeException(ex);
- }
- return retObj;
}
- public void stop(Endpoint ep)
+ static class CallbackImpl implements BeanContextLifecycleCallback
{
- // Nothing to do
- }
+ private javax.xml.ws.handler.MessageContext jaxwsMessageContext;
+ private javax.xml.rpc.handler.MessageContext jaxrpcMessageContext;
- public void destroy(Endpoint ep)
- {
- // Nothing to do
- }
-
- class ContextCallback implements BeanContextLifecycleCallback
- {
- private WebServiceContext wsContext;
-
- public ContextCallback(InvocationContext context)
+ public CallbackImpl(Invocation epInv)
{
- if (context instanceof WebServiceContext)
- this.wsContext = (WebServiceContext)context;
+ jaxrpcMessageContext = epInv.getInvocationContext().getAttachment(javax.xml.rpc.handler.MessageContext.class);
+ jaxwsMessageContext = epInv.getInvocationContext().getAttachment(javax.xml.ws.handler.MessageContext.class);
}
public void attached(BeanContext beanCtx)
{
StatelessBeanContext sbc = (StatelessBeanContext)beanCtx;
+ sbc.setMessageContextJAXRPC(jaxrpcMessageContext);
BeanProperty beanProp = sbc.getWebServiceContextProperty();
- if (beanProp != null && wsContext instanceof WebServiceContext)
+ if (beanProp != null)
{
EJBContext ejbCtx = beanCtx.getEJBContext();
- beanProp.set(beanCtx.getInstance(), wsContext);
+ 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);
}
}
-}
+}
\ No newline at end of file
Modified: 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 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerJSE.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -25,11 +25,14 @@
import java.lang.reflect.Method;
+import javax.xml.rpc.server.ServiceLifecycle;
+import javax.xml.rpc.server.ServletEndpointContext;
import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.invocation.Invocation;
import org.jboss.ws.integration.invocation.InvocationContext;
-import org.jboss.ws.integration.invocation.InvocationHandler;
import org.jboss.ws.integration.invocation.WebServiceContextInjector;
/**
@@ -38,41 +41,60 @@
* @author Thomas.Diesler(a)jboss.org
* @since 25-Apr-2007
*/
-public class InvocationHandlerJSE implements InvocationHandler
+public class InvocationHandlerJSE extends AbstractInvocationHandler
{
+ private Object targetBean;
+
public void create(Endpoint ep)
{
- // Nothing to do
+ try
+ {
+ Class epImpl = ep.getTargetBean();
+ targetBean = epImpl.newInstance();
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot load target bean");
+ }
}
- public void start(Endpoint endpoint)
+ public void invoke(Endpoint ep, Invocation epInv) throws Exception
{
- // Nothing to do
- }
+ try
+ {
+ InvocationContext invContext = epInv.getInvocationContext();
+ WebServiceContext wsContext = invContext.getAttachment(WebServiceContext.class);
+ if (wsContext != null)
+ {
+ new WebServiceContextInjector().injectContext(targetBean, (WebServiceContext)wsContext);
+ }
- public void stop(Endpoint endpoint)
- {
- // Nothing to do
- }
+ if (targetBean instanceof ServiceLifecycle)
+ {
+ ServletEndpointContext sepContext = invContext.getAttachment(ServletEndpointContext.class);
+ if (sepContext == null)
+ throw new IllegalStateException("Cannot obtain ServletEndpointContext");
+
+ ((ServiceLifecycle)targetBean).init(sepContext);
+ }
- public void destroy(Endpoint ep)
- {
- // Nothing to do
+ try
+ {
+ Method method = getImplMethod(ep.getTargetBean(), epInv.getJavaMethod());
+ Object retObj = method.invoke(targetBean, epInv.getArgs());
+ epInv.setReturn(retObj);
+ }
+ finally
+ {
+ if (targetBean instanceof ServiceLifecycle)
+ {
+ ((ServiceLifecycle)targetBean).destroy();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ handleInvocationException(e);
+ }
}
-
- public Object getTargetBean(Endpoint endpoint) throws InstantiationException, IllegalAccessException
- {
- Class epImpl = endpoint.getTargetBean();
- 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;
- }
}
Modified: 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 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -23,7 +23,7 @@
// $Id$
-import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
import org.jboss.ejb.plugins.AbstractInterceptor;
import org.jboss.invocation.Invocation;
@@ -53,30 +53,50 @@
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);
+ SOAPMessageContext msgContext = (SOAPMessageContext)mi.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
if (msgContext == null)
{
return getNext().invoke(mi);
}
+ // Get the endpoint invocation
+ org.jboss.ws.integration.invocation.Invocation epInv = (org.jboss.ws.integration.invocation.Invocation)mi
+ .getValue(org.jboss.ws.integration.invocation.Invocation.class.getName());
+
// 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)
+ if (callback != null && epInv != 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 next interceptor in the chain
+ if (handlersPass)
+ {
+ // 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.getArgs();
+ mi.setArguments(reqParams);
+ Object resObj = getNext().invoke(mi);
+
+ // Setting the message to null should trigger binding of the response message
+ msgContext.setMessage(null);
+ epInv.setReturn(resObj);
+ }
+
// 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.getReturn();
+
return resObj;
}
catch (Exception ex)
@@ -93,6 +113,10 @@
}
throw ex;
}
+ finally
+ {
+ // do nothing
+ }
}
else
{
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 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-16 22:47:19 UTC (rev 3115)
@@ -116,6 +116,7 @@
<inject bean="WSEndpointHandlerDeployer"/>
<inject bean="WSPublishContractDeployer"/>
<inject bean="WSClassLoaderInjectionDeployer"/>
+ <inject bean="WSServiceEndpointInvokerDeployer"/>
<inject bean="WSEagerInitializeDeployer"/>
<inject bean="WSEventingDeployer"/>
<inject bean="WSEndpointRegistryDeployer"/>
@@ -150,6 +151,7 @@
<property name="servletClass">org.jboss.ws.core.server.ServiceEndpointServlet</property>
</bean>
<bean name="WSPublishContractDeployer" class="org.jboss.ws.core.deployment.PublishContractDeployer"/>
+ <bean name="WSServiceEndpointInvokerDeployer" class="org.jboss.ws.core.deployment.ServiceEndpointInvokerDeployer"/>
<bean name="WSUnifiedDeploymentInfoDeployer" class="org.jboss.ws.integration.jboss50.UnifiedDeploymentInfoDeployer"/>
<bean name="WSUnifiedMetaDataAssociationDeployer" class="org.jboss.ws.core.deployment.UnifiedMetaDataAssociationDeployer"/>
<bean name="WSUnifiedMetaDataDeployer" class="org.jboss.ws.core.deployment.UnifiedMetaDataDeployer"/>
Modified: branches/tdiesler/trunk/integration/spi/ant-import/build-thirdparty.xml
===================================================================
--- branches/tdiesler/trunk/integration/spi/ant-import/build-thirdparty.xml 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/integration/spi/ant-import/build-thirdparty.xml 2007-05-16 22:47:19 UTC (rev 3115)
@@ -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-jaxws/${sun-jaxws}/lib/saaj-api.jar" dest="${thirdparty.dir}/saaj-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"/>
Added: branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/core/utils/JavaUtils.java
===================================================================
--- branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/core/utils/JavaUtils.java (rev 0)
+++ branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/core/utils/JavaUtils.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -0,0 +1,648 @@
+/*
+ * 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.utils;
+
+// $Id$
+
+import java.lang.reflect.Array;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.jboss.logging.Logger;
+
+/** Java utilities
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 22-Dec-2004
+ */
+public class JavaUtils
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(JavaUtils.class);
+
+ private static HashMap<String, Class> primitiveNames = new HashMap<String, Class>(8);
+ private static HashMap<String, String> primitiveNameDescriptors = new HashMap<String, String>(8);
+ private static HashSet<String> reservedKeywords = new HashSet<String>(50);
+
+ static
+ {
+ primitiveNames.put("int", int.class);
+ primitiveNames.put("short", short.class);
+ primitiveNames.put("boolean", boolean.class);
+ primitiveNames.put("byte", byte.class);
+ primitiveNames.put("long", long.class);
+ primitiveNames.put("double", double.class);
+ primitiveNames.put("float", float.class);
+ primitiveNames.put("char", char.class);
+
+ primitiveNameDescriptors.put("int", "I");
+ primitiveNameDescriptors.put("short", "S");
+ primitiveNameDescriptors.put("boolean", "Z");
+ primitiveNameDescriptors.put("byte", "B");
+ primitiveNameDescriptors.put("long", "J");
+ primitiveNameDescriptors.put("double", "D");
+ primitiveNameDescriptors.put("float", "F");
+ primitiveNameDescriptors.put("char", "C");
+
+ reservedKeywords.add("abstract");
+ reservedKeywords.add("continue");
+ reservedKeywords.add("for");
+ reservedKeywords.add("new");
+ reservedKeywords.add("switch");
+ reservedKeywords.add("assert");
+ reservedKeywords.add("default");
+ reservedKeywords.add("if");
+ reservedKeywords.add("package");
+ reservedKeywords.add("synchronized");
+ reservedKeywords.add("boolean");
+ reservedKeywords.add("do");
+ reservedKeywords.add("goto");
+ reservedKeywords.add("private");
+ reservedKeywords.add("this");
+ reservedKeywords.add("break");
+ reservedKeywords.add("double");
+ reservedKeywords.add("implements");
+ reservedKeywords.add("protected");
+ reservedKeywords.add("throw");
+ reservedKeywords.add("byte");
+ reservedKeywords.add("else");
+ reservedKeywords.add("import");
+ reservedKeywords.add("public");
+ reservedKeywords.add("throws");
+ reservedKeywords.add("case");
+ reservedKeywords.add("enum");
+ reservedKeywords.add("instanceof");
+ reservedKeywords.add("return");
+ reservedKeywords.add("transient");
+ reservedKeywords.add("catch");
+ reservedKeywords.add("extends");
+ reservedKeywords.add("int");
+ reservedKeywords.add("short");
+ reservedKeywords.add("try");
+ reservedKeywords.add("char");
+ reservedKeywords.add("final");
+ reservedKeywords.add("interface");
+ reservedKeywords.add("static");
+ reservedKeywords.add("void");
+ reservedKeywords.add("class");
+ reservedKeywords.add("finally");
+ reservedKeywords.add("long");
+ reservedKeywords.add("strictfp");
+ reservedKeywords.add("volatile");
+ reservedKeywords.add("const");
+ reservedKeywords.add("float");
+ reservedKeywords.add("native");
+ reservedKeywords.add("super");
+ reservedKeywords.add("while");
+ }
+
+ /**
+ * Load a Java type from a given class loader.
+ *
+ * @param typeName maybe the source notation of a primitve, class name, array of both
+ */
+ public static Class loadJavaType(String typeName) throws ClassNotFoundException
+ {
+ return loadJavaType(typeName, null);
+ }
+
+ /**
+ * Load a Java type from a given class loader.
+ *
+ * @param typeName maybe the source notation of a primitve, class name, array of both
+ */
+ public static Class loadJavaType(String typeName, ClassLoader classLoader) throws ClassNotFoundException
+ {
+ if (classLoader == null)
+ classLoader = Thread.currentThread().getContextClassLoader();
+
+ Class javaType = primitiveNames.get(typeName);
+ if (javaType == null)
+ javaType = getArray(typeName, classLoader);
+
+ if (javaType == null)
+ javaType = classLoader.loadClass(typeName);
+
+ return javaType;
+ }
+
+ /**
+ * True if the given type name is the source notation of a primitive or array of which.
+ */
+ public static boolean isPrimitive(String javaType)
+ {
+ return getPrimitiveType(javaType) != null;
+ }
+
+ /**
+ * True if the given class is a primitive or array of which.
+ */
+ public static boolean isPrimitive(Class javaType)
+ {
+ return javaType.isPrimitive() || (javaType.isArray() && isPrimitive(javaType.getComponentType()));
+ }
+
+ public static Class getPrimitiveType(String javaType)
+ {
+ Class type = primitiveNames.get(javaType);
+ if (type != null)
+ return type;
+
+ try
+ {
+ // null loader = primitive only
+ type = getArray(javaType, null);
+ }
+ catch (ClassNotFoundException e)
+ {
+ // This will actually never be thrown since is null
+ }
+
+ return type;
+ }
+
+ private static Class getArray(String javaType, ClassLoader loader) throws ClassNotFoundException
+ {
+ if (javaType.charAt(0) == '[')
+ return getArrayFromJVMName(javaType, loader);
+
+ if (javaType.endsWith("[]"))
+ return getArrayFromSourceName(javaType, loader);
+
+ return null;
+ }
+
+ private static Class getArrayFromJVMName(String javaType, ClassLoader loader) throws ClassNotFoundException
+ {
+ Class componentType;
+ int componentStart = javaType.lastIndexOf('[') + 1;
+ switch (javaType.charAt(componentStart))
+ {
+ case 'I': componentType = int.class; break;
+ case 'S': componentType = short.class; break;
+ case 'Z': componentType = boolean.class; break;
+ case 'B': componentType = byte.class; break;
+ case 'J': componentType = long.class; break;
+ case 'D': componentType = double.class; break;
+ case 'F': componentType = float.class; break;
+ case 'C': componentType = char.class; break;
+ case 'L':
+ if (loader == null)
+ return null;
+ String name = javaType.substring(componentStart + 1, javaType.length() - 1);
+ componentType = loader.loadClass(name);
+ break;
+ default:
+ throw new IllegalArgumentException("Invalid binary component for array: " + javaType.charAt(componentStart));
+ }
+
+ // componentStart doubles as the number of '['s which is the number of dimensions
+ return Array.newInstance(componentType, new int[componentStart]).getClass();
+ }
+
+ private static Class getArrayFromSourceName(String javaType, ClassLoader loader) throws ClassNotFoundException
+ {
+ int arrayStart = javaType.indexOf('[');
+ String componentName = javaType.substring(0, arrayStart);
+
+ Class componentType = primitiveNames.get(componentName);
+ if (componentType == null)
+ {
+ if (loader == null)
+ return null;
+
+ componentType = loader.loadClass(componentName);
+ }
+
+ // [][][][] divided by 2
+ int dimensions = (javaType.length() - arrayStart) >> 1;
+
+ return Array.newInstance(componentType, new int[dimensions]).getClass();
+ }
+
+ /**
+ * Get the corresponding primitive for a give wrapper type.
+ * Also handles arrays of which.
+ */
+ public static Class getPrimitiveType(Class javaType)
+ {
+ if (javaType == Integer.class)
+ return int.class;
+ if (javaType == Short.class)
+ return short.class;
+ if (javaType == Boolean.class)
+ return boolean.class;
+ if (javaType == Byte.class)
+ return byte.class;
+ if (javaType == Long.class)
+ return long.class;
+ if (javaType == Double.class)
+ return double.class;
+ if (javaType == Float.class)
+ return float.class;
+ if (javaType == Character.class)
+ return char.class;
+
+ if (javaType == Integer[].class)
+ return int[].class;
+ if (javaType == Short[].class)
+ return short[].class;
+ if (javaType == Boolean[].class)
+ return boolean[].class;
+ if (javaType == Byte[].class)
+ return byte[].class;
+ if (javaType == Long[].class)
+ return long[].class;
+ if (javaType == Double[].class)
+ return double[].class;
+ if (javaType == Float[].class)
+ return float[].class;
+ if (javaType == Character[].class)
+ return char[].class;
+
+ if (javaType.isArray() && javaType.getComponentType().isArray())
+ {
+ Class compType = getPrimitiveType(javaType.getComponentType());
+ return Array.newInstance(compType, 0).getClass();
+ }
+
+ return javaType;
+ }
+
+ /**
+ * Converts an n-dimensional array of wrapper types to primitive types
+ */
+ public static Object getPrimitiveValueArray(Object value)
+ {
+ if (value == null)
+ return null;
+
+ Class javaType = value.getClass();
+ if (javaType.isArray())
+ {
+ int length = Array.getLength(value);
+ Object destArr = Array.newInstance(getPrimitiveType(javaType.getComponentType()), length);
+ for (int i = 0; i < length; i++)
+ {
+ Object srcObj = Array.get(value, i);
+ Array.set(destArr, i, getPrimitiveValueArray(srcObj));
+ }
+ return destArr;
+ }
+
+ return value;
+ }
+
+ /**
+ * Get the corresponding wrapper type for a give primitive.
+ * Also handles arrays of which.
+ */
+ public static Class getWrapperType(Class javaType)
+ {
+ if (javaType == int.class)
+ return Integer.class;
+ if (javaType == short.class)
+ return Short.class;
+ if (javaType == boolean.class)
+ return Boolean.class;
+ if (javaType == byte.class)
+ return Byte.class;
+ if (javaType == long.class)
+ return Long.class;
+ if (javaType == double.class)
+ return Double.class;
+ if (javaType == float.class)
+ return Float.class;
+ if (javaType == char.class)
+ return Character.class;
+
+ if (javaType == int[].class)
+ return Integer[].class;
+ if (javaType == short[].class)
+ return Short[].class;
+ if (javaType == boolean[].class)
+ return Boolean[].class;
+ if (javaType == byte[].class)
+ return Byte[].class;
+ if (javaType == long[].class)
+ return Long[].class;
+ if (javaType == double[].class)
+ return Double[].class;
+ if (javaType == float[].class)
+ return Float[].class;
+ if (javaType == char[].class)
+ return Character[].class;
+
+ if (javaType.isArray() && javaType.getComponentType().isArray())
+ {
+ Class compType = getWrapperType(javaType.getComponentType());
+ return Array.newInstance(compType, 0).getClass();
+ }
+
+ return javaType;
+ }
+
+ /**
+ * Converts an n-dimensional array of primitive types to wrapper types
+ */
+ public static Object getWrapperValueArray(Object value)
+ {
+ if (value == null)
+ return null;
+
+ Class javaType = value.getClass();
+ if (javaType.isArray())
+ {
+ int length = Array.getLength(value);
+ Object destArr = Array.newInstance(getWrapperType(javaType.getComponentType()), length);
+ for (int i = 0; i < length; i++)
+ {
+ Object srcObj = Array.get(value, i);
+ Array.set(destArr, i, getWrapperValueArray(srcObj));
+ }
+ return destArr;
+ }
+
+ return value;
+ }
+
+ public static Object syncArray(Object array, Class target)
+ {
+ return (JavaUtils.isPrimitive(target)) ? JavaUtils.getPrimitiveValueArray(array) : JavaUtils.getWrapperValueArray(array);
+ }
+
+ /**
+ * Return true if the dest class is assignable from the src.
+ * Also handles arrays and primitives.
+ */
+ public static boolean isAssignableFrom(Class dest, Class src)
+ {
+ if (dest == null)
+ throw new IllegalArgumentException("Destination class cannot be null");
+ if (src == null)
+ throw new IllegalArgumentException("Source class cannot be null");
+
+ boolean isAssignable = dest.isAssignableFrom(src);
+ if (isAssignable == false && dest.getName().equals(src.getName()))
+ {
+ ClassLoader destLoader = dest.getClassLoader();
+ ClassLoader srcLoader = src.getClassLoader();
+ if(log.isDebugEnabled()) log.debug("Not assignable because of conflicting class loaders:\ndstLoader=" + destLoader + "\nsrcLoader=" + srcLoader);
+ }
+
+ if (isAssignable == false && isPrimitive(dest))
+ {
+ dest = getWrapperType(dest);
+ isAssignable = dest.isAssignableFrom(src);
+ }
+ if (isAssignable == false && isPrimitive(src))
+ {
+ src = getWrapperType(src);
+ isAssignable = dest.isAssignableFrom(src);
+ }
+ return isAssignable;
+ }
+
+ public static String convertJVMNameToSourceName(String typeName, ClassLoader loader)
+ {
+ // TODO Don't use a ClassLoader for this, we need to just convert it
+ try
+ {
+ Class javaType = loadJavaType(typeName, loader);
+ typeName = getSourceName(javaType);
+ }
+ catch (Exception e)
+ {
+ }
+
+ return typeName;
+ }
+
+ /**
+ * Converts a JVM external name to a JVM signature name. An external name is
+ * that which is returned from {@link Class#getName()} A signature name is
+ * the name in class file format.
+ * <p>
+ * For example:
+ * <p>
+ * [java.lang.Object
+ * <p>
+ * becomes:
+ * <p>
+ * [Ljava/lang/Object;
+ *
+ * @param externalName
+ * @return
+ */
+ public static String toSignature(String externalName)
+ {
+ if (externalName == null)
+ return null;
+
+ String ret = primitiveNameDescriptors.get(externalName);
+ if (ret != null)
+ return ret;
+
+ ret = externalName.replace('.', '/');
+ return (ret.charAt(0) == '[') ? ret : "L" + ret + ";";
+ }
+
+ public static String printArray(Object[] val)
+ {
+ if (val == null)
+ return "null";
+
+ StringBuilder out = new StringBuilder("[");
+ for (int i = 0; i < val.length; i++)
+ {
+ if (i > 0)
+ {
+ out.append(",");
+ }
+ out.append(val[i].getClass().isArray() ? printArray((Object[])val[i]) : val[i]);
+ }
+ return out.append("]").toString();
+ }
+
+ public static String getSourceName(Class type)
+ {
+ if (! type.isArray())
+ return type.getName();
+
+ String arrayNotation = "";
+ Class component = type;
+ while(component.isArray())
+ {
+ component = component.getComponentType();
+ arrayNotation += "[]";
+ }
+
+ return component.getName() + arrayNotation;
+ }
+
+ public static String capitalize(String source)
+ {
+ if (source == null)
+ return null;
+
+ if (source.length() == 0)
+ return source;
+
+ if (Character.isUpperCase(source.charAt(0)))
+ return source;
+
+ char c = Character.toUpperCase(source.charAt(0));
+
+ return c + source.substring(1);
+ }
+
+ public static boolean isLoaded(String className, ClassLoader loader)
+ {
+ try
+ {
+ loadJavaType(className, loader);
+ }
+ catch (ClassNotFoundException e)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static String getPackageName(Class<?> clazz)
+ {
+ String fullName = clazz.getName();
+ return fullName.substring(0, fullName.lastIndexOf("."));
+ }
+
+ public static boolean isReservedKeyword(String keyword)
+ {
+ return reservedKeywords.contains(keyword);
+ }
+
+ /**
+ * Erases a type according to the JLS type erasure rules
+ *
+ * @param t type to erase
+ * @return erased type
+ */
+ public static Class erasure(Type type)
+ {
+ if (type instanceof ParameterizedType)
+ {
+ return erasure(((ParameterizedType)type).getRawType());
+ }
+ if (type instanceof TypeVariable)
+ {
+ return erasure(((TypeVariable)type).getBounds()[0]);
+ }
+ if (type instanceof WildcardType)
+ {
+ return erasure(((WildcardType)type).getUpperBounds()[0]);
+ }
+ if (type instanceof GenericArrayType)
+ {
+ return Array.newInstance(erasure(((GenericArrayType)type).getGenericComponentType()), 0).getClass();
+ }
+
+ // Only type left is class
+ return (Class)type;
+ }
+
+ public static String[] getRawParameterTypeArguments(ParameterizedType type)
+ {
+ Type[] arguments = type.getActualTypeArguments();
+ String[] ret = new String[arguments.length];
+ for (int i = 0; i < arguments.length; i++)
+ {
+ Class raw = erasure(arguments[i]);
+ ret[i] = raw.getName();
+ }
+
+ return ret;
+ }
+
+ /**
+ * This method tests for retro translation by searching for a known problem where Class
+ * does not implement Type. If this is true, then code must never cast a Class to a Type.
+ *
+ * @return true if we are in retro
+ */
+ public static boolean isRetro14()
+ {
+ return !(String.class instanceof java.lang.reflect.Type);
+ }
+
+ /**
+ * Tests if this class loader is a JBoss RepositoryClassLoader
+ *
+ * @param loader
+ * @return
+ */
+ public static boolean isJBossRepositoryClassLoader(ClassLoader loader)
+ {
+ Class clazz = loader.getClass();
+ while (!clazz.getName().startsWith("java"))
+ {
+ if ("org.jboss.mx.loading.RepositoryClassLoader".equals(clazz.getName()))
+ return true;
+ clazz = clazz.getSuperclass();
+ }
+
+ return false;
+ }
+
+ /**
+ * Clears black lists on a JBoss RepositoryClassLoader. This is somewhat of a hack, and
+ * could be replaced with an integration module. This is needed when the following order of
+ * events occur.
+ *
+ * <ol>
+ * <li>loadClass() returns not found</li>
+ * <li>Some call to defineClass()</li>
+ * <ol>
+ *
+ * The CNFE triggers a black list addition, which cause the class never again to be found.
+ *
+ * @param loader the loader to clear black lists for
+ */
+ public static void clearBlacklists(ClassLoader loader)
+ {
+ if (isJBossRepositoryClassLoader(loader))
+ {
+ try
+ {
+ loader.getClass().getMethod("clearBlacklists").invoke(loader);
+ }
+ catch (Exception e)
+ {
+ if(log.isDebugEnabled()) log.debug("Could not clear blacklists on " + loader);
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/core/utils/JavaUtils.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/BasicLifecycleHandler.java
===================================================================
--- branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/BasicLifecycleHandler.java 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/BasicLifecycleHandler.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -25,7 +25,6 @@
import org.jboss.logging.Logger;
import org.jboss.ws.integration.Endpoint.EndpointState;
-import org.jboss.ws.integration.invocation.InvocationHandler;
/**
* A basic lifecycle handler
@@ -38,42 +37,47 @@
// provide logging
protected final Logger log = Logger.getLogger(getClass());
- public void create(Endpoint endpoint)
+ public void create(Endpoint ep)
{
- log.debug("Create: " + endpoint.getName());
+ log.debug("Create: " + ep.getName());
- // Initialize the invoker
- InvocationHandler invoker = endpoint.getInvocationHandler();
- invoker.create(endpoint);
+ ep.getInvocationHandler().create(ep);
- endpoint.setState(EndpointState.CREATED);
+ ep.setState(EndpointState.CREATED);
}
- public void start(Endpoint endpoint)
+ public void start(Endpoint ep)
{
- log.debug("Start: " + endpoint.getName());
+ log.debug("Start: " + ep.getName());
- EndpointState state = endpoint.getState();
+ EndpointState state = ep.getState();
if (state == EndpointState.UNDEFINED || state == EndpointState.DESTROYED)
throw new IllegalStateException("Cannot start endpoint in state: " + state);
- endpoint.setState(EndpointState.STARTED);
+ ep.getInvocationHandler().start(ep);
+
+ ep.setState(EndpointState.STARTED);
}
- public void stop(Endpoint endpoint)
+ public void stop(Endpoint ep)
{
- log.debug("Stop: " + endpoint.getName());
+ log.debug("Stop: " + ep.getName());
- EndpointState state = endpoint.getState();
+ EndpointState state = ep.getState();
if (state != EndpointState.STARTED)
throw new IllegalStateException("Cannot stop endpoint in state: " + state);
- endpoint.setState(EndpointState.STOPED);
+ ep.getInvocationHandler().stop(ep);
+
+ ep.setState(EndpointState.STOPED);
}
- public void destroy(Endpoint endpoint)
+ public void destroy(Endpoint ep)
{
- log.debug("Destroy: " + endpoint.getName());
- endpoint.setState(EndpointState.DESTROYED);
+ log.debug("Destroy: " + ep.getName());
+
+ ep.getInvocationHandler().destroy(ep);
+
+ ep.setState(EndpointState.DESTROYED);
}
}
Copied: branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/AbstractWebServiceContext.java (from rev 3110, branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/AbstractWebServiceContext.java)
===================================================================
--- branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/AbstractWebServiceContext.java (rev 0)
+++ branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/AbstractWebServiceContext.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -0,0 +1,69 @@
+/*
+ * 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;
+
+import java.security.Principal;
+
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.util.NotImplementedException;
+import org.w3c.dom.Element;
+
+/**
+ * A WebServiceContext makes it possible for a web service endpoint implementation
+ * class to access message context and security information relative to a request
+ * being served. Typically a WebServiceContext is injected into an endpoint implementation
+ * class using the Resource annotation.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 03-May-2006
+ */
+public abstract class AbstractWebServiceContext implements WebServiceContext
+{
+ private MessageContext messageContext;
+
+ public AbstractWebServiceContext(MessageContext messageContext)
+ {
+ this.messageContext = messageContext;
+ }
+
+ public MessageContext getMessageContext()
+ {
+ return messageContext;
+ }
+
+ public abstract Principal getUserPrincipal();
+
+ public abstract boolean isUserInRole(String role);
+
+ public EndpointReference getEndpointReference(Element... referenceParameters)
+ {
+ throw new NotImplementedException();
+ }
+
+ public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
Added: branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/BasicInvocation.java
===================================================================
--- branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/BasicInvocation.java (rev 0)
+++ branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/BasicInvocation.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -0,0 +1,114 @@
+/*
+ * ====================================================================
+ *
+ * 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.lang.reflect.Method;
+
+//$Id$
+
+/**
+ * A general endpoint invocation.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 20-Apr-2007
+ */
+public class BasicInvocation implements Invocation
+{
+ private InvocationContext invocationContext;
+ private Method javaMethod;
+ private Object[] args;
+ private Object returnValue;
+
+ public InvocationContext getInvocationContext()
+ {
+ return invocationContext;
+ }
+
+ public void setInvocationContext(InvocationContext invocationContext)
+ {
+ this.invocationContext = invocationContext;
+ }
+
+ public Method getJavaMethod()
+ {
+ return javaMethod;
+ }
+
+ public void setJavaMethod(Method javaMethod)
+ {
+ this.javaMethod = javaMethod;
+ }
+
+ public Object[] getArgs()
+ {
+ return args;
+ }
+
+ public void setArgs(Object[] args)
+ {
+ this.args = args;
+ }
+
+ public Object getReturn()
+ {
+ return returnValue;
+ }
+
+ public void setReturn(Object returnValue)
+ {
+ this.returnValue = returnValue;
+ }
+}
Property changes on: branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/BasicInvocation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/Invocation.java
===================================================================
--- branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/Invocation.java (rev 0)
+++ branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/Invocation.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -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.lang.reflect.Method;
+
+//$Id$
+
+/**
+ * A general endpoint invocation.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 20-Apr-2007
+ */
+public interface Invocation
+{
+ InvocationContext getInvocationContext();
+
+ void setInvocationContext(InvocationContext context);
+
+ Method getJavaMethod();
+
+ void setJavaMethod(Method method);
+
+ Object[] getArgs();
+
+ void setArgs(Object[] args);
+
+ Object getReturn();
+
+ void setReturn(Object ret);
+}
Property changes on: branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/Invocation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
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 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/InvocationHandler.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -57,10 +57,6 @@
//$Id$
-import java.lang.reflect.Method;
-
-import javax.xml.ws.WebServiceContext;
-
import org.jboss.ws.integration.Endpoint;
/**
@@ -73,19 +69,16 @@
{
/** Create the invocation handler */
void create(Endpoint ep);
-
+
/** 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 context) throws Exception;
-
+
+ /** Invoke the the service endpoint */
+ void invoke(Endpoint ep, Invocation inv) throws Exception;
+
/** Stop the invocation handler */
void stop(Endpoint ep);
-
+
/** Destroy the invocation handler */
void destroy(Endpoint ep);
}
Copied: branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/WebServiceContextEJB.java (from rev 3110, branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextEJB.java)
===================================================================
--- branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/WebServiceContextEJB.java (rev 0)
+++ branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/WebServiceContextEJB.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -0,0 +1,58 @@
+/*
+ * 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.security.Principal;
+
+import javax.ejb.EJBContext;
+import javax.xml.ws.handler.MessageContext;
+
+/**
+ * A WebServiceContext implementation that delegates to the EJBContext.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 23-Jan-2007
+ */
+public class WebServiceContextEJB extends AbstractWebServiceContext
+{
+ private EJBContext ejbContext;
+
+ public WebServiceContextEJB(MessageContext msgContext, EJBContext ejbContext)
+ {
+ super(msgContext);
+ this.ejbContext = ejbContext;
+ }
+
+ public Principal getUserPrincipal()
+ {
+ Principal principal = ejbContext.getCallerPrincipal();
+ return principal;
+ }
+
+ public boolean isUserInRole(String role)
+ {
+ boolean isUserInRole = ejbContext.isCallerInRole(role);
+ return isUserInRole;
+ }
+}
Copied: branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/WebServiceContextJSE.java (from rev 3110, branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextJSE.java)
===================================================================
--- branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/WebServiceContextJSE.java (rev 0)
+++ branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/invocation/WebServiceContextJSE.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -0,0 +1,62 @@
+/*
+ * 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.security.Principal;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.ws.handler.MessageContext;
+
+/**
+ * A WebServiceContext implementation that delegates to the HttpServletRequest.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 23-Jan-2007
+ */
+public class WebServiceContextJSE extends AbstractWebServiceContext
+{
+ private HttpServletRequest httpRequest;
+
+ public WebServiceContextJSE(MessageContext messageContext)
+ {
+ super(messageContext);
+ httpRequest = (HttpServletRequest)messageContext.get(MessageContext.SERVLET_REQUEST);
+ if (httpRequest == null)
+ throw new IllegalStateException("Cannot obtain HTTPServletRequest from message context");
+ }
+
+ @Override
+ public Principal getUserPrincipal()
+ {
+ Principal principal = httpRequest.getUserPrincipal();
+ return principal;
+ }
+
+ @Override
+ public boolean isUserInRole(String role)
+ {
+ boolean isUserInRole = httpRequest.isUserInRole(role);
+ return isUserInRole;
+ }
+}
Modified: branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/EndpointInvocation.java
===================================================================
--- branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/EndpointInvocation.java 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/EndpointInvocation.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -1,24 +1,24 @@
/*
-* 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.
-*/
+ * 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;
// $Id$
@@ -99,22 +99,31 @@
public void setRequestParamValue(QName xmlName, Object value)
{
- if(log.isDebugEnabled()) log.debug("setRequestParamValue: [name=" + xmlName + ",value=" + getTypeName(value) + "]");
+ if (log.isDebugEnabled())
+ log.debug("setRequestParamValue: [name=" + xmlName + ",value=" + getTypeName(value) + "]");
reqPayload.put(xmlName, value);
}
- public Object getRequestParamValue(QName xmlName) throws SOAPException
+ public Object getRequestParamValue(QName xmlName)
{
- if(log.isDebugEnabled()) log.debug("getRequestParamValue: " + xmlName);
+ if (log.isDebugEnabled())
+ log.debug("getRequestParamValue: " + xmlName);
Object paramValue = reqPayload.get(xmlName);
ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName);
- paramValue = transformPayloadValue(paramMetaData, paramValue);
+ try
+ {
+ paramValue = transformPayloadValue(paramMetaData, paramValue);
+ }
+ catch (SOAPException ex)
+ {
+ throw new WSException(ex);
+ }
return paramValue;
}
/** Returns the payload that can be passed on to the endpoint implementation
*/
- public Object[] getRequestPayload() throws SOAPException
+ public Object[] getRequestPayload()
{
log.debug("getRequestPayload");
List<QName> xmlNames = getRequestParamNames();
@@ -141,13 +150,15 @@
public void setResponseParamValue(QName xmlName, Object value)
{
- if(log.isDebugEnabled()) log.debug("setResponseParamValue: [name=" + xmlName + ",value=" + getTypeName(value) + "]");
+ if (log.isDebugEnabled())
+ log.debug("setResponseParamValue: [name=" + xmlName + ",value=" + getTypeName(value) + "]");
resPayload.put(xmlName, value);
}
public Object getResponseParamValue(QName xmlName) throws SOAPException
{
- if(log.isDebugEnabled()) log.debug("getResponseParamValue: " + xmlName);
+ if (log.isDebugEnabled())
+ log.debug("getResponseParamValue: " + xmlName);
Object paramValue = resPayload.get(xmlName);
ParameterMetaData paramMetaData = opMetaData.getParameter(xmlName);
paramValue = transformPayloadValue(paramMetaData, paramValue);
@@ -168,18 +179,27 @@
if (value != null && retMetaData == null)
throw new WSException("Operation does not have a return value: " + opMetaData.getQName());
- if(log.isDebugEnabled()) log.debug("setReturnValue: " + getTypeName(value));
+ if (log.isDebugEnabled())
+ log.debug("setReturnValue: " + getTypeName(value));
this.returnValue = value;
}
- public Object getReturnValue() throws SOAPException
+ public Object getReturnValue()
{
- if(log.isDebugEnabled()) log.debug("getReturnValue");
+ if (log.isDebugEnabled())
+ log.debug("getReturnValue");
Object paramValue = returnValue;
ParameterMetaData paramMetaData = opMetaData.getReturnParameter();
if (paramMetaData != null)
{
- paramValue = transformPayloadValue(paramMetaData, paramValue);
+ try
+ {
+ paramValue = transformPayloadValue(paramMetaData, paramValue);
+ }
+ catch (SOAPException ex)
+ {
+ throw new WSException(ex);
+ }
}
return paramValue;
}
@@ -237,14 +257,15 @@
// the content element as is.
// Note, that it is possible for a Java type to be bound to an any
// type, so checking the xml type is not sufficient.
- if (! Element.class.isAssignableFrom(javaType))
+ if (!Element.class.isAssignableFrom(javaType))
{
SOAPContentElement soapElement = (SOAPContentElement)paramValue;
retValue = soapElement.getObjectValue();
}
}
- if(log.isDebugEnabled()) log.debug("transformPayloadValue: " + getTypeName(paramValue) + " -> " + getTypeName(retValue));
+ if (log.isDebugEnabled())
+ log.debug("transformPayloadValue: " + getTypeName(paramValue) + " -> " + getTypeName(retValue));
return retValue;
}
@@ -307,7 +328,7 @@
Method method = opMetaData.getJavaMethod();
Class[] targetParameterTypes = method.getParameterTypes();
- if (opMetaData.isDocumentWrapped() && !paramMetaData.isInHeader()&& !paramMetaData.isSwA() && !paramMetaData.isMessageType())
+ if (opMetaData.isDocumentWrapped() && !paramMetaData.isInHeader() && !paramMetaData.isSwA() && !paramMetaData.isMessageType())
{
outParameters = ParameterWrapping.unwrapRequestParameters(paramMetaData, paramValue, payload);
syncOutWrappedParameters(targetParameterTypes, payload);
@@ -336,7 +357,8 @@
retValue = JavaUtils.syncArray(retValue, targetParameterType);
}
- if(log.isDebugEnabled()) log.debug("syncEndpointInputParam: " + getTypeName(paramValue) + " -> " + getTypeName(retValue) + "(" + index + ")");
+ if (log.isDebugEnabled())
+ log.debug("syncEndpointInputParam: " + getTypeName(paramValue) + " -> " + getTypeName(retValue) + "(" + index + ")");
payload[index] = retValue;
}
}
Added: branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/ServiceEndpointInvokerDeployer.java
===================================================================
--- branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/ServiceEndpointInvokerDeployer.java (rev 0)
+++ branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/ServiceEndpointInvokerDeployer.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -0,0 +1,63 @@
+/*
+ * 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.deployment;
+
+//$Id$
+
+import org.jboss.ws.core.server.ServiceEndpointInvoker;
+import org.jboss.ws.core.server.ServiceEndpointInvokerEJB21;
+import org.jboss.ws.integration.Endpoint;
+import org.jboss.ws.integration.deployment.AbstractDeployer;
+import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.Deployment.DeploymentType;
+
+/**
+ * A deployer that associates the ServiceEndpointInvoker with the endpoint
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Apr-2007
+ */
+public class ServiceEndpointInvokerDeployer extends AbstractDeployer
+{
+ @Override
+ public void create(Deployment dep)
+ {
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ ServiceEndpointInvoker epInvoker = ep.getAttachment(ServiceEndpointInvoker.class);
+ if (epInvoker == null)
+ {
+ DeploymentType depType = ep.getService().getDeployment().getType();
+ if (depType == DeploymentType.JAXRPC_EJB21)
+ {
+ epInvoker = new ServiceEndpointInvokerEJB21();
+ }
+ else
+ {
+ epInvoker = new ServiceEndpointInvoker();
+ }
+ ep.addAttachment(ServiceEndpointInvoker.class, epInvoker);
+ epInvoker.init(ep);
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/ServiceEndpointInvokerDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/AbstractWebServiceContext.java
===================================================================
--- branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/AbstractWebServiceContext.java 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/AbstractWebServiceContext.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -1,69 +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;
-
-import java.security.Principal;
-
-import javax.xml.ws.EndpointReference;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.handler.MessageContext;
-
-import org.jboss.util.NotImplementedException;
-import org.w3c.dom.Element;
-
-/**
- * A WebServiceContext makes it possible for a web service endpoint implementation
- * class to access message context and security information relative to a request
- * being served. Typically a WebServiceContext is injected into an endpoint implementation
- * class using the Resource annotation.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 03-May-2006
- */
-public abstract class AbstractWebServiceContext implements WebServiceContext
-{
- private MessageContext messageContext;
-
- public AbstractWebServiceContext(MessageContext messageContext)
- {
- this.messageContext = messageContext;
- }
-
- public MessageContext getMessageContext()
- {
- return messageContext;
- }
-
- public abstract Principal getUserPrincipal();
-
- public abstract boolean isUserInRole(String role);
-
- public EndpointReference getEndpointReference(Element... referenceParameters)
- {
- throw new NotImplementedException();
- }
-
- public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters)
- {
- throw new NotImplementedException();
- }
-}
\ No newline at end of file
Deleted: branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextEJB.java
===================================================================
--- branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextEJB.java 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextEJB.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.core.jaxws;
-
-// $Id$
-
-import java.security.Principal;
-
-import javax.ejb.EJBContext;
-import javax.xml.ws.handler.MessageContext;
-
-import org.jboss.logging.Logger;
-
-/**
- * A WebServiceContext implementation that delegates to the EJBContext.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 23-Jan-2007
- */
-public class WebServiceContextEJB extends AbstractWebServiceContext
-{
- // provide logging
- private Logger log = Logger.getLogger(WebServiceContextEJB.class);
-
- private EJBContext ejbContext;
-
- public WebServiceContextEJB(MessageContext messageContext, EJBContext ejbContext)
- {
- super(messageContext);
- this.ejbContext = ejbContext;
- }
-
- @Override
- public Principal getUserPrincipal()
- {
- Principal principal = ejbContext.getCallerPrincipal();
- return principal;
- }
-
- @Override
- public boolean isUserInRole(String role)
- {
- boolean isUserInRole = ejbContext.isCallerInRole(role);
- return isUserInRole;
- }
-}
Deleted: branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextJSE.java
===================================================================
--- branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextJSE.java 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextJSE.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -1,64 +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.security.Principal;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.xml.ws.handler.MessageContext;
-
-import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
-
-/**
- * A WebServiceContext implementation that delegates to the HttpServletRequest.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 23-Jan-2007
- */
-public class WebServiceContextJSE extends AbstractWebServiceContext
-{
- private HttpServletRequest httpRequest;
-
- public WebServiceContextJSE(MessageContext messageContext)
- {
- super(messageContext);
- httpRequest = (HttpServletRequest)messageContext.get(MessageContextJAXWS.SERVLET_REQUEST);
- if (httpRequest == null)
- throw new IllegalStateException("Cannot obtain HTTPServletRequest from message context");
- }
-
- @Override
- public Principal getUserPrincipal()
- {
- Principal principal = httpRequest.getUserPrincipal();
- return principal;
- }
-
- @Override
- public boolean isUserInRole(String role)
- {
- boolean isUserInRole = httpRequest.isUserInRole(role);
- return isUserInRole;
- }
-}
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 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/RequestHandlerImpl.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -77,9 +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;
import org.jboss.ws.integration.management.ServerConfigFactory;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
@@ -305,12 +303,12 @@
/**
* Handle a request to this web service endpoint
*/
- private MessageAbstraction processRequest(Endpoint endpoint, MimeHeaderSource headerSource, ServletRequestContext reqContext, InputStream inputStream)
+ private MessageAbstraction processRequest(Endpoint ep, MimeHeaderSource headerSource, ServletRequestContext reqContext, InputStream inputStream)
throws BindingException
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class);
+ ServerEndpointMetaData sepMetaData = ep.getAttachment(ServerEndpointMetaData.class);
if (sepMetaData == null)
throw new IllegalStateException("Cannot obtain endpoint meta data");
@@ -318,7 +316,7 @@
ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
try
{
- EndpointState state = endpoint.getState();
+ EndpointState state = ep.getState();
if (state != EndpointState.STARTED)
{
QName faultCode = Constants.SOAP11_FAULT_CODE_SERVER;
@@ -326,8 +324,8 @@
throw new SOAPFaultException(faultCode, faultString, null, null);
}
- log.debug("BEGIN handleRequest: " + endpoint.getName());
- beginProcessing = initRequestMetrics(endpoint);
+ log.debug("BEGIN handleRequest: " + ep.getName());
+ beginProcessing = initRequestMetrics(ep);
MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() : null);
@@ -358,26 +356,9 @@
Thread.currentThread().setContextClassLoader(classLoader);
// Get the Invoker
- ServiceEndpointInvoker epInvoker = endpoint.getAttachment(ServiceEndpointInvoker.class);
+ ServiceEndpointInvoker epInvoker = ep.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);
- }
+ throw new IllegalStateException("Cannot obtain ServiceEndpointInvoker");
// Invoke the service endpoint
epInvoker.invoke(reqContext);
@@ -419,11 +400,11 @@
{
if (resMessage.isFaultMessage())
{
- processFaultMetrics(endpoint, beginProcessing);
+ processFaultMetrics(ep, beginProcessing);
}
else
{
- processResponseMetrics(endpoint, beginProcessing);
+ processResponseMetrics(ep, beginProcessing);
}
}
}
@@ -434,7 +415,7 @@
// Reset the thread context class loader
Thread.currentThread().setContextClassLoader(ctxClassLoader);
- log.debug("END handleRequest: " + endpoint.getName());
+ log.debug("END handleRequest: " + ep.getName());
}
}
Modified: 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 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -23,15 +23,12 @@
// $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.handler.soap.SOAPMessageContext;
import javax.xml.rpc.server.ServiceLifecycle;
import javax.xml.rpc.server.ServletEndpointContext;
import javax.xml.rpc.soap.SOAPFaultException;
@@ -40,6 +37,7 @@
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.http.HTTPBinding;
@@ -55,10 +53,10 @@
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.binding.BindingException;
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;
@@ -68,8 +66,11 @@
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.BasicInvocation;
+import org.jboss.ws.integration.invocation.Invocation;
import org.jboss.ws.integration.invocation.InvocationContext;
import org.jboss.ws.integration.invocation.InvocationHandler;
+import org.jboss.ws.integration.invocation.WebServiceContextJSE;
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -200,9 +201,10 @@
epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
}
- /** Invoke an instance of the SEI implementation bean */
- Object targetBean = getTargetBean(endpoint, invContext);
- invokeTargetBean(endpoint, targetBean, epInv, invContext);
+ // Invoke an instance of the SEI implementation bean
+ Invocation inv = setupInvocation(endpoint, epInv, invContext);
+ InvocationHandler invHandler = endpoint.getInvocationHandler();
+ invHandler.invoke(endpoint, inv);
}
finally
{
@@ -275,59 +277,61 @@
}
}
- protected void invokeTargetBean(Endpoint endpoint, Object targetBean, EndpointInvocation epInv, InvocationContext invContext) throws Exception
+ protected Invocation setupInvocation(Endpoint ep, EndpointInvocation epInv, InvocationContext invContext) throws Exception
{
- // Set the the ServletEndpointContext on a JSE endpoint
- if (targetBean instanceof ServiceLifecycle && invContext instanceof ServletRequestContext)
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof SOAPMessageContextJAXWS)
{
- try
- {
- ServiceLifecycle serviceLifecycle = ((ServiceLifecycle)targetBean);
- ServletEndpointContext servletEndpointContext = new ServletEndpointContextImpl((ServletRequestContext)invContext);
- serviceLifecycle.init(servletEndpointContext);
- }
- catch (ServiceException ex)
- {
- throw new WSException(ex);
- }
+ invContext.addAttachment(WebServiceContext.class, new WebServiceContextJSE((SOAPMessageContextJAXWS)msgContext));
+ invContext.addAttachment(javax.xml.ws.handler.MessageContext.class, msgContext);
}
-
- try
+ if (msgContext instanceof SOAPMessageContextJAXRPC)
{
- Method implMethod = getImplMethod(endpoint, epInv);
+ invContext.addAttachment(javax.xml.rpc.handler.MessageContext.class, msgContext);
+ }
+ if (ServiceLifecycle.class.isAssignableFrom(ep.getTargetBean()) && invContext instanceof ServletRequestContext)
+ {
+ ServletEndpointContext servletEndpointContext = new ServletEndpointContextImpl((ServletRequestContext)invContext);
+ invContext.addAttachment(ServletEndpointContext.class, servletEndpointContext);
+ }
- Object[] args = epInv.getRequestPayload();
+ Invocation inv = new DelegatingInvocation(epInv);
+ inv.setInvocationContext(invContext);
+ inv.setJavaMethod(getImplMethod(endpoint, epInv));
- 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);
- }
+ return inv;
+ }
- InvocationHandler invHandler = endpoint.getInvocationHandler();
- Object retObj = invHandler.invoke(endpoint, targetBean, implMethod, args, invContext);
+ protected Method getImplMethod(Endpoint endpoint, EndpointInvocation epInv) throws ClassNotFoundException, NoSuchMethodException
+ {
+ Class implClass = endpoint.getTargetBean();
+ Method seiMethod = epInv.getJavaMethod();
- epInv.setReturnValue(retObj);
- }
- finally
+ String methodName = seiMethod.getName();
+ Class[] paramTypes = seiMethod.getParameterTypes();
+ for (int i = 0; i < paramTypes.length; i++)
{
- if (targetBean instanceof ServiceLifecycle)
+ Class paramType = paramTypes[i];
+ if (JavaUtils.isPrimitive(paramType) == false)
{
- ((ServiceLifecycle)targetBean).destroy();
+ String paramTypeName = paramType.getName();
+ paramType = JavaUtils.loadJavaType(paramTypeName);
+ paramTypes[i] = paramType;
}
}
- }
- protected Object getTargetBean(Endpoint endpoint, InvocationContext invContext) throws InstantiationException, IllegalAccessException
- {
- InvocationHandler invHandler = endpoint.getInvocationHandler();
- Object targetBean = invHandler.getTargetBean(endpoint);
- return targetBean;
+ Method implMethod = null;
+ try
+ {
+ implMethod = implClass.getMethod(methodName, paramTypes);
+ }
+ catch (NoSuchMethodException ex)
+ {
+ log.error("CodeSource: " + implClass.getProtectionDomain().getCodeSource());
+ log.error("ClassLoader: " + implClass.getClassLoader());
+ throw ex;
+ }
+ return implMethod;
}
protected void setInboundContextProperties()
@@ -420,69 +424,55 @@
return opMetaData;
}
- protected Method getImplMethod(Endpoint endpoint, EndpointInvocation epInv) throws ClassNotFoundException, NoSuchMethodException
+ class DelegatingInvocation extends BasicInvocation
{
- Class implClass = endpoint.getTargetBean();
- Method seiMethod = epInv.getJavaMethod();
+ private EndpointInvocation epInv;
- String methodName = seiMethod.getName();
- Class[] paramTypes = seiMethod.getParameterTypes();
- for (int i = 0; i < paramTypes.length; i++)
+ public DelegatingInvocation(EndpointInvocation epInv)
{
- Class paramType = paramTypes[i];
- if (JavaUtils.isPrimitive(paramType) == false)
- {
- String paramTypeName = paramType.getName();
- paramType = JavaUtils.loadJavaType(paramTypeName);
- paramTypes[i] = paramType;
- }
+ this.epInv = epInv;
}
- Method implMethod = null;
- try
+ @Override
+ public void setReturn(Object value)
{
- implMethod = implClass.getMethod(methodName, paramTypes);
+ epInv.setReturnValue(value);
+
+ SOAPMessageContext msgContext = (SOAPMessageContext)getInvocationContext().getAttachment(javax.xml.rpc.handler.MessageContext.class);
+ if (msgContext != null && msgContext.getMessage() == null)
+ {
+ try
+ {
+ // Bind the response message
+ OperationMetaData opMetaData = epInv.getOperationMetaData();
+ CommonBindingProvider bindingProvider = new CommonBindingProvider(opMetaData.getEndpointMetaData());
+ CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
+ SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
+ msgContext.setMessage(resMessage);
+ }
+ catch (BindingException ex)
+ {
+ WSException.rethrow(ex);
+ }
+ }
}
- catch (NoSuchMethodException ex)
- {
- log.error("CodeSource: " + implClass.getProtectionDomain().getCodeSource());
- log.error("ClassLoader: " + implClass.getClassLoader());
- throw ex;
- }
- return implMethod;
- }
- /** handle invocation exceptions */
- public void handleInvocationException(Throwable th) throws Exception
- {
- if (th instanceof InvocationTargetException)
+ @Override
+ public Object[] getArgs()
{
- // unwrap the throwable raised by the service endpoint implementation
- Throwable targetEx = ((InvocationTargetException)th).getTargetException();
- handleInvocationThrowable(targetEx);
+ return epInv.getRequestPayload();
}
- if (th instanceof MBeanException)
+ @Override
+ public Object getReturn()
{
- throw ((MBeanException)th).getTargetException();
+ return epInv.getReturnValue();
}
- handleInvocationThrowable(th);
- }
-
- private void handleInvocationThrowable(Throwable th) throws Exception
- {
- if (th instanceof Exception)
+ @Override
+ public void setArgs(Object[] args)
{
- throw (Exception)th;
+ throw new IllegalArgumentException("Cannot set args on this invocation");
}
- 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/ServiceEndpointInvokerEJB21.java
===================================================================
--- branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerEJB21.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -23,14 +23,11 @@
// $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.Invocation;
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;
@@ -42,33 +39,16 @@
*/
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
+ protected Invocation setupInvocation(Endpoint ep, EndpointInvocation epInv, InvocationContext invContext) throws Exception
{
- log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
+ Invocation inv = super.setupInvocation(ep, epInv, invContext);
+
+ // Attach the handler callback
+ ServerEndpointMetaData sepMetaData = endpoint.getAttachment(ServerEndpointMetaData.class);
+ invContext.addAttachment(HandlerCallback.class, new HandlerCallbackImpl(sepMetaData));
- 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);
- }
+ return inv;
}
/** Handlers are beeing called through the HandlerCallback from the EJB interceptor */
Deleted: branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/utils/JavaUtils.java
===================================================================
--- branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/utils/JavaUtils.java 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/utils/JavaUtils.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -1,648 +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.utils;
-
-// $Id$
-
-import java.lang.reflect.Array;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.HashMap;
-import java.util.HashSet;
-
-import org.jboss.logging.Logger;
-
-/** Java utilities
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 22-Dec-2004
- */
-public class JavaUtils
-{
- // provide logging
- private static final Logger log = Logger.getLogger(JavaUtils.class);
-
- private static HashMap<String, Class> primitiveNames = new HashMap<String, Class>(8);
- private static HashMap<String, String> primitiveNameDescriptors = new HashMap<String, String>(8);
- private static HashSet<String> reservedKeywords = new HashSet<String>(50);
-
- static
- {
- primitiveNames.put("int", int.class);
- primitiveNames.put("short", short.class);
- primitiveNames.put("boolean", boolean.class);
- primitiveNames.put("byte", byte.class);
- primitiveNames.put("long", long.class);
- primitiveNames.put("double", double.class);
- primitiveNames.put("float", float.class);
- primitiveNames.put("char", char.class);
-
- primitiveNameDescriptors.put("int", "I");
- primitiveNameDescriptors.put("short", "S");
- primitiveNameDescriptors.put("boolean", "Z");
- primitiveNameDescriptors.put("byte", "B");
- primitiveNameDescriptors.put("long", "J");
- primitiveNameDescriptors.put("double", "D");
- primitiveNameDescriptors.put("float", "F");
- primitiveNameDescriptors.put("char", "C");
-
- reservedKeywords.add("abstract");
- reservedKeywords.add("continue");
- reservedKeywords.add("for");
- reservedKeywords.add("new");
- reservedKeywords.add("switch");
- reservedKeywords.add("assert");
- reservedKeywords.add("default");
- reservedKeywords.add("if");
- reservedKeywords.add("package");
- reservedKeywords.add("synchronized");
- reservedKeywords.add("boolean");
- reservedKeywords.add("do");
- reservedKeywords.add("goto");
- reservedKeywords.add("private");
- reservedKeywords.add("this");
- reservedKeywords.add("break");
- reservedKeywords.add("double");
- reservedKeywords.add("implements");
- reservedKeywords.add("protected");
- reservedKeywords.add("throw");
- reservedKeywords.add("byte");
- reservedKeywords.add("else");
- reservedKeywords.add("import");
- reservedKeywords.add("public");
- reservedKeywords.add("throws");
- reservedKeywords.add("case");
- reservedKeywords.add("enum");
- reservedKeywords.add("instanceof");
- reservedKeywords.add("return");
- reservedKeywords.add("transient");
- reservedKeywords.add("catch");
- reservedKeywords.add("extends");
- reservedKeywords.add("int");
- reservedKeywords.add("short");
- reservedKeywords.add("try");
- reservedKeywords.add("char");
- reservedKeywords.add("final");
- reservedKeywords.add("interface");
- reservedKeywords.add("static");
- reservedKeywords.add("void");
- reservedKeywords.add("class");
- reservedKeywords.add("finally");
- reservedKeywords.add("long");
- reservedKeywords.add("strictfp");
- reservedKeywords.add("volatile");
- reservedKeywords.add("const");
- reservedKeywords.add("float");
- reservedKeywords.add("native");
- reservedKeywords.add("super");
- reservedKeywords.add("while");
- }
-
- /**
- * Load a Java type from a given class loader.
- *
- * @param typeName maybe the source notation of a primitve, class name, array of both
- */
- public static Class loadJavaType(String typeName) throws ClassNotFoundException
- {
- return loadJavaType(typeName, null);
- }
-
- /**
- * Load a Java type from a given class loader.
- *
- * @param typeName maybe the source notation of a primitve, class name, array of both
- */
- public static Class loadJavaType(String typeName, ClassLoader classLoader) throws ClassNotFoundException
- {
- if (classLoader == null)
- classLoader = Thread.currentThread().getContextClassLoader();
-
- Class javaType = primitiveNames.get(typeName);
- if (javaType == null)
- javaType = getArray(typeName, classLoader);
-
- if (javaType == null)
- javaType = classLoader.loadClass(typeName);
-
- return javaType;
- }
-
- /**
- * True if the given type name is the source notation of a primitive or array of which.
- */
- public static boolean isPrimitive(String javaType)
- {
- return getPrimitiveType(javaType) != null;
- }
-
- /**
- * True if the given class is a primitive or array of which.
- */
- public static boolean isPrimitive(Class javaType)
- {
- return javaType.isPrimitive() || (javaType.isArray() && isPrimitive(javaType.getComponentType()));
- }
-
- public static Class getPrimitiveType(String javaType)
- {
- Class type = primitiveNames.get(javaType);
- if (type != null)
- return type;
-
- try
- {
- // null loader = primitive only
- type = getArray(javaType, null);
- }
- catch (ClassNotFoundException e)
- {
- // This will actually never be thrown since is null
- }
-
- return type;
- }
-
- private static Class getArray(String javaType, ClassLoader loader) throws ClassNotFoundException
- {
- if (javaType.charAt(0) == '[')
- return getArrayFromJVMName(javaType, loader);
-
- if (javaType.endsWith("[]"))
- return getArrayFromSourceName(javaType, loader);
-
- return null;
- }
-
- private static Class getArrayFromJVMName(String javaType, ClassLoader loader) throws ClassNotFoundException
- {
- Class componentType;
- int componentStart = javaType.lastIndexOf('[') + 1;
- switch (javaType.charAt(componentStart))
- {
- case 'I': componentType = int.class; break;
- case 'S': componentType = short.class; break;
- case 'Z': componentType = boolean.class; break;
- case 'B': componentType = byte.class; break;
- case 'J': componentType = long.class; break;
- case 'D': componentType = double.class; break;
- case 'F': componentType = float.class; break;
- case 'C': componentType = char.class; break;
- case 'L':
- if (loader == null)
- return null;
- String name = javaType.substring(componentStart + 1, javaType.length() - 1);
- componentType = loader.loadClass(name);
- break;
- default:
- throw new IllegalArgumentException("Invalid binary component for array: " + javaType.charAt(componentStart));
- }
-
- // componentStart doubles as the number of '['s which is the number of dimensions
- return Array.newInstance(componentType, new int[componentStart]).getClass();
- }
-
- private static Class getArrayFromSourceName(String javaType, ClassLoader loader) throws ClassNotFoundException
- {
- int arrayStart = javaType.indexOf('[');
- String componentName = javaType.substring(0, arrayStart);
-
- Class componentType = primitiveNames.get(componentName);
- if (componentType == null)
- {
- if (loader == null)
- return null;
-
- componentType = loader.loadClass(componentName);
- }
-
- // [][][][] divided by 2
- int dimensions = (javaType.length() - arrayStart) >> 1;
-
- return Array.newInstance(componentType, new int[dimensions]).getClass();
- }
-
- /**
- * Get the corresponding primitive for a give wrapper type.
- * Also handles arrays of which.
- */
- public static Class getPrimitiveType(Class javaType)
- {
- if (javaType == Integer.class)
- return int.class;
- if (javaType == Short.class)
- return short.class;
- if (javaType == Boolean.class)
- return boolean.class;
- if (javaType == Byte.class)
- return byte.class;
- if (javaType == Long.class)
- return long.class;
- if (javaType == Double.class)
- return double.class;
- if (javaType == Float.class)
- return float.class;
- if (javaType == Character.class)
- return char.class;
-
- if (javaType == Integer[].class)
- return int[].class;
- if (javaType == Short[].class)
- return short[].class;
- if (javaType == Boolean[].class)
- return boolean[].class;
- if (javaType == Byte[].class)
- return byte[].class;
- if (javaType == Long[].class)
- return long[].class;
- if (javaType == Double[].class)
- return double[].class;
- if (javaType == Float[].class)
- return float[].class;
- if (javaType == Character[].class)
- return char[].class;
-
- if (javaType.isArray() && javaType.getComponentType().isArray())
- {
- Class compType = getPrimitiveType(javaType.getComponentType());
- return Array.newInstance(compType, 0).getClass();
- }
-
- return javaType;
- }
-
- /**
- * Converts an n-dimensional array of wrapper types to primitive types
- */
- public static Object getPrimitiveValueArray(Object value)
- {
- if (value == null)
- return null;
-
- Class javaType = value.getClass();
- if (javaType.isArray())
- {
- int length = Array.getLength(value);
- Object destArr = Array.newInstance(getPrimitiveType(javaType.getComponentType()), length);
- for (int i = 0; i < length; i++)
- {
- Object srcObj = Array.get(value, i);
- Array.set(destArr, i, getPrimitiveValueArray(srcObj));
- }
- return destArr;
- }
-
- return value;
- }
-
- /**
- * Get the corresponding wrapper type for a give primitive.
- * Also handles arrays of which.
- */
- public static Class getWrapperType(Class javaType)
- {
- if (javaType == int.class)
- return Integer.class;
- if (javaType == short.class)
- return Short.class;
- if (javaType == boolean.class)
- return Boolean.class;
- if (javaType == byte.class)
- return Byte.class;
- if (javaType == long.class)
- return Long.class;
- if (javaType == double.class)
- return Double.class;
- if (javaType == float.class)
- return Float.class;
- if (javaType == char.class)
- return Character.class;
-
- if (javaType == int[].class)
- return Integer[].class;
- if (javaType == short[].class)
- return Short[].class;
- if (javaType == boolean[].class)
- return Boolean[].class;
- if (javaType == byte[].class)
- return Byte[].class;
- if (javaType == long[].class)
- return Long[].class;
- if (javaType == double[].class)
- return Double[].class;
- if (javaType == float[].class)
- return Float[].class;
- if (javaType == char[].class)
- return Character[].class;
-
- if (javaType.isArray() && javaType.getComponentType().isArray())
- {
- Class compType = getWrapperType(javaType.getComponentType());
- return Array.newInstance(compType, 0).getClass();
- }
-
- return javaType;
- }
-
- /**
- * Converts an n-dimensional array of primitive types to wrapper types
- */
- public static Object getWrapperValueArray(Object value)
- {
- if (value == null)
- return null;
-
- Class javaType = value.getClass();
- if (javaType.isArray())
- {
- int length = Array.getLength(value);
- Object destArr = Array.newInstance(getWrapperType(javaType.getComponentType()), length);
- for (int i = 0; i < length; i++)
- {
- Object srcObj = Array.get(value, i);
- Array.set(destArr, i, getWrapperValueArray(srcObj));
- }
- return destArr;
- }
-
- return value;
- }
-
- public static Object syncArray(Object array, Class target)
- {
- return (JavaUtils.isPrimitive(target)) ? JavaUtils.getPrimitiveValueArray(array) : JavaUtils.getWrapperValueArray(array);
- }
-
- /**
- * Return true if the dest class is assignable from the src.
- * Also handles arrays and primitives.
- */
- public static boolean isAssignableFrom(Class dest, Class src)
- {
- if (dest == null)
- throw new IllegalArgumentException("Destination class cannot be null");
- if (src == null)
- throw new IllegalArgumentException("Source class cannot be null");
-
- boolean isAssignable = dest.isAssignableFrom(src);
- if (isAssignable == false && dest.getName().equals(src.getName()))
- {
- ClassLoader destLoader = dest.getClassLoader();
- ClassLoader srcLoader = src.getClassLoader();
- if(log.isDebugEnabled()) log.debug("Not assignable because of conflicting class loaders:\ndstLoader=" + destLoader + "\nsrcLoader=" + srcLoader);
- }
-
- if (isAssignable == false && isPrimitive(dest))
- {
- dest = getWrapperType(dest);
- isAssignable = dest.isAssignableFrom(src);
- }
- if (isAssignable == false && isPrimitive(src))
- {
- src = getWrapperType(src);
- isAssignable = dest.isAssignableFrom(src);
- }
- return isAssignable;
- }
-
- public static String convertJVMNameToSourceName(String typeName, ClassLoader loader)
- {
- // TODO Don't use a ClassLoader for this, we need to just convert it
- try
- {
- Class javaType = loadJavaType(typeName, loader);
- typeName = getSourceName(javaType);
- }
- catch (Exception e)
- {
- }
-
- return typeName;
- }
-
- /**
- * Converts a JVM external name to a JVM signature name. An external name is
- * that which is returned from {@link Class#getName()} A signature name is
- * the name in class file format.
- * <p>
- * For example:
- * <p>
- * [java.lang.Object
- * <p>
- * becomes:
- * <p>
- * [Ljava/lang/Object;
- *
- * @param externalName
- * @return
- */
- public static String toSignature(String externalName)
- {
- if (externalName == null)
- return null;
-
- String ret = primitiveNameDescriptors.get(externalName);
- if (ret != null)
- return ret;
-
- ret = externalName.replace('.', '/');
- return (ret.charAt(0) == '[') ? ret : "L" + ret + ";";
- }
-
- public static String printArray(Object[] val)
- {
- if (val == null)
- return "null";
-
- StringBuilder out = new StringBuilder("[");
- for (int i = 0; i < val.length; i++)
- {
- if (i > 0)
- {
- out.append(",");
- }
- out.append(val[i].getClass().isArray() ? printArray((Object[])val[i]) : val[i]);
- }
- return out.append("]").toString();
- }
-
- public static String getSourceName(Class type)
- {
- if (! type.isArray())
- return type.getName();
-
- String arrayNotation = "";
- Class component = type;
- while(component.isArray())
- {
- component = component.getComponentType();
- arrayNotation += "[]";
- }
-
- return component.getName() + arrayNotation;
- }
-
- public static String capitalize(String source)
- {
- if (source == null)
- return null;
-
- if (source.length() == 0)
- return source;
-
- if (Character.isUpperCase(source.charAt(0)))
- return source;
-
- char c = Character.toUpperCase(source.charAt(0));
-
- return c + source.substring(1);
- }
-
- public static boolean isLoaded(String className, ClassLoader loader)
- {
- try
- {
- loadJavaType(className, loader);
- }
- catch (ClassNotFoundException e)
- {
- return false;
- }
-
- return true;
- }
-
- public static String getPackageName(Class<?> clazz)
- {
- String fullName = clazz.getName();
- return fullName.substring(0, fullName.lastIndexOf("."));
- }
-
- public static boolean isReservedKeyword(String keyword)
- {
- return reservedKeywords.contains(keyword);
- }
-
- /**
- * Erases a type according to the JLS type erasure rules
- *
- * @param t type to erase
- * @return erased type
- */
- public static Class erasure(Type type)
- {
- if (type instanceof ParameterizedType)
- {
- return erasure(((ParameterizedType)type).getRawType());
- }
- if (type instanceof TypeVariable)
- {
- return erasure(((TypeVariable)type).getBounds()[0]);
- }
- if (type instanceof WildcardType)
- {
- return erasure(((WildcardType)type).getUpperBounds()[0]);
- }
- if (type instanceof GenericArrayType)
- {
- return Array.newInstance(erasure(((GenericArrayType)type).getGenericComponentType()), 0).getClass();
- }
-
- // Only type left is class
- return (Class)type;
- }
-
- public static String[] getRawParameterTypeArguments(ParameterizedType type)
- {
- Type[] arguments = type.getActualTypeArguments();
- String[] ret = new String[arguments.length];
- for (int i = 0; i < arguments.length; i++)
- {
- Class raw = erasure(arguments[i]);
- ret[i] = raw.getName();
- }
-
- return ret;
- }
-
- /**
- * This method tests for retro translation by searching for a known problem where Class
- * does not implement Type. If this is true, then code must never cast a Class to a Type.
- *
- * @return true if we are in retro
- */
- public static boolean isRetro14()
- {
- return !(String.class instanceof java.lang.reflect.Type);
- }
-
- /**
- * Tests if this class loader is a JBoss RepositoryClassLoader
- *
- * @param loader
- * @return
- */
- public static boolean isJBossRepositoryClassLoader(ClassLoader loader)
- {
- Class clazz = loader.getClass();
- while (!clazz.getName().startsWith("java"))
- {
- if ("org.jboss.mx.loading.RepositoryClassLoader".equals(clazz.getName()))
- return true;
- clazz = clazz.getSuperclass();
- }
-
- return false;
- }
-
- /**
- * Clears black lists on a JBoss RepositoryClassLoader. This is somewhat of a hack, and
- * could be replaced with an integration module. This is needed when the following order of
- * events occur.
- *
- * <ol>
- * <li>loadClass() returns not found</li>
- * <li>Some call to defineClass()</li>
- * <ol>
- *
- * The CNFE triggers a black list addition, which cause the class never again to be found.
- *
- * @param loader the loader to clear black lists for
- */
- public static void clearBlacklists(ClassLoader loader)
- {
- if (isJBossRepositoryClassLoader(loader))
- {
- try
- {
- loader.getClass().getMethod("clearBlacklists").invoke(loader);
- }
- catch (Exception e)
- {
- if(log.isDebugEnabled()) log.debug("Could not clear blacklists on " + loader);
- }
- }
- }
-}
\ No newline at end of file
Modified: branches/tdiesler/trunk/jbossws/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointNoInjectEJB.java
===================================================================
--- branches/tdiesler/trunk/jbossws/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointNoInjectEJB.java 2007-05-16 22:34:28 UTC (rev 3114)
+++ branches/tdiesler/trunk/jbossws/src/test/java/org/jboss/test/ws/jaxws/samples/context/EndpointNoInjectEJB.java 2007-05-16 22:47:19 UTC (rev 3115)
@@ -37,9 +37,9 @@
import org.jboss.annotation.security.SecurityDomain;
import org.jboss.ws.annotation.WebContext;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.jaxws.WebServiceContextEJB;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.integration.invocation.WebServiceContextEJB;
@WebService(name = "TestEndpoint", targetNamespace = "http://org.jboss.ws/jaxws/context")
@SOAPBinding(style = Style.RPC)
17 years, 4 months
JBossWS SVN: r3114 - in branches/JBWS-856: jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: palin
Date: 2007-05-16 18:34:28 -0400 (Wed, 16 May 2007)
New Revision: 3114
Added:
branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecurityAnnotatedpolicy/WEB-INF/Policy.xml
Removed:
branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecurityAnnotatedpolicy/Policy.xml
branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/simple-encrypt/META-INF/jboss-wsse-client.xml
Modified:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
branches/JBWS-856/jbossws-tests/ant-import/build-samples-jaxws.xml
branches/JBWS-856/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/HelloJavaBean.java
branches/JBWS-856/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/SimpleEncryptTestCase.java
Log:
- Finished refactoring of policy metadata generation
- wsprovide running with policies from wsdl fragment
- Client running with policies from wsdl fragment
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java 2007-05-16 20:47:45 UTC (rev 3113)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java 2007-05-16 22:34:28 UTC (rev 3114)
@@ -39,7 +39,6 @@
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedPolicy;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.wsdl.WSDLBinding;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
@@ -48,9 +47,12 @@
import org.jboss.ws.metadata.wsdl.WSDLService;
/**
+ * A meta data builder for policies; handles checks for policy support
+ * and their eventual deploy on both server side and client side.
+ *
* @author Alessio Soldano, <mailto:alessio.soldano@javalinux.it>
*
- * since 16-May-2007
+ * @since 16-May-2007
*/
public class PolicyMetaDataBuilder
{
@@ -186,7 +188,7 @@
private void processPolicies(List<WSDLExtensibilityElement> policyReferences, PolicyScopeLevel scope, PolicyRegistry localPolicies, ExtensibleMetaData extMetaData)
{
- if (policyReferences != null && policyReferences.size() != 0 && extMetaData instanceof ServerEndpointMetaData)
+ if (policyReferences != null && policyReferences.size() != 0)
{
DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
for (WSDLExtensibilityElement element : policyReferences)
@@ -207,15 +209,7 @@
}
}
- /**
- * Implementors should add PolicyMetaDataExt to the provided ExtensibleMetaData according
- * to the specified policy and policy scope.
- *
- * @param policy
- * @param scope
- * @param extMetaData
- */
- protected void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData)
+ private void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData)
{
PolicyDeployer deployer;
if (toolMode)
@@ -237,7 +231,7 @@
}
- protected void deployPolicyServerSide(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData, PolicyDeployer deployer)
+ private void deployPolicyServerSide(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData, PolicyDeployer deployer)
{
PolicyMetaExtension ext = (PolicyMetaExtension)extMetaData.getExtension(Constants.URI_WS_POLICY);
if (ext == null)
@@ -260,7 +254,7 @@
}
- protected void deployPolicyClientSide(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData, PolicyDeployer deployer)
+ private void deployPolicyClientSide(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData, PolicyDeployer deployer)
{
PolicyMetaExtension ext = (PolicyMetaExtension)extMetaData.getExtension(Constants.URI_WS_POLICY);
if (ext == null)
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-05-16 20:47:45 UTC (rev 3113)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-05-16 22:34:28 UTC (rev 3114)
@@ -31,21 +31,15 @@
import javax.xml.namespace.QName;
import javax.xml.ws.BindingType;
-import org.apache.ws.policy.Policy;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.jaxws.client.ServiceObjectFactoryJAXWS;
-import org.jboss.ws.extensions.policy.PolicyScopeLevel;
-import org.jboss.ws.extensions.policy.deployer.PolicyDeployer;
-import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedPolicy;
import org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder;
-import org.jboss.ws.extensions.policy.metadata.PolicyMetaExtension;
import org.jboss.ws.integration.ResourceLoaderAdapter;
import org.jboss.ws.integration.UnifiedVirtualFile;
import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
@@ -96,7 +90,6 @@
{
PolicyMetaDataBuilder policyBuilder = PolicyMetaDataBuilder.getClientSidePolicyMetaDataBuilder();
policyBuilder.processPolicyExtensions(epMetaData, wsdlDefinitions);
- //processPolicyMetaDataExtension(epMetaData, wsdlDefinitions);
}
// Read the WSDL and initialize the schema model
@@ -309,26 +302,4 @@
if(log.isDebugEnabled()) log.debug("END: rebuildMetaData\n" + epMetaData.getServiceMetaData());
}
-
-// protected void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData)
-// {
-// PolicyMetaExtension ext = (PolicyMetaExtension)extMetaData.getExtension(Constants.URI_WS_POLICY);
-// if (ext == null)
-// {
-// ext = new PolicyMetaExtension(Constants.URI_WS_POLICY);
-// extMetaData.addExtension(ext);
-// }
-// try
-// {
-// PolicyDeployer.getInstance().deployClientSide(policy, extMetaData);
-// ext.addPolicy(scope, policy);
-// }
-// catch (UnsupportedPolicy e)
-// {
-// if (log.isDebugEnabled())
-// {
-// log.debug("Policy Not supported:" + policy.getPolicyURI());
-// }
-// }
-// }
}
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2007-05-16 20:47:45 UTC (rev 3113)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2007-05-16 22:34:28 UTC (rev 3114)
@@ -55,11 +55,6 @@
import javax.xml.ws.addressing.Action;
import javax.xml.ws.addressing.AddressingProperties;
-import org.apache.ws.policy.Policy;
-import org.apache.ws.policy.PolicyReference;
-import org.apache.ws.policy.util.DOMPolicyReader;
-import org.apache.ws.policy.util.PolicyFactory;
-import org.apache.ws.policy.util.PolicyRegistry;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
@@ -67,14 +62,11 @@
import org.jboss.ws.core.jaxrpc.Use;
import org.jboss.ws.core.jaxws.DynamicWrapperGenerator;
import org.jboss.ws.core.jaxws.WrapperGenerator;
-import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.utils.HolderUtils;
import org.jboss.ws.core.utils.JBossWSEntityResolver;
import org.jboss.ws.core.utils.JavaUtils;
import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl;
import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt;
-import org.jboss.ws.extensions.policy.PolicyScopeLevel;
-import org.jboss.ws.extensions.policy.annotation.PolicyAttachment;
import org.jboss.ws.metadata.acessor.JAXBAccessor;
import org.jboss.ws.metadata.builder.MetaDataBuilder;
import org.jboss.ws.metadata.j2ee.serviceref.HandlerChainsObjectFactory;
@@ -82,11 +74,9 @@
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
-import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.TypeMappingMetaData;
import org.jboss.ws.metadata.umdm.TypesMetaData;
import org.jboss.ws.metadata.umdm.WrappedParameter;
@@ -95,11 +85,7 @@
import org.jboss.ws.metadata.wsdl.WSDLBindingMessageReference;
import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
-import org.jboss.ws.metadata.wsdl.WSDLExtensibilityElement;
-import org.jboss.ws.metadata.wsdl.WSDLInterface;
import org.jboss.ws.metadata.wsdl.WSDLMIMEPart;
-import org.jboss.ws.metadata.wsdl.WSDLService;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -973,129 +959,4 @@
this.wrapperGenerator = wrapperGenerator;
}
-
-// protected void processPolicyAnnotation(EndpointMetaData epMetaData, Class<?> sepClass, UnifiedDeploymentInfo udi)
-// {
-// for (org.jboss.ws.extensions.policy.annotation.Policy policy : sepClass.getAnnotation(PolicyAttachment.class).value())
-// {
-// InputStream is = null;
-// try
-// {
-// DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
-// is = udi.getMetaDataFileURL(policy.policyFileLocation()).openStream();
-// Policy unnormalizedPolicy = reader.readPolicy(is);
-// Policy normPolicy = (Policy)unnormalizedPolicy.normalize();
-// log.info("Deploying Annotated Policy = "+policy.policyFileLocation());
-// PolicyScopeLevel scope = policy.scope();
-// if (PolicyScopeLevel.WSDL_PORT.equals(scope) || PolicyScopeLevel.WSDL_PORT_TYPE.equals(scope) ||
-// PolicyScopeLevel.WSDL_BINDING.equals(scope))
-// {
-// deployPolicy(normPolicy, scope, epMetaData);
-// }
-// else
-// {
-// throw new WSException("Policy scope "+scope+" not supported yet!");
-// }
-// }
-// catch (Exception e)
-// {
-// e.printStackTrace();
-// } finally
-// {
-// try
-// {
-// is.close();
-// } catch (Exception e) {}
-// }
-// }
-// }
-//
-// protected void processPolicyMetaDataExtension(EndpointMetaData epMetaData, WSDLDefinitions wsdlDefinitions)
-// {
-// //Collect all policies defined in our wsdl definitions
-// DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
-// PolicyRegistry localPolicyRegistry = new PolicyRegistry();
-// for (WSDLExtensibilityElement policyElement : wsdlDefinitions.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICY))
-// {
-// Policy policy = reader.readPolicy(policyElement.getElement());
-// localPolicyRegistry.register(policy.getPolicyURI(), policy);
-// }
-// //Port scope
-// WSDLService wsdlService = wsdlDefinitions.getService(epMetaData.getServiceMetaData().getServiceName());
-// if (wsdlService != null)
-// {
-// WSDLEndpoint wsdlEndpoint = wsdlService.getEndpoint(epMetaData.getPortName());
-// if (wsdlEndpoint != null)
-// {
-// List<WSDLExtensibilityElement> portPolicyRefList = wsdlEndpoint.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
-// deployPolicies(portPolicyRefList, PolicyScopeLevel.WSDL_PORT, localPolicyRegistry, epMetaData);
-// }
-// else
-// {
-// log.warn("Cannot get port '"+epMetaData.getPortName()+"' from the given wsdl definitions! Eventual policies attached to this port won't be considered.");
-// }
-// }
-// else
-// {
-// log.warn("Cannot get service '"+epMetaData.getServiceMetaData().getServiceName()+"' from the given wsdl definitions! Eventual policies attached to this service won't be considered.");
-// }
-//
-// //Binding scope
-// WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(epMetaData.getPortTypeName());
-// if (wsdlBinding != null)
-// {
-// List<WSDLExtensibilityElement> bindingPolicyRefList = wsdlBinding.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
-// deployPolicies(bindingPolicyRefList, PolicyScopeLevel.WSDL_BINDING, localPolicyRegistry, epMetaData);
-// }
-// else
-// {
-// log.warn("Cannot get binding for portType '"+epMetaData.getPortTypeName()+"' from the given wsdl definitions! Eventual policies attached to this binding won't be considered.");
-// }
-//
-// //PortType scope
-// WSDLInterface wsdlInterface = wsdlDefinitions.getInterface(epMetaData.getPortTypeName());
-// if (wsdlInterface != null)
-// {
-// List<WSDLExtensibilityElement> portTypePolicyRefList = wsdlInterface.getExtensibilityElements(Constants.WSDL_PROPERTY_POLICYURIS);
-// deployPolicies(portTypePolicyRefList, PolicyScopeLevel.WSDL_PORT_TYPE, localPolicyRegistry, epMetaData);
-// }
-// else
-// {
-// log.warn("Cannot get portType '"+epMetaData.getPortTypeName()+"' from the given wsdl definitions! Eventual policies attached to this portType won't be considered.");
-// }
-// }
-//
-// private void deployPolicies(List<WSDLExtensibilityElement> policyReferences, PolicyScopeLevel scope, PolicyRegistry localPolicies, ExtensibleMetaData extMetaData)
-// {
-// if (policyReferences != null && policyReferences.size() != 0 && extMetaData instanceof ServerEndpointMetaData)
-// {
-// DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
-// for (WSDLExtensibilityElement element : policyReferences)
-// {
-// PolicyReference policyRef = reader.readPolicyReference(element.getElement());
-// Policy normPolicy;
-// try
-// {
-// normPolicy = (Policy)policyRef.normalize(localPolicies);
-// }
-// catch (RuntimeException e)
-// {
-// //TODO!!! not a local policy: get the policy definition and create the policy
-// normPolicy = null;
-// }
-// deployPolicy(normPolicy, scope, extMetaData);
-// }
-// }
-// }
-//
-// /**
-// * Implementors should add PolicyMetaDataExt to the provided ExtensibleMetaData according
-// * to the specified policy and policy scope.
-// *
-// * @param policy
-// * @param scope
-// * @param extMetaData
-// */
-// protected abstract void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData);
-
}
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2007-05-16 20:47:45 UTC (rev 3113)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2007-05-16 22:34:28 UTC (rev 3114)
@@ -26,17 +26,10 @@
import javax.jws.WebService;
import javax.xml.ws.WebServiceProvider;
-import org.apache.ws.policy.Policy;
-import org.jboss.ws.Constants;
import org.jboss.ws.annotation.EndpointConfig;
import org.jboss.ws.annotation.WebContext;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.server.UnifiedDeploymentInfo.DeploymentType;
-import org.jboss.ws.extensions.policy.PolicyScopeLevel;
-import org.jboss.ws.extensions.policy.deployer.PolicyDeployer;
-import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedPolicy;
-import org.jboss.ws.extensions.policy.metadata.PolicyMetaExtension;
-import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
@@ -161,25 +154,4 @@
}
}
-// protected void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData)
-// {
-// PolicyMetaExtension ext = (PolicyMetaExtension)extMetaData.getExtension(Constants.URI_WS_POLICY);
-// if (ext == null)
-// {
-// ext = new PolicyMetaExtension(Constants.URI_WS_POLICY);
-// extMetaData.addExtension(ext);
-// }
-// try
-// {
-// Policy deployedPolicy = PolicyDeployer.getInstance().deployServerside(policy, extMetaData);
-// ext.addPolicy(scope,deployedPolicy);
-// }
-// catch (UnsupportedPolicy e)
-// {
-// if (log.isDebugEnabled())
-// {
-// log.debug("Policy Not supported:" + policy.getPolicyURI());
-// }
-// }
-// }
}
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-05-16 20:47:45 UTC (rev 3113)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-05-16 22:34:28 UTC (rev 3114)
@@ -141,6 +141,7 @@
return sepMetaData;
//Process an optional @PolicyAttachment annotation
+ //TODO!! Move this before toolMode return after pacthing error with policy annotation resource reading
if (sepClass.isAnnotationPresent(PolicyAttachment.class))
{
PolicyMetaDataBuilder policyBuilder = PolicyMetaDataBuilder.getServerSidePolicyMetaDataBuilder(toolMode);
@@ -344,28 +345,18 @@
if (anPolicy!=null)
{
String policyLocation = anPolicy.wsdlFragmentLocation();
- System.out.println("Policy Location: ###"+policyLocation+"###");
if (policyLocation==null || policyLocation.length()==0)
throw new WSException("Missing wsdlFragmentLocation for @Policy on " + sepClass.getName());
+
if (toolMode)
{
result.policyLocation = Thread.currentThread().getContextClassLoader().getResource(policyLocation);
- }else
+ }
+ else
{
result.policyLocation = udi.getMetaDataFileURL(policyLocation);
}
-
-// if (result.policyLocation==null) {
-// try
-// {
-// result.policyLocation = new File(policyLocation).toURL();
-// }
-// catch (Exception e)
-// {
-// e.printStackTrace();
-// }
-// }
- System.out.println("Policy Location: ###"+result.policyLocation+"###");
+ log.debug("Policy Location: " + result.policyLocation);
}
return result;
Modified: branches/JBWS-856/jbossws-tests/ant-import/build-samples-jaxws.xml
===================================================================
--- branches/JBWS-856/jbossws-tests/ant-import/build-samples-jaxws.xml 2007-05-16 20:47:45 UTC (rev 3113)
+++ branches/JBWS-856/jbossws-tests/ant-import/build-samples-jaxws.xml 2007-05-16 22:34:28 UTC (rev 3114)
@@ -467,12 +467,10 @@
<webinf dir="${tests.output.dir}/resources/jaxws/samples/wssecuritypolicy">
<include name="wsse.keystore"/>
<include name="wsse.truststore"/>
-
</webinf>
- <webinf dir="${tests.output.dir}/resources/jaxws/samples/wssecuritypolicy/WEB-INF">
-
- <include name="PolicyAttachmentFragment.wsdl"/>
- </webinf>
+ <webinf dir="${tests.output.dir}/resources/jaxws/samples/wssecuritypolicy/WEB-INF">
+ <include name="PolicyAttachmentFragment.wsdl"/>
+ </webinf>
</war>
<!-- jaxws-samples-wssecurityAnnotatedpolicy-encrypt -->
<war warfile="${tests.output.dir}/libs/jaxws-samples-wssecurityAnnotatedpolicy-encrypt.war" webxml="${tests.output.dir}/resources/jaxws/samples/wssecurityAnnotatedpolicy/WEB-INF/web.xml">
@@ -484,6 +482,8 @@
<webinf dir="${tests.output.dir}/resources/jaxws/samples/wssecurityAnnotatedpolicy">
<include name="wsse.keystore"/>
<include name="wsse.truststore"/>
+ </webinf>
+ <webinf dir="${tests.output.dir}/resources/jaxws/samples/wssecurityAnnotatedpolicy/WEB-INF">
<include name="Policy.xml"/>
</webinf>
</war>
Modified: branches/JBWS-856/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/HelloJavaBean.java
===================================================================
--- branches/JBWS-856/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/HelloJavaBean.java 2007-05-16 20:47:45 UTC (rev 3113)
+++ branches/JBWS-856/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/HelloJavaBean.java 2007-05-16 22:34:28 UTC (rev 3114)
@@ -31,7 +31,6 @@
import org.jboss.ws.annotation.PolicyWsdlFragment;
@WebService(name = "Hello", targetNamespace = "http://org.jboss.ws/samples/wssecuritypolicy")
-//@PolicyWsdlFragment(wsdlFragmentLocation="WEB-INF/PolicyAttachmentFragment.wsdl")
@PolicyWsdlFragment(wsdlFragmentLocation="WEB-INF/PolicyAttachmentFragment.wsdl")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class HelloJavaBean
Modified: branches/JBWS-856/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/SimpleEncryptTestCase.java
===================================================================
--- branches/JBWS-856/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/SimpleEncryptTestCase.java 2007-05-16 20:47:45 UTC (rev 3113)
+++ branches/JBWS-856/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/SimpleEncryptTestCase.java 2007-05-16 22:34:28 UTC (rev 3114)
@@ -69,14 +69,11 @@
private Hello getPort() throws Exception
{
URL wsdlURL = new File("wsprovide/resources/jaxws/samples/wssecuritypolicy/HelloService.wsdl").toURL();
- //URL securityURL = new File("resources/jaxws/samples/wssecuritypolicy/simple-encrypt/META-INF/jboss-wsse-client.xml").toURL();
QName serviceName = new QName("http://org.jboss.ws/samples/wssecuritypolicy", "HelloService");
Service service = Service.create(wsdlURL, serviceName);
- //((ServiceExt)service).setSecurityConfig(securityURL.toExternalForm());
Hello port = (Hello)service.getPort(Hello.class);
- //((StubExt)port).setConfigName("Standard WSSecurity Client");
Map<String, Object> reqContext = ((BindingProvider)port).getRequestContext();
reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://" + getServerHost() + ":8080/jaxws-samples-wssecuritypolicy-encrypt");
Deleted: branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecurityAnnotatedpolicy/Policy.xml
===================================================================
--- branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecurityAnnotatedpolicy/Policy.xml 2007-05-16 20:47:45 UTC (rev 3113)
+++ branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecurityAnnotatedpolicy/Policy.xml 2007-05-16 22:34:28 UTC (rev 3114)
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<wsp:Policy wsu:Id="X509EndpointPolicy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
- xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit...">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:jboss-ws-security xmlns:sp="http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
- <sp:key-store-file>WEB-INF/wsse.keystore</sp:key-store-file>
- <sp:key-store-password>jbossws</sp:key-store-password>
- <sp:trust-store-file>WEB-INF/wsse.truststore</sp:trust-store-file>
- <sp:trust-store-password>jbossws</sp:trust-store-password>
- <sp:config>
- <sp:encrypt type="x509v3" alias="wsse"/>
- <sp:requires>
- <sp:encryption/>
- </sp:requires>
- </sp:config>
- </sp:jboss-ws-security>
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy>
-
Added: branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecurityAnnotatedpolicy/WEB-INF/Policy.xml
===================================================================
--- branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecurityAnnotatedpolicy/WEB-INF/Policy.xml (rev 0)
+++ branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecurityAnnotatedpolicy/WEB-INF/Policy.xml 2007-05-16 22:34:28 UTC (rev 3114)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<wsp:Policy wsu:Id="X509EndpointPolicy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit...">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:jboss-ws-security xmlns:sp="http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
+ <sp:key-store-file>WEB-INF/wsse.keystore</sp:key-store-file>
+ <sp:key-store-password>jbossws</sp:key-store-password>
+ <sp:trust-store-file>WEB-INF/wsse.truststore</sp:trust-store-file>
+ <sp:trust-store-password>jbossws</sp:trust-store-password>
+ <sp:config>
+ <sp:encrypt type="x509v3" alias="wsse"/>
+ <sp:requires>
+ <sp:encryption/>
+ </sp:requires>
+ </sp:config>
+ </sp:jboss-ws-security>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
Deleted: branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/simple-encrypt/META-INF/jboss-wsse-client.xml
===================================================================
--- branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/simple-encrypt/META-INF/jboss-wsse-client.xml 2007-05-16 20:47:45 UTC (rev 3113)
+++ branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/simple-encrypt/META-INF/jboss-wsse-client.xml 2007-05-16 22:34:28 UTC (rev 3114)
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jboss-ws-security xmlns="http://www.jboss.com/ws-security/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
- <config>
- <encrypt type="x509v3" alias="wsse"/>
- <requires>
- <encryption/>
- </requires>
- </config>
-</jboss-ws-security>
\ No newline at end of file
17 years, 4 months
JBossWS SVN: r3113 - in branches/JBWS-856: jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: maeste
Date: 2007-05-16 16:47:45 -0400 (Wed, 16 May 2007)
New Revision: 3113
Added:
branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/WEB-INF/PolicyAttachmentFragment.wsdl
Removed:
branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/PolicyAttachmentFragment.wsdl
Modified:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
branches/JBWS-856/jbossws-tests/ant-import/build-samples-jaxws.xml
branches/JBWS-856/jbossws-tests/build.xml
branches/JBWS-856/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/HelloJavaBean.java
Log:
wsprovide can use PolicyFragment file relative to current classpath
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java 2007-05-16 19:58:28 UTC (rev 3112)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java 2007-05-16 20:47:45 UTC (rev 3113)
@@ -95,7 +95,13 @@
try
{
DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
- is = udi.getMetaDataFileURL(policy.policyFileLocation()).openStream();
+ if (toolMode)
+ {
+ is = Thread.currentThread().getContextClassLoader().getResourceAsStream(policy.policyFileLocation());
+ } else
+ {
+ is = udi.getMetaDataFileURL(policy.policyFileLocation()).openStream();
+ }
Policy unnormalizedPolicy = reader.readPolicy(is);
Policy normPolicy = (Policy)unnormalizedPolicy.normalize();
log.info("Deploying Annotated Policy = "+policy.policyFileLocation());
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-05-16 19:58:28 UTC (rev 3112)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-05-16 20:47:45 UTC (rev 3113)
@@ -347,17 +347,24 @@
System.out.println("Policy Location: ###"+policyLocation+"###");
if (policyLocation==null || policyLocation.length()==0)
throw new WSException("Missing wsdlFragmentLocation for @Policy on " + sepClass.getName());
- result.policyLocation = udi.getMetaDataFileURL(policyLocation);
- if (result.policyLocation==null) {
- try
- {
- result.policyLocation = new File(policyLocation).toURL();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
+ if (toolMode)
+ {
+ result.policyLocation = Thread.currentThread().getContextClassLoader().getResource(policyLocation);
+ }else
+ {
+ result.policyLocation = udi.getMetaDataFileURL(policyLocation);
}
+
+// if (result.policyLocation==null) {
+// try
+// {
+// result.policyLocation = new File(policyLocation).toURL();
+// }
+// catch (Exception e)
+// {
+// e.printStackTrace();
+// }
+// }
System.out.println("Policy Location: ###"+result.policyLocation+"###");
}
Modified: branches/JBWS-856/jbossws-tests/ant-import/build-samples-jaxws.xml
===================================================================
--- branches/JBWS-856/jbossws-tests/ant-import/build-samples-jaxws.xml 2007-05-16 19:58:28 UTC (rev 3112)
+++ branches/JBWS-856/jbossws-tests/ant-import/build-samples-jaxws.xml 2007-05-16 20:47:45 UTC (rev 3113)
@@ -467,8 +467,12 @@
<webinf dir="${tests.output.dir}/resources/jaxws/samples/wssecuritypolicy">
<include name="wsse.keystore"/>
<include name="wsse.truststore"/>
- <include name="PolicyAttachmentFragment.wsdl"/>
+
</webinf>
+ <webinf dir="${tests.output.dir}/resources/jaxws/samples/wssecuritypolicy/WEB-INF">
+
+ <include name="PolicyAttachmentFragment.wsdl"/>
+ </webinf>
</war>
<!-- jaxws-samples-wssecurityAnnotatedpolicy-encrypt -->
<war warfile="${tests.output.dir}/libs/jaxws-samples-wssecurityAnnotatedpolicy-encrypt.war" webxml="${tests.output.dir}/resources/jaxws/samples/wssecurityAnnotatedpolicy/WEB-INF/web.xml">
Modified: branches/JBWS-856/jbossws-tests/build.xml
===================================================================
--- branches/JBWS-856/jbossws-tests/build.xml 2007-05-16 19:58:28 UTC (rev 3112)
+++ branches/JBWS-856/jbossws-tests/build.xml 2007-05-16 20:47:45 UTC (rev 3113)
@@ -354,6 +354,7 @@
<classpath location="${thirdparty.dir}/concurrent.jar"/>
<classpath location="${thirdparty.dir}/commons-logging.jar"/>
<classpath location="${tests.output.dir}/classes"/>
+ <classpath location="${tests.output.dir}/resources/jaxws/samples/wssecuritypolicy"/>
</taskdef>
<wsprovide resourcedestdir="${tests.output.dir}/wsprovide/resources/jaxws/samples/wssecurity" genwsdl="true" sei="org.jboss.test.ws.jaxws.samples.wssecurity.HelloJavaBean"/>
Modified: branches/JBWS-856/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/HelloJavaBean.java
===================================================================
--- branches/JBWS-856/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/HelloJavaBean.java 2007-05-16 19:58:28 UTC (rev 3112)
+++ branches/JBWS-856/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/HelloJavaBean.java 2007-05-16 20:47:45 UTC (rev 3113)
@@ -32,7 +32,7 @@
@WebService(name = "Hello", targetNamespace = "http://org.jboss.ws/samples/wssecuritypolicy")
//@PolicyWsdlFragment(wsdlFragmentLocation="WEB-INF/PolicyAttachmentFragment.wsdl")
-@PolicyWsdlFragment(wsdlFragmentLocation="/dati/jbws_JBWS-856/jbossws-tests/output/resources/jaxws/samples/wssecuritypolicy/WEB-INF/PolicyAttachmentFragment.wsdl")
+@PolicyWsdlFragment(wsdlFragmentLocation="WEB-INF/PolicyAttachmentFragment.wsdl")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class HelloJavaBean
{
Deleted: branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/PolicyAttachmentFragment.wsdl
===================================================================
--- branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/PolicyAttachmentFragment.wsdl 2007-05-16 19:58:28 UTC (rev 3112)
+++ branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/PolicyAttachmentFragment.wsdl 2007-05-16 20:47:45 UTC (rev 3113)
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<definitions name="TestService" targetNamespace="http://org.jboss.ws/samples/wssecuritypolicy"
- xmlns:tns="http://org.jboss.ws/samples/wssecuritypolicy"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:sp="http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
- xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit...">
- <wsp:Policy wsu:Id="X509EndpointPolicy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:jboss-ws-security xmlns:sp="http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
- <sp:key-store-file>WEB-INF/wsse.keystore</sp:key-store-file>
- <sp:key-store-password>jbossws</sp:key-store-password>
- <sp:trust-store-file>WEB-INF/wsse.truststore</sp:trust-store-file>
- <sp:trust-store-password>jbossws</sp:trust-store-password>
- <sp:config>
- <sp:encrypt type="x509v3" alias="wsse"/>
- <sp:requires>
- <sp:encryption/>
- </sp:requires>
- </sp:config>
- </sp:jboss-ws-security>
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy>
- <binding name='HelloBinding' type='tns:Hello'>
- <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
- <wsp:PolicyReference URI="#X509EndpointPolicy" wsdl:required="true" />
- </binding>
- <service name='HelloService'>
- <port binding='tns:HelloBinding' name='HelloPort'>
- <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
- </port>
- </service>
-</definitions>
Copied: branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/WEB-INF/PolicyAttachmentFragment.wsdl (from rev 3112, branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/PolicyAttachmentFragment.wsdl)
===================================================================
--- branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/WEB-INF/PolicyAttachmentFragment.wsdl (rev 0)
+++ branches/JBWS-856/jbossws-tests/src/resources/jaxws/samples/wssecuritypolicy/WEB-INF/PolicyAttachmentFragment.wsdl 2007-05-16 20:47:45 UTC (rev 3113)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<definitions name="TestService" targetNamespace="http://org.jboss.ws/samples/wssecuritypolicy"
+ xmlns:tns="http://org.jboss.ws/samples/wssecuritypolicy"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:sp="http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit...">
+ <wsp:Policy wsu:Id="X509EndpointPolicy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:jboss-ws-security xmlns:sp="http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
+ <sp:key-store-file>WEB-INF/wsse.keystore</sp:key-store-file>
+ <sp:key-store-password>jbossws</sp:key-store-password>
+ <sp:trust-store-file>WEB-INF/wsse.truststore</sp:trust-store-file>
+ <sp:trust-store-password>jbossws</sp:trust-store-password>
+ <sp:config>
+ <sp:encrypt type="x509v3" alias="wsse"/>
+ <sp:requires>
+ <sp:encryption/>
+ </sp:requires>
+ </sp:config>
+ </sp:jboss-ws-security>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ <binding name='HelloBinding' type='tns:Hello'>
+ <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
+ <wsp:PolicyReference URI="#X509EndpointPolicy" wsdl:required="true" />
+ </binding>
+ <service name='HelloService'>
+ <port binding='tns:HelloBinding' name='HelloPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>
17 years, 4 months
JBossWS SVN: r3112 - in branches/JBWS-856/jbossws-core/src/java/org/jboss/ws: extensions/policy/deployer/domainAssertion and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: palin
Date: 2007-05-16 15:58:28 -0400 (Wed, 16 May 2007)
New Revision: 3112
Added:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java
Modified:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/NopAssertionDeployer.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
Log:
Partial commit: still refactoring policy metadata generation
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java 2007-05-16 19:47:00 UTC (rev 3111)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/PolicyDeployer.java 2007-05-16 19:58:28 UTC (rev 3112)
@@ -33,6 +33,7 @@
import org.apache.ws.policy.XorCompositeAssertion;
import org.jboss.logging.Logger;
import org.jboss.ws.extensions.policy.deployer.domainAssertion.AssertionDeployer;
+import org.jboss.ws.extensions.policy.deployer.domainAssertion.NopAssertionDeployer;
import org.jboss.ws.extensions.policy.deployer.domainAssertion.WSSecurityAssertionDeployer;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAlternative;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
@@ -69,19 +70,19 @@
}
//for test
- public static PolicyDeployer newInstance(Map<String,Class> specialDomainMap)
+ public static PolicyDeployer newInstance(Map<String,Class> customDomainMap)
{
PolicyDeployer instance = new PolicyDeployer();
- instance.domainDeployerMap = specialDomainMap;
+ instance.domainDeployerMap = customDomainMap;
return instance;
}
-// for tools
+ //for tools
public static PolicyDeployer newInstanceForTools()
{
PolicyDeployer instance = new PolicyDeployer();
- instance.domainDeployerMap.put("http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd",NopAssertionDeployer.class);
+ instance.domainDeployerMap.put("http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd", NopAssertionDeployer.class);
return instance;
}
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/NopAssertionDeployer.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/NopAssertionDeployer.java 2007-05-16 19:47:00 UTC (rev 3111)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/NopAssertionDeployer.java 2007-05-16 19:58:28 UTC (rev 3112)
@@ -1,3 +1,24 @@
+/*
+ * 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.extensions.policy.deployer.domainAssertion;
import org.apache.ws.policy.PrimitiveAssertion;
@@ -4,19 +25,30 @@
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
+/**
+ * This assertion deployer actually does nothing when asked to
+ * deploy a policy assertion. It is used as a placeholder by
+ * PolicyDeployer in case no modification to umdm or anything
+ * else is actually required (for example when running the
+ * wsprovide tool).
+ *
+ * @author Stefano Maestri <mailto:stefano.maestri@javalinux.it>
+ * @author Alessio Soldano <mailto:alessio.soldano@javalinux.it>
+ *
+ * @since 16-May-2007
+ *
+ */
public class NopAssertionDeployer implements AssertionDeployer
{
public void deployClientSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion
{
- // TODO Auto-generated method stub
-
+ //nop
}
public void deployServerSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion
{
- // TODO Auto-generated method stub
-
+ //nop
}
}
Added: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java (rev 0)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/metadata/PolicyMetaDataBuilder.java 2007-05-16 19:58:28 UTC (rev 3112)
@@ -0,0 +1,299 @@
+/*
+ * 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.extensions.policy.metadata;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.apache.ws.policy.Policy;
+import org.apache.ws.policy.PolicyReference;
+import org.apache.ws.policy.util.DOMPolicyReader;
+import org.apache.ws.policy.util.PolicyFactory;
+import org.apache.ws.policy.util.PolicyRegistry;
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.extensions.policy.PolicyScopeLevel;
+import org.jboss.ws.extensions.policy.annotation.PolicyAttachment;
+import org.jboss.ws.extensions.policy.deployer.PolicyDeployer;
+import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedPolicy;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.metadata.wsdl.WSDLBinding;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.metadata.wsdl.WSDLExtensibilityElement;
+import org.jboss.ws.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.metadata.wsdl.WSDLService;
+
+/**
+ * @author Alessio Soldano, <mailto:alessio.soldano@javalinux.it>
+ *
+ * since 16-May-2007
+ */
+public class PolicyMetaDataBuilder
+{
+ private static final Logger log = Logger.getLogger(PolicyMetaDataBuilder.class);
+ private boolean serverSide = true;
+ private boolean toolMode = false;
+
+ public PolicyMetaDataBuilder()
+ {
+
+ }
+
+ /**
+ * Creates a new PolicyMetaDataBuilder for server side policy processing.
+ *
+ * @param toolMode True if running wsprovide (no policy deployments)
+ * @return
+ */
+ public static PolicyMetaDataBuilder getServerSidePolicyMetaDataBuilder(boolean toolMode) {
+ PolicyMetaDataBuilder builder = new PolicyMetaDataBuilder();
+ builder.setServerSide(true);
+ builder.setToolMode(toolMode);
+ return builder;
+ }
+
+ /**
+ * Creates a new PolicyMetaDataBuilder for client side policy processing.
+ *
+ * @return
+ */
+ public static PolicyMetaDataBuilder getClientSidePolicyMetaDataBuilder() {
+ PolicyMetaDataBuilder builder = new PolicyMetaDataBuilder();
+ builder.setServerSide(false);
+ return builder;
+ }
+
+ public void processPolicyAnnotations(EndpointMetaData epMetaData, Class<?> sepClass, UnifiedDeploymentInfo udi)
+ {
+ for (org.jboss.ws.extensions.policy.annotation.Policy policy : sepClass.getAnnotation(PolicyAttachment.class).value())
+ {
+ InputStream is = null;
+ try
+ {
+ DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
+ is = udi.getMetaDataFileURL(policy.policyFileLocation()).openStream();
+ Policy unnormalizedPolicy = reader.readPolicy(is);
+ Policy normPolicy = (Policy)unnormalizedPolicy.normalize();
+ log.info("Deploying Annotated Policy = "+policy.policyFileLocation());
+ PolicyScopeLevel scope = policy.scope();
+ if (PolicyScopeLevel.WSDL_PORT.equals(scope) || PolicyScopeLevel.WSDL_PORT_TYPE.equals(scope) ||
+ PolicyScopeLevel.WSDL_BINDING.equals(scope))
+ {
+ deployPolicy(normPolicy, scope, epMetaData);
+ }
+ else
+ {
+ throw new WSException("Policy scope "+scope+" not supported yet!");
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ } finally
+ {
+ try
+ {
+ is.close();
+ } catch (Exception e) {}
+ }
+ }
+ }
+
+ public void processPolicyExtensions(EndpointMetaData epMetaData, WSDLDefinitions wsdlDefinitions)
+ {
+ //Collect all policies defined in our wsdl definitions
+ DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
+ PolicyRegistry localPolicyRegistry = new PolicyRegistry();
+ for (WSDLExtensibilityElement policyElement : wsdlDefinitions.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICY))
+ {
+ Policy policy = reader.readPolicy(policyElement.getElement());
+ localPolicyRegistry.register(policy.getPolicyURI(), policy);
+ }
+ //Port scope
+ WSDLService wsdlService = wsdlDefinitions.getService(epMetaData.getServiceMetaData().getServiceName());
+ if (wsdlService != null)
+ {
+ WSDLEndpoint wsdlEndpoint = wsdlService.getEndpoint(epMetaData.getPortName());
+ if (wsdlEndpoint != null)
+ {
+ List<WSDLExtensibilityElement> portPolicyRefList = wsdlEndpoint.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
+ processPolicies(portPolicyRefList, PolicyScopeLevel.WSDL_PORT, localPolicyRegistry, epMetaData);
+ }
+ else
+ {
+ log.warn("Cannot get port '"+epMetaData.getPortName()+"' from the given wsdl definitions! Eventual policies attached to this port won't be considered.");
+ }
+ }
+ else
+ {
+ log.warn("Cannot get service '"+epMetaData.getServiceMetaData().getServiceName()+"' from the given wsdl definitions! Eventual policies attached to this service won't be considered.");
+ }
+
+ //Binding scope
+ WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(epMetaData.getPortTypeName());
+ if (wsdlBinding != null)
+ {
+ List<WSDLExtensibilityElement> bindingPolicyRefList = wsdlBinding.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
+ processPolicies(bindingPolicyRefList, PolicyScopeLevel.WSDL_BINDING, localPolicyRegistry, epMetaData);
+ }
+ else
+ {
+ log.warn("Cannot get binding for portType '"+epMetaData.getPortTypeName()+"' from the given wsdl definitions! Eventual policies attached to this binding won't be considered.");
+ }
+
+ //PortType scope
+ WSDLInterface wsdlInterface = wsdlDefinitions.getInterface(epMetaData.getPortTypeName());
+ if (wsdlInterface != null)
+ {
+ List<WSDLExtensibilityElement> portTypePolicyRefList = wsdlInterface.getExtensibilityElements(Constants.WSDL_PROPERTY_POLICYURIS);
+ processPolicies(portTypePolicyRefList, PolicyScopeLevel.WSDL_PORT_TYPE, localPolicyRegistry, epMetaData);
+ }
+ else
+ {
+ log.warn("Cannot get portType '"+epMetaData.getPortTypeName()+"' from the given wsdl definitions! Eventual policies attached to this portType won't be considered.");
+ }
+ }
+
+ private void processPolicies(List<WSDLExtensibilityElement> policyReferences, PolicyScopeLevel scope, PolicyRegistry localPolicies, ExtensibleMetaData extMetaData)
+ {
+ if (policyReferences != null && policyReferences.size() != 0 && extMetaData instanceof ServerEndpointMetaData)
+ {
+ DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
+ for (WSDLExtensibilityElement element : policyReferences)
+ {
+ PolicyReference policyRef = reader.readPolicyReference(element.getElement());
+ Policy normPolicy;
+ try
+ {
+ normPolicy = (Policy)policyRef.normalize(localPolicies);
+ }
+ catch (RuntimeException e)
+ {
+ //TODO!!! not a local policy: get the policy definition and create the policy
+ normPolicy = null;
+ }
+ deployPolicy(normPolicy, scope, extMetaData);
+ }
+ }
+ }
+
+ /**
+ * Implementors should add PolicyMetaDataExt to the provided ExtensibleMetaData according
+ * to the specified policy and policy scope.
+ *
+ * @param policy
+ * @param scope
+ * @param extMetaData
+ */
+ protected void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData)
+ {
+ PolicyDeployer deployer;
+ if (toolMode)
+ {
+ deployer = PolicyDeployer.newInstanceForTools();
+ }
+ else
+ {
+ deployer = PolicyDeployer.getInstance();
+ }
+ if (serverSide)
+ {
+ deployPolicyServerSide(policy, scope, extMetaData, deployer);
+ }
+ else
+ {
+ deployPolicyClientSide(policy, scope, extMetaData, deployer);
+ }
+ }
+
+
+ protected void deployPolicyServerSide(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData, PolicyDeployer deployer)
+ {
+ PolicyMetaExtension ext = (PolicyMetaExtension)extMetaData.getExtension(Constants.URI_WS_POLICY);
+ if (ext == null)
+ {
+ ext = new PolicyMetaExtension(Constants.URI_WS_POLICY);
+ extMetaData.addExtension(ext);
+ }
+ try
+ {
+ Policy deployedPolicy = deployer.deployServerside(policy, extMetaData);
+ ext.addPolicy(scope,deployedPolicy);
+ }
+ catch (UnsupportedPolicy e)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Policy Not supported:" + policy.getPolicyURI());
+ }
+ }
+ }
+
+
+ protected void deployPolicyClientSide(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData, PolicyDeployer deployer)
+ {
+ PolicyMetaExtension ext = (PolicyMetaExtension)extMetaData.getExtension(Constants.URI_WS_POLICY);
+ if (ext == null)
+ {
+ ext = new PolicyMetaExtension(Constants.URI_WS_POLICY);
+ extMetaData.addExtension(ext);
+ }
+ try
+ {
+ deployer.deployClientSide(policy, extMetaData);
+ ext.addPolicy(scope, policy);
+ }
+ catch (UnsupportedPolicy e)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Policy Not supported:" + policy.getPolicyURI());
+ }
+ WSException.rethrow("Policy not supported! " + policy.getPolicyURI(), e);
+ }
+ }
+
+ public boolean isServerSide()
+ {
+ return serverSide;
+ }
+
+ public void setServerSide(boolean serverSide)
+ {
+ this.serverSide = serverSide;
+ }
+
+ public boolean isToolMode()
+ {
+ return toolMode;
+ }
+
+ public void setToolMode(boolean toolMode)
+ {
+ this.toolMode = toolMode;
+ }
+}
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-05-16 19:47:00 UTC (rev 3111)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-05-16 19:58:28 UTC (rev 3112)
@@ -39,6 +39,7 @@
import org.jboss.ws.extensions.policy.PolicyScopeLevel;
import org.jboss.ws.extensions.policy.deployer.PolicyDeployer;
import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedPolicy;
+import org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder;
import org.jboss.ws.extensions.policy.metadata.PolicyMetaExtension;
import org.jboss.ws.integration.ResourceLoaderAdapter;
import org.jboss.ws.integration.UnifiedVirtualFile;
@@ -93,7 +94,9 @@
// Setup policies for each endpoint
for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
{
- processPolicyMetaDataExtension(epMetaData, wsdlDefinitions);
+ PolicyMetaDataBuilder policyBuilder = PolicyMetaDataBuilder.getClientSidePolicyMetaDataBuilder();
+ policyBuilder.processPolicyExtensions(epMetaData, wsdlDefinitions);
+ //processPolicyMetaDataExtension(epMetaData, wsdlDefinitions);
}
// Read the WSDL and initialize the schema model
@@ -307,25 +310,25 @@
}
- protected void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData)
- {
- PolicyMetaExtension ext = (PolicyMetaExtension)extMetaData.getExtension(Constants.URI_WS_POLICY);
- if (ext == null)
- {
- ext = new PolicyMetaExtension(Constants.URI_WS_POLICY);
- extMetaData.addExtension(ext);
- }
- try
- {
- PolicyDeployer.getInstance().deployClientSide(policy, extMetaData);
- ext.addPolicy(scope, policy);
- }
- catch (UnsupportedPolicy e)
- {
- if (log.isDebugEnabled())
- {
- log.debug("Policy Not supported:" + policy.getPolicyURI());
- }
- }
- }
+// protected void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData)
+// {
+// PolicyMetaExtension ext = (PolicyMetaExtension)extMetaData.getExtension(Constants.URI_WS_POLICY);
+// if (ext == null)
+// {
+// ext = new PolicyMetaExtension(Constants.URI_WS_POLICY);
+// extMetaData.addExtension(ext);
+// }
+// try
+// {
+// PolicyDeployer.getInstance().deployClientSide(policy, extMetaData);
+// ext.addPolicy(scope, policy);
+// }
+// catch (UnsupportedPolicy e)
+// {
+// if (log.isDebugEnabled())
+// {
+// log.debug("Policy Not supported:" + policy.getPolicyURI());
+// }
+// }
+// }
}
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2007-05-16 19:47:00 UTC (rev 3111)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2007-05-16 19:58:28 UTC (rev 3112)
@@ -974,128 +974,128 @@
}
- protected void processPolicyAnnotation(EndpointMetaData epMetaData, Class<?> sepClass, UnifiedDeploymentInfo udi)
- {
- for (org.jboss.ws.extensions.policy.annotation.Policy policy : sepClass.getAnnotation(PolicyAttachment.class).value())
- {
- InputStream is = null;
- try
- {
- DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
- is = udi.getMetaDataFileURL(policy.policyFileLocation()).openStream();
- Policy unnormalizedPolicy = reader.readPolicy(is);
- Policy normPolicy = (Policy)unnormalizedPolicy.normalize();
- log.info("Deploying Annotated Policy = "+policy.policyFileLocation());
- PolicyScopeLevel scope = policy.scope();
- if (PolicyScopeLevel.WSDL_PORT.equals(scope) || PolicyScopeLevel.WSDL_PORT_TYPE.equals(scope) ||
- PolicyScopeLevel.WSDL_BINDING.equals(scope))
- {
- deployPolicy(normPolicy, scope, epMetaData);
- }
- else
- {
- throw new WSException("Policy scope "+scope+" not supported yet!");
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- } finally
- {
- try
- {
- is.close();
- } catch (Exception e) {}
- }
- }
- }
+// protected void processPolicyAnnotation(EndpointMetaData epMetaData, Class<?> sepClass, UnifiedDeploymentInfo udi)
+// {
+// for (org.jboss.ws.extensions.policy.annotation.Policy policy : sepClass.getAnnotation(PolicyAttachment.class).value())
+// {
+// InputStream is = null;
+// try
+// {
+// DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
+// is = udi.getMetaDataFileURL(policy.policyFileLocation()).openStream();
+// Policy unnormalizedPolicy = reader.readPolicy(is);
+// Policy normPolicy = (Policy)unnormalizedPolicy.normalize();
+// log.info("Deploying Annotated Policy = "+policy.policyFileLocation());
+// PolicyScopeLevel scope = policy.scope();
+// if (PolicyScopeLevel.WSDL_PORT.equals(scope) || PolicyScopeLevel.WSDL_PORT_TYPE.equals(scope) ||
+// PolicyScopeLevel.WSDL_BINDING.equals(scope))
+// {
+// deployPolicy(normPolicy, scope, epMetaData);
+// }
+// else
+// {
+// throw new WSException("Policy scope "+scope+" not supported yet!");
+// }
+// }
+// catch (Exception e)
+// {
+// e.printStackTrace();
+// } finally
+// {
+// try
+// {
+// is.close();
+// } catch (Exception e) {}
+// }
+// }
+// }
+//
+// protected void processPolicyMetaDataExtension(EndpointMetaData epMetaData, WSDLDefinitions wsdlDefinitions)
+// {
+// //Collect all policies defined in our wsdl definitions
+// DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
+// PolicyRegistry localPolicyRegistry = new PolicyRegistry();
+// for (WSDLExtensibilityElement policyElement : wsdlDefinitions.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICY))
+// {
+// Policy policy = reader.readPolicy(policyElement.getElement());
+// localPolicyRegistry.register(policy.getPolicyURI(), policy);
+// }
+// //Port scope
+// WSDLService wsdlService = wsdlDefinitions.getService(epMetaData.getServiceMetaData().getServiceName());
+// if (wsdlService != null)
+// {
+// WSDLEndpoint wsdlEndpoint = wsdlService.getEndpoint(epMetaData.getPortName());
+// if (wsdlEndpoint != null)
+// {
+// List<WSDLExtensibilityElement> portPolicyRefList = wsdlEndpoint.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
+// deployPolicies(portPolicyRefList, PolicyScopeLevel.WSDL_PORT, localPolicyRegistry, epMetaData);
+// }
+// else
+// {
+// log.warn("Cannot get port '"+epMetaData.getPortName()+"' from the given wsdl definitions! Eventual policies attached to this port won't be considered.");
+// }
+// }
+// else
+// {
+// log.warn("Cannot get service '"+epMetaData.getServiceMetaData().getServiceName()+"' from the given wsdl definitions! Eventual policies attached to this service won't be considered.");
+// }
+//
+// //Binding scope
+// WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(epMetaData.getPortTypeName());
+// if (wsdlBinding != null)
+// {
+// List<WSDLExtensibilityElement> bindingPolicyRefList = wsdlBinding.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
+// deployPolicies(bindingPolicyRefList, PolicyScopeLevel.WSDL_BINDING, localPolicyRegistry, epMetaData);
+// }
+// else
+// {
+// log.warn("Cannot get binding for portType '"+epMetaData.getPortTypeName()+"' from the given wsdl definitions! Eventual policies attached to this binding won't be considered.");
+// }
+//
+// //PortType scope
+// WSDLInterface wsdlInterface = wsdlDefinitions.getInterface(epMetaData.getPortTypeName());
+// if (wsdlInterface != null)
+// {
+// List<WSDLExtensibilityElement> portTypePolicyRefList = wsdlInterface.getExtensibilityElements(Constants.WSDL_PROPERTY_POLICYURIS);
+// deployPolicies(portTypePolicyRefList, PolicyScopeLevel.WSDL_PORT_TYPE, localPolicyRegistry, epMetaData);
+// }
+// else
+// {
+// log.warn("Cannot get portType '"+epMetaData.getPortTypeName()+"' from the given wsdl definitions! Eventual policies attached to this portType won't be considered.");
+// }
+// }
+//
+// private void deployPolicies(List<WSDLExtensibilityElement> policyReferences, PolicyScopeLevel scope, PolicyRegistry localPolicies, ExtensibleMetaData extMetaData)
+// {
+// if (policyReferences != null && policyReferences.size() != 0 && extMetaData instanceof ServerEndpointMetaData)
+// {
+// DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
+// for (WSDLExtensibilityElement element : policyReferences)
+// {
+// PolicyReference policyRef = reader.readPolicyReference(element.getElement());
+// Policy normPolicy;
+// try
+// {
+// normPolicy = (Policy)policyRef.normalize(localPolicies);
+// }
+// catch (RuntimeException e)
+// {
+// //TODO!!! not a local policy: get the policy definition and create the policy
+// normPolicy = null;
+// }
+// deployPolicy(normPolicy, scope, extMetaData);
+// }
+// }
+// }
+//
+// /**
+// * Implementors should add PolicyMetaDataExt to the provided ExtensibleMetaData according
+// * to the specified policy and policy scope.
+// *
+// * @param policy
+// * @param scope
+// * @param extMetaData
+// */
+// protected abstract void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData);
- protected void processPolicyMetaDataExtension(EndpointMetaData epMetaData, WSDLDefinitions wsdlDefinitions)
- {
- //Collect all policies defined in our wsdl definitions
- DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
- PolicyRegistry localPolicyRegistry = new PolicyRegistry();
- for (WSDLExtensibilityElement policyElement : wsdlDefinitions.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICY))
- {
- Policy policy = reader.readPolicy(policyElement.getElement());
- localPolicyRegistry.register(policy.getPolicyURI(), policy);
- }
- //Port scope
- WSDLService wsdlService = wsdlDefinitions.getService(epMetaData.getServiceMetaData().getServiceName());
- if (wsdlService != null)
- {
- WSDLEndpoint wsdlEndpoint = wsdlService.getEndpoint(epMetaData.getPortName());
- if (wsdlEndpoint != null)
- {
- List<WSDLExtensibilityElement> portPolicyRefList = wsdlEndpoint.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
- deployPolicies(portPolicyRefList, PolicyScopeLevel.WSDL_PORT, localPolicyRegistry, epMetaData);
- }
- else
- {
- log.warn("Cannot get port '"+epMetaData.getPortName()+"' from the given wsdl definitions! Eventual policies attached to this port won't be considered.");
- }
- }
- else
- {
- log.warn("Cannot get service '"+epMetaData.getServiceMetaData().getServiceName()+"' from the given wsdl definitions! Eventual policies attached to this service won't be considered.");
- }
-
- //Binding scope
- WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(epMetaData.getPortTypeName());
- if (wsdlBinding != null)
- {
- List<WSDLExtensibilityElement> bindingPolicyRefList = wsdlBinding.getExtensibilityElements(Constants.WSDL_ELEMENT_POLICYREFERENCE);
- deployPolicies(bindingPolicyRefList, PolicyScopeLevel.WSDL_BINDING, localPolicyRegistry, epMetaData);
- }
- else
- {
- log.warn("Cannot get binding for portType '"+epMetaData.getPortTypeName()+"' from the given wsdl definitions! Eventual policies attached to this binding won't be considered.");
- }
-
- //PortType scope
- WSDLInterface wsdlInterface = wsdlDefinitions.getInterface(epMetaData.getPortTypeName());
- if (wsdlInterface != null)
- {
- List<WSDLExtensibilityElement> portTypePolicyRefList = wsdlInterface.getExtensibilityElements(Constants.WSDL_PROPERTY_POLICYURIS);
- deployPolicies(portTypePolicyRefList, PolicyScopeLevel.WSDL_PORT_TYPE, localPolicyRegistry, epMetaData);
- }
- else
- {
- log.warn("Cannot get portType '"+epMetaData.getPortTypeName()+"' from the given wsdl definitions! Eventual policies attached to this portType won't be considered.");
- }
- }
-
- private void deployPolicies(List<WSDLExtensibilityElement> policyReferences, PolicyScopeLevel scope, PolicyRegistry localPolicies, ExtensibleMetaData extMetaData)
- {
- if (policyReferences != null && policyReferences.size() != 0 && extMetaData instanceof ServerEndpointMetaData)
- {
- DOMPolicyReader reader = (DOMPolicyReader) PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
- for (WSDLExtensibilityElement element : policyReferences)
- {
- PolicyReference policyRef = reader.readPolicyReference(element.getElement());
- Policy normPolicy;
- try
- {
- normPolicy = (Policy)policyRef.normalize(localPolicies);
- }
- catch (RuntimeException e)
- {
- //TODO!!! not a local policy: get the policy definition and create the policy
- normPolicy = null;
- }
- deployPolicy(normPolicy, scope, extMetaData);
- }
- }
- }
-
- /**
- * Implementors should add PolicyMetaDataExt to the provided ExtensibleMetaData according
- * to the specified policy and policy scope.
- *
- * @param policy
- * @param scope
- * @param extMetaData
- */
- protected abstract void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData);
-
}
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2007-05-16 19:47:00 UTC (rev 3111)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSServerMetaDataBuilder.java 2007-05-16 19:58:28 UTC (rev 3112)
@@ -161,25 +161,25 @@
}
}
- protected void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData)
- {
- PolicyMetaExtension ext = (PolicyMetaExtension)extMetaData.getExtension(Constants.URI_WS_POLICY);
- if (ext == null)
- {
- ext = new PolicyMetaExtension(Constants.URI_WS_POLICY);
- extMetaData.addExtension(ext);
- }
- try
- {
- Policy deployedPolicy = PolicyDeployer.getInstance().deployServerside(policy, extMetaData);
- ext.addPolicy(scope,deployedPolicy);
- }
- catch (UnsupportedPolicy e)
- {
- if (log.isDebugEnabled())
- {
- log.debug("Policy Not supported:" + policy.getPolicyURI());
- }
- }
- }
+// protected void deployPolicy(Policy policy, PolicyScopeLevel scope, ExtensibleMetaData extMetaData)
+// {
+// PolicyMetaExtension ext = (PolicyMetaExtension)extMetaData.getExtension(Constants.URI_WS_POLICY);
+// if (ext == null)
+// {
+// ext = new PolicyMetaExtension(Constants.URI_WS_POLICY);
+// extMetaData.addExtension(ext);
+// }
+// try
+// {
+// Policy deployedPolicy = PolicyDeployer.getInstance().deployServerside(policy, extMetaData);
+// ext.addPolicy(scope,deployedPolicy);
+// }
+// catch (UnsupportedPolicy e)
+// {
+// if (log.isDebugEnabled())
+// {
+// log.debug("Policy Not supported:" + policy.getPolicyURI());
+// }
+// }
+// }
}
Modified: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-05-16 19:47:00 UTC (rev 3111)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-05-16 19:58:28 UTC (rev 3112)
@@ -38,6 +38,7 @@
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
import org.jboss.ws.core.utils.IOUtils;
import org.jboss.ws.extensions.policy.annotation.PolicyAttachment;
+import org.jboss.ws.extensions.policy.metadata.PolicyMetaDataBuilder;
import org.jboss.ws.metadata.builder.MetaDataBuilder;
import org.jboss.ws.metadata.umdm.*;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
@@ -139,6 +140,13 @@
if (toolMode)
return sepMetaData;
+ //Process an optional @PolicyAttachment annotation
+ if (sepClass.isAnnotationPresent(PolicyAttachment.class))
+ {
+ PolicyMetaDataBuilder policyBuilder = PolicyMetaDataBuilder.getServerSidePolicyMetaDataBuilder(toolMode);
+ policyBuilder.processPolicyAnnotations(sepMetaData, sepClass, udi);
+ }
+
// Sanity check: read the generated WSDL and initialize the schema model
// Note, this should no longer be needed, look into removing it
WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
@@ -160,10 +168,6 @@
else if (seiClass.isAnnotationPresent(HandlerChain.class))
processHandlerChain(sepMetaData, seiClass);
- //Process an optional @PolicyAttachment annotation
- if (sepClass.isAnnotationPresent(PolicyAttachment.class))
- processPolicyAnnotation(sepMetaData, sepClass, udi);
-
// process webservices.xml contributions
processWSDDContribution(sepMetaData);
@@ -344,16 +348,16 @@
if (policyLocation==null || policyLocation.length()==0)
throw new WSException("Missing wsdlFragmentLocation for @Policy on " + sepClass.getName());
result.policyLocation = udi.getMetaDataFileURL(policyLocation);
-// if (result.policyLocation==null) {
-// try
-// {
-// result.policyLocation = new File(policyLocation).toURL();
-// }
-// catch (Exception e)
-// {
-// e.printStackTrace();
-// }
-// }
+ if (result.policyLocation==null) {
+ try
+ {
+ result.policyLocation = new File(policyLocation).toURL();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
System.out.println("Policy Location: ###"+result.policyLocation+"###");
}
@@ -362,6 +366,7 @@
private void processOrGenerateWSDL(Class wsClass, ServiceMetaData serviceMetaData, URL wsdlLocation, EndpointMetaData epMetaData, URL policyLocation)
{
+ PolicyMetaDataBuilder policyBuilder = PolicyMetaDataBuilder.getServerSidePolicyMetaDataBuilder(toolMode);
try
{
WSDLGenerator generator = new JAXBWSDLGenerator(jaxbCtx);
@@ -371,12 +376,12 @@
//we can no longer use the user provided wsdl without parsing it right now, since we
//need to look for policies and eventually choose the supported policy alternatives
WSDLDefinitions wsdlDefinitions = factory.parse(wsdlLocation);
- processPolicyMetaDataExtension(epMetaData, wsdlDefinitions);
+ policyBuilder.processPolicyExtensions(epMetaData, wsdlDefinitions);
if (policyLocation != null)
{
//process wsdl fragment with additional policies
WSDLDefinitions policyDefinitions = factory.parse(policyLocation);
- processPolicyMetaDataExtension(epMetaData, policyDefinitions);
+ policyBuilder.processPolicyExtensions(epMetaData, policyDefinitions);
}
//now we have the UMDM containing policy data; anyway we can't write a new wsdl file with
//the supported alternatives and so on, since we need to publish the file the user provided
@@ -394,7 +399,7 @@
else
{
WSDLDefinitions policyDefinitions = factory.parse(policyLocation);
- processPolicyMetaDataExtension(epMetaData, policyDefinitions);
+ policyBuilder.processPolicyExtensions(epMetaData, policyDefinitions);
//generate the wsdl4j model again for the actual UMDM containing policy data
WSDLDefinitions actualWsdlDefinitions = generator.generate(serviceMetaData);
writeWsdl(serviceMetaData,actualWsdlDefinitions,epMetaData);
17 years, 4 months
JBossWS SVN: r3110 - in branches/jbossws-2.0: jbossws-core/src/java/org/jboss/ws/core/soap and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-05-16 10:57:48 -0400 (Wed, 16 May 2007)
New Revision: 3110
Modified:
branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java
branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
branches/jbossws-2.0/jbossws-tests/ant-import/build-jars-jaxws.xml
branches/jbossws-2.0/jbossws-tests/build.xml
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws801/JBWS801TestCase.java
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleTestCase.java
Log:
Fix JBWS-1579
Modified: branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2007-05-16 13:29:33 UTC (rev 3109)
+++ branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2007-05-16 14:57:48 UTC (rev 3110)
@@ -255,6 +255,9 @@
// metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true"); // since 2.0.0.GA
metadata.put("NoThrowOnError", "true");
+ // Chunked transfer encoding
+ metadata.put("chunkedLength", "1024");
+
if (reqMessage != null)
{
populateHeaders(reqMessage, metadata);
Modified: branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java 2007-05-16 13:29:33 UTC (rev 3109)
+++ branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java 2007-05-16 14:57:48 UTC (rev 3110)
@@ -21,17 +21,15 @@
*/
package org.jboss.ws.core.soap;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
import org.jboss.logging.Logger;
import org.jboss.remoting.InvocationRequest;
import org.jboss.remoting.invocation.OnewayInvocation;
import org.jboss.remoting.marshal.Marshaller;
+import javax.xml.soap.SOAPMessage;
+import java.io.IOException;
+import java.io.OutputStream;
+
/**
* @author Thomas.Diesler(a)jboss.org
* @since 25-Nov-2004
Modified: branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-05-16 13:29:33 UTC (rev 3109)
+++ branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-05-16 14:57:48 UTC (rev 3110)
@@ -23,40 +23,29 @@
//$Id$
-import java.io.IOException;
-import java.net.URL;
-import java.util.*;
-
-import javax.jws.soap.SOAPBinding;
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingType;
-
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
+import org.jboss.ws.annotation.EndpointConfig;
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.jaxws.client.ServiceObjectFactoryJAXWS;
import org.jboss.ws.integration.ResourceLoaderAdapter;
import org.jboss.ws.integration.UnifiedVirtualFile;
-import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedCallPropertyMetaData;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedStubPropertyMetaData;
+import org.jboss.ws.metadata.umdm.*;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
-import org.jboss.ws.metadata.wsdl.WSDLBinding;
-import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
-import org.jboss.ws.metadata.wsdl.WSDLInterface;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
-import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.metadata.wsdl.*;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
-import org.jboss.ws.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
-import org.jboss.ws.metadata.j2ee.serviceref.UnifiedStubPropertyMetaData;
-import org.jboss.ws.metadata.j2ee.serviceref.UnifiedCallPropertyMetaData;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingType;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Iterator;
+
/**
* A client side meta data builder.
*
@@ -269,6 +258,7 @@
processSOAPBinding(epMetaData, wsClass);
// process config, this will as well setup the handler
+ processEndpointConfig(epMetaData, wsClass);
epMetaData.initEndpointConfig();
// Process an optional @HandlerChain annotation
@@ -293,4 +283,18 @@
if(log.isDebugEnabled()) log.debug("END: rebuildMetaData\n" + epMetaData.getServiceMetaData());
}
+
+ /**
+ * Process config contribution through service endpoint interfaces
+ * @param epMetaData
+ * @param wsClass - the service endpoint interface
+ */
+ private void processEndpointConfig(EndpointMetaData epMetaData, Class<?> wsClass)
+ {
+ if (wsClass.isAnnotationPresent(EndpointConfig.class))
+ {
+ EndpointConfig anConfig = wsClass.getAnnotation(EndpointConfig.class);
+ epMetaData.setConfigName(anConfig.configName(), anConfig.configFile());
+ }
+ }
}
Modified: branches/jbossws-2.0/jbossws-tests/ant-import/build-jars-jaxws.xml
===================================================================
--- branches/jbossws-2.0/jbossws-tests/ant-import/build-jars-jaxws.xml 2007-05-16 13:29:33 UTC (rev 3109)
+++ branches/jbossws-2.0/jbossws-tests/ant-import/build-jars-jaxws.xml 2007-05-16 14:57:48 UTC (rev 3110)
@@ -139,6 +139,12 @@
</webinf>
</war>
+ <jar jarfile="${tests.output.dir}/libs/jaxws-handlerlifecycle-client.jar">
+ <metainf dir="${tests.output.dir}/resources/jaxws/handlerlifecycle/META-INF">
+ <include name="*.xml"/>
+ </metainf>
+ </jar>
+
<!-- jaxws-handlerscope -->
<war warfile="${tests.output.dir}/libs/jaxws-handlerscope.war" webxml="${tests.output.dir}/resources/jaxws/handlerscope/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
Modified: branches/jbossws-2.0/jbossws-tests/build.xml
===================================================================
--- branches/jbossws-2.0/jbossws-tests/build.xml 2007-05-16 13:29:33 UTC (rev 3109)
+++ branches/jbossws-2.0/jbossws-tests/build.xml 2007-05-16 14:57:48 UTC (rev 3110)
@@ -253,7 +253,7 @@
<classpath location="${thirdparty.dir}/jaxb-xjc.jar"/>
</taskdef>
- <wsconsume wsdl="${tests.resources.dir}/benchmark/jaxws/doclit/WEB-INF/wsdl/BenchmarkWebService.wsdl" package="org.jboss.test.ws.benchmark.jaxws.doclit" sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true" verbose="true"/>
+ <wsconsume wsdl="${tests.resources.dir}/benchmark/jaxws/doclit/WEB-INF/wsdl/BenchmarkWebService.wsdl" package="org.jboss.test.ws.benchmark.jaxws.doclit" sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true" verbose="false"/>
<wsconsume wsdl="${tests.resources.dir}/interop/soapwsdl/BaseDataTypesDocLitB/WEB-INF/wsdl/service.wsdl" package="org.jboss.test.ws.interop.soapwsdl.basedoclitb" sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true"/>
<wsconsume wsdl="${tests.resources.dir}/interop/soapwsdl/BaseDataTypesDocLitW/WEB-INF/wsdl/service.wsdl" package="org.jboss.test.ws.interop.soapwsdl.basedoclitw" sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true"/>
<wsconsume wsdl="${tests.resources.dir}/interop/soapwsdl/BaseDataTypesRpcLit/WEB-INF/wsdl/service.wsdl" package="org.jboss.test.ws.interop.soapwsdl.baserpclit" sourcedestdir="${tests.output.dir}/wsconsume/java" keep="true"/>
Modified: branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws801/JBWS801TestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws801/JBWS801TestCase.java 2007-05-16 13:29:33 UTC (rev 3109)
+++ branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws801/JBWS801TestCase.java 2007-05-16 14:57:48 UTC (rev 3110)
@@ -62,7 +62,7 @@
public void testLargeFile() throws Exception
{
- long size = 6L * 1024L * 1024L;
+ long size = 6L * 1024L * 1024L * 1024L; // approx 600mb
String methodName = "sendLargeFile";
SOAPMessage msg = setupMimeMessage(methodName);
Modified: branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleTestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleTestCase.java 2007-05-16 13:29:33 UTC (rev 3109)
+++ branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleTestCase.java 2007-05-16 14:57:48 UTC (rev 3110)
@@ -27,6 +27,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.StringTokenizer;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
@@ -51,7 +52,7 @@
public static Test suite()
{
- return JBossWSTestSetup.newTestSetup(HandlerLifecycleTestCase.class, "jaxws-handlerlifecycle.war");
+ return JBossWSTestSetup.newTestSetup(HandlerLifecycleTestCase.class, "jaxws-handlerlifecycle.war, jaxws-handlerlifecycle-client.jar");
}
public void setUp() throws Exception
@@ -85,25 +86,43 @@
* All handlers return true
*/
public void testHandleMessageTrue() throws Exception
- {
- System.out.println("FIXME: [JBWS-1579] @EndpointConfig ignored on SEI");
-
+ {
String testResponse = port.runTest(getName());
String trackerMessages = HandlerTracker.getListMessages();
List<String> expMessages = new ArrayList<String>();
+
+ expMessages.add("PreClientHandler1:PostConstruct");
+ expMessages.add("PreClientHandler2:PostConstruct");
expMessages.add("ClientHandler1:PostConstruct");
expMessages.add("ClientHandler2:PostConstruct");
expMessages.add("ClientHandler3:PostConstruct");
+ expMessages.add("PostClientHandler1:PostConstruct");
+ expMessages.add("PostClientHandler2:PostConstruct");
+
+ expMessages.add("PreClientHandler1:Message:OutBound");
+ expMessages.add("PreClientHandler2:Message:OutBound");
expMessages.add("ClientHandler1:Message:OutBound");
expMessages.add("ClientHandler2:Message:OutBound");
expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("PostClientHandler1:Message:OutBound");
+ expMessages.add("PostClientHandler2:Message:OutBound");
+
+ expMessages.add("PostClientHandler2:Message:InBound");
+ expMessages.add("PostClientHandler1:Message:InBound");
expMessages.add("ClientHandler3:Message:InBound");
expMessages.add("ClientHandler2:Message:InBound");
expMessages.add("ClientHandler1:Message:InBound");
+ expMessages.add("PreClientHandler2:Message:InBound");
+ expMessages.add("PreClientHandler1:Message:InBound");
+
+ expMessages.add("PostClientHandler2:Close");
+ expMessages.add("PostClientHandler1:Close");
expMessages.add("ClientHandler3:Close");
expMessages.add("ClientHandler2:Close");
expMessages.add("ClientHandler1:Close");
+ expMessages.add("PreClientHandler2:Close");
+ expMessages.add("PreClientHandler1:Close");
assertEquals(expMessages.toString(), trackerMessages);
trackerMessages = trackerPort.getListMessages();
@@ -159,10 +178,18 @@
String trackerMessages = HandlerTracker.getListMessages();
List<String> expMessages = new ArrayList<String>();
+
+ expMessages.add("PreClientHandler1:Message:OutBound");
+ expMessages.add("PreClientHandler2:Message:OutBound");
expMessages.add("ClientHandler1:Message:OutBound");
expMessages.add("ClientHandler2:Message:OutBound:false");
+ expMessages.add("PostClientHandler2:Close");
+ expMessages.add("PostClientHandler1:Close");
expMessages.add("ClientHandler2:Close");
expMessages.add("ClientHandler1:Close");
+ expMessages.add("PreClientHandler2:Close");
+ expMessages.add("PreClientHandler1:Close");
+
assertEquals(expMessages.toString(), trackerMessages);
trackerMessages = trackerPort.getListMessages();
@@ -172,6 +199,20 @@
assertNull(testResponse);
}
+ private void dumpTracker(String trackerMessages)
+ {
+ StringTokenizer tok = new StringTokenizer(trackerMessages, ",");
+ while(tok.hasMoreTokens())
+ {
+ System.out.print("expMessages.add(\"");
+ String s = tok.nextToken().trim();
+ if(s.startsWith("[")) s = s.substring(1);
+ if(s.endsWith("]")) s = s.substring(0, s.length()-1);
+ System.out.print(s);
+ System.out.print("\");\n");
+ }
+ }
+
/**
* ClientHandler2 throws a RuntimeException on outbound
*/
@@ -190,11 +231,25 @@
String trackerMessages = HandlerTracker.getListMessages();
List<String> expMessages = new ArrayList<String>();
+
+ expMessages.add("PreClientHandler1:Message:OutBound");
+ expMessages.add("PreClientHandler2:Message:OutBound");
expMessages.add("ClientHandler1:Message:OutBound");
expMessages.add("ClientHandler2:Message:OutBound:ErrorInClientHandler2");
+
+ expMessages.add("PostClientHandler2:Fault:InBound");
+ expMessages.add("PostClientHandler1:Fault:InBound");
expMessages.add("ClientHandler1:Fault:InBound");
+ expMessages.add("PreClientHandler2:Fault:InBound");
+ expMessages.add("PreClientHandler1:Fault:InBound");
+
+ expMessages.add("PostClientHandler2:Close");
+ expMessages.add("PostClientHandler1:Close");
expMessages.add("ClientHandler2:Close");
expMessages.add("ClientHandler1:Close");
+ expMessages.add("PreClientHandler2:Close");
+ expMessages.add("PreClientHandler1:Close");
+
assertEquals(expMessages.toString(), trackerMessages);
trackerMessages = trackerPort.getListMessages();
@@ -224,19 +279,34 @@
expMessages.add("ServerHandler3:Close");
expMessages.add("PostServerHandler1:Close");
expMessages.add("PostServerHandler2:Close");
+
assertEquals(expMessages.toString(), trackerMessages);
trackerMessages = HandlerTracker.getListMessages();
expMessages = new ArrayList<String>();
+
+ expMessages.add("PreClientHandler1:Message:OutBound");
+ expMessages.add("PreClientHandler2:Message:OutBound");
expMessages.add("ClientHandler1:Message:OutBound");
expMessages.add("ClientHandler2:Message:OutBound");
expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("PostClientHandler1:Message:OutBound");
+ expMessages.add("PostClientHandler2:Message:OutBound");
+ expMessages.add("PostClientHandler2:Message:InBound");
+ expMessages.add("PostClientHandler1:Message:InBound");
expMessages.add("ClientHandler3:Message:InBound");
expMessages.add("ClientHandler2:Message:InBound");
expMessages.add("ClientHandler1:Message:InBound");
+ expMessages.add("PreClientHandler2:Message:InBound");
+ expMessages.add("PreClientHandler1:Message:InBound");
+ expMessages.add("PostClientHandler2:Close");
+ expMessages.add("PostClientHandler1:Close");
expMessages.add("ClientHandler3:Close");
expMessages.add("ClientHandler2:Close");
expMessages.add("ClientHandler1:Close");
+ expMessages.add("PreClientHandler2:Close");
+ expMessages.add("PreClientHandler1:Close");
+
assertEquals(expMessages.toString(), trackerMessages);
assertEquals("testServerHandler2Response", testResponse);
@@ -271,19 +341,34 @@
expMessages.add("ServerHandler3:Close");
expMessages.add("PostServerHandler1:Close");
expMessages.add("PostServerHandler2:Close");
+
assertEquals(expMessages.toString(), trackerMessages);
trackerMessages = HandlerTracker.getListMessages();
expMessages = new ArrayList<String>();
+
+ expMessages.add("PreClientHandler1:Message:OutBound");
+ expMessages.add("PreClientHandler2:Message:OutBound");
expMessages.add("ClientHandler1:Message:OutBound");
expMessages.add("ClientHandler2:Message:OutBound");
expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("PostClientHandler1:Message:OutBound");
+ expMessages.add("PostClientHandler2:Message:OutBound");
+ expMessages.add("PostClientHandler2:Message:InBound");
+ expMessages.add("PostClientHandler1:Message:InBound");
expMessages.add("ClientHandler3:Fault:InBound");
expMessages.add("ClientHandler2:Fault:InBound");
expMessages.add("ClientHandler1:Fault:InBound");
+ expMessages.add("PreClientHandler2:Fault:InBound");
+ expMessages.add("PreClientHandler1:Fault:InBound");
+ expMessages.add("PostClientHandler2:Close");
+ expMessages.add("PostClientHandler1:Close");
expMessages.add("ClientHandler3:Close");
expMessages.add("ClientHandler2:Close");
expMessages.add("ClientHandler1:Close");
+ expMessages.add("PreClientHandler2:Close");
+ expMessages.add("PreClientHandler1:Close");
+
assertEquals(expMessages.toString(), trackerMessages);
assertEquals("ErrorInServerHandler2", testResponse);
@@ -320,15 +405,29 @@
trackerMessages = HandlerTracker.getListMessages();
expMessages = new ArrayList<String>();
+
+ expMessages.add("PreClientHandler1:Message:OutBound");
+ expMessages.add("PreClientHandler2:Message:OutBound");
expMessages.add("ClientHandler1:Message:OutBound");
expMessages.add("ClientHandler2:Message:OutBound");
expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("PostClientHandler1:Message:OutBound");
+ expMessages.add("PostClientHandler2:Message:OutBound");
+ expMessages.add("PostClientHandler2:Message:InBound");
+ expMessages.add("PostClientHandler1:Message:InBound");
expMessages.add("ClientHandler3:Message:InBound");
expMessages.add("ClientHandler2:Message:InBound");
expMessages.add("ClientHandler1:Message:InBound");
+ expMessages.add("PreClientHandler2:Message:InBound");
+ expMessages.add("PreClientHandler1:Message:InBound");
+ expMessages.add("PostClientHandler2:Close");
+ expMessages.add("PostClientHandler1:Close");
expMessages.add("ClientHandler3:Close");
expMessages.add("ClientHandler2:Close");
expMessages.add("ClientHandler1:Close");
+ expMessages.add("PreClientHandler2:Close");
+ expMessages.add("PreClientHandler1:Close");
+
assertEquals(expMessages.toString(), trackerMessages);
assertEquals(getName() + "Response", testResponse);
@@ -377,15 +476,29 @@
trackerMessages = HandlerTracker.getListMessages();
expMessages = new ArrayList<String>();
+
+ expMessages.add("PreClientHandler1:Message:OutBound");
+ expMessages.add("PreClientHandler2:Message:OutBound");
expMessages.add("ClientHandler1:Message:OutBound");
expMessages.add("ClientHandler2:Message:OutBound");
expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("PostClientHandler1:Message:OutBound");
+ expMessages.add("PostClientHandler2:Message:OutBound");
+ expMessages.add("PostClientHandler2:Message:InBound");
+ expMessages.add("PostClientHandler1:Message:InBound");
expMessages.add("ClientHandler3:Fault:InBound");
expMessages.add("ClientHandler2:Fault:InBound");
expMessages.add("ClientHandler1:Fault:InBound");
+ expMessages.add("PreClientHandler2:Fault:InBound");
+ expMessages.add("PreClientHandler1:Fault:InBound");
+ expMessages.add("PostClientHandler2:Close");
+ expMessages.add("PostClientHandler1:Close");
expMessages.add("ClientHandler3:Close");
expMessages.add("ClientHandler2:Close");
expMessages.add("ClientHandler1:Close");
+ expMessages.add("PreClientHandler2:Close");
+ expMessages.add("PreClientHandler1:Close");
+
assertEquals(expMessages.toString(), trackerMessages);
assertEquals("ErrorInServerHandler2", testResponse);
@@ -400,14 +513,26 @@
String trackerMessages = HandlerTracker.getListMessages();
List<String> expMessages = new ArrayList<String>();
+
+ expMessages.add("PreClientHandler1:Message:OutBound");
+ expMessages.add("PreClientHandler2:Message:OutBound");
expMessages.add("ClientHandler1:Message:OutBound");
expMessages.add("ClientHandler2:Message:OutBound");
expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("PostClientHandler1:Message:OutBound");
+ expMessages.add("PostClientHandler2:Message:OutBound");
+ expMessages.add("PostClientHandler2:Message:InBound");
+ expMessages.add("PostClientHandler1:Message:InBound");
expMessages.add("ClientHandler3:Message:InBound");
expMessages.add("ClientHandler2:Message:InBound:false");
+ expMessages.add("PostClientHandler2:Close");
+ expMessages.add("PostClientHandler1:Close");
expMessages.add("ClientHandler3:Close");
expMessages.add("ClientHandler2:Close");
expMessages.add("ClientHandler1:Close");
+ expMessages.add("PreClientHandler2:Close");
+ expMessages.add("PreClientHandler1:Close");
+
assertEquals(expMessages.toString(), trackerMessages);
trackerMessages = trackerPort.getListMessages();
@@ -456,15 +581,29 @@
String trackerMessages = HandlerTracker.getListMessages();
List<String> expMessages = new ArrayList<String>();
+
+ expMessages.add("PreClientHandler1:Message:OutBound");
+ expMessages.add("PreClientHandler2:Message:OutBound");
expMessages.add("ClientHandler1:Message:OutBound");
expMessages.add("ClientHandler2:Message:OutBound");
expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("PostClientHandler1:Message:OutBound");
+ expMessages.add("PostClientHandler2:Message:OutBound");
+ expMessages.add("PostClientHandler2:Message:InBound");
+ expMessages.add("PostClientHandler1:Message:InBound");
expMessages.add("ClientHandler3:Message:InBound");
expMessages.add("ClientHandler2:Message:InBound:ErrorInClientHandler2");
expMessages.add("ClientHandler1:Fault:InBound");
+ expMessages.add("PreClientHandler2:Fault:InBound");
+ expMessages.add("PreClientHandler1:Fault:InBound");
+ expMessages.add("PostClientHandler2:Close");
+ expMessages.add("PostClientHandler1:Close");
expMessages.add("ClientHandler3:Close");
expMessages.add("ClientHandler2:Close");
expMessages.add("ClientHandler1:Close");
+ expMessages.add("PreClientHandler2:Close");
+ expMessages.add("PreClientHandler1:Close");
+
assertEquals(expMessages.toString(), trackerMessages);
trackerMessages = trackerPort.getListMessages();
17 years, 4 months
JBossWS SVN: r3109 - in branches/tdiesler/trunk: integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-05-16 09:29:33 -0400 (Wed, 16 May 2007)
New Revision: 3109
Modified:
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ClassLoaderInjectionDeployer.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml
branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
Log:
restructure
Modified: branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ClassLoaderInjectionDeployer.java
===================================================================
--- branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ClassLoaderInjectionDeployer.java 2007-05-16 13:17:58 UTC (rev 3108)
+++ branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/ClassLoaderInjectionDeployer.java 2007-05-16 13:29:33 UTC (rev 3109)
@@ -25,8 +25,10 @@
import org.jboss.deployers.spi.deployer.DeploymentUnit;
import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.deployment.AbstractDeployer;
import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
/**
* A deployer that injects the correct classloader into the Deployment
@@ -46,12 +48,34 @@
ClassLoader classLoader = unit.getClassLoader();
// Get the webapp context classloader and use it as the deploymet class loader
- WebMetaData webMetaData = unit.getAttachment(WebMetaData.class);
+ WebMetaData webMetaData = dep.getContext().getAttachment(WebMetaData.class);
if (webMetaData != null)
{
classLoader = webMetaData.getContextLoader();
}
dep.setClassLoader(classLoader);
+
+ // Reload target beans with the updated class loader
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ Class targetBean = ep.getTargetBean();
+ if (targetBean != null)
+ {
+ String beanName = targetBean.getName();
+ if (targetBean.getClassLoader() != classLoader)
+ {
+ try
+ {
+ targetBean = classLoader.loadClass(beanName);
+ ep.setTargetBean(targetBean);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new WSDeploymentException("Cannot reload target bean: " + beanName);
+ }
+ }
+ }
+ }
}
}
\ No newline at end of file
Modified: branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java
===================================================================
--- branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java 2007-05-16 13:17:58 UTC (rev 3108)
+++ branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ClassLoaderInjectionDeployer.java 2007-05-16 13:29:33 UTC (rev 3109)
@@ -25,8 +25,10 @@
import org.jboss.deployment.DeploymentInfo;
import org.jboss.metadata.WebMetaData;
+import org.jboss.ws.integration.Endpoint;
import org.jboss.ws.integration.deployment.AbstractDeployer;
import org.jboss.ws.integration.deployment.Deployment;
+import org.jboss.ws.integration.deployment.WSDeploymentException;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
/**
@@ -57,6 +59,28 @@
classLoader = webMetaData.getContextLoader();
}
- umd.setClassLoader(classLoader);
+ dep.setClassLoader(classLoader);
+
+ // Reload target beans with the updated class loader
+ for (Endpoint ep : dep.getService().getEndpoints())
+ {
+ Class targetBean = ep.getTargetBean();
+ if (targetBean != null)
+ {
+ String beanName = targetBean.getName();
+ if (targetBean.getClassLoader() != classLoader)
+ {
+ try
+ {
+ targetBean = classLoader.loadClass(beanName);
+ ep.setTargetBean(targetBean);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new WSDeploymentException("Cannot reload target bean: " + beanName);
+ }
+ }
+ }
+ }
}
}
\ No newline at end of file
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 13:17:58 UTC (rev 3108)
+++ branches/tdiesler/trunk/integration/jbws-jboss50/src/main/resources/jbossws.sar/META-INF/jbossws-beans.xml 2007-05-16 13:29:33 UTC (rev 3109)
@@ -128,7 +128,7 @@
The Deployers
Each handles a single aspect of web service deployment
-->
- <bean name="WSClassLoaderInjectionDeployer" class="org.jboss.ws.integration.jboss50.jbossws.ClassLoaderInjectionDeployer"/>
+ <bean name="WSClassLoaderInjectionDeployer" class="org.jboss.ws.integration.jboss50.ClassLoaderInjectionDeployer"/>
<bean name="WSEagerInitializeDeployer" class="org.jboss.ws.core.deployment.EagerInitializeDeployer"/>
<bean name="WSEndpointHandlerDeployer" class="org.jboss.ws.integration.deployment.EndpointHandlerDeployer">
<property name="requestHandler">org.jboss.ws.core.server.RequestHandlerImpl</property>
Modified: 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 2007-05-16 13:17:58 UTC (rev 3108)
+++ branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-05-16 13:29:33 UTC (rev 3109)
@@ -438,7 +438,17 @@
}
}
- Method implMethod = implClass.getMethod(methodName, paramTypes);
+ Method implMethod = null;
+ try
+ {
+ implMethod = implClass.getMethod(methodName, paramTypes);
+ }
+ catch (NoSuchMethodException ex)
+ {
+ log.error("CodeSource: " + implClass.getProtectionDomain().getCodeSource());
+ log.error("ClassLoader: " + implClass.getClassLoader());
+ throw ex;
+ }
return implMethod;
}
17 years, 4 months
JBossWS SVN: r3108 - branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/extensions/security.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-05-16 09:17:58 -0400 (Wed, 16 May 2007)
New Revision: 3108
Modified:
branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
Log:
Help debugging JBWS-1592
Modified: branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2007-05-16 12:47:42 UTC (rev 3107)
+++ branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2007-05-16 13:17:58 UTC (rev 3108)
@@ -125,6 +125,9 @@
// for the server side inbound message.
EndpointMetaData epMetaData = ctx.getEndpointMetaData();
opMetaData = soapMessage.getOperationMetaData(epMetaData);
+
+ if(null == opMetaData)
+ throw new WSException("[JBWS-1592] Unable to resolve operation meta data from soap message");
}
String operation = opMetaData.getQName().toString();
17 years, 4 months
JBossWS SVN: r3107 - branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion.
by jbossws-commits@lists.jboss.org
Author: maeste
Date: 2007-05-16 08:47:42 -0400 (Wed, 16 May 2007)
New Revision: 3107
Added:
branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/NopAssertionDeployer.java
Log:
forgotten file
Added: branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/NopAssertionDeployer.java
===================================================================
--- branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/NopAssertionDeployer.java (rev 0)
+++ branches/JBWS-856/jbossws-core/src/java/org/jboss/ws/extensions/policy/deployer/domainAssertion/NopAssertionDeployer.java 2007-05-16 12:47:42 UTC (rev 3107)
@@ -0,0 +1,22 @@
+package org.jboss.ws.extensions.policy.deployer.domainAssertion;
+
+import org.apache.ws.policy.PrimitiveAssertion;
+import org.jboss.ws.extensions.policy.deployer.exceptions.UnsupportedAssertion;
+import org.jboss.ws.metadata.umdm.ExtensibleMetaData;
+
+public class NopAssertionDeployer implements AssertionDeployer
+{
+
+ public void deployClientSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void deployServerSide(PrimitiveAssertion assertion, ExtensibleMetaData extMetaData) throws UnsupportedAssertion
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
17 years, 4 months
JBossWS SVN: r3106 - in branches/tdiesler/trunk: integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws and 5 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-05-16 08:24:40 -0400 (Wed, 16 May 2007)
New Revision: 3106
Added:
branches/tdiesler/trunk/integration/jbws-jboss50/src/main/java/
Modified:
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/JAXRPCDeployerHookEJB21.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerHookJSE.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerHookEJB3.java
branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerHookJSE.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java
branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java
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/sunri-jboss50/src/main/java/org/jboss/ws/integration/jboss50/sunri/SunJaxwsDeployer.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/server/ServiceEndpointInvoker.java
Log:
restructure
Modified: 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 2007-05-16 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/InvocationHandlerJSE.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -62,7 +62,7 @@
public Object getTargetBean(Endpoint endpoint) throws InstantiationException, IllegalAccessException
{
- Class epImpl = endpoint.getEndpointImpl();
+ Class epImpl = endpoint.getTargetBean();
Object targetBean = epImpl.newInstance();
return targetBean;
}
Modified: branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerHookEJB21.java
===================================================================
--- branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerHookEJB21.java 2007-05-16 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerHookEJB21.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -92,7 +92,7 @@
// Create the endpoint
Endpoint ep = createEndpoint();
ep.setService(service);
- ep.setEndpointImpl(epBean);
+ ep.setTargetBean(epBean);
String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbLink;
ep.setName(ObjectNameFactory.create(nameStr));
Modified: branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerHookJSE.java
===================================================================
--- branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerHookJSE.java 2007-05-16 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXRPCDeployerHookJSE.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -95,7 +95,7 @@
// Create the endpoint
Endpoint ep = createEndpoint();
ep.setService(service);
- ep.setEndpointImpl(epBean);
+ ep.setTargetBean(epBean);
String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletLink;
ep.setName(ObjectNameFactory.create(nameStr));
Modified: branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerHookEJB3.java
===================================================================
--- branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerHookEJB3.java 2007-05-16 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerHookEJB3.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -83,7 +83,7 @@
// Create the endpoint
Endpoint ep = createEndpoint();
ep.setService(service);
- ep.setEndpointImpl(epBean);
+ ep.setTargetBean(epBean);
String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbName;
ep.setName(ObjectNameFactory.create(nameStr));
Modified: branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerHookJSE.java
===================================================================
--- branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerHookJSE.java 2007-05-16 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/integration/jboss50/src/main/java/org/jboss/ws/integration/jboss50/JAXWSDeployerHookJSE.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -85,7 +85,7 @@
// Create the endpoint
Endpoint ep = createEndpoint();
ep.setService(service);
- ep.setEndpointImpl(epBean);
+ ep.setTargetBean(epBean);
String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName;
ep.setName(ObjectNameFactory.create(nameStr));
Modified: branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java
===================================================================
--- branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java 2007-05-16 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookEJB21.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -92,7 +92,7 @@
// Create the endpoint
Endpoint ep = createEndpoint();
ep.setService(service);
- ep.setEndpointImpl(epBean);
+ ep.setTargetBean(epBean);
String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbLink;
ep.setName(ObjectNameFactory.create(nameStr));
Modified: branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java
===================================================================
--- branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java 2007-05-16 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXRPCDeployerHookJSE.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -102,7 +102,7 @@
// Create the endpoint
Endpoint ep = createEndpoint();
ep.setService(service);
- ep.setEndpointImpl(epBean);
+ ep.setTargetBean(epBean);
String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletLink;
ep.setName(ObjectNameFactory.create(nameStr));
Modified: branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java
===================================================================
--- branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java 2007-05-16 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookEJB3.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -74,7 +74,7 @@
// Create the endpoint
Endpoint ep = createEndpoint();
ep.setService(service);
- ep.setEndpointImpl(epBean);
+ ep.setTargetBean(epBean);
String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + ejbName;
ep.setName(ObjectNameFactory.create(nameStr));
Modified: branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java
===================================================================
--- branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java 2007-05-16 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/JAXWSDeployerHookJSE.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -85,7 +85,7 @@
// Create the endpoint
Endpoint ep = createEndpoint();
ep.setService(service);
- ep.setEndpointImpl(epBean);
+ ep.setTargetBean(epBean);
String nameStr = Endpoint.SEPID_DOMAIN + ":" + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName;
ep.setName(ObjectNameFactory.create(nameStr));
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 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/integration/jbws-jboss42/src/main/java/org/jboss/ws/integration/jboss42/jbossws/ModifyWebMetaDataDeployer.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -58,7 +58,7 @@
// <servlet-class> originally contained a javax.servlet.Servlet
for (Endpoint ep : dep.getService().getEndpoints())
{
- if (ep.getEndpointImpl() == null)
+ if (ep.getTargetBean() == null)
{
String servletName = ep.getName().getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
String beanName = results.sepTargetMap.get(servletName);
@@ -69,7 +69,7 @@
{
ClassLoader loader = dep.getClassLoader();
Class<?> epBean = loader.loadClass(beanName);
- ep.setEndpointImpl(epBean);
+ ep.setTargetBean(epBean);
ServerEndpointMetaData sepMetaData = ep.getAttachment(ServerEndpointMetaData.class);
sepMetaData.setServiceEndpointImplName(beanName);
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 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/BasicEndpoint.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -72,7 +72,7 @@
{
private Service service;
private ObjectName name;
- private Class endpointImpl;
+ private Class targetBean;
private EndpointState state;
private RequestHandler requestHandler;
private InvocationHandler invocationHandler;
@@ -94,14 +94,14 @@
this.service = service;
}
- public Class getEndpointImpl()
+ public Class getTargetBean()
{
- return endpointImpl;
+ return targetBean;
}
- public void setEndpointImpl(Class endpointImpl)
+ public void setTargetBean(Class targetBean)
{
- this.endpointImpl = endpointImpl;
+ this.targetBean = targetBean;
}
public EndpointState getState()
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 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/integration/spi/src/main/java/org/jboss/ws/integration/Endpoint.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -97,10 +97,10 @@
void setState(EndpointState state);
/** Get the endpoint implementation bean */
- Class getEndpointImpl();
+ Class getTargetBean();
/** Set the endpoint implementation bean */
- void setEndpointImpl(Class epImpl);
+ void setTargetBean(Class epImpl);
/** Set the request handler for this endpoint */
void setRequestHandler(RequestHandler handler);
Modified: branches/tdiesler/trunk/integration/sunri-jboss50/src/main/java/org/jboss/ws/integration/jboss50/sunri/SunJaxwsDeployer.java
===================================================================
--- branches/tdiesler/trunk/integration/sunri-jboss50/src/main/java/org/jboss/ws/integration/jboss50/sunri/SunJaxwsDeployer.java 2007-05-16 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/integration/sunri-jboss50/src/main/java/org/jboss/ws/integration/jboss50/sunri/SunJaxwsDeployer.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -50,7 +50,7 @@
for (Endpoint ep : dep.getService().getEndpoints())
{
String name = getName(dep, ep);
- String implementation = ep.getEndpointImpl().getName();
+ String implementation = ep.getTargetBean().getName();
String urlPattern = getUrlPattern(dep, ep);
DDEndpoint ddep = new DDEndpoint(name, implementation, urlPattern);
@@ -63,7 +63,7 @@
private String getName(Deployment dep, Endpoint ep)
{
String name = null;
- String impl = ep.getEndpointImpl().getName();
+ String impl = ep.getTargetBean().getName();
WebMetaData webMetaData = dep.getContext().getAttachment(WebMetaData.class);
if (webMetaData != null)
{
@@ -82,7 +82,7 @@
private String getUrlPattern(Deployment dep, Endpoint ep)
{
String urlPattern = null;
- String impl = ep.getEndpointImpl().getName();
+ String impl = ep.getTargetBean().getName();
WebMetaData webMetaData = dep.getContext().getAttachment(WebMetaData.class);
if (webMetaData != null)
{
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 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/deployment/UnifiedMetaDataAssociationDeployer.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -56,7 +56,7 @@
sepMetaData = getEndpointMetaData(umd, ep.getName());
ep.addAttachment(ServerEndpointMetaData.class, sepMetaData);
- Class targetBean = ep.getEndpointImpl();
+ Class targetBean = ep.getTargetBean();
if (targetBean != null)
sepMetaData.setServiceEndpointImplName(targetBean.getName());
}
Modified: 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 2007-05-16 12:10:39 UTC (rev 3105)
+++ branches/tdiesler/trunk/jbossws/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-05-16 12:24:40 UTC (rev 3106)
@@ -422,7 +422,7 @@
protected Method getImplMethod(Endpoint endpoint, EndpointInvocation epInv) throws ClassNotFoundException, NoSuchMethodException
{
- Class implClass = endpoint.getEndpointImpl();
+ Class implClass = endpoint.getTargetBean();
Method seiMethod = epInv.getJavaMethod();
String methodName = seiMethod.getName();
17 years, 4 months