From f955360d1ac83472162e88eb9db4c3c2f1bfb94c Mon Sep 17 00:00:00 2001 From: antelder Date: Mon, 16 May 2011 07:21:58 +0000 Subject: Rename EndpointRegistry to DomainRegistry. Doing this has been brought up lots of times in the past just no one ever got around to it. It effects quite a few classes but its a relatively trivial rename and i don't think it should impact on anyone too much git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1103629 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/core/assembly/impl/DomainRegistryImpl.java | 229 +++++++++++++++++++++ .../core/assembly/impl/EndpointRegistryImpl.java | 229 --------------------- .../assembly/impl/LocalDomainRegistryFactory.java | 10 +- .../core/assembly/impl/RuntimeEndpointImpl.java | 34 +-- .../impl/RuntimeEndpointReferenceImpl.java | 30 +-- .../sca/core/invocation/AsyncResponseInvoker.java | 58 +++--- .../runtime/impl/EndpointReferenceBinderImpl.java | 26 +-- 7 files changed, 308 insertions(+), 308 deletions(-) create mode 100644 sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java delete mode 100644 sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java (limited to 'sca-java-2.x/trunk/modules/core') diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java new file mode 100644 index 0000000000..6b99b77802 --- /dev/null +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/DomainRegistryImpl.java @@ -0,0 +1,229 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.core.assembly.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.LifeCycleListener; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.runtime.BaseDomainRegistry; +import org.apache.tuscany.sca.runtime.ContributionListener; +import org.apache.tuscany.sca.runtime.EndpointListener; +import org.apache.tuscany.sca.runtime.DomainRegistry; +import org.apache.tuscany.sca.runtime.InstalledContribution; +import org.apache.tuscany.sca.runtime.RuntimeProperties; + +/** + * A DomainRegistry implementation that sees registrations from the same JVM + */ +public class DomainRegistryImpl extends BaseDomainRegistry implements DomainRegistry, LifeCycleListener { + private final Logger logger = Logger.getLogger(DomainRegistryImpl.class.getName()); + + private List endpoints = new ArrayList(); + private Map> runningComposites = new HashMap>(); + private Map installedContributions = new HashMap(); + + protected boolean quietLogging; + + public DomainRegistryImpl(ExtensionPointRegistry extensionPoints, String endpointRegistryURI, String domainURI) { + super(extensionPoints, null, endpointRegistryURI, domainURI); + Properties runtimeProps = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(RuntimeProperties.class).getProperties(); + quietLogging = Boolean.parseBoolean(runtimeProps.getProperty(RuntimeProperties.QUIET_LOGGING)); + } + + public synchronized void addEndpoint(Endpoint endpoint) { + endpoints.add(endpoint); + for (EndpointListener listener : listeners) { + listener.endpointAdded(endpoint); + } + if (logger.isLoggable(quietLogging ? Level.FINE : Level.INFO)) { + String uri = null; + Binding b = endpoint.getBinding(); + if (b != null) { + uri = b.getURI(); + if (uri != null && uri.startsWith("/")) { + uri = uri.substring(1); + } + } + String msg = "Add endpoint - " + (uri == null ? endpoint.getURI() : b.getType().getLocalPart()+" - " + uri); + if (quietLogging) { + logger.fine(msg); + } else { + logger.info(msg); + } + } + } + + public List findEndpoint(String uri) { + List foundEndpoints = new ArrayList(); + for (Endpoint endpoint : endpoints) { + if (endpoint.matches(uri)) { + foundEndpoints.add(endpoint); + logger.fine("Found endpoint with matching service - " + endpoint); + } + // else the service name doesn't match + } + return foundEndpoints; + } + + public synchronized void removeEndpoint(Endpoint endpoint) { + endpoints.remove(endpoint); + endpointRemoved(endpoint); + if (logger.isLoggable(quietLogging ? Level.FINE : Level.INFO)) { + String uri = null; + Binding b = endpoint.getBinding(); + if (b != null) { + uri = b.getURI(); + if (uri != null && uri.startsWith("/")) { + uri = uri.substring(1); + } + } + String msg = "Remove endpoint - " + (uri == null ? endpoint.getURI() : b.getType().getLocalPart()+" - "+uri); + if (quietLogging) { + logger.fine(msg); + } else { + logger.info(msg); + } + } + } + + public synchronized List getEndpoints() { + return endpoints; + } + + public synchronized Endpoint getEndpoint(String uri) { + for (Endpoint ep : endpoints) { + String epURI = + ep.getComponent().getURI() + "#" + ep.getService().getName() + "/" + ep.getBinding().getName(); + if (epURI.equals(uri)) { + return ep; + } + if (ep.getBinding().getName() == null || ep.getBinding().getName().equals(ep.getService().getName())) { + epURI = ep.getComponent().getURI() + "#" + ep.getService().getName(); + if (epURI.equals(uri)) { + return ep; + } + } + } + return null; + + } + + public synchronized void updateEndpoint(String uri, Endpoint endpoint) { + Endpoint oldEndpoint = getEndpoint(uri); + if (oldEndpoint == null) { + throw new IllegalArgumentException("Endpoint is not found: " + uri); + } + endpoints.remove(oldEndpoint); + endpoints.add(endpoint); + for (EndpointListener listener : listeners) { + listener.endpointUpdated(oldEndpoint, endpoint); + } + } + + public synchronized void start() { + } + + public synchronized void stop() { + for (Iterator i = endpoints.iterator(); i.hasNext();) { + Endpoint ep = i.next(); + i.remove(); + endpointRemoved(ep); + } + endpointreferences.clear(); + listeners.clear(); + } + + public void addRunningComposite(String curi, Composite composite) { + Map cs = runningComposites.get(curi); + if (cs == null) { + cs = new HashMap(); + runningComposites.put(curi, cs); + } + cs.put(composite.getName(), composite); + } + + public void removeRunningComposite(String curi, QName name) { + Map cs = runningComposites.get(curi); + if (cs != null) { + cs.remove(name); + } + } + + public Composite getRunningComposite(String curi, QName name) { + Map cs = runningComposites.get(curi); + if (cs != null) { + return cs.get(name); + } + return null; + } + + public Map> getRunningCompositeNames() { + Map> compositeNames = new HashMap>(); + for (String curi : runningComposites.keySet()) { + List names = new ArrayList(); + compositeNames.put(curi, names); + for (QName qn : runningComposites.get(curi).keySet()) { + names.add(qn); + } + } + return compositeNames; + } + + public void installContribution(InstalledContribution ic) { + installedContributions.put(ic.getURI(), ic); + } + + public void uninstallContribution(String uri) { + installedContributions.remove(uri); + for (ContributionListener listener : contributionlisteners) { + listener.contributionRemoved(uri); + } + } + + public List getInstalledContributionURIs() { + return new ArrayList(installedContributions.keySet()); + } + + public InstalledContribution getInstalledContribution(String uri) { + return installedContributions.get(uri); + } + + @Override + public void updateInstalledContribution(InstalledContribution ic) { + installedContributions.put(ic.getURI(), ic); + for (ContributionListener listener : contributionlisteners) { + listener.contributionUpdated(ic.getURI()); + } + } +} diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java deleted file mode 100644 index e18b96c50b..0000000000 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.core.assembly.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.Endpoint; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.LifeCycleListener; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.runtime.BaseEndpointRegistry; -import org.apache.tuscany.sca.runtime.ContributionListener; -import org.apache.tuscany.sca.runtime.EndpointListener; -import org.apache.tuscany.sca.runtime.EndpointRegistry; -import org.apache.tuscany.sca.runtime.InstalledContribution; -import org.apache.tuscany.sca.runtime.RuntimeProperties; - -/** - * A EndpointRegistry implementation that sees registrations from the same JVM - */ -public class EndpointRegistryImpl extends BaseEndpointRegistry implements EndpointRegistry, LifeCycleListener { - private final Logger logger = Logger.getLogger(EndpointRegistryImpl.class.getName()); - - private List endpoints = new ArrayList(); - private Map> runningComposites = new HashMap>(); - private Map installedContributions = new HashMap(); - - protected boolean quietLogging; - - public EndpointRegistryImpl(ExtensionPointRegistry extensionPoints, String endpointRegistryURI, String domainURI) { - super(extensionPoints, null, endpointRegistryURI, domainURI); - Properties runtimeProps = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(RuntimeProperties.class).getProperties(); - quietLogging = Boolean.parseBoolean(runtimeProps.getProperty(RuntimeProperties.QUIET_LOGGING)); - } - - public synchronized void addEndpoint(Endpoint endpoint) { - endpoints.add(endpoint); - for (EndpointListener listener : listeners) { - listener.endpointAdded(endpoint); - } - if (logger.isLoggable(quietLogging ? Level.FINE : Level.INFO)) { - String uri = null; - Binding b = endpoint.getBinding(); - if (b != null) { - uri = b.getURI(); - if (uri != null && uri.startsWith("/")) { - uri = uri.substring(1); - } - } - String msg = "Add endpoint - " + (uri == null ? endpoint.getURI() : b.getType().getLocalPart()+" - " + uri); - if (quietLogging) { - logger.fine(msg); - } else { - logger.info(msg); - } - } - } - - public List findEndpoint(String uri) { - List foundEndpoints = new ArrayList(); - for (Endpoint endpoint : endpoints) { - if (endpoint.matches(uri)) { - foundEndpoints.add(endpoint); - logger.fine("Found endpoint with matching service - " + endpoint); - } - // else the service name doesn't match - } - return foundEndpoints; - } - - public synchronized void removeEndpoint(Endpoint endpoint) { - endpoints.remove(endpoint); - endpointRemoved(endpoint); - if (logger.isLoggable(quietLogging ? Level.FINE : Level.INFO)) { - String uri = null; - Binding b = endpoint.getBinding(); - if (b != null) { - uri = b.getURI(); - if (uri != null && uri.startsWith("/")) { - uri = uri.substring(1); - } - } - String msg = "Remove endpoint - " + (uri == null ? endpoint.getURI() : b.getType().getLocalPart()+" - "+uri); - if (quietLogging) { - logger.fine(msg); - } else { - logger.info(msg); - } - } - } - - public synchronized List getEndpoints() { - return endpoints; - } - - public synchronized Endpoint getEndpoint(String uri) { - for (Endpoint ep : endpoints) { - String epURI = - ep.getComponent().getURI() + "#" + ep.getService().getName() + "/" + ep.getBinding().getName(); - if (epURI.equals(uri)) { - return ep; - } - if (ep.getBinding().getName() == null || ep.getBinding().getName().equals(ep.getService().getName())) { - epURI = ep.getComponent().getURI() + "#" + ep.getService().getName(); - if (epURI.equals(uri)) { - return ep; - } - } - } - return null; - - } - - public synchronized void updateEndpoint(String uri, Endpoint endpoint) { - Endpoint oldEndpoint = getEndpoint(uri); - if (oldEndpoint == null) { - throw new IllegalArgumentException("Endpoint is not found: " + uri); - } - endpoints.remove(oldEndpoint); - endpoints.add(endpoint); - for (EndpointListener listener : listeners) { - listener.endpointUpdated(oldEndpoint, endpoint); - } - } - - public synchronized void start() { - } - - public synchronized void stop() { - for (Iterator i = endpoints.iterator(); i.hasNext();) { - Endpoint ep = i.next(); - i.remove(); - endpointRemoved(ep); - } - endpointreferences.clear(); - listeners.clear(); - } - - public void addRunningComposite(String curi, Composite composite) { - Map cs = runningComposites.get(curi); - if (cs == null) { - cs = new HashMap(); - runningComposites.put(curi, cs); - } - cs.put(composite.getName(), composite); - } - - public void removeRunningComposite(String curi, QName name) { - Map cs = runningComposites.get(curi); - if (cs != null) { - cs.remove(name); - } - } - - public Composite getRunningComposite(String curi, QName name) { - Map cs = runningComposites.get(curi); - if (cs != null) { - return cs.get(name); - } - return null; - } - - public Map> getRunningCompositeNames() { - Map> compositeNames = new HashMap>(); - for (String curi : runningComposites.keySet()) { - List names = new ArrayList(); - compositeNames.put(curi, names); - for (QName qn : runningComposites.get(curi).keySet()) { - names.add(qn); - } - } - return compositeNames; - } - - public void installContribution(InstalledContribution ic) { - installedContributions.put(ic.getURI(), ic); - } - - public void uninstallContribution(String uri) { - installedContributions.remove(uri); - for (ContributionListener listener : contributionlisteners) { - listener.contributionRemoved(uri); - } - } - - public List getInstalledContributionURIs() { - return new ArrayList(installedContributions.keySet()); - } - - public InstalledContribution getInstalledContribution(String uri) { - return installedContributions.get(uri); - } - - @Override - public void updateInstalledContribution(InstalledContribution ic) { - installedContributions.put(ic.getURI(), ic); - for (ContributionListener listener : contributionlisteners) { - listener.contributionUpdated(ic.getURI()); - } - } -} diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/LocalDomainRegistryFactory.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/LocalDomainRegistryFactory.java index b7d83e754a..002eb774ef 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/LocalDomainRegistryFactory.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/LocalDomainRegistryFactory.java @@ -21,7 +21,7 @@ package org.apache.tuscany.sca.core.assembly.impl; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.runtime.BaseDomainRegistryFactory; -import org.apache.tuscany.sca.runtime.EndpointRegistry; +import org.apache.tuscany.sca.runtime.DomainRegistry; /** * The utility responsible for finding the endpoint regstry by the scheme and creating instances for the @@ -37,10 +37,10 @@ public class LocalDomainRegistryFactory extends BaseDomainRegistryFactory { super(registry); } - protected EndpointRegistry createEndpointRegistry(String endpointRegistryURI, String domainURI) { - EndpointRegistry endpointRegistry = - new EndpointRegistryImpl(registry, endpointRegistryURI, domainURI); - return endpointRegistry; + protected DomainRegistry createEndpointRegistry(String endpointRegistryURI, String domainURI) { + DomainRegistry domainRegistry = + new DomainRegistryImpl(registry, endpointRegistryURI, domainURI); + return domainRegistry; } public String[] getSupportedSchemes() { 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 adad30c778..8e04a6ae47 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 @@ -95,7 +95,7 @@ import org.apache.tuscany.sca.provider.PolicyProviderFactory; import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint; import org.apache.tuscany.sca.provider.ServiceBindingProvider; import org.apache.tuscany.sca.runtime.DomainRegistryFactory; -import org.apache.tuscany.sca.runtime.EndpointRegistry; +import org.apache.tuscany.sca.runtime.DomainRegistry; import org.apache.tuscany.sca.runtime.EndpointSerializer; import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory; import org.apache.tuscany.sca.runtime.RuntimeComponent; @@ -181,9 +181,9 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint bind(compositeContext.getExtensionPointRegistry(), compositeContext.getEndpointRegistry()); } - public void bind(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry) { + public void bind(ExtensionPointRegistry registry, DomainRegistry domainRegistry) { if (compositeContext == null) { - compositeContext = new CompositeContext(registry, endpointRegistry); + compositeContext = new CompositeContext(registry, domainRegistry); } // if interfaceContractMapper is already initialized then all the rest will be too @@ -435,8 +435,8 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint // Store the new callback EPR into the Endpoint this.getCallbackEndpointReferences().add(asyncEPR); - // Also store the callback EPR into the EndpointRegistry - EndpointRegistry epReg = getEndpointRegistry( registry ); + // Also store the callback EPR into the DomainRegistry + DomainRegistry epReg = getEndpointRegistry( registry ); if( epReg != null ) epReg.addEndpointReference(asyncEPR); } // end method createAsyncServerCallback @@ -931,7 +931,7 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class); this.serializer = utilities.getUtility(EndpointSerializer.class); RuntimeEndpointImpl ep = (RuntimeEndpointImpl)serializer.readEndpoint(xml); - // Find the actual Endpoint in the EndpointRegistry + // Find the actual Endpoint in the DomainRegistry ep = findActualEP( ep, registry ); if( ep != null ){ copyFrom( ep ); @@ -943,19 +943,19 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint } // end method resolve /** - * Find the actual Endpoint in the EndpointRegistry which corresponds to the configuration described + * Find the actual Endpoint in the DomainRegistry which corresponds to the configuration described * in a deserialized Endpoint * @param ep The deserialized endpoint * @param registry - the main extension point Registry - * @return the corresponding Endpoint from the EndpointRegistry, or null if no match can be found + * @return the corresponding Endpoint from the DomainRegistry, or null if no match can be found */ private RuntimeEndpointImpl findActualEP(RuntimeEndpointImpl ep, ExtensionPointRegistry registry) { - EndpointRegistry endpointRegistry = getEndpointRegistry( registry ); + DomainRegistry domainRegistry = getEndpointRegistry( registry ); - if( endpointRegistry == null ) return null; + if( domainRegistry == null ) return null; - for( Endpoint endpoint : endpointRegistry.findEndpoint(ep.getURI()) ) { + for( Endpoint endpoint : domainRegistry.findEndpoint(ep.getURI()) ) { // TODO: For the present, simply return the first matching endpoint return (RuntimeEndpointImpl) endpoint; } // end for @@ -964,19 +964,19 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint } // end method findActualEP /** - * Get the EndpointRegistry + * Get the DomainRegistry * @param registry - the ExtensionPoint registry - * @return the EndpointRegistry - will be null if the EndpointRegistry cannot be found + * @return the DomainRegistry - will be null if the DomainRegistry cannot be found */ - private EndpointRegistry getEndpointRegistry( ExtensionPointRegistry registry) { + private DomainRegistry getEndpointRegistry( ExtensionPointRegistry registry) { DomainRegistryFactory domainRegistryFactory = ExtensibleDomainRegistryFactory.getInstance(registry); if( domainRegistryFactory == null ) return null; - // TODO: For the moment, just use the first (and only!) EndpointRegistry... - EndpointRegistry endpointRegistry = (EndpointRegistry) domainRegistryFactory.getEndpointRegistries().toArray()[0]; + // TODO: For the moment, just use the first (and only!) DomainRegistry... + DomainRegistry domainRegistry = (DomainRegistry) domainRegistryFactory.getEndpointRegistries().toArray()[0]; - return endpointRegistry; + return domainRegistry; } // end method public InterfaceContract getBindingInterfaceContract() { 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 410056628b..e990231841 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 @@ -81,7 +81,7 @@ import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint; import org.apache.tuscany.sca.provider.ReferenceBindingProvider; import org.apache.tuscany.sca.runtime.DomainRegistryFactory; import org.apache.tuscany.sca.runtime.EndpointReferenceBinder; -import org.apache.tuscany.sca.runtime.EndpointRegistry; +import org.apache.tuscany.sca.runtime.DomainRegistry; import org.apache.tuscany.sca.runtime.EndpointSerializer; import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory; import org.apache.tuscany.sca.runtime.RuntimeComponent; @@ -104,7 +104,7 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen private transient PhaseManager phaseManager; private transient MessageFactory messageFactory; private transient RuntimeInvoker invoker; - private transient EndpointRegistry endpointRegistry; + private transient DomainRegistry domainRegistry; private transient List chains; private transient Map invocationChainMap = @@ -173,12 +173,12 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen bind(compositeContext.getExtensionPointRegistry(), compositeContext.getEndpointRegistry()); } - public void bind(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry) { + public void bind(ExtensionPointRegistry registry, DomainRegistry domainRegistry) { if (compositeContext == null) { - compositeContext = new CompositeContext(registry, endpointRegistry); + compositeContext = new CompositeContext(registry, domainRegistry); } this.registry = registry; - this.endpointRegistry = endpointRegistry; + this.domainRegistry = domainRegistry; UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); this.eprBinder = utilities.getUtility(EndpointReferenceBinder.class); this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class); @@ -427,7 +427,7 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen private void resolveEndpointReference() { resolve(); - eprBinder.bindRunTime(endpointRegistry, this); + eprBinder.bindRunTime(domainRegistry, this); // start the binding provider final ReferenceBindingProvider bindingProvider = getBindingProvider(); @@ -539,7 +539,7 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen public boolean isOutOfDate() { resolve(); - return eprBinder.isOutOfDate(endpointRegistry, this); + return eprBinder.isOutOfDate(domainRegistry, this); } public synchronized ReferenceBindingProvider getBindingProvider() { @@ -648,7 +648,7 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); this.serializer = utilities.getUtility(EndpointSerializer.class); RuntimeEndpointReferenceImpl epr = (RuntimeEndpointReferenceImpl)serializer.readEndpointReference(xml); - // Find the actual Endpoint in the EndpointRegistry + // Find the actual Endpoint in the DomainRegistry epr = findActualEPR( epr, registry ); if( epr != null ){ copyFrom( epr ); @@ -660,23 +660,23 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen } // end method resolve /** - * Find the actual EndpointReference in the EndpointRegistry which corresponds to the configuration described + * Find the actual EndpointReference in the DomainRegistry which corresponds to the configuration described * in a deserialized EndpointReference * @param ep The deserialized endpointReference * @param registry - the main extension point Registry - * @return the corresponding EndpointReference from the EndpointRegistry, or null if no match can be found + * @return the corresponding EndpointReference from the DomainRegistry, or null if no match can be found */ private RuntimeEndpointReferenceImpl findActualEPR(RuntimeEndpointReferenceImpl epr, ExtensionPointRegistry registry) { - // Get the EndpointRegistry + // Get the DomainRegistry DomainRegistryFactory domainRegistryFactory = ExtensibleDomainRegistryFactory.getInstance(registry); if( domainRegistryFactory == null ) return null; - // TODO: For the moment, just use the first (and only!) EndpointRegistry... - EndpointRegistry endpointRegistry = (EndpointRegistry) domainRegistryFactory.getEndpointRegistries().toArray()[0]; - if( endpointRegistry == null ) return null; + // TODO: For the moment, just use the first (and only!) DomainRegistry... + DomainRegistry domainRegistry = (DomainRegistry) domainRegistryFactory.getEndpointRegistries().toArray()[0]; + if( domainRegistry == null ) return null; - for( EndpointReference epReference : endpointRegistry.getEndpointReferences() ) { + for( EndpointReference epReference : domainRegistry.getEndpointReferences() ) { // TODO: For the present, simply return the first matching endpointReference if( epReference.getURI().equals(epr.getURI()) ) { return (RuntimeEndpointReferenceImpl) epReference; diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java index 87b8da62a9..1ebc9c633a 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java @@ -37,7 +37,7 @@ import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.provider.EndpointAsyncProvider; import org.apache.tuscany.sca.runtime.DomainRegistryFactory; -import org.apache.tuscany.sca.runtime.EndpointRegistry; +import org.apache.tuscany.sca.runtime.DomainRegistry; import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; @@ -70,7 +70,7 @@ public class AsyncResponseInvoker implements InvokerAsyncResponse, Serializab private String endpointReferenceURI; private String domainURI; - private transient EndpointRegistry endpointRegistry; + private transient DomainRegistry domainRegistry; private transient ExtensionPointRegistry registry; public AsyncResponseInvoker(RuntimeEndpoint requestEndpoint, @@ -256,8 +256,8 @@ public class AsyncResponseInvoker implements InvokerAsyncResponse, Serializab */ private RuntimeEndpointReference retrieveEndpointReference(String uri) { if( uri == null ) return null; - if( endpointRegistry == null ) return null; - List refs = endpointRegistry.findEndpointReferences( uri ); + if( domainRegistry == null ) return null; + List refs = domainRegistry.findEndpointReferences( uri ); // If there is more than EndpointReference with the uri... if( refs.isEmpty() ) return null; // TODO: what if there is more than 1 EPR with the given URI? @@ -266,37 +266,37 @@ public class AsyncResponseInvoker implements InvokerAsyncResponse, Serializab /** * Fetches the Endpoint identified by an endpoint URI - * - the Endpoint is retrieved from the EndpointRegistry + * - the Endpoint is retrieved from the DomainRegistry * @param uri - the URI of the Endpoint * @return - the Endpoint corresponding to the URI, or null if no Endpoint is found which has the * supplied URI */ private RuntimeEndpoint retrieveEndpoint(String uri) { if( uri == null ) return null; - if( endpointRegistry == null ) endpointRegistry = getEndpointRegistry( uri ); - if( endpointRegistry == null ) return null; + if( domainRegistry == null ) domainRegistry = getEndpointRegistry( uri ); + if( domainRegistry == null ) return null; // TODO what if more than one Endpoint gets returned?? - return (RuntimeEndpoint) endpointRegistry.findEndpoint(uri).get(0); + return (RuntimeEndpoint) domainRegistry.findEndpoint(uri).get(0); } // end method retrieveEndpoint /** - * Gets the EndpointRegistry which contains an Endpoint with the supplied URI + * Gets the DomainRegistry which contains an Endpoint with the supplied URI * @param uri - The URI of an Endpoint - * @return - the EndpointRegistry containing the Endpoint with the supplied URI - null if no - * such EndpointRegistry can be found + * @return - the DomainRegistry containing the Endpoint with the supplied URI - null if no + * such DomainRegistry can be found */ - private EndpointRegistry getEndpointRegistry(String uri) { + private DomainRegistry getEndpointRegistry(String uri) { ExtensionPointRegistry registry = null; - EndpointRegistry endpointRegistry = null; + DomainRegistry domainRegistry = null; CompositeContext context = CompositeContext.getCurrentCompositeContext(); if( context == null && requestEndpoint != null ) context = requestEndpoint.getCompositeContext(); if( context != null ) { registry = context.getExtensionPointRegistry(); - endpointRegistry = getEndpointRegistry( registry ); - if( endpointRegistry != null ) { + domainRegistry = getEndpointRegistry( registry ); + if( domainRegistry != null ) { this.registry = registry; - return endpointRegistry; + return domainRegistry; } // end if } // end if @@ -304,14 +304,14 @@ public class AsyncResponseInvoker implements InvokerAsyncResponse, Serializab for(ExtensionPointRegistry r : ExtensionPointRegistryLocator.getExtensionPointRegistries()) { registry = r; if( registry != null ) { - // Find the actual Endpoint in the EndpointRegistry - endpointRegistry = getEndpointRegistry( registry ); + // Find the actual Endpoint in the DomainRegistry + domainRegistry = getEndpointRegistry( registry ); - if( endpointRegistry != null ) { - for( Endpoint endpoint : endpointRegistry.findEndpoint(uri) ) { + if( domainRegistry != null ) { + for( Endpoint endpoint : domainRegistry.findEndpoint(uri) ) { // TODO: For the present, simply return the first registry with a matching endpoint this.registry = registry; - return endpointRegistry; + return domainRegistry; } // end for } // end if } // end if @@ -321,27 +321,27 @@ public class AsyncResponseInvoker implements InvokerAsyncResponse, Serializab } // end method getEndpointRegistry /** - * Get the EndpointRegistry + * Get the DomainRegistry * @param registry - the ExtensionPoint registry - * @return the EndpointRegistry - will be null if the EndpointRegistry cannot be found + * @return the DomainRegistry - will be null if the DomainRegistry cannot be found */ - private EndpointRegistry getEndpointRegistry( ExtensionPointRegistry registry) { + private DomainRegistry getEndpointRegistry( ExtensionPointRegistry registry) { DomainRegistryFactory domainRegistryFactory = ExtensibleDomainRegistryFactory.getInstance(registry); if( domainRegistryFactory == null ) return null; // Find the first endpoint registry that matches the domain name if( domainURI != null ) { - for( EndpointRegistry endpointRegistry : domainRegistryFactory.getEndpointRegistries() ) { - if( domainURI.equals( endpointRegistry.getDomainURI() ) ) return endpointRegistry; + for( DomainRegistry domainRegistry : domainRegistryFactory.getEndpointRegistries() ) { + if( domainURI.equals( domainRegistry.getDomainURI() ) ) return domainRegistry; } // end for } // end if - // if there was no domainName to match, simply return the first EndpointRegistry if there is one... + // if there was no domainName to match, simply return the first DomainRegistry if there is one... if (domainRegistryFactory.getEndpointRegistries().size() > 0){ - EndpointRegistry endpointRegistry = (EndpointRegistry) domainRegistryFactory.getEndpointRegistries().toArray()[0]; - return endpointRegistry; + DomainRegistry domainRegistry = (DomainRegistry) domainRegistryFactory.getEndpointRegistries().toArray()[0]; + return domainRegistry; } else { return null; } diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java index 068f13f953..cfdb099423 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java @@ -60,7 +60,7 @@ import org.apache.tuscany.sca.provider.EndpointReferenceAsyncProvider; import org.apache.tuscany.sca.provider.ReferenceBindingProvider; import org.apache.tuscany.sca.runtime.CompositeActivator; import org.apache.tuscany.sca.runtime.EndpointReferenceBinder; -import org.apache.tuscany.sca.runtime.EndpointRegistry; +import org.apache.tuscany.sca.runtime.DomainRegistry; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; import org.apache.tuscany.sca.runtime.UnknownEndpointHandler; @@ -110,35 +110,35 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { * Bind a single endpoint reference at build time. Here we only expect the * registry to have a record of local endpoints * - * @param endpointRegistry + * @param domainRegistry * @param endpointReference */ - public void bindBuildTime(EndpointRegistry endpointRegistry, + public void bindBuildTime(DomainRegistry domainRegistry, EndpointReference endpointReference, BuilderContext builderContext) { - bind(endpointRegistry, endpointReference, builderContext, false); + bind(domainRegistry, endpointReference, builderContext, false); } /** * Bind a single endpoint reference at run time. Here we expect the * registry to be populated with endpoints from across the domain * - * @param endpointRegistry + * @param domainRegistry * @param endpointReference */ - public void bindRunTime(EndpointRegistry endpointRegistry, + public void bindRunTime(DomainRegistry domainRegistry, EndpointReference endpointReference) { - bind(endpointRegistry, endpointReference, null, true); + bind(domainRegistry, endpointReference, null, true); } /** * Bind a reference to a service endpoint * - * @param endpointRegistry + * @param domainRegistry * @param endpointReference * @param runtime set true if called from the runtime */ - public void bind(EndpointRegistry endpointRegistry, + public void bind(DomainRegistry domainRegistry, EndpointReference endpointReference, BuilderContext builderContext, boolean runtime){ @@ -154,7 +154,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { // do autowire matching // will only be called at build time at the moment Multiplicity multiplicity = endpointReference.getReference().getMultiplicity(); - for (Endpoint endpoint : endpointRegistry.getEndpoints()){ + for (Endpoint endpoint : domainRegistry.getEndpoints()){ // if (endpoint is in the same composite as endpoint reference){ if ((multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) && @@ -253,7 +253,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { // The reference is not yet matched to a service // find the service in the endpoint registry - List endpoints = endpointRegistry.findEndpoint(endpointReference); + List endpoints = domainRegistry.findEndpoint(endpointReference); if (endpoints.size() > 0){ selectForwardEndpoint(endpointReference, @@ -917,12 +917,12 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { * * @return true is the registry has changed */ - public boolean isOutOfDate(EndpointRegistry endpointRegistry, EndpointReference endpointReference) { + public boolean isOutOfDate(DomainRegistry domainRegistry, EndpointReference endpointReference) { Endpoint te = endpointReference.getTargetEndpoint(); if (te != null && !te.isUnresolved() && te.getURI() != null && endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING) { - List endpoints = endpointRegistry.findEndpoint(endpointReference); + List endpoints = domainRegistry.findEndpoint(endpointReference); return ! endpoints.contains(endpointReference.getTargetEndpoint()); } return false; -- cgit v1.2.3