summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java17
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java9
-rw-r--r--sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java8
-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
-rw-r--r--sca-java-2.x/trunk/modules/interface-java/META-INF/MANIFEST.MF2
8 files changed, 81 insertions, 6 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java
index 1f3d412364..9caa7563c9 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java
@@ -39,4 +39,21 @@ public interface Service extends AbstractService, Contract {
* @return the endpoints implied by this service
*/
List<Endpoint> getEndpoints();
+
+
+ /**
+ * Returns true if this service was defined based on JAXWS annotations
+ * in a Java implementation
+ *
+ * @return
+ */
+ boolean isJAXWSService();
+
+ /**
+ * Allows the JAXWSService flag to be set. It should be set true if the service
+ * configuration has been affected by JAXWS annotations.
+ *
+ * @param isJAXWSService
+ */
+ void setJAXWSService(boolean isJAXWSService);
}
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
index 62523e5c17..f8eb0fa6ec 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
@@ -38,6 +38,7 @@ public class ServiceImpl extends AbstractServiceImpl implements Service, Cloneab
private boolean overridingBindings;
private Callback callback;
private List<Endpoint> endpoints = new ArrayList<Endpoint>();
+ private boolean isJAXWSService = false;
/**
* Constructs a new service.
@@ -103,4 +104,12 @@ public class ServiceImpl extends AbstractServiceImpl implements Service, Cloneab
public void setOverridingBindings(boolean overridingBindings) {
this.overridingBindings = overridingBindings;
}
+
+ public boolean isJAXWSService() {
+ return isJAXWSService;
+ }
+
+ public void setJAXWSService(boolean isJAXWSService) {
+ this.isJAXWSService = isJAXWSService;
+ }
}
diff --git a/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java b/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java
index bc19b82aec..d31500c85a 100644
--- a/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java
+++ b/sca-java-2.x/trunk/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java
@@ -216,5 +216,11 @@ public class TestRuntimeComponentService implements RuntimeComponentService {
// TODO Auto-generated method stub
}
-
+
+ public boolean isJAXWSService() {
+ return false;
+ }
+
+ public void setJAXWSService(boolean isJAXWSService) {
+ }
}
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);
}
diff --git a/sca-java-2.x/trunk/modules/interface-java/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/interface-java/META-INF/MANIFEST.MF
index 41dd68ed26..16f285a815 100644
--- a/sca-java-2.x/trunk/modules/interface-java/META-INF/MANIFEST.MF
+++ b/sca-java-2.x/trunk/modules/interface-java/META-INF/MANIFEST.MF
@@ -21,7 +21,6 @@ Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-Description: Apache Tuscany SCA Java Interface Model
Import-Package: javax.xml.namespace,
javax.xml.stream,
- org.oasisopen.sca;version="2.0.0",
org.apache.tuscany.sca.assembly;version="2.0.0",
org.apache.tuscany.sca.assembly.xml;version="2.0.0",
org.apache.tuscany.sca.contribution.processor;version="2.0.0",
@@ -37,6 +36,7 @@ Import-Package: javax.xml.namespace,
org.apache.tuscany.sca.interfacedef.util;version="2.0.0",
org.apache.tuscany.sca.monitor;version="2.0.0",
org.apache.tuscany.sca.policy;version="2.0.0",
+ org.oasisopen.sca;version="2.0.0",
org.oasisopen.sca.annotation;version="2.0.0"
Bundle-SymbolicName: org.apache.tuscany.sca.interface.java
Bundle-DocURL: http://www.apache.org/