diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-03 22:00:39 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-03 22:00:39 +0000 |
commit | ce670f8fc119fc342ab628dfaa8ab42f9cf4bb3f (patch) | |
tree | f93030cc3960ae8b134c9c73ddfa7755adbdc116 | |
parent | b7fe08cba88419f9e30f2795b5b171436bfabf7f (diff) |
Add domainURI/nodeURI to runtime endpoint/endpoint reference
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@906262 13f79535-47bb-0310-9956-ffa450edef68
6 files changed, 67 insertions, 7 deletions
diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java index 6e3bedc205..6d81a596b3 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/CompositeContext.java @@ -39,17 +39,21 @@ public class CompositeContext { protected EndpointRegistry endpointRegistry; protected ComponentContextFactory componentContextFactory; protected Composite domainComposite; + protected String nodeURI; + protected String domainURI; - public CompositeContext(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry, Composite domainComposite) { + public CompositeContext(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry, Composite domainComposite, String domainURI, String nodeURI) { this.extensionPointRegistry = registry; this.endpointRegistry = endpointRegistry; ContextFactoryExtensionPoint contextFactories = registry.getExtensionPoint(ContextFactoryExtensionPoint.class); this.componentContextFactory = contextFactories.getFactory(ComponentContextFactory.class); this.domainComposite = domainComposite; + this.domainURI = domainURI; + this.nodeURI = nodeURI; } public CompositeContext(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry) { - this(registry, endpointRegistry, null); + this(registry, endpointRegistry, null, "default", "default"); } /** @@ -124,4 +128,12 @@ public class CompositeContext { public static void removeCompositeContext() { context.remove(); } + + public String getNodeURI() { + return nodeURI; + } + + public String getDomainURI() { + return domainURI; + } } diff --git a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java index 4e0128c49a..a52f478436 100644 --- a/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java +++ b/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/Invocable.java @@ -55,6 +55,18 @@ public interface Invocable { * @return */ CompositeContext getCompositeContext(); + + + /** + * Get the node URI + * @return The node URI + */ + String getNodeURI(); + /** + * Get the domain URI + * @return The domain URI + */ + String getDomainURI(); /** * Unbind the invocable from the composite context diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java index 3e73960367..b4743676b0 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -78,7 +78,6 @@ import org.oasisopen.sca.ServiceRuntimeException; */ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint, Externalizable { private transient CompositeContext compositeContext; - private transient EndpointRegistry endpointRegistry; private transient RuntimeWireProcessor wireProcessor; private transient ProviderFactoryExtensionPoint providerFactories; private transient InterfaceContractMapper interfaceContractMapper; @@ -99,6 +98,9 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint protected InterfaceContract bindingInterfaceContract; protected InterfaceContract serviceInterfaceContract; + + private String domainURI; + private String nodeURI; /** * No-arg constructor for Java serilization @@ -129,6 +131,8 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint this.policySets = copy.policySets; this.uri = copy.uri; + this.nodeURI = copy.nodeURI; + this.domainURI = copy.domainURI; this.remote = copy.remote; this.unresolved = copy.unresolved; @@ -144,6 +148,12 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint public void bind(CompositeContext compositeContext) { this.compositeContext = compositeContext; + if (nodeURI != null) { + this.nodeURI = compositeContext.getNodeURI(); + } + if (domainURI != null) { + this.domainURI = compositeContext.getDomainURI(); + } bind(compositeContext.getExtensionPointRegistry(), compositeContext.getEndpointRegistry()); } @@ -152,7 +162,6 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint compositeContext = new CompositeContext(registry, endpointRegistry); } this.registry = registry; - this.endpointRegistry = endpointRegistry; UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class); this.workScheduler = utilities.getUtility(WorkScheduler.class); @@ -566,4 +575,12 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint } } + public String getDomainURI() { + return domainURI; + } + + public String getNodeURI() { + return nodeURI; + } + } 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 57ca960c5b..32078eabc9 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 @@ -100,6 +100,8 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen protected InterfaceContract bindingInterfaceContract; protected InterfaceContract referenceInterfaceContract; + private String domainURI; + private String nodeURI; private String xml; @@ -132,6 +134,8 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen this.policySets = copy.policySets; this.uri = copy.uri; + this.domainURI = copy.domainURI; + this.nodeURI = copy.nodeURI; this.remote = copy.remote; this.unresolved = copy.unresolved; this.status = copy.status; @@ -148,6 +152,12 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen public void bind(CompositeContext compositeContext) { this.compositeContext = compositeContext; + if (nodeURI != null) { + this.nodeURI = compositeContext.getNodeURI(); + } + if (domainURI != null) { + this.domainURI = compositeContext.getDomainURI(); + } bind(compositeContext.getExtensionPointRegistry(), compositeContext.getEndpointRegistry()); } @@ -534,5 +544,13 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen } } } + + public String getDomainURI() { + return domainURI; + } + + public String getNodeURI() { + return nodeURI; + } } diff --git a/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java b/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java index b6b80c8524..bcda806165 100644 --- a/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java +++ b/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java @@ -250,7 +250,8 @@ public class RemoteServiceAdminImpl implements RemoteServiceAdmin, ManagedServic EndpointDescription ep = null; if (rsaEvent.getImportReference() != null) { ep = rsaEvent.getImportReference().getImportedEndpoint(); - } else { + } + if (rsaEvent.getExportReference() != null) { ep = rsaEvent.getExportReference().getExportedEndpoint(); } props.put("endpoint.service.id", ep.getServiceId()); diff --git a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java index 483431b98a..043951b86c 100644 --- a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java +++ b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java @@ -134,7 +134,8 @@ public class NodeImpl implements Node, Client { domainComposite = manager.configureNode(configuration, contributions, context); this.compositeContext = - new CompositeContext(manager.registry, endpointRegistry, domainComposite); + new CompositeContext(manager.registry, endpointRegistry, domainComposite, configuration + .getDomainURI(), configuration.getURI()); CompositeContext.setThreadCompositeContext(compositeContext); } finally { // Reset the thread context monitor @@ -211,7 +212,6 @@ public class NodeImpl implements Node, Client { } // end if manager.removeNode(configuration); - manager.registry.getExtensionPoint(UtilityExtensionPoint.class).removeUtility(compositeActivator); this.compositeActivator = null; this.proxyFactory = null; this.domainComposite = null; |