JBossWS SVN: r10519 - in container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration: invocation and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-08-11 10:01:52 -0400 (Tue, 11 Aug 2009)
New Revision: 10519
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java
Log:
[JBWS-2332] refactoring + javadoc
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java 2009-08-11 13:58:25 UTC (rev 10518)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/deployers/WSDeploymentDeployer.java 2009-08-11 14:01:52 UTC (rev 10519)
@@ -38,8 +38,8 @@
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.metadata.web.spec.ServletMetaData;
import org.jboss.virtual.VirtualFile;
-import org.jboss.webservices.integration.invocation.InvocationHandlerEJB3;
import org.jboss.webservices.integration.util.ASHelper;
+import org.jboss.wsf.common.integration.WSConstants;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
@@ -161,7 +161,7 @@
final String ejbClass = container.getComponentClassName();
final Endpoint ep = this.createEndpoint(ejbClass, ejbName, dep);
- ep.setProperty(InvocationHandlerEJB3.CONTAINER_NAME, container.getContainerName());
+ ep.setProperty(WSConstants.CONTAINER_NAME, container.getContainerName());
}
dep.addAttachment(DeploymentUnit.class, unit);
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java 2009-08-11 13:58:25 UTC (rev 10518)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java 2009-08-11 14:01:52 UTC (rev 10519)
@@ -38,9 +38,6 @@
import org.jboss.invocation.PayloadKey;
import org.jboss.logging.Logger;
import org.jboss.mx.util.MBeanServerLocator;
-import org.jboss.security.SecurityContext;
-import org.jboss.security.SecurityContextAssociation;
-import org.jboss.webservices.integration.invocation.ServiceEndpointInterceptorEJB21;
import org.jboss.wsf.common.ObjectNameFactory;
import org.jboss.wsf.common.integration.WSHelper;
import org.jboss.wsf.spi.SPIProvider;
@@ -60,133 +57,190 @@
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
* @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
*/
-public class InvocationHandlerEJB21 extends AbstractInvocationHandler
+final class InvocationHandlerEJB21 extends AbstractInvocationHandler
{
- // provide logging
- private static final Logger log = Logger.getLogger(InvocationHandlerEJB21.class);
+ /** Logger. */
+ private static final Logger LOG = Logger.getLogger(InvocationHandlerEJB21.class);
+
+ /** EJB21 JNDI name. */
private String jndiName;
+
+ /** MBean server. */
private MBeanServer server;
- private ObjectName objectName;
+ /** Object name. */
+ private ObjectName ejb21ContainerName;
+
+ /**
+ * Consctructor.
+ */
InvocationHandlerEJB21()
{
+ super();
+
+ this.server = MBeanServerLocator.locateJBoss();
}
- public void init(Endpoint ep)
+ /**
+ * Initializes EJB 21 endpoint.
+ *
+ * @param endpoint web service endpoint
+ */
+ public void init(final Endpoint endpoint)
{
- String ejbName = ep.getShortName();
- Deployment dep = ep.getService().getDeployment();
- EJBArchiveMetaData apMetaData = WSHelper.getRequiredAttachment(dep, EJBArchiveMetaData.class);
- EJBMetaData beanMetaData = (EJBMetaData)apMetaData.getBeanByEjbName(ejbName);
- if (beanMetaData == null)
+ final String ejbName = endpoint.getShortName();
+ final Deployment dep = endpoint.getService().getDeployment();
+ final EJBArchiveMetaData ejbArchiveMD = WSHelper.getRequiredAttachment(dep, EJBArchiveMetaData.class);
+ final EJBMetaData ejbMD = (EJBMetaData)ejbArchiveMD.getBeanByEjbName(ejbName);
+
+ if (ejbMD == null)
+ {
throw new WebServiceException("Cannot obtain ejb meta data for: " + ejbName);
+ }
- // get the MBeanServer
- server = MBeanServerLocator.locateJBoss();
+ // get the bean's JNDI name
+ this.jndiName = ejbMD.getContainerObjectNameJndiName();
- // get the bean's JNDI name
- jndiName = beanMetaData.getContainerObjectNameJndiName();
- if (jndiName == null)
+ if (this.jndiName == null)
+ {
throw new WebServiceException("Cannot obtain JNDI name for: " + ejbName);
+ }
}
- public void invoke(Endpoint ep, Invocation inv) throws Exception
+ /**
+ * Gets EJB 21 container name lazily.
+ *
+ * @param endpoint webservice endpoint
+ * @return EJB21 container name
+ */
+ private synchronized ObjectName getEjb21ContainerName(final Endpoint endpoint)
{
- log.debug("Invoke: " + inv.getJavaMethod().getName());
+ final boolean ejb21ContainerNotInitialized = this.ejb21ContainerName == null;
- if (objectName == null)
+ if (ejb21ContainerNotInitialized)
{
- objectName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + jndiName + ",service=EJB");
- if (server.isRegistered(objectName) == false)
- throw new WebServiceException("Cannot find service endpoint target: " + objectName);
+ this.ejb21ContainerName = ObjectNameFactory.create("jboss.j2ee:jndiName=" + this.jndiName + ",service=EJB");
+ final boolean ejb21NotRegistered = !this.server.isRegistered(this.ejb21ContainerName);
+ if (ejb21NotRegistered)
+ {
+ throw new IllegalArgumentException("Cannot find service endpoint target: " + this.ejb21ContainerName);
+ }
// Inject the Service endpoint interceptor
- injectServiceEndpointInterceptor(objectName, ep.getShortName());
+ this.insertEJB21ServiceEndpointInterceptor(this.ejb21ContainerName, endpoint.getShortName());
}
- // invoke on the container
+ return this.ejb21ContainerName;
+ }
+
+ /**
+ * Invokes EJB 21 endpoint.
+ *
+ * @param endpoint EJB 21 endpoint
+ * @param wsInvocation web service invocation
+ * @throws Exception if any error occurs
+ */
+ public void invoke(final Endpoint endpoint, final Invocation wsInvocation) throws Exception
+ {
+ final ObjectName ejb21Name = this.getEjb21ContainerName(endpoint);
+
try
{
- // setup the invocation
- org.jboss.invocation.Invocation jbInv = getMBeanInvocation(inv);
+ // prepare for invocation
+ final org.jboss.invocation.Invocation jbossInvocation = this.getMBeanInvocation(wsInvocation);
+ final String[] signature = {org.jboss.invocation.Invocation.class.getName()};
+ final Object[] args = new Object[] {jbossInvocation};
- String[] sig = { org.jboss.invocation.Invocation.class.getName() };
- Object retObj = server.invoke(objectName, "invoke", new Object[] { jbInv }, sig);
- inv.setReturnValue(retObj);
+ // invoke method
+ final Object retObj = this.server.invoke(ejb21Name, "invoke", args, signature);
+ wsInvocation.setReturnValue(retObj);
}
catch (Exception e)
{
- handleInvocationException(e);
+ this.handleInvocationException(e);
}
}
- private org.jboss.invocation.Invocation getMBeanInvocation(Invocation inv)
+ /**
+ * Returns configured EJB 21 JBoss MBean invocation.
+ *
+ * @param wsInvocation webservice invocation
+ * @return configured JBoss invocation
+ */
+ private org.jboss.invocation.Invocation getMBeanInvocation(final Invocation wsInvocation)
{
- // EJB2.1 endpoints will only get an JAXRPC context
- MessageContext msgContext = inv.getInvocationContext().getAttachment(MessageContext.class);
+ // ensure preconditions
+ final MessageContext msgContext = wsInvocation.getInvocationContext().getAttachment(MessageContext.class);
if (msgContext == null)
+ {
throw new IllegalStateException("Cannot obtain MessageContext");
+ }
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter();
- SecurityContext sc = SecurityContextAssociation.getSecurityContext();
- Principal principal = securityAdaptor.getPrincipal();
- Object credential = securityAdaptor.getCredential();
+ final HandlerCallback callback = wsInvocation.getInvocationContext().getAttachment(HandlerCallback.class);
+ if (callback == null)
+ {
+ throw new IllegalStateException("Cannot obtain HandlerCallback");
+ }
- if (principal == null && sc != null)
- principal = sc.getUtil().getUserPrincipal();
+ // prepare security data
+ final SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ final SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter();
+ final Principal principal = securityAdaptor.getPrincipal();
+ final Object credential = securityAdaptor.getCredential();
- if (credential == null && sc != null)
- credential = sc.getUtil().getCredential();
+ // prepare invocation data
+ final Method method = wsInvocation.getJavaMethod();
+ final Object[] args = wsInvocation.getArgs();
+ final org.jboss.invocation.Invocation jbossInvocation = new org.jboss.invocation.Invocation(null, method, args, null, principal, credential);
- Method method = inv.getJavaMethod();
- Object[] args = inv.getArgs();
- org.jboss.invocation.Invocation jbInv = new org.jboss.invocation.Invocation(null, method, args, null, principal, credential);
+ // propagate values to JBoss invocation
+ jbossInvocation.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
+ jbossInvocation.setValue(InvocationKey.SOAP_MESSAGE, ((SOAPMessageContext)msgContext).getMessage());
+ jbossInvocation.setType(InvocationType.SERVICE_ENDPOINT);
+ jbossInvocation.setValue(HandlerCallback.class.getName(), callback, PayloadKey.TRANSIENT);
+ jbossInvocation.setValue(Invocation.class.getName(), wsInvocation, PayloadKey.TRANSIENT);
- HandlerCallback callback = inv.getInvocationContext().getAttachment(HandlerCallback.class);
- if (callback == null)
- throw new IllegalStateException("Cannot obtain HandlerCallback");
-
- jbInv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
- jbInv.setValue(InvocationKey.SOAP_MESSAGE, ((SOAPMessageContext)msgContext).getMessage());
- jbInv.setType(InvocationType.SERVICE_ENDPOINT);
- jbInv.setValue(HandlerCallback.class.getName(), callback, PayloadKey.TRANSIENT);
- jbInv.setValue(Invocation.class.getName(), inv, PayloadKey.TRANSIENT);
-
- return jbInv;
+ return jbossInvocation;
}
- private void injectServiceEndpointInterceptor(ObjectName objectName, String ejbName)
+ /**
+ * This method dynamically inserts EJB 21 webservice endpoint interceptor
+ * to the last but one position in EJB 21 processing chain. See [JBWS-756] for more info.
+ *
+ * @param objectName EJB 21 object name
+ * @param ejbName EJB 21 short name
+ */
+ private void insertEJB21ServiceEndpointInterceptor(final ObjectName objectName, final String ejbName)
{
- // Dynamically add the service endpoint interceptor
- // http://jira.jboss.org/jira/browse/JBWS-758
try
{
- EjbModule ejbModule = (EjbModule)server.getAttribute(objectName, "EjbModule");
- StatelessSessionContainer container = (StatelessSessionContainer)ejbModule.getContainer(ejbName);
+ final EjbModule ejbModule = (EjbModule)this.server.getAttribute(objectName, "EjbModule");
+ final StatelessSessionContainer container = (StatelessSessionContainer)ejbModule.getContainer(ejbName);
- boolean injectionPointFound = false;
- Interceptor prev = container.getInterceptor();
- while (prev != null && prev.getNext() != null)
+ Interceptor currentInterceptor = container.getInterceptor();
+ while (currentInterceptor != null && currentInterceptor.getNext() != null)
{
- Interceptor next = prev.getNext();
- if (next.getNext() == null)
+ final Interceptor nextInterceptor = currentInterceptor.getNext();
+
+ if (nextInterceptor.getNext() == null)
{
- log.debug("Inject service endpoint interceptor after: " + prev.getClass().getName());
- ServiceEndpointInterceptorEJB21 sepInterceptor = new ServiceEndpointInterceptorEJB21();
- prev.setNext(sepInterceptor);
- sepInterceptor.setNext(next);
- injectionPointFound = true;
+ final ServiceEndpointInterceptorEJB21 sepInterceptor = new ServiceEndpointInterceptorEJB21();
+ currentInterceptor.setNext(sepInterceptor);
+ sepInterceptor.setNext(nextInterceptor);
+ InvocationHandlerEJB21.LOG.debug("Injecting EJB 21 service endpoint interceptor after: " + currentInterceptor.getClass().getName());
+
+ return;
}
- prev = next;
+ currentInterceptor = nextInterceptor;
}
- if (injectionPointFound == false)
- log.warn("Cannot service endpoint interceptor injection point");
+
+ InvocationHandlerEJB21.LOG.warn("Cannot find EJB 21 service endpoint interceptor insert point");
}
catch (Exception ex)
{
- log.warn("Cannot add service endpoint interceptor", ex);
+ InvocationHandlerEJB21.LOG.warn("Cannot register EJB 21 service endpoint interceptor: ", ex);
}
}
+
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java 2009-08-11 13:58:25 UTC (rev 10518)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB3.java 2009-08-11 14:01:52 UTC (rev 10519)
@@ -21,91 +21,145 @@
*/
package org.jboss.webservices.integration.invocation;
+import java.lang.reflect.Method;
+
+import javax.xml.ws.WebServiceException;
+
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.wsf.common.integration.WSConstants;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.invocation.Invocation;
import org.jboss.wsf.spi.invocation.integration.InvocationContextCallback;
import org.jboss.wsf.spi.invocation.integration.ServiceEndpointContainer;
import org.jboss.wsf.spi.util.KernelLocator;
-import javax.xml.ws.WebServiceException;
-import java.lang.reflect.Method;
-
/**
* Handles invocations on EJB3 endpoints.
*
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
* @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
*/
-public class InvocationHandlerEJB3 extends AbstractInvocationHandler
+final class InvocationHandlerEJB3 extends AbstractInvocationHandler
{
- public static final String CONTAINER_NAME = "org.jboss.wsf.spi.invocation.ContainerName";
+ /** MC kernel controller. */
+ private final KernelController controller;
+ /** EJB3 container name. */
private String containerName;
- private KernelController houston;
+
+ /** EJB3 container. */
private ServiceEndpointContainer serviceEndpointContainer;
+ /**
+ * Constructor.
+ */
InvocationHandlerEJB3()
{
- houston = KernelLocator.getKernel().getController();
+ super();
+
+ this.controller = KernelLocator.getKernel().getController();
}
- public void init(Endpoint ep)
+ /**
+ * Initializes EJB3 container name.
+ *
+ * @param endpoint web service endpoint
+ */
+ public void init(final Endpoint endpoint)
{
- containerName = (String)ep.getProperty(InvocationHandlerEJB3.CONTAINER_NAME);
- assert containerName != null : "Target container name not set";
+ this.containerName = (String)endpoint.getProperty(WSConstants.CONTAINER_NAME);
+
+ if (this.containerName == null)
+ {
+ throw new IllegalArgumentException("Container name cannot be null");
+ }
}
- private ServiceEndpointContainer lazyInitializeInvocationTarget()
+ /**
+ * Gets EJB 3 container lazily.
+ *
+ * @return EJB3 container
+ */
+ private synchronized ServiceEndpointContainer getEjb3Container()
{
- if (null == this.serviceEndpointContainer)
+ final boolean ejb3ContainerNotInitialized = this.serviceEndpointContainer == null;
+
+ if (ejb3ContainerNotInitialized)
{
- ControllerContext context = houston.getInstalledContext(containerName);
+ final ControllerContext context = this.controller.getInstalledContext(this.containerName);
if (context == null)
- throw new WebServiceException("Cannot find service endpoint target: " + containerName);
+ {
+ throw new WebServiceException("Cannot find service endpoint target: " + this.containerName);
+ }
- assert (context.getTarget() instanceof ServiceEndpointContainer) : "Invocation target mismatch";
this.serviceEndpointContainer = (ServiceEndpointContainer)context.getTarget();
}
return this.serviceEndpointContainer;
}
- public void invoke(Endpoint ep, Invocation wsInv) throws Exception
+ /**
+ * Invokes EJB 3 endpoint.
+ *
+ * @param endpoint EJB 3 endpoint
+ * @param wsInvocation web service invocation
+ * @throws Exception if any error occurs
+ */
+ public void invoke(final Endpoint endpoint, final Invocation wsInvocation) throws Exception
{
try
{
- ServiceEndpointContainer invocationTarget = lazyInitializeInvocationTarget();
+ // prepare for invocation
+ final ServiceEndpointContainer ejbContainer = this.getEjb3Container();
+ final InvocationContextCallback invocationCallback = new EJB3InvocationContextCallback(wsInvocation);
+ final Class<?> implClass = ejbContainer.getServiceImplementationClass();
+ final Method seiMethod = wsInvocation.getJavaMethod();
+ final Method implMethod = this.getImplMethod(implClass, seiMethod);
+ final Object[] args = wsInvocation.getArgs();
- Class beanClass = invocationTarget.getServiceImplementationClass();
- Method method = getImplMethod(beanClass, wsInv.getJavaMethod());
- Object[] args = wsInv.getArgs();
- InvocationContextCallback invProps = new EJB3InvocationContextCallback(wsInv);
-
- Object retObj = invocationTarget.invokeEndpoint(method, args, invProps);
-
- wsInv.setReturnValue(retObj);
+ // invoke method
+ final Object retObj = ejbContainer.invokeEndpoint(implMethod, args, invocationCallback);
+ wsInvocation.setReturnValue(retObj);
}
catch (Throwable th)
{
- handleInvocationException(th);
+ this.handleInvocationException(th);
}
}
- static class EJB3InvocationContextCallback implements InvocationContextCallback
+ /**
+ * EJB3 invocation callback allowing EJB 3 beans to access Web Service invocation properties.
+ */
+ private static final class EJB3InvocationContextCallback implements InvocationContextCallback
{
- private Invocation wsInv;
- public EJB3InvocationContextCallback(Invocation wsInv)
+ /** WebService invocation. */
+ private Invocation wsInvocation;
+
+ /**
+ * Constructor.
+ *
+ * @param wsInvocation delegee
+ */
+ public EJB3InvocationContextCallback(final Invocation wsInvocation)
{
- this.wsInv = wsInv;
+ this.wsInvocation = wsInvocation;
}
- public <T> T get(Class<T> propertyType)
+ /**
+ * Retrieves attachment type from Web Service invocation context attachments.
+ *
+ * @param <T> attachment type
+ * @param attachmentType attachment class
+ * @return attachment value
+ */
+ public <T> T get(final Class<T> attachmentType)
{
- return wsInv.getInvocationContext().getAttachment(propertyType);
+ return this.wsInvocation.getInvocationContext().getAttachment(attachmentType);
}
+
}
+
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java 2009-08-11 13:58:25 UTC (rev 10518)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java 2009-08-11 14:01:52 UTC (rev 10519)
@@ -56,7 +56,16 @@
*/
public Principal getPrincipal()
{
- return SecurityAssociation.getPrincipal();
+ final Principal principal = SecurityAssociation.getPrincipal();
+
+ if (principal != null)
+ {
+ return principal;
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrincipalPrivilegedAction());
+ }
}
/**
@@ -76,7 +85,16 @@
*/
public Object getCredential()
{
- return SecurityAssociation.getCredential();
+ final Object credential = SecurityAssociation.getCredential();
+
+ if (credential != null)
+ {
+ return credential;
+ }
+ else
+ {
+ return AccessController.doPrivileged(new CredentialPrivilegedAction());
+ }
}
/**
@@ -115,4 +133,70 @@
});
}
+ /**
+ * Returns user principal from security context if available.
+ */
+ private static final class PrincipalPrivilegedAction implements PrivilegedAction<Principal>
+ {
+
+ /**
+ * Constructor.
+ */
+ private PrincipalPrivilegedAction()
+ {
+ super();
+ }
+
+ /**
+ * Execute this action.
+ *
+ * @return user principal if available or null.
+ */
+ public Principal run()
+ {
+ final SecurityContext securityContext = SecurityContextAssociation.getSecurityContext();
+
+ if (securityContext != null)
+ {
+ return securityContext.getUtil().getUserPrincipal();
+ }
+
+ return null;
+ }
+
+ }
+
+ /**
+ * Returns user credential from security context if available.
+ */
+ private static final class CredentialPrivilegedAction implements PrivilegedAction<Object>
+ {
+
+ /**
+ * Constructor.
+ */
+ private CredentialPrivilegedAction()
+ {
+ super();
+ }
+
+ /**
+ * Execute this action.
+ *
+ * @return user credential if available or null.
+ */
+ public Object run()
+ {
+ final SecurityContext securityContext = SecurityContextAssociation.getSecurityContext();
+
+ if (securityContext != null)
+ {
+ return securityContext.getUtil().getCredential();
+ }
+
+ return null;
+ }
+
+ }
+
}
15 years, 5 months
JBossWS SVN: r10518 - common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-08-11 09:58:25 -0400 (Tue, 11 Aug 2009)
New Revision: 10518
Modified:
common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration/WSConstants.java
Log:
[JBWS-2332] refactoring + javadoc
Modified: common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration/WSConstants.java
===================================================================
--- common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration/WSConstants.java 2009-08-11 11:54:13 UTC (rev 10517)
+++ common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration/WSConstants.java 2009-08-11 13:58:25 UTC (rev 10518)
@@ -33,11 +33,17 @@
* Stack specific context parameters configuration property.
*/
public static final String STACK_CONTEXT_PARAMS = "stack.context.parameters";
+
/**
* Stack specific transport class configuration property.
*/
public static final String STACK_TRANSPORT_CLASS = "stack.transport.class";
+ /**
+ * EJB invocation property.
+ */
+ public static final String CONTAINER_NAME = "org.jboss.wsf.spi.invocation.ContainerName";
+
/**
* Forbidden constructor.
*/
15 years, 5 months
JBossWS SVN: r10517 - in container/jboss50/branches/ropalka-jboss510/src/main: java/org/jboss/webservices/integration/security and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-08-11 07:54:13 -0400 (Tue, 11 Aug 2009)
New Revision: 10517
Added:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptorEJB21.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterFactoryImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java
Removed:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory
Log:
[JBWS-2332] refactoring + javadoc
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java 2009-08-11 09:17:49 UTC (rev 10516)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java 2009-08-11 11:54:13 UTC (rev 10517)
@@ -40,7 +40,7 @@
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.security.SecurityContext;
import org.jboss.security.SecurityContextAssociation;
-import org.jboss.webservices.integration.invocation.ServiceEndpointInterceptor;
+import org.jboss.webservices.integration.invocation.ServiceEndpointInterceptorEJB21;
import org.jboss.wsf.common.ObjectNameFactory;
import org.jboss.wsf.common.integration.WSHelper;
import org.jboss.wsf.spi.SPIProvider;
@@ -174,7 +174,7 @@
if (next.getNext() == null)
{
log.debug("Inject service endpoint interceptor after: " + prev.getClass().getName());
- ServiceEndpointInterceptor sepInterceptor = new ServiceEndpointInterceptor();
+ ServiceEndpointInterceptorEJB21 sepInterceptor = new ServiceEndpointInterceptorEJB21();
prev.setNext(sepInterceptor);
sepInterceptor.setNext(next);
injectionPointFound = true;
Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java 2009-08-11 09:17:49 UTC (rev 10516)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java 2009-08-11 11:54:13 UTC (rev 10517)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * 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.webservices.integration.invocation;
-
-import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
-import org.jboss.wsf.spi.invocation.SecurityAdaptor;
-
-/**
- * Security adapters factory.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-public final class SecurityAdapterFactoryImpl extends SecurityAdaptorFactory
-{
-
- /**
- * Constructor.
- */
- public SecurityAdapterFactoryImpl()
- {
- super();
- }
-
- /**
- * Creates new security adapter instance.
- *
- * @return security adapter
- */
- public SecurityAdaptor newSecurityAdapter()
- {
- return new SecurityAdaptorImpl();
- }
-
-}
Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java 2009-08-11 09:17:49 UTC (rev 10516)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java 2009-08-11 11:54:13 UTC (rev 10517)
@@ -1,118 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * 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.webservices.integration.invocation;
-
-import java.security.AccessController;
-import java.security.Principal;
-import java.security.PrivilegedAction;
-
-import javax.security.auth.Subject;
-
-import org.jboss.security.SecurityAssociation;
-import org.jboss.security.SecurityContext;
-import org.jboss.security.SecurityContextAssociation;
-import org.jboss.wsf.spi.invocation.SecurityAdaptor;
-
-/**
- * The JBoss AS specific SecurityAssociationAdaptor.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-final class SecurityAdaptorImpl implements SecurityAdaptor
-{
-
- /**
- * Constructor.
- */
- SecurityAdaptorImpl()
- {
- super();
- }
-
- /**
- * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#getPrincipal()
- *
- * @return principal
- */
- public Principal getPrincipal()
- {
- return SecurityAssociation.getPrincipal();
- }
-
- /**
- * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#setPrincipal(Principal)
- *
- * @param principal principal
- */
- public void setPrincipal(final Principal principal)
- {
- SecurityAssociation.setPrincipal(principal);
- }
-
- /**
- * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#getCredential()
- *
- * @return credential
- */
- public Object getCredential()
- {
- return SecurityAssociation.getCredential();
- }
-
- /**
- * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#setCredential(Object)
- *
- * @param credential credential
- */
- public void setCredential(final Object credential)
- {
- SecurityAssociation.setCredential(credential);
- }
-
- /**
- * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#pushSubjectContext(Subject, Principal, Object)
- *
- * @param subject subject
- * @param principal principal
- * @param credential credential
- */
- public void pushSubjectContext(final Subject subject, final Principal principal, final Object credential)
- {
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
-
- public Void run()
- {
- final SecurityContext securityContext = SecurityContextAssociation.getSecurityContext();
- if (securityContext == null)
- {
- throw new IllegalStateException("Security Context is null");
- }
-
- securityContext.getUtil().createSubjectInfo(principal, credential, subject);
-
- return null;
- }
- });
- }
-
-}
Deleted: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java 2009-08-11 09:17:49 UTC (rev 10516)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java 2009-08-11 11:54:13 UTC (rev 10517)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * 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.webservices.integration.invocation;
-
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
-
-import org.jboss.ejb.plugins.AbstractInterceptor;
-import org.jboss.invocation.InvocationKey;
-import org.jboss.wsf.spi.invocation.HandlerCallback;
-import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-
-/**
- * This Interceptor does the ws4ee handler processing on EJB 21 endpoints.
- *
- * According to the ws4ee spec the handler logic must be invoked after the container
- * applied method level security to the invocation.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-final class ServiceEndpointInterceptor extends AbstractInterceptor
-{
-
- /**
- * Constructor.
- */
- ServiceEndpointInterceptor()
- {
- super();
- }
-
- /**
- * Before and after we call the EJB 21 service endpoint bean, we process the handler chains.
- *
- * @param jbossInvocation jboss invocation
- * @return ws invocation return value
- * @throws Exception if any error occurs
- */
- public Object invoke(final org.jboss.invocation.Invocation jbossInvocation) throws Exception
- {
- final SOAPMessageContext msgContext = (SOAPMessageContext)jbossInvocation.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
- if (msgContext == null)
- {
- // not for us
- return this.getNext().invoke(jbossInvocation);
- }
-
- // Get the endpoint invocation
- final Invocation wsInvocation = (Invocation)jbossInvocation.getValue(Invocation.class.getName());
-
- // Get the handler callback
- final HandlerCallback callback = (HandlerCallback)jbossInvocation.getValue(HandlerCallback.class.getName());
-
- // Handlers need to be Tx. Therefore we must invoke the handler chain after the TransactionInterceptor.
- if (callback != null && wsInvocation != null)
- {
- try
- {
- // call the request handlers
- boolean handlersPass = callback.callRequestHandlerChain(wsInvocation, HandlerType.ENDPOINT);
- handlersPass = handlersPass && callback.callRequestHandlerChain(wsInvocation, HandlerType.POST);
-
- // 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.
- final Object[] reqParams = wsInvocation.getArgs();
- jbossInvocation.setArguments(reqParams);
- final Object resObj = this.getNext().invoke(jbossInvocation);
-
- // Setting the message to null should trigger binding of the response message
- msgContext.setMessage(null);
- wsInvocation.setReturnValue(resObj);
- }
-
- // call the response handlers
- handlersPass = callback.callResponseHandlerChain(wsInvocation, HandlerType.POST);
- handlersPass = handlersPass && callback.callResponseHandlerChain(wsInvocation, HandlerType.ENDPOINT);
-
- // update the return value after response handler processing
- return wsInvocation.getReturnValue();
- }
- catch (Exception ex)
- {
- try
- {
- // call the fault handlers
- boolean handlersPass = callback.callFaultHandlerChain(wsInvocation, HandlerType.POST, ex);
- handlersPass = handlersPass && callback.callFaultHandlerChain(wsInvocation, HandlerType.ENDPOINT, ex);
- }
- catch (Exception subEx)
- {
- log.warn("Cannot process handlerChain.handleFault, ignoring: ", subEx);
- }
- throw ex;
- }
- }
- else
- {
- log.warn("Handler callback not available");
- return this.getNext().invoke(jbossInvocation);
- }
- }
-}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptorEJB21.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptorEJB21.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptorEJB21.java 2009-08-11 11:54:13 UTC (rev 10517)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * 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.webservices.integration.invocation;
+
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+
+import org.jboss.ejb.plugins.AbstractInterceptor;
+import org.jboss.invocation.InvocationKey;
+import org.jboss.wsf.spi.invocation.HandlerCallback;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
+
+/**
+ * This Interceptor does the ws4ee handler processing on EJB 21 endpoints.
+ *
+ * According to the ws4ee spec the handler logic must be invoked after the container
+ * applied method level security to the invocation.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+final class ServiceEndpointInterceptorEJB21 extends AbstractInterceptor
+{
+
+ /**
+ * Constructor.
+ */
+ ServiceEndpointInterceptorEJB21()
+ {
+ super();
+ }
+
+ /**
+ * Before and after we call the EJB 21 service endpoint bean, we process the handler chains.
+ *
+ * @param jbossInvocation jboss invocation
+ * @return ws invocation return value
+ * @throws Exception if any error occurs
+ */
+ public Object invoke(final org.jboss.invocation.Invocation jbossInvocation) throws Exception
+ {
+ final SOAPMessageContext msgContext = (SOAPMessageContext)jbossInvocation.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
+ if (msgContext == null)
+ {
+ // not for us
+ return this.getNext().invoke(jbossInvocation);
+ }
+
+ final Invocation wsInvocation = (Invocation)jbossInvocation.getValue(Invocation.class.getName());
+ final HandlerCallback callback = (HandlerCallback)jbossInvocation.getValue(HandlerCallback.class.getName());
+
+ if (callback == null || wsInvocation == null)
+ {
+ log.warn("Handler callback not available");
+ return this.getNext().invoke(jbossInvocation);
+ }
+
+ // Handlers need to be Tx. Therefore we must invoke the handler chain after the TransactionInterceptor.
+ try
+ {
+ // call the request handlers
+ boolean handlersPass = callback.callRequestHandlerChain(wsInvocation, HandlerType.ENDPOINT);
+ handlersPass = handlersPass && callback.callRequestHandlerChain(wsInvocation, HandlerType.POST);
+
+ // 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.
+ final Object[] reqParams = wsInvocation.getArgs();
+ jbossInvocation.setArguments(reqParams);
+ final Object resObj = this.getNext().invoke(jbossInvocation);
+
+ // Setting the message to null should trigger binding of the response message
+ msgContext.setMessage(null);
+ wsInvocation.setReturnValue(resObj);
+ }
+
+ // call the response handlers
+ handlersPass = callback.callResponseHandlerChain(wsInvocation, HandlerType.POST);
+ handlersPass = handlersPass && callback.callResponseHandlerChain(wsInvocation, HandlerType.ENDPOINT);
+
+ // update the return value after response handler processing
+ return wsInvocation.getReturnValue();
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ // call the fault handlers
+ boolean handlersPass = callback.callFaultHandlerChain(wsInvocation, HandlerType.POST, ex);
+ handlersPass = handlersPass && callback.callFaultHandlerChain(wsInvocation, HandlerType.ENDPOINT, ex);
+ }
+ catch (Exception e)
+ {
+ log.warn("Cannot process handlerChain.handleFault, ignoring: ", e);
+ }
+ throw ex;
+ }
+ }
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterFactoryImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterFactoryImpl.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterFactoryImpl.java 2009-08-11 11:54:13 UTC (rev 10517)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * 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.webservices.integration.security;
+
+import org.jboss.wsf.spi.invocation.SecurityAdaptor;
+import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
+
+/**
+ * Security adapters factory.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class SecurityAdapterFactoryImpl extends SecurityAdaptorFactory
+{
+
+ /**
+ * Constructor.
+ */
+ public SecurityAdapterFactoryImpl()
+ {
+ super();
+ }
+
+ /**
+ * Creates new security adapter instance.
+ *
+ * @return security adapter
+ */
+ public SecurityAdaptor newSecurityAdapter()
+ {
+ return new SecurityAdapterImpl();
+ }
+
+}
Added: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java (rev 0)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java 2009-08-11 11:54:13 UTC (rev 10517)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * 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.webservices.integration.security;
+
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedAction;
+
+import javax.security.auth.Subject;
+
+import org.jboss.security.SecurityAssociation;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextAssociation;
+import org.jboss.wsf.spi.invocation.SecurityAdaptor;
+
+/**
+ * The JBoss AS specific SecurityAssociation adapter.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+final class SecurityAdapterImpl implements SecurityAdaptor
+{
+
+ /**
+ * Constructor.
+ */
+ SecurityAdapterImpl()
+ {
+ super();
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#getPrincipal()
+ *
+ * @return principal
+ */
+ public Principal getPrincipal()
+ {
+ return SecurityAssociation.getPrincipal();
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#setPrincipal(Principal)
+ *
+ * @param principal principal
+ */
+ public void setPrincipal(final Principal principal)
+ {
+ SecurityAssociation.setPrincipal(principal);
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#getCredential()
+ *
+ * @return credential
+ */
+ public Object getCredential()
+ {
+ return SecurityAssociation.getCredential();
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#setCredential(Object)
+ *
+ * @param credential credential
+ */
+ public void setCredential(final Object credential)
+ {
+ SecurityAssociation.setCredential(credential);
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#pushSubjectContext(Subject, Principal, Object)
+ *
+ * @param subject subject
+ * @param principal principal
+ * @param credential credential
+ */
+ public void pushSubjectContext(final Subject subject, final Principal principal, final Object credential)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+
+ public Void run()
+ {
+ final SecurityContext securityContext = SecurityContextAssociation.getSecurityContext();
+ if (securityContext == null)
+ {
+ throw new IllegalStateException("Security Context is null");
+ }
+
+ securityContext.getUtil().createSubjectInfo(principal, credential, subject);
+
+ return null;
+ }
+ });
+ }
+
+}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory 2009-08-11 09:17:49 UTC (rev 10516)
+++ container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory 2009-08-11 11:54:13 UTC (rev 10517)
@@ -1 +1 @@
-org.jboss.webservices.integration.invocation.SecurityAdapterFactoryImpl
\ No newline at end of file
+org.jboss.webservices.integration.security.SecurityAdapterFactoryImpl
\ No newline at end of file
15 years, 5 months
JBossWS SVN: r10516 - container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-08-11 05:17:49 -0400 (Tue, 11 Aug 2009)
New Revision: 10516
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerFactoryImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java
Log:
[JBWS-2332] refactoring + javadoc
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerFactoryImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerFactoryImpl.java 2009-08-10 17:06:28 UTC (rev 10515)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerFactoryImpl.java 2009-08-11 09:17:49 UTC (rev 10516)
@@ -21,18 +21,35 @@
*/
package org.jboss.webservices.integration.invocation;
-import org.jboss.wsf.spi.invocation.*;
+import org.jboss.wsf.spi.invocation.InvocationHandler;
+import org.jboss.wsf.spi.invocation.InvocationHandlerFactory;
+import org.jboss.wsf.spi.invocation.InvocationType;
/**
- * The default invocation model factory fro AS 5.0.
+ * The default invocation model factory for JBoss AS.
*
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
* @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
*/
-public class InvocationHandlerFactoryImpl extends InvocationHandlerFactory
+public final class InvocationHandlerFactoryImpl extends InvocationHandlerFactory
{
- public InvocationHandler newInvocationHandler(InvocationType type)
+
+ /**
+ * Constructor.
+ */
+ public InvocationHandlerFactoryImpl()
{
+ super();
+ }
+
+ /**
+ * Returns invocation handler associated with invocation type.
+ *
+ * @param type invocation type
+ * @return invocation handler
+ */
+ public InvocationHandler newInvocationHandler(final InvocationType type)
+ {
InvocationHandler handler = null;
switch (type)
@@ -55,11 +72,11 @@
case JAXWS_MDB3:
handler = new InvocationHandlerMDB3();
break;
+ default:
+ throw new IllegalArgumentException("Unable to resolve spi.invocation.InvocationHandler for type " + type);
}
- if (null == handler)
- throw new IllegalArgumentException("Unable to resolve spi.invocation.InvocationHandler for type " + type);
-
return handler;
}
+
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java 2009-08-10 17:06:28 UTC (rev 10515)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java 2009-08-11 09:17:49 UTC (rev 10516)
@@ -25,13 +25,30 @@
import org.jboss.wsf.spi.invocation.SecurityAdaptor;
/**
+ * Security adapters factory.
+ *
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
* @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
*/
-public class SecurityAdapterFactoryImpl extends SecurityAdaptorFactory
+public final class SecurityAdapterFactoryImpl extends SecurityAdaptorFactory
{
+
+ /**
+ * Constructor.
+ */
+ public SecurityAdapterFactoryImpl()
+ {
+ super();
+ }
+
+ /**
+ * Creates new security adapter instance.
+ *
+ * @return security adapter
+ */
public SecurityAdaptor newSecurityAdapter()
{
return new SecurityAdaptorImpl();
}
+
}
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java 2009-08-10 17:06:28 UTC (rev 10515)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java 2009-08-11 09:17:49 UTC (rev 10516)
@@ -21,74 +21,95 @@
*/
package org.jboss.webservices.integration.invocation;
-import org.jboss.security.SecurityAssociation;
-import org.jboss.security.SecurityContext;
-import org.jboss.security.SecurityContextAssociation;
-import org.jboss.wsf.spi.invocation.SecurityAdaptor;
-
import java.security.AccessController;
import java.security.Principal;
import java.security.PrivilegedAction;
import javax.security.auth.Subject;
+import org.jboss.security.SecurityAssociation;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextAssociation;
+import org.jboss.wsf.spi.invocation.SecurityAdaptor;
+
/**
- * A JBoss specific SecurityAssociationAdaptor
+ * The JBoss AS specific SecurityAssociationAdaptor.
*
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
* @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
*/
-public class SecurityAdaptorImpl implements SecurityAdaptor
+final class SecurityAdaptorImpl implements SecurityAdaptor
{
+
+ /**
+ * Constructor.
+ */
SecurityAdaptorImpl()
{
+ super();
}
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#getPrincipal()
+ *
+ * @return principal
+ */
public Principal getPrincipal()
{
return SecurityAssociation.getPrincipal();
}
- public void setPrincipal(Principal pricipal)
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#setPrincipal(Principal)
+ *
+ * @param principal principal
+ */
+ public void setPrincipal(final Principal principal)
{
- SecurityAssociation.setPrincipal(pricipal);
+ SecurityAssociation.setPrincipal(principal);
}
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#getCredential()
+ *
+ * @return credential
+ */
public Object getCredential()
{
return SecurityAssociation.getCredential();
}
- public void setCredential(Object credential)
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#setCredential(Object)
+ *
+ * @param credential credential
+ */
+ public void setCredential(final Object credential)
{
SecurityAssociation.setCredential(credential);
}
- public void pushSubjectContext(Subject subject, Principal principal, Object credential)
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#pushSubjectContext(Subject, Principal, Object)
+ *
+ * @param subject subject
+ * @param principal principal
+ * @param credential credential
+ */
+ public void pushSubjectContext(final Subject subject, final Principal principal, final Object credential)
{
- SecurityAdaptorImpl.pushSubjectContext(principal, credential, subject);
- }
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
- private static SecurityContext getSecurityContext()
- {
- return (SecurityContext)AccessController.doPrivileged(new PrivilegedAction() {
- public Object run()
+ public Void run()
{
- return SecurityContextAssociation.getSecurityContext();
- }
- });
- }
+ final SecurityContext securityContext = SecurityContextAssociation.getSecurityContext();
+ if (securityContext == null)
+ {
+ throw new IllegalStateException("Security Context is null");
+ }
- private static void pushSubjectContext(final Principal p, final Object cred, final Subject s)
- {
- AccessController.doPrivileged(new PrivilegedAction() {
+ securityContext.getUtil().createSubjectInfo(principal, credential, subject);
- public Object run()
- {
- SecurityContext sc = getSecurityContext();
- if (sc == null)
- throw new IllegalStateException("Security Context is null");
- sc.getUtil().createSubjectInfo(p, cred, s);
return null;
}
});
Modified: container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java
===================================================================
--- container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java 2009-08-10 17:06:28 UTC (rev 10515)
+++ container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java 2009-08-11 09:17:49 UTC (rev 10516)
@@ -21,17 +21,16 @@
*/
package org.jboss.webservices.integration.invocation;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+
import org.jboss.ejb.plugins.AbstractInterceptor;
import org.jboss.invocation.InvocationKey;
-import org.jboss.logging.Logger;
import org.jboss.wsf.spi.invocation.HandlerCallback;
import org.jboss.wsf.spi.invocation.Invocation;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
-
/**
- * This Interceptor does the ws4ee handler processing.
+ * This Interceptor does the ws4ee handler processing on EJB 21 endpoints.
*
* According to the ws4ee spec the handler logic must be invoked after the container
* applied method level security to the invocation.
@@ -39,38 +38,47 @@
* @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
* @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
*/
-public class ServiceEndpointInterceptor extends AbstractInterceptor
+final class ServiceEndpointInterceptor extends AbstractInterceptor
{
- // provide logging
- private static Logger log = Logger.getLogger(ServiceEndpointInterceptor.class);
+
+ /**
+ * Constructor.
+ */
+ ServiceEndpointInterceptor()
+ {
+ super();
+ }
- // Interceptor implementation --------------------------------------
-
- /** Before and after we call the service endpoint bean, we process the handler chains.
+ /**
+ * Before and after we call the EJB 21 service endpoint bean, we process the handler chains.
+ *
+ * @param jbossInvocation jboss invocation
+ * @return ws invocation return value
+ * @throws Exception if any error occurs
*/
- public Object invoke(final org.jboss.invocation.Invocation jbInv) throws Exception
+ public Object invoke(final org.jboss.invocation.Invocation jbossInvocation) throws Exception
{
- // If no msgContext, it's not for us
- SOAPMessageContext msgContext = (SOAPMessageContext)jbInv.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
+ final SOAPMessageContext msgContext = (SOAPMessageContext)jbossInvocation.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
if (msgContext == null)
{
- return getNext().invoke(jbInv);
+ // not for us
+ return this.getNext().invoke(jbossInvocation);
}
// Get the endpoint invocation
- Invocation wsInv = (Invocation)jbInv.getValue(Invocation.class.getName());
+ final Invocation wsInvocation = (Invocation)jbossInvocation.getValue(Invocation.class.getName());
// Get the handler callback
- HandlerCallback callback = (HandlerCallback)jbInv.getValue(HandlerCallback.class.getName());
+ final HandlerCallback callback = (HandlerCallback)jbossInvocation.getValue(HandlerCallback.class.getName());
// Handlers need to be Tx. Therefore we must invoke the handler chain after the TransactionInterceptor.
- if (callback != null && wsInv != null)
+ if (callback != null && wsInvocation != null)
{
try
{
// call the request handlers
- boolean handlersPass = callback.callRequestHandlerChain(wsInv, HandlerType.ENDPOINT);
- handlersPass = handlersPass && callback.callRequestHandlerChain(wsInv, HandlerType.POST);
+ boolean handlersPass = callback.callRequestHandlerChain(wsInvocation, HandlerType.ENDPOINT);
+ handlersPass = handlersPass && callback.callRequestHandlerChain(wsInvocation, HandlerType.POST);
// Call the next interceptor in the chain
if (handlersPass)
@@ -78,31 +86,29 @@
// 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 = wsInv.getArgs();
- jbInv.setArguments(reqParams);
- Object resObj = getNext().invoke(jbInv);
+ final Object[] reqParams = wsInvocation.getArgs();
+ jbossInvocation.setArguments(reqParams);
+ final Object resObj = this.getNext().invoke(jbossInvocation);
// Setting the message to null should trigger binding of the response message
msgContext.setMessage(null);
- wsInv.setReturnValue(resObj);
+ wsInvocation.setReturnValue(resObj);
}
// call the response handlers
- handlersPass = callback.callResponseHandlerChain(wsInv, HandlerType.POST);
- handlersPass = handlersPass && callback.callResponseHandlerChain(wsInv, HandlerType.ENDPOINT);
+ handlersPass = callback.callResponseHandlerChain(wsInvocation, HandlerType.POST);
+ handlersPass = handlersPass && callback.callResponseHandlerChain(wsInvocation, HandlerType.ENDPOINT);
// update the return value after response handler processing
- Object resObj = wsInv.getReturnValue();
-
- return resObj;
+ return wsInvocation.getReturnValue();
}
catch (Exception ex)
{
try
{
// call the fault handlers
- boolean handlersPass = callback.callFaultHandlerChain(wsInv, HandlerType.POST, ex);
- handlersPass = handlersPass && callback.callFaultHandlerChain(wsInv, HandlerType.ENDPOINT, ex);
+ boolean handlersPass = callback.callFaultHandlerChain(wsInvocation, HandlerType.POST, ex);
+ handlersPass = handlersPass && callback.callFaultHandlerChain(wsInvocation, HandlerType.ENDPOINT, ex);
}
catch (Exception subEx)
{
@@ -110,15 +116,11 @@
}
throw ex;
}
- finally
- {
- // do nothing
- }
}
else
{
log.warn("Handler callback not available");
- return getNext().invoke(jbInv);
+ return this.getNext().invoke(jbossInvocation);
}
}
}
15 years, 5 months
JBossWS SVN: r10515 - stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/xop/jaxws.
by jbossws-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-08-10 13:06:28 -0400 (Mon, 10 Aug 2009)
New Revision: 10515
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/xop/jaxws/ReflectiveAttachmentRefScanner.java
Log:
[JBPAPP-2341] - XmlAttachmentRef annotation on List<DataHandler> is not identified as an Attachment part
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/xop/jaxws/ReflectiveAttachmentRefScanner.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/xop/jaxws/ReflectiveAttachmentRefScanner.java 2009-08-10 17:04:55 UTC (rev 10514)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/extensions/xop/jaxws/ReflectiveAttachmentRefScanner.java 2009-08-10 17:06:28 UTC (rev 10515)
@@ -86,6 +86,7 @@
boolean exceptionToTheRule = isAttachmentDataType(type);
if (! exceptionToTheRule) {
type = getFieldComponentType(field);
+ exceptionToTheRule = isAttachmentDataType(type);
}
// only non JDK types are inspected except for byte[] and java.lang.String
if( !alreadyScanned(field) && (exceptionToTheRule || !isJDKType(type)) )
15 years, 5 months
JBossWS SVN: r10514 - framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref.
by jbossws-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-08-10 13:04:55 -0400 (Mon, 10 Aug 2009)
New Revision: 10514
Added:
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/DocumentPayloadWithList.java
Modified:
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/SWARefTestCase.java
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpoint.java
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpointImpl.java
Log:
[JBPAPP-2341] - XmlAttachmentRef annotation on List<DataHandler> is not identified as an Attachment part - Testcase
Added: framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/DocumentPayloadWithList.java
===================================================================
--- framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/DocumentPayloadWithList.java (rev 0)
+++ framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/DocumentPayloadWithList.java 2009-08-10 17:04:55 UTC (rev 10514)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * 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.test.ws.jaxws.samples.swaref;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.activation.DataHandler;
+import javax.xml.bind.annotation.XmlAttachmentRef;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class DocumentPayloadWithList
+{
+ @XmlElement
+ @XmlAttachmentRef
+ private List<DataHandler> data;
+
+ public DocumentPayloadWithList()
+ {
+ }
+
+ public List<DataHandler> getData()
+ {
+ if (data == null)
+ {
+ data = new ArrayList<DataHandler>();
+ }
+ return data;
+ }
+}
Modified: framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/SWARefTestCase.java
===================================================================
--- framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/SWARefTestCase.java 2009-08-10 14:38:35 UTC (rev 10513)
+++ framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/SWARefTestCase.java 2009-08-10 17:04:55 UTC (rev 10514)
@@ -91,4 +91,17 @@
assertTrue(response.getData().getContent().equals("Server data"));
}
+
+ public void testListAnnotationWithWrapped() throws Exception
+ {
+ //[JBWS-2708]
+ Service service = Service.create(new URL(wrappedEndpointURL+"?wsdl"), wrappedServiceQName);
+ WrappedEndpoint port = service.getPort(WrappedEndpoint.class);
+ DocumentPayloadWithList payload = new DocumentPayloadWithList();
+ payload.getData().add(data);
+
+ DocumentPayloadWithList response = port.listAnnotation(payload, "Wrapped test");
+ assertTrue(response.getData().get(0).getContent().equals("Server data"));
+
+ }
}
Modified: framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpoint.java
===================================================================
--- framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpoint.java 2009-08-10 14:38:35 UTC (rev 10513)
+++ framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpoint.java 2009-08-10 17:04:55 UTC (rev 10514)
@@ -33,6 +33,9 @@
DocumentPayload beanAnnotation(DocumentPayload dhw, String test);
@WebMethod
+ DocumentPayloadWithList listAnnotation(DocumentPayloadWithList dhw, String test);
+
+ @WebMethod
@XmlAttachmentRef
DataHandler parameterAnnotation(DocumentPayload payload, String test, @XmlAttachmentRef DataHandler data);
Modified: framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpointImpl.java
===================================================================
--- framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpointImpl.java 2009-08-10 14:38:35 UTC (rev 10513)
+++ framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpointImpl.java 2009-08-10 17:04:55 UTC (rev 10514)
@@ -75,7 +75,44 @@
return new DocumentPayload(dh);
}
+ @WebMethod
+ public DocumentPayloadWithList listAnnotation(DocumentPayloadWithList dhw, String test)
+ {
+ DataHandler dh;
+
+ try {
+ System.out.println("[TestServiceImpl] ---> Dans le service");
+ if (dhw != null && dhw.getData() != null && dhw.getData().get(0) != null) {
+ dh=dhw.getData().get(0);
+ dumpDH(dh);
+ }
+ else
+ {
+ System.out.println("[TestServiceImpl] ---> Le DataHandler est NULL.");
+ }
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ dh = new DataHandler("Server data", "text/plain") ;
+
+ try{
+ System.out.println("[TestServiceImpl] ---> Le DataHandler returned.");
+ dumpDH(dh);
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ DocumentPayloadWithList payload = new DocumentPayloadWithList();
+ payload.getData().add(dh);
+
+ return payload;
+ }
+
+
@WebMethod
@XmlAttachmentRef
public DataHandler parameterAnnotation(DocumentPayload payload, String test, @XmlAttachmentRef DataHandler data)
15 years, 5 months
JBossWS SVN: r10513 - stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/extensions/xop/jaxws.
by jbossws-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-08-10 10:38:35 -0400 (Mon, 10 Aug 2009)
New Revision: 10513
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/extensions/xop/jaxws/ReflectiveAttachmentRefScanner.java
Log:
[JBPAPP-2341] - XmlAttachmentRef annotation on List<DataHandler> is not identified as an Attachment part
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/extensions/xop/jaxws/ReflectiveAttachmentRefScanner.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/extensions/xop/jaxws/ReflectiveAttachmentRefScanner.java 2009-08-10 14:23:29 UTC (rev 10512)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/extensions/xop/jaxws/ReflectiveAttachmentRefScanner.java 2009-08-10 14:38:35 UTC (rev 10513)
@@ -86,6 +86,7 @@
boolean exceptionToTheRule = isAttachmentDataType(type);
if (! exceptionToTheRule) {
type = getFieldComponentType(field);
+ exceptionToTheRule = isAttachmentDataType(type);
}
// only non JDK types are inspected except for byte[] and java.lang.String
if( !alreadyScanned(field) && (exceptionToTheRule || !isJDKType(type)) )
15 years, 5 months