summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/contrib')
-rw-r--r--sca-java-2.x/contrib/modules/binding-foo-runtime/pom.xml7
-rw-r--r--sca-java-2.x/contrib/modules/binding-foo-runtime/src/main/java/org/apache/tuscany/sca/binding/foo/runtime/FooBindingProviderFactory.java5
-rw-r--r--sca-java-2.x/contrib/modules/binding-foo-runtime/src/main/java/org/apache/tuscany/sca/binding/foo/runtime/FooReferenceBindingProvider.java43
-rw-r--r--sca-java-2.x/contrib/modules/binding-foo-runtime/src/test/resources/helloworld.composite4
4 files changed, 49 insertions, 10 deletions
diff --git a/sca-java-2.x/contrib/modules/binding-foo-runtime/pom.xml b/sca-java-2.x/contrib/modules/binding-foo-runtime/pom.xml
index 588b485694..8b264d480a 100644
--- a/sca-java-2.x/contrib/modules/binding-foo-runtime/pom.xml
+++ b/sca-java-2.x/contrib/modules/binding-foo-runtime/pom.xml
@@ -72,6 +72,13 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-runtime-axis2</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca-api</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>test</scope>
diff --git a/sca-java-2.x/contrib/modules/binding-foo-runtime/src/main/java/org/apache/tuscany/sca/binding/foo/runtime/FooBindingProviderFactory.java b/sca-java-2.x/contrib/modules/binding-foo-runtime/src/main/java/org/apache/tuscany/sca/binding/foo/runtime/FooBindingProviderFactory.java
index e57b2437af..b59cd50684 100644
--- a/sca-java-2.x/contrib/modules/binding-foo-runtime/src/main/java/org/apache/tuscany/sca/binding/foo/runtime/FooBindingProviderFactory.java
+++ b/sca-java-2.x/contrib/modules/binding-foo-runtime/src/main/java/org/apache/tuscany/sca/binding/foo/runtime/FooBindingProviderFactory.java
@@ -29,7 +29,10 @@ import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
public class FooBindingProviderFactory implements BindingProviderFactory<FooBinding> {
+ private ExtensionPointRegistry extensionPoints;
+
public FooBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ this.extensionPoints = extensionPoints;
}
public Class<FooBinding> getModelType() {
@@ -37,7 +40,7 @@ public class FooBindingProviderFactory implements BindingProviderFactory<FooBind
}
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpoint) {
- return new FooReferenceBindingProvider(endpoint);
+ return new FooReferenceBindingProvider(extensionPoints, endpoint);
}
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
diff --git a/sca-java-2.x/contrib/modules/binding-foo-runtime/src/main/java/org/apache/tuscany/sca/binding/foo/runtime/FooReferenceBindingProvider.java b/sca-java-2.x/contrib/modules/binding-foo-runtime/src/main/java/org/apache/tuscany/sca/binding/foo/runtime/FooReferenceBindingProvider.java
index a9f49eace5..128ee24aed 100644
--- a/sca-java-2.x/contrib/modules/binding-foo-runtime/src/main/java/org/apache/tuscany/sca/binding/foo/runtime/FooReferenceBindingProvider.java
+++ b/sca-java-2.x/contrib/modules/binding-foo-runtime/src/main/java/org/apache/tuscany/sca/binding/foo/runtime/FooReferenceBindingProvider.java
@@ -20,36 +20,65 @@
package org.apache.tuscany.sca.binding.foo.runtime;
import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
public class FooReferenceBindingProvider implements ReferenceBindingProvider {
- private EndpointReference endpoint;
- private InterfaceContract contract;
+ private ReferenceBindingProvider delegate;
- public FooReferenceBindingProvider(EndpointReference endpoint) {
- this.endpoint = endpoint;
+ public FooReferenceBindingProvider(ExtensionPointRegistry extensionPoints, EndpointReference endpointReference) {
+
+ initWSBindingDelegate(endpointReference, extensionPoints);
}
public Invoker createInvoker(Operation operation) {
- return new FooReferenceInvoker(operation, endpoint);
+ return delegate.createInvoker(operation);
+ }
+
+ private void initWSBindingDelegate(EndpointReference endpointReference, ExtensionPointRegistry extensionPoints) {
+ FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
+ WebServiceBindingFactory wsBindingFactory = modelFactories.getFactory(WebServiceBindingFactory.class);
+ WebServiceBinding wsBinding = wsBindingFactory.createWebServiceBinding();
+
+ // FIXME: this url needs to be set from some programatic lookup
+ wsBinding.setURI("http://localhost:8085/HelloWorldComponent/HelloWorldService");
+
+ BindingWSDLGenerator.generateWSDL(endpointReference.getComponent(), endpointReference.getReference(), wsBinding, extensionPoints, null);
+
+ RuntimeEndpointReference clonedEPR;
+ try {
+ clonedEPR = (RuntimeEndpointReference)endpointReference.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ clonedEPR.setBinding(wsBinding);
+ clonedEPR.setBindingProvider(null);
+ delegate = clonedEPR.getBindingProvider();
}
public void start() {
+ delegate.start();
}
public void stop() {
+ delegate.stop();
}
public InterfaceContract getBindingInterfaceContract() {
- return contract;
+ return delegate.getBindingInterfaceContract();
}
public boolean supportsOneWayInvocation() {
- return false;
+ return delegate.supportsOneWayInvocation();
}
}
diff --git a/sca-java-2.x/contrib/modules/binding-foo-runtime/src/test/resources/helloworld.composite b/sca-java-2.x/contrib/modules/binding-foo-runtime/src/test/resources/helloworld.composite
index e2de4e9528..10c96b39cd 100644
--- a/sca-java-2.x/contrib/modules/binding-foo-runtime/src/test/resources/helloworld.composite
+++ b/sca-java-2.x/contrib/modules/binding-foo-runtime/src/test/resources/helloworld.composite
@@ -25,14 +25,14 @@
<component name="HelloWorldComponent">
<implementation.java class="helloworld.HelloWorldImpl"/>
<service name="HelloWorldService" >
- <tuscany:binding.foo bindingType="ws" />
+ <binding.ws />
</service>
</component>
<component name="HelloWorldClient">
<implementation.java class="helloworld.HelloWorldClient"/>
<reference name="ref" >
- <tuscany:binding.foo uri="HelloWorldComponent/HelloWorldService"/>
+ <tuscany:binding.foo />
</reference>
</component>