summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-12-08 16:16:13 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-12-08 16:16:13 +0000
commit2199d0dc8ee5c8ee3269076112618e953c56e748 (patch)
tree852c3782b9219ecfab9683d0401d9756259b8adc
parent12e313601f2ce28638f4ef44f559116d692873b5 (diff)
Add a strawman approach to enable setting the binding uri on a ServiceReference
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1211945 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java17
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java6
2 files changed, 22 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
index 73bd58dcc0..2ccb8a791e 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
@@ -71,6 +71,7 @@ import org.apache.tuscany.sca.invocation.InvokerAsyncResponse;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.EndpointReferenceProvider;
import org.apache.tuscany.sca.provider.ImplementationAsyncProvider;
@@ -127,6 +128,7 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen
private boolean started;
private RuntimeEndpointReference delegateEndpointReference;
+ private boolean bindingURIaltered;
/**
* No-arg constructor for Java serilization
@@ -352,6 +354,9 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen
chains = chainList;
wireProcessor.process(this);
+ // reset the binding uri altered flag
+ bindingURIaltered = false;
+
if (isAsyncInvocation()){
// Fix up all of the operation chain response paths to point back to the implementation provided
// async response handler
@@ -546,7 +551,7 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen
public boolean isOutOfDate() {
resolve();
- return eprBinder.isOutOfDate(domainRegistry, this);
+ return bindingURIaltered || eprBinder.isOutOfDate(domainRegistry, this);
}
public synchronized ReferenceBindingProvider getBindingProvider() {
@@ -819,5 +824,15 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen
}
return null;
}
+
+ public void setBindingURI(String uri) {
+ binding.setURI(uri);
+ bindingURIaltered = true;
+ BindingBuilder builder = builders.getBindingBuilder(binding.getType());
+ if (builder != null) {
+ BuilderContext builderContext = new BuilderContext(null, null, null);
+ builder.build(component, reference, binding, builderContext, true);
+ }
+ }
}
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java
index 0cda879011..6fa53dcea2 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java
@@ -47,6 +47,7 @@ import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtens
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
+import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointReferenceImpl;
import org.apache.tuscany.sca.core.context.ServiceReferenceExt;
import org.apache.tuscany.sca.core.factory.ObjectCreationException;
import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
@@ -421,4 +422,9 @@ public class ServiceReferenceImpl<B> implements ServiceReferenceExt<B> {
return xmlReader;
}
*/
+
+ public void setBindingURI(String uri) {
+ ((RuntimeEndpointReferenceImpl)endpointReference).setBindingURI(uri);
+ }
+
}