riftsaw SVN: r1356 - in dsp/trunk: api and 11 other directories.
by riftsaw-commits@lists.jboss.org
Author: objectiser
Date: 2011-04-15 10:31:54 -0400 (Fri, 15 Apr 2011)
New Revision: 1356
Added:
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/annotation/
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/annotation/SecurityDomain.java
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/annotation/WebMetaData.java
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/IDeploymentBuilder.java
Modified:
dsp/trunk/api/pom.xml
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/InvocationAdapter.java
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/BaseWebServiceEndpoint.java
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/BuildProcessor.java
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/DeploymentBuilder.java
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/TemplateWebServiceEndpoint.java
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/WSInvocationAdapter.java
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/WebServiceProviderFactory.java
dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/WebServiceProviderGenerator.java
dsp/trunk/distribution/pom.xml
dsp/trunk/integration/jbossas5/pom.xml
dsp/trunk/integration/jbossas5/src/main/java/org/jboss/soa/dsp/deployer/jbossas5/WebMetaDataFactory.java
dsp/trunk/integration/jbossas6/pom.xml
dsp/trunk/integration/pom.xml
dsp/trunk/integration/tomcat/pom.xml
dsp/trunk/integration/tomcat/src/main/java/org/jboss/soa/dsp/deployer/tomcat/TomcatServiceDeployer.java
dsp/trunk/pom.xml
dsp/trunk/samples/example-deployer/provider/src/org/jboss/soa/dsp/example/provider/ExampleWebServiceFactory.java
Log:
RIFTSAW-373 - applied contribution from David Vilaverde. Thanks David.
Modified: dsp/trunk/api/pom.xml
===================================================================
--- dsp/trunk/api/pom.xml 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/api/pom.xml 2011-04-15 14:31:54 UTC (rev 1356)
@@ -5,13 +5,13 @@
<groupId>org.jboss.soa.dsp</groupId>
<artifactId>dsp-api</artifactId>
<packaging>jar</packaging>
- <version>1.1.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
<name>SOA::DSP::API</name>
<parent>
<groupId>org.jboss.soa.dsp</groupId>
<artifactId>dsp</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
</parent>
<dependencies>
Modified: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/InvocationAdapter.java
===================================================================
--- dsp/trunk/api/src/main/java/org/jboss/soa/dsp/InvocationAdapter.java 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/api/src/main/java/org/jboss/soa/dsp/InvocationAdapter.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -17,6 +17,7 @@
package org.jboss.soa.dsp;
import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceContext;
/**
* Hides the message translation details when invoking ODE from
@@ -33,6 +34,11 @@
QName getServiceName();
String getPortName();
+
+ /**
+ * Get the web service context.
+ */
+ public WebServiceContext getContext();
/**
* Callback from the Service towards the adapter when
@@ -46,13 +52,22 @@
/**
* Callback from the Engine towards the adapter when
* turning an ODE response {@link org.apache.ode.bpel.iapi.Message} into an external format <T>
- * @param mex
*/
void createResponse(javax.wsdl.Operation wsdl, MessageAdapter resp);
+ /**
+ * @param op
+ * @param faultName
+ * @param fault
+ */
void createFault(javax.wsdl.Operation op, QName faultName, MessageAdapter fault);
/**
+ * @param message
+ */
+ public void setMessage(T message);
+
+ /**
* Access the invocation result (response)
* @return T
*/
Added: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/annotation/SecurityDomain.java
===================================================================
--- dsp/trunk/api/src/main/java/org/jboss/soa/dsp/annotation/SecurityDomain.java (rev 0)
+++ dsp/trunk/api/src/main/java/org/jboss/soa/dsp/annotation/SecurityDomain.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2011 Red Hat, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.jboss.soa.dsp.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for specifying the JBoss security domain of dynamically deployed services.
+ * This annotation needs to be specified on the {@see WebServiceProviderFactory}.
+ **/
+(a)Target(ElementType.TYPE)
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface SecurityDomain {
+ String value();
+}
Added: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/annotation/WebMetaData.java
===================================================================
--- dsp/trunk/api/src/main/java/org/jboss/soa/dsp/annotation/WebMetaData.java (rev 0)
+++ dsp/trunk/api/src/main/java/org/jboss/soa/dsp/annotation/WebMetaData.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2011 Red Hat, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.jboss.soa.dsp.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Provides web context specific meta data to DSP based web service endpoints.
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE })
+public @interface WebMetaData {
+ /**
+ * The authMethod is used to configure the authentication mechanism for the web service.
+ * As a prerequisite to gaining access to any web service which are protected by an authorization
+ * constraint, a user must have authenticated using the configured mechanism.
+ *
+ * Legal values for this element are "BASIC", or "CLIENT-CERT".
+ */
+ String authMethod() default "";
+
+ /**
+ * The transportGuarantee specifies that the communication
+ * between client and server should be NONE, INTEGRAL, or
+ * CONFIDENTIAL. NONE means that the application does not require any
+ * transport guarantees. A value of INTEGRAL means that the application
+ * requires that the data sent between the client and server be sent in
+ * such a way that it can't be changed in transit. CONFIDENTIAL means
+ * that the application requires that the data be transmitted in a
+ * fashion that prevents other entities from observing the contents of
+ * the transmission. In most cases, the presence of the INTEGRAL or
+ * CONFIDENTIAL flag will indicate that the use of SSL is required.
+ */
+ String transportGuarantee() default "";
+
+ /**
+ * A secure endpoint does not secure wsdl access by default.
+ * Explicitly setting secureWSDLAccess overrides this behaviour.
+ *
+ * Protect access to WSDL. See http://jira.jboss.org/jira/browse/JBWS-723
+ */
+ boolean secureWSDLAccess() default false;
+}
Modified: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/BaseWebServiceEndpoint.java
===================================================================
--- dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/BaseWebServiceEndpoint.java 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/BaseWebServiceEndpoint.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -18,10 +18,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.soa.dsp.InvocationAdapter;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import javax.annotation.Resource;
import javax.wsdl.Definition;
import javax.wsdl.Operation;
import javax.wsdl.WSDLException;
@@ -30,6 +32,7 @@
import javax.xml.namespace.QName;
import javax.xml.soap.*;
import javax.xml.ws.Provider;
+import javax.xml.ws.WebServiceContext;
/**
* Base class for BPEL endpoints that are created through javassist.
@@ -46,10 +49,13 @@
private SOAPMessageAdapter soapAdapter;
private QName serviceQName;
private Definition wsdlDefinition;
- private WebServiceProviderFactory serviceFactory;
+ private WebServiceProviderFactory<SOAPMessage> serviceFactory;
private boolean isInitialized;
-
+ @Resource
+ private WebServiceContext context;
+
+ @SuppressWarnings("unchecked")
private void init()
{
if(!isInitialized)
@@ -105,10 +111,10 @@
// Create invocation context
final String operationName = resolveOperationName(messageElement);
- WSInvocationAdapter invocationContext = serviceFactory.getInvocationAdapter(operationName,
- serviceQName, getPortName(), soapAdapter);
+ InvocationAdapter<SOAPMessage> invocationContext = serviceFactory.getInvocationAdapter(operationName,
+ serviceQName, getPortName(), soapAdapter, getContext());
- invocationContext.setSOAPMessage(soapMessage);
+ invocationContext.setMessage(soapMessage);
// Invoke ODE
serviceFactory.getServiceProvider().invoke(invocationContext);
@@ -138,7 +144,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Failed to invoke BPEL process: "+e.getMessage(), e);
+ throw new RuntimeException("Failed to invoke endpoint: "+e.getMessage(), e);
}
}
@@ -203,6 +209,13 @@
return messageElement;
}
+ /**
+ *
+ */
+ protected WebServiceContext getContext() {
+ return context;
+ }
+
public String getEndpointId() {
return(null);
}
Modified: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/BuildProcessor.java
===================================================================
--- dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/BuildProcessor.java 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/BuildProcessor.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -18,6 +18,6 @@
public interface BuildProcessor {
- public void process(DeploymentBuilder builder);
+ public void process(IDeploymentBuilder builder);
}
Modified: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/DeploymentBuilder.java
===================================================================
--- dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/DeploymentBuilder.java 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/DeploymentBuilder.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -20,7 +20,7 @@
import java.io.*;
-public class DeploymentBuilder
+public class DeploymentBuilder implements IDeploymentBuilder
{
private static final String DSP = "dsp";
@@ -61,18 +61,30 @@
return this;
}
+ /**
+ * @see org.jboss.soa.dsp.ws.IDeploymentBuilder#getWar()
+ */
public File getWar() {
return(this.war);
}
+ /**
+ * @see org.jboss.soa.dsp.ws.IDeploymentBuilder#getWebInf()
+ */
public File getWebInf() {
return(this.webInf);
}
+ /**
+ * @see org.jboss.soa.dsp.ws.IDeploymentBuilder#getWSDLDir()
+ */
public File getWSDLDir() {
return(this.wsdlDir);
}
+ /**
+ * @see org.jboss.soa.dsp.ws.IDeploymentBuilder#getEndpoint()
+ */
public String getEndpoint() {
return(this.endpointId);
}
@@ -119,6 +131,9 @@
return this;
}
+ /**
+ * @see org.jboss.soa.dsp.ws.IDeploymentBuilder#getWSDL()
+ */
public File getWSDL() {
return(this.wsdl);
}
@@ -129,11 +144,17 @@
return(this);
}
+ /**
+ * @see org.jboss.soa.dsp.ws.IDeploymentBuilder#getProvider()
+ */
public javax.xml.ws.Provider<?> getProvider() {
return(this.provider);
}
- public DeploymentBuilder process(BuildProcessor processor) {
+ /**
+ * @see org.jboss.soa.dsp.ws.IDeploymentBuilder#process(org.jboss.soa.dsp.ws.BuildProcessor)
+ */
+ public IDeploymentBuilder process(BuildProcessor processor) {
if (processor != null) {
processor.process(this);
}
@@ -141,6 +162,9 @@
return(this);
}
+ /**
+ * @see org.jboss.soa.dsp.ws.IDeploymentBuilder#build()
+ */
public File build()
{
return this.war;
Added: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/IDeploymentBuilder.java
===================================================================
--- dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/IDeploymentBuilder.java (rev 0)
+++ dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/IDeploymentBuilder.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2011 Red Hat, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.jboss.soa.dsp.ws;
+
+import java.io.File;
+
+/**
+ * This interface represents the deployment builder.
+ */
+public interface IDeploymentBuilder {
+
+ /**
+ * This method returns the location of the war file.
+ *
+ * @return The WAR file location
+ */
+ public File getWar();
+
+ /**
+ * This method returns the location of the WEB-INF folder within
+ * the war file.
+ *
+ * @return The location of the WEB-INF folder
+ */
+ public File getWebInf();
+
+ /**
+ * This method returns the location of the folder containing
+ * the WSDL files.
+ *
+ * @return The WSDL folder within the war
+ */
+ public File getWSDLDir();
+
+ /**
+ * This method returns the unique endpoint id associated with the
+ * deployment.
+ *
+ * @return The endpoint id
+ */
+ public String getEndpoint();
+
+ /**
+ * This method returns the location of the WSDL representing the
+ * interface to the deployed service.
+ *
+ * @return The WSDL
+ */
+ public File getWSDL();
+
+ /**
+ * This method returns the Web Service Provider.
+ *
+ * @return The web service provider
+ */
+ public javax.xml.ws.Provider<?> getProvider();
+
+ /**
+ * This method enables a deployment target to customise the deployment
+ * using a supplied build processor.
+ *
+ * @param processor The build processor for modifying the deployment
+ */
+ public IDeploymentBuilder process(BuildProcessor processor);
+
+ /**
+ * This method builds the deployment and returns a reference to the
+ * resulting file.
+ *
+ * @return The deployable file
+ */
+ public File build();
+
+}
\ No newline at end of file
Modified: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/TemplateWebServiceEndpoint.java
===================================================================
--- dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/TemplateWebServiceEndpoint.java 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/TemplateWebServiceEndpoint.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -17,7 +17,7 @@
package org.jboss.soa.dsp.ws;
-import javax.xml.soap.*;
+import javax.xml.soap.SOAPMessage;
import javax.xml.ws.Provider;
Modified: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/WSInvocationAdapter.java
===================================================================
--- dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/WSInvocationAdapter.java 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/WSInvocationAdapter.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -23,6 +23,7 @@
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceContext;
/**
* @author Heiko Braun <hbraun(a)redhat.com>
@@ -35,16 +36,18 @@
private SOAPMessage soapRequestMessage;
private SOAPMessage soapResponseMessage;
+ private WebServiceContext context;
private final SOAPMessageAdapter soapAdapter;
public WSInvocationAdapter(String operationName,
- QName serviceName, String portName, SOAPMessageAdapter soapAdapter)
+ QName serviceName, String portName, SOAPMessageAdapter soapAdapter, WebServiceContext context)
{
this.operationName = operationName;
this.serviceName = serviceName;
this.portName = portName;
this.soapAdapter = soapAdapter;
+ this.context = context;
}
public String getOperationName()
@@ -105,8 +108,17 @@
return soapResponseMessage;
}
- public void setSOAPMessage(SOAPMessage soapMessage)
- {
- this.soapRequestMessage = soapMessage;
+ /**
+ * @see org.jboss.soa.dsp.InvocationAdapter#getContext()
+ */
+ public WebServiceContext getContext() {
+ return context;
}
+
+ /**
+ * @see org.jboss.soa.dsp.InvocationAdapter#setMessage(java.lang.Object)
+ */
+ public void setMessage(SOAPMessage message) {
+ this.soapRequestMessage = message;
+ }
}
Modified: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/WebServiceProviderFactory.java
===================================================================
--- dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/WebServiceProviderFactory.java 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/WebServiceProviderFactory.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -17,14 +17,33 @@
package org.jboss.soa.dsp.ws;
import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceContext;
+import org.jboss.soa.dsp.InvocationAdapter;
import org.jboss.soa.dsp.ServiceProvider;
-public interface WebServiceProviderFactory {
+/**
+ * This class provides implementations of the web service provider that
+ * can be dynamically invoked upon receiving requests to the Web Service
+ * interface.
+ */
+public interface WebServiceProviderFactory<T> {
+ /**
+ * This method returns a reference to the service provider.
+ *
+ * @return The service provider
+ */
public ServiceProvider getServiceProvider();
- public WSInvocationAdapter getInvocationAdapter(String operationName,
- QName serviceName, String portName, SOAPMessageAdapter soapAdapter);
+ /**
+ * @param operationName The operation name
+ * @param serviceName The WSDL service name
+ * @param portName The WSDL port name
+ * @param soapAdapter The soap adapter
+ * @param context The context
+ */
+ public InvocationAdapter<T> getInvocationAdapter(String operationName, QName serviceName,
+ String portName, SOAPMessageAdapter soapAdapter, WebServiceContext context);
}
Modified: dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/WebServiceProviderGenerator.java
===================================================================
--- dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/WebServiceProviderGenerator.java 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/api/src/main/java/org/jboss/soa/dsp/ws/WebServiceProviderGenerator.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -16,15 +16,23 @@
*/
package org.jboss.soa.dsp.ws;
-import javassist.*;
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtField;
+import javassist.CtMethod;
+import javassist.LoaderClassPath;
+import javassist.Modifier;
import javassist.bytecode.AnnotationsAttribute;
import javassist.bytecode.ClassFile;
import javassist.bytecode.ConstPool;
import javassist.bytecode.annotation.Annotation;
+import javassist.bytecode.annotation.BooleanMemberValue;
import javassist.bytecode.annotation.EnumMemberValue;
import javassist.bytecode.annotation.StringMemberValue;
import org.jboss.soa.dsp.EndpointMetaData;
+import org.jboss.soa.dsp.annotation.SecurityDomain;
+import org.jboss.soa.dsp.annotation.WebMetaData;
/**
@@ -148,11 +156,38 @@
new StringMemberValue(providerFactory.getName(), constantPool));
attr.addAnnotation(detailsAnnotation);
+
+
+ CtClass factoryProvider = pool.get(providerFactory.getName());
+ AnnotationsAttribute annotationsAttr = (AnnotationsAttribute) factoryProvider.getClassFile().getAttribute(AnnotationsAttribute.visibleTag);
+ if (annotationsAttr != null) {
+ Annotation sd = annotationsAttr.getAnnotation(SecurityDomain.class.getName());
+ if (sd != null) {
+ Annotation sdAnnotation = new Annotation(
+ org.jboss.soa.dsp.annotation.SecurityDomain.class.getName(), constantPool);
+ StringMemberValue value = (StringMemberValue) sd.getMemberValue("value");
+ sdAnnotation.addMemberValue("value", new StringMemberValue(value.getValue(), constantPool));
+ attr.addAnnotation(sdAnnotation);
+ }
+
+ Annotation wmd = annotationsAttr.getAnnotation(WebMetaData.class.getName());
+ if (wmd != null) {
+ Annotation wmdAnnotation = new Annotation(
+ org.jboss.soa.dsp.annotation.WebMetaData.class.getName(), constantPool);
+
+ StringMemberValue auth = (StringMemberValue) wmd.getMemberValue("authMethod");
+ StringMemberValue trans = (StringMemberValue) wmd.getMemberValue("transportGuarantee");
+ BooleanMemberValue secure = (BooleanMemberValue) wmd.getMemberValue("secureWSDLAccess");
+
+ wmdAnnotation.addMemberValue("authMethod", new StringMemberValue(auth.getValue(), constantPool));
+ wmdAnnotation.addMemberValue("transportGuarantee", new StringMemberValue(trans.getValue(), constantPool));
+ wmdAnnotation.addMemberValue("secureWSDLAccess", new BooleanMemberValue(secure.getValue(), constantPool));
+ attr.addAnnotation(wmdAnnotation);
+ }
+ }
-
classFile.addAttribute(attr);
-
// Check if handler chain should be established
if (handlerFilePath != null) {
Annotation handlerChain = new Annotation("javax.jws.HandlerChain", constantPool);
@@ -186,6 +221,10 @@
return obj;
}
+ /**
+ * @param war
+ * @throws Exception
+ */
public void writeClass(java.io.File war) throws Exception {
String dir=war.getAbsolutePath()+java.io.File.separatorChar+"WEB-INF"+
Modified: dsp/trunk/distribution/pom.xml
===================================================================
--- dsp/trunk/distribution/pom.xml 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/distribution/pom.xml 2011-04-15 14:31:54 UTC (rev 1356)
@@ -4,13 +4,13 @@
<groupId>org.jboss.soa.dsp</groupId>
<artifactId>distribution</artifactId>
<packaging>pom</packaging>
- <version>1.1.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
<name>SOA::DSP::Distribution</name>
<parent>
<groupId>org.jboss.soa.dsp</groupId>
<artifactId>dsp</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
</parent>
<properties>
Modified: dsp/trunk/integration/jbossas5/pom.xml
===================================================================
--- dsp/trunk/integration/jbossas5/pom.xml 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/integration/jbossas5/pom.xml 2011-04-15 14:31:54 UTC (rev 1356)
@@ -5,13 +5,13 @@
<groupId>org.jboss.soa.dsp</groupId>
<artifactId>dsp-jbossas5</artifactId>
<packaging>jar</packaging>
- <version>1.1.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
<name>SOA::DSP::Integration::JBossAS5</name>
<parent>
<groupId>org.jboss.soa.dsp</groupId>
<artifactId>integration</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
</parent>
<properties>
Modified: dsp/trunk/integration/jbossas5/src/main/java/org/jboss/soa/dsp/deployer/jbossas5/WebMetaDataFactory.java
===================================================================
--- dsp/trunk/integration/jbossas5/src/main/java/org/jboss/soa/dsp/deployer/jbossas5/WebMetaDataFactory.java 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/integration/jbossas5/src/main/java/org/jboss/soa/dsp/deployer/jbossas5/WebMetaDataFactory.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -16,14 +16,24 @@
*/
package org.jboss.soa.dsp.deployer.jbossas5;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
import org.jboss.metadata.web.jboss.JBossServletMetaData;
import org.jboss.metadata.web.jboss.JBossServletsMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.AuthConstraintMetaData;
+import org.jboss.metadata.web.spec.LoginConfigMetaData;
+import org.jboss.metadata.web.spec.SecurityConstraintMetaData;
import org.jboss.metadata.web.spec.ServletMappingMetaData;
+import org.jboss.metadata.web.spec.TransportGuaranteeType;
+import org.jboss.metadata.web.spec.UserDataConstraintMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionMetaData;
+import org.jboss.metadata.web.spec.WebResourceCollectionsMetaData;
+import org.jboss.soa.dsp.annotation.SecurityDomain;
+import org.jboss.soa.dsp.annotation.WebMetaData;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Creates an in-memory representation of web meta data.
* Based on http://anonsvn.jboss.org/repos/jbossas/tags/JBoss_5_1_0_GA/webservices/sr...
@@ -48,12 +58,18 @@
public JBossWebMetaData createWebMetaData(ClassLoader loader)
{
JBossWebMetaData jbwmd = new JBossWebMetaData();
- createWebAppDescriptor(jbwmd);
- createJBossWebAppDescriptor(jbwmd);
+ try {
+ Class<?> providerFactory = Class.forName(servletClassName);
+ createWebAppDescriptor(jbwmd, providerFactory);
+ createJBossWebAppDescriptor(jbwmd, providerFactory);
+ } catch (ClassNotFoundException ex) {
+
+ }
+
return jbwmd;
}
- private void createWebAppDescriptor(JBossWebMetaData jbwmd)
+ private void createWebAppDescriptor(JBossWebMetaData jbwmd, Class<?> providerFactory)
{
/*
<servlet>
@@ -75,8 +91,7 @@
</servlet-mapping>
*/
List<ServletMappingMetaData> servletMappings = jbwmd.getServletMappings();
- if (servletMappings == null)
- {
+ if (servletMappings == null) {
servletMappings = new ArrayList<ServletMappingMetaData>();
jbwmd.setServletMappings(servletMappings);
}
@@ -87,9 +102,90 @@
servletMapping.setUrlPatterns(urlPatterns);
servletMappings.add(servletMapping);
+ WebMetaData metaData = providerFactory.getAnnotation(WebMetaData.class);
+ if (metaData != null)
+ configureSecurity(jbwmd, metaData);
}
- private void createJBossWebAppDescriptor(JBossWebMetaData jbwmd)
+ /**
+ * @param jbwmd
+ */
+ protected void configureSecurity(JBossWebMetaData jbwmd, WebMetaData metaData) {
+ Boolean secureWSDLAccess = null;
+ String transportGuarantee = null;
+ String beanAuthMethod = null;
+
+ if (metaData != null) {
+ if (metaData.authMethod().length() > 0)
+ beanAuthMethod = metaData.authMethod();
+ if (metaData.transportGuarantee().length() > 0)
+ transportGuarantee = metaData.transportGuarantee();
+ if (metaData.secureWSDLAccess())
+ secureWSDLAccess = metaData.secureWSDLAccess();
+ }
+
+ String authMethod = null;
+ if (beanAuthMethod != null || transportGuarantee != null) {
+ List<SecurityConstraintMetaData> securityContraints = jbwmd.getSecurityContraints();
+ if (securityContraints == null) {
+ securityContraints = new ArrayList<SecurityConstraintMetaData>();
+ jbwmd.setSecurityContraints(securityContraints);
+ }
+
+ SecurityConstraintMetaData securityConstraint = new SecurityConstraintMetaData();
+ securityContraints.add(securityConstraint);
+
+ WebResourceCollectionsMetaData resourceCollections = securityConstraint.getResourceCollections();
+ if (resourceCollections == null) {
+ resourceCollections = new WebResourceCollectionsMetaData();
+ securityConstraint.setResourceCollections(resourceCollections);
+ }
+
+ WebResourceCollectionMetaData resourceCollection = new WebResourceCollectionMetaData();
+ resourceCollections.add(resourceCollection);
+
+ resourceCollection.setWebResourceName(endpointId);
+ resourceCollection.setUrlPatterns(Arrays.asList(new String[] { urlPattern }));
+ ArrayList<String> httpMethods = new ArrayList<String>();
+ resourceCollection.setHttpMethods(httpMethods);
+ if (Boolean.TRUE.equals(secureWSDLAccess)) {
+ httpMethods.add("GET");
+ }
+ httpMethods.add("POST");
+
+ if (beanAuthMethod != null) {
+ // Only the first auth-method gives the war login-config/auth-method
+ if (authMethod == null)
+ authMethod = beanAuthMethod;
+
+ AuthConstraintMetaData authConstraint = new AuthConstraintMetaData();
+ authConstraint.setRoleNames(Arrays.asList(new String[] { "*" }));
+ securityConstraint.setAuthConstraint(authConstraint);
+ }
+
+ if (transportGuarantee != null) {
+ UserDataConstraintMetaData userDataConstraint = new UserDataConstraintMetaData();
+ userDataConstraint.setTransportGuarantee(TransportGuaranteeType.valueOf(transportGuarantee));
+ securityConstraint.setUserDataConstraint(userDataConstraint);
+ }
+
+ if (authMethod != null) {
+ LoginConfigMetaData loginConfig = jbwmd.getLoginConfig();
+ if (loginConfig == null) {
+ loginConfig = new LoginConfigMetaData();
+ jbwmd.setLoginConfig(loginConfig);
+ }
+ loginConfig.setAuthMethod(authMethod);
+ loginConfig.setRealmName("DSP Security Realm");
+ }
+ }
+ }
+
+ /**
+ * @param jbwmd
+ * @param providerFactory
+ */
+ private void createJBossWebAppDescriptor(JBossWebMetaData jbwmd, Class<?> providerFactory)
{
/* Create a jboss-web
<jboss-web>
@@ -98,7 +194,21 @@
<virtual-host>some.domain.com</virtual-host>
</jboss-web>
*/
-
+ SecurityDomain domain = providerFactory.getAnnotation(SecurityDomain.class);
+ if (domain != null)
+ addSecurityDomain(jbwmd, domain.value());
jbwmd.setContextRoot(webContext);
}
+
+ public void addSecurityDomain(JBossWebMetaData jbossWeb, String securityDomain)
+ {
+
+ if (securityDomain != null)
+ {
+ if (securityDomain.startsWith("java:/jaas/") == false)
+ securityDomain = "java:/jaas/" + securityDomain;
+
+ jbossWeb.setSecurityDomain(securityDomain);
+ }
+ }
}
Modified: dsp/trunk/integration/jbossas6/pom.xml
===================================================================
--- dsp/trunk/integration/jbossas6/pom.xml 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/integration/jbossas6/pom.xml 2011-04-15 14:31:54 UTC (rev 1356)
@@ -5,13 +5,13 @@
<groupId>org.jboss.soa.dsp</groupId>
<artifactId>dsp-jbossas6</artifactId>
<packaging>jar</packaging>
- <version>1.1.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
<name>SOA::DSP::Integration::JBossAS6</name>
<parent>
<groupId>org.jboss.soa.dsp</groupId>
<artifactId>integration</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
</parent>
<properties>
Modified: dsp/trunk/integration/pom.xml
===================================================================
--- dsp/trunk/integration/pom.xml 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/integration/pom.xml 2011-04-15 14:31:54 UTC (rev 1356)
@@ -5,13 +5,13 @@
<groupId>org.jboss.soa.dsp</groupId>
<artifactId>integration</artifactId>
<packaging>pom</packaging>
- <version>1.1.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
<name>SOA::DSP::Integration</name>
<parent>
<groupId>org.jboss.soa.dsp</groupId>
<artifactId>dsp</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
</parent>
<modules>
Modified: dsp/trunk/integration/tomcat/pom.xml
===================================================================
--- dsp/trunk/integration/tomcat/pom.xml 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/integration/tomcat/pom.xml 2011-04-15 14:31:54 UTC (rev 1356)
@@ -5,13 +5,13 @@
<groupId>org.jboss.soa.dsp</groupId>
<artifactId>dsp-tomcat</artifactId>
<packaging>jar</packaging>
- <version>1.1.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
<name>SOA::DSP::Integration::Tomcat</name>
<parent>
<groupId>org.jboss.soa.dsp</groupId>
<artifactId>integration</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
</parent>
<dependencies>
Modified: dsp/trunk/integration/tomcat/src/main/java/org/jboss/soa/dsp/deployer/tomcat/TomcatServiceDeployer.java
===================================================================
--- dsp/trunk/integration/tomcat/src/main/java/org/jboss/soa/dsp/deployer/tomcat/TomcatServiceDeployer.java 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/integration/tomcat/src/main/java/org/jboss/soa/dsp/deployer/tomcat/TomcatServiceDeployer.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -37,7 +37,7 @@
import org.jboss.soa.dsp.deployer.ServiceDeployer;
import org.jboss.soa.dsp.server.ServerConfig;
import org.jboss.soa.dsp.ws.BuildProcessor;
-import org.jboss.soa.dsp.ws.DeploymentBuilder;
+import org.jboss.soa.dsp.ws.IDeploymentBuilder;
public class TomcatServiceDeployer implements ServiceDeployer {
@@ -140,7 +140,7 @@
protected class TomcatBuildProcessor implements BuildProcessor {
- public void process(DeploymentBuilder builder) {
+ public void process(IDeploymentBuilder builder) {
String endpointId=builder.getEndpoint();
String provider=(builder.getProvider() == null ? null : builder.getProvider().getClass().getName());
java.util.List<String> urls=getURLs(builder.getWSDL());
Modified: dsp/trunk/pom.xml
===================================================================
--- dsp/trunk/pom.xml 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/pom.xml 2011-04-15 14:31:54 UTC (rev 1356)
@@ -5,11 +5,11 @@
<groupId>org.jboss.soa.dsp</groupId>
<artifactId>dsp</artifactId>
<packaging>pom</packaging>
- <version>1.1.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
<name>SOA::DSP</name>
<properties>
- <dsp.version>1.1.0-SNAPSHOT</dsp.version>
+ <dsp.version>2.0.0-SNAPSHOT</dsp.version>
<junit.version>4.8.1</junit.version>
<jaxws.version>2.1</jaxws.version>
<wsdl4j.version>1.6.2</wsdl4j.version>
Modified: dsp/trunk/samples/example-deployer/provider/src/org/jboss/soa/dsp/example/provider/ExampleWebServiceFactory.java
===================================================================
--- dsp/trunk/samples/example-deployer/provider/src/org/jboss/soa/dsp/example/provider/ExampleWebServiceFactory.java 2011-04-15 06:02:02 UTC (rev 1355)
+++ dsp/trunk/samples/example-deployer/provider/src/org/jboss/soa/dsp/example/provider/ExampleWebServiceFactory.java 2011-04-15 14:31:54 UTC (rev 1356)
@@ -17,21 +17,24 @@
package org.jboss.soa.dsp.example.provider;
import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
import org.jboss.soa.dsp.ServiceProvider;
import org.jboss.soa.dsp.ws.SOAPMessageAdapter;
+import org.jboss.soa.dsp.InvocationAdapter;
import org.jboss.soa.dsp.ws.WSInvocationAdapter;
import org.jboss.soa.dsp.ws.WebServiceProviderFactory;
-public class ExampleWebServiceFactory implements WebServiceProviderFactory {
+public class ExampleWebServiceFactory implements WebServiceProviderFactory<SOAPMessage> {
public ServiceProvider getServiceProvider() {
return(new ExampleServiceProvider());
}
- public WSInvocationAdapter getInvocationAdapter(String operationName,
- QName serviceName, String portName, SOAPMessageAdapter soapAdapter) {
+ public InvocationAdapter<SOAPMessage> getInvocationAdapter(String operationName,
+ QName serviceName, String portName, SOAPMessageAdapter soapAdapter,
+ javax.xml.ws.WebServiceContext context) {
return(new WSInvocationAdapter(operationName,
- serviceName, portName, soapAdapter));
+ serviceName, portName, soapAdapter, context));
}
}