summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/implementation-java
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/implementation-java')
-rw-r--r--sca-java-2.x/trunk/modules/implementation-java/META-INF/MANIFEST.MF1
-rw-r--r--sca-java-2.x/trunk/modules/implementation-java/pom.xml10
-rw-r--r--sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JAXWSProcessor.java37
-rw-r--r--sca-java-2.x/trunk/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java3
4 files changed, 47 insertions, 4 deletions
diff --git a/sca-java-2.x/trunk/modules/implementation-java/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/implementation-java/META-INF/MANIFEST.MF
index 650e78dbbe..1d2458dfd7 100644
--- a/sca-java-2.x/trunk/modules/implementation-java/META-INF/MANIFEST.MF
+++ b/sca-java-2.x/trunk/modules/implementation-java/META-INF/MANIFEST.MF
@@ -24,6 +24,7 @@ Import-Package: javax.jws,
org.apache.tuscany.sca.assembly.builder;version="2.0.0";resolution:=optional,
org.apache.tuscany.sca.assembly.impl;version="2.0.0",
org.apache.tuscany.sca.assembly.xml;version="2.0.0",
+ org.apache.tuscany.sca.binding.ws;version="2.0.0",
org.apache.tuscany.sca.contribution.processor;version="2.0.0",
org.apache.tuscany.sca.contribution.resolver;version="2.0.0",
org.apache.tuscany.sca.core;version="2.0.0",
diff --git a/sca-java-2.x/trunk/modules/implementation-java/pom.xml b/sca-java-2.x/trunk/modules/implementation-java/pom.xml
index 7b4a62e6f6..3a2dd6daff 100644
--- a/sca-java-2.x/trunk/modules/implementation-java/pom.xml
+++ b/sca-java-2.x/trunk/modules/implementation-java/pom.xml
@@ -76,9 +76,15 @@
<artifactId>tuscany-contribution</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
-
+
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <!--dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-builder</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>test</scope>
@@ -96,7 +102,7 @@
<artifactId>tuscany-binding-ws</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>test</scope>
- </dependency>
+ </dependency-->
</dependencies>
diff --git a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JAXWSProcessor.java b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JAXWSProcessor.java
index d2678bf93e..71a582e67f 100644
--- a/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JAXWSProcessor.java
+++ b/sca-java-2.x/trunk/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JAXWSProcessor.java
@@ -32,6 +32,9 @@ import javax.xml.ws.WebServiceProvider;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.xml.WebServiceConstants;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.implementation.java.IntrospectionException;
@@ -47,6 +50,7 @@ import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+import org.apache.tuscany.sca.policy.ExtensionType;
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.PolicyFactory;
import org.apache.tuscany.sca.policy.PolicySubject;
@@ -59,6 +63,7 @@ public class JAXWSProcessor extends BaseJavaClassVisitor {
private PolicyFactory policyFactory;
private WSDLFactory wsdlFactory;
+ private WebServiceBindingFactory wsBindingFactory;
public JAXWSProcessor(ExtensionPointRegistry registry) {
super(registry);
@@ -67,14 +72,18 @@ public class JAXWSProcessor extends BaseJavaClassVisitor {
this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
this.policyFactory = factories.getFactory(PolicyFactory.class);
this.javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
+ this.wsBindingFactory = factories.getFactory(WebServiceBindingFactory.class);
}
@Override
public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ boolean hasJaxwsAnnotation = false;
+
// Process @ServiceMode annotation - JCA 11013
if ( clazz.getAnnotation(ServiceMode.class) != null ) {
addSOAPIntent(type);
+ hasJaxwsAnnotation = true;
}
// Process @WebService annotation - POJO_8029, POJO_8030
@@ -95,6 +104,7 @@ public class JAXWSProcessor extends BaseJavaClassVisitor {
} catch (InvalidInterfaceException e) {
throw new IntrospectionException(e);
}
+ hasJaxwsAnnotation = true;
}
// Process @WebServiceProvider annotation - JCA_11015, POJO_8034
@@ -127,6 +137,8 @@ public class JAXWSProcessor extends BaseJavaClassVisitor {
for ( Service service : type.getServices() ) {
service.getInterfaceContract().getInterface().setRemotable(true);
}
+
+ hasJaxwsAnnotation = true;
}
// Process @WebParam and @WebResult annotations - POJO_8031, POJO_8032
@@ -170,6 +182,7 @@ public class JAXWSProcessor extends BaseJavaClassVisitor {
if (hasHeaderParam){
// Add a SOAP intent to the service
addSOAPIntent(service);
+ hasJaxwsAnnotation = true;
}
}
@@ -180,7 +193,18 @@ public class JAXWSProcessor extends BaseJavaClassVisitor {
for ( Service service : type.getServices() ) {
addSOAPIntent(service);
}
+ hasJaxwsAnnotation = true;
}
+
+ if (hasJaxwsAnnotation == true){
+ // Note that services are based on JAXWS annotations so
+ // that during the build process a binding.ws can be added
+ // if required
+ for ( Service service : type.getServices() ) {
+ service.setJAXWSService(true);
+ createWSBinding(type, service);
+ }
+ }
}
/**
@@ -191,7 +215,7 @@ public class JAXWSProcessor extends BaseJavaClassVisitor {
return "".equals(value) ? defaultValue : value;
}
- public Service createService(JavaImplementation type, Class<?> clazz, String serviceName, String javaInterfaceName, String wsdlFileName, boolean replace) throws InvalidInterfaceException, IntrospectionException {
+ private Service createService(JavaImplementation type, Class<?> clazz, String serviceName, String javaInterfaceName, String wsdlFileName, boolean replace) throws InvalidInterfaceException, IntrospectionException {
Service service = assemblyFactory.createService();
if (serviceName != null) {
@@ -269,5 +293,16 @@ public class JAXWSProcessor extends BaseJavaClassVisitor {
soapIntent.setName(Constants.SOAP_INTENT);
policySubject.getRequiredIntents().add(soapIntent);
}
+
+ private void createWSBinding(JavaImplementation javaImplementation, Service service){
+ if(service.getBindings().size() == 0){
+ WebServiceBinding wsBinding = wsBindingFactory.createWebServiceBinding();
+ ExtensionType bindingType = policyFactory.createBindingType();
+ bindingType.setType(WebServiceConstants.BINDING_WS_QNAME);
+ bindingType.setUnresolved(true);
+ ((PolicySubject)wsBinding).setExtensionType(bindingType);
+ service.getBindings().add(wsBinding);
+ }
+ }
}
diff --git a/sca-java-2.x/trunk/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java b/sca-java-2.x/trunk/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java
index 635b491b06..6ea4868983 100644
--- a/sca-java-2.x/trunk/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java
+++ b/sca-java-2.x/trunk/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java
@@ -95,7 +95,8 @@ public class ReadTestCase {
Composite composite = (Composite)staxProcessor.read(reader, context);
assertNotNull(composite);
- compositeBuilder.build(composite, builderContext);
+ // remove dependency on builder
+ //compositeBuilder.build(composite, builderContext);
}