X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fmanager%2Fimpl%2FServiceReferenceRegistryImpl.java;h=dd6c2b94222b67b6b0d04310993e83b435bdd436;hp=0dff41402ebd747bb69c3805d216a1e5f7e45b8e;hb=e3998d55e33da9f6ecb69da75ecc71a047b6362b;hpb=e6d2fd575fa138ec597714ad3056b5dc4761c984 diff --git a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ServiceReferenceRegistryImpl.java b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ServiceReferenceRegistryImpl.java index 0dff41402e..dd6c2b9422 100644 --- a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ServiceReferenceRegistryImpl.java +++ b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/ServiceReferenceRegistryImpl.java @@ -8,6 +8,7 @@ package org.opendaylight.controller.config.manager.impl; import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import java.util.Collections; @@ -39,7 +40,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceReadableRegistry, SearchableServiceReferenceWritableRegistry { - private static final Logger LOGGER = LoggerFactory.getLogger(ServiceReferenceRegistryImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(ServiceReferenceRegistryImpl.class); private final Map factories; private final Map> factoryNamesToQNames; @@ -96,6 +97,16 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe throw new UnsupportedOperationException(); } + @Override + public Set lookupRuntimeBeans() { + throw new UnsupportedOperationException(); + } + + @Override + public Set lookupRuntimeBeans(final String moduleName, final String instanceName) { + throw new UnsupportedOperationException(); + } + @Override public String toString() { return "initial"; @@ -177,7 +188,7 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe boolean skipChecks = true; newRegistry.saveServiceReference(refNameEntry.getKey(), currentImplementation, skipChecks); } catch (InstanceNotFoundException e) { - LOGGER.error("Cannot save service reference({}, {})", refNameEntry.getKey(), currentImplementation); + LOG.error("Cannot save service reference({}, {})", refNameEntry.getKey(), currentImplementation); throw new IllegalStateException("Possible code error", e); } } @@ -207,7 +218,7 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe for (Entry entry : factories.entrySet()) { if (entry.getKey().equals(entry.getValue().getImplementationName()) == false) { - LOGGER.error("Possible error in code: Mismatch between supplied and actual name of {}", entry); + LOG.error("Possible error in code: Mismatch between supplied and actual name of {}", entry); throw new IllegalArgumentException("Possible error in code: Mismatch between supplied and actual name of " + entry); } Set siAnnotations = InterfacesHelper.getServiceInterfaceAnnotations(entry.getValue()); @@ -229,7 +240,7 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe modifiableNamespacesToAnnotations.put(sia.namespace(), ofNamespace); } if (ofNamespace.containsKey(sia.localName())) { - LOGGER.error("Cannot construct namespacesToAnnotations map, conflict between local names in {}, offending local name: {}, map so far {}", + LOG.error("Cannot construct namespacesToAnnotations map, conflict between local names in {}, offending local name: {}, map so far {}", sia.namespace(), sia.localName(), modifiableNamespacesToAnnotations); throw new IllegalArgumentException("Conflict between local names in " + sia.namespace() + " : " + sia.localName()); } @@ -238,7 +249,7 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe } this.namespacesToAnnotations = ImmutableMap.copyOf(modifiableNamespacesToAnnotations); this.serviceQNamesToAnnotations = ImmutableMap.copyOf(modifiableServiceQNamesToAnnotations); - LOGGER.trace("factoryNamesToQNames:{}", this.factoryNamesToQNames); + LOG.trace("factoryNamesToQNames:{}", this.factoryNamesToQNames); } @Override @@ -257,7 +268,7 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe String factoryName = ObjectNameUtil.getFactoryName(objectName); Set serviceInterfaceAnnotations = factoryNamesToQNames.get(factoryName); if (serviceInterfaceAnnotations == null) { - LOGGER.error("Possible error in code: cannot find factory annotations of '{}' extracted from ON {} in {}", + LOG.error("Possible error in code: cannot find factory annotations of '{}' extracted from ON {} in {}", factoryName, objectName, factoryNamesToQNames); throw new IllegalArgumentException("Cannot find factory with name " + factoryName); } @@ -268,12 +279,12 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe public synchronized String getServiceInterfaceName(final String namespace, final String localName) { Map ofNamespace = namespacesToAnnotations.get(namespace); if (ofNamespace == null) { - LOGGER.error("Cannot find namespace {} in {}", namespace, namespacesToAnnotations); + LOG.error("Cannot find namespace {} in {}", namespace, namespacesToAnnotations); throw new IllegalArgumentException("Cannot find namespace " + namespace); } ServiceInterfaceAnnotation sia = ofNamespace.get(localName); if (sia == null) { - LOGGER.error("Cannot find local name {} in namespace {}, found only {}", localName, namespace, ofNamespace); + LOG.error("Cannot find local name {} in namespace {}, found only {}", localName, namespace, ofNamespace); throw new IllegalArgumentException("Cannot find local name " + localName + " in namespace " + namespace); } return sia.value(); @@ -301,7 +312,7 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe try { on = lookupRegistry.lookupConfigBean(moduleIdentifier.getFactoryName(), moduleIdentifier.getInstanceName()); } catch (InstanceNotFoundException e) { - LOGGER.error("Cannot find instance {}", moduleIdentifier); + LOG.error("Cannot find instance {}", moduleIdentifier); throw new IllegalStateException("Cannot find instance " + moduleIdentifier, e); } return on; @@ -312,7 +323,7 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe ServiceReference serviceReference = new ServiceReference(serviceInterfaceQName, refName); ModuleIdentifier moduleIdentifier = refNames.get(serviceReference); if (moduleIdentifier == null) { - LOGGER.error("Cannot find qname {} and refName {} in {}", serviceInterfaceQName, refName, refName); + LOG.error("Cannot find qname {} and refName {} in {}", serviceInterfaceQName, refName, refName); throw new IllegalArgumentException("Cannot find " + serviceReference); } return getObjectName(moduleIdentifier); @@ -323,7 +334,7 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe Map> serviceMapping = getServiceMapping(); Map innerMap = serviceMapping.get(serviceInterfaceQName); if (innerMap == null) { - LOGGER.error("Cannot find qname {} in {}", serviceInterfaceQName, refNames); + LOG.error("Cannot find qname {} in {}", serviceInterfaceQName, refNames); throw new IllegalArgumentException("Cannot find " + serviceInterfaceQName); } return innerMap; @@ -349,7 +360,7 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe String referenceName = ObjectNameUtil.getReferenceName(objectName); ServiceReference serviceReference = new ServiceReference(serviceQName, referenceName); if (refNames.containsKey(serviceReference) == false) { - LOGGER.warn("Cannot find {} in {}", serviceReference, refNames); + LOG.warn("Cannot find {} in {}", serviceReference, refNames); throw new InstanceNotFoundException("Service reference not found:" + objectName); } } @@ -388,13 +399,13 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe // check that service interface name exist Set serviceInterfaceQNames = factoryNamesToQNames.get(moduleIdentifier.getFactoryName()); if (serviceInterfaceQNames == null) { - LOGGER.error("Possible error in code: cannot find factoryName {} in {}, {}", moduleIdentifier.getFactoryName(), + LOG.error("Possible error in code: cannot find factoryName {} in {}, {}", moduleIdentifier.getFactoryName(), factoryNamesToQNames, moduleIdentifier); throw new IllegalStateException("Possible error in code: cannot find annotations of existing factory " + moduleIdentifier.getFactoryName()); } // supplied serviceInterfaceName must exist in this collection if (serviceInterfaceQNames.contains(serviceReference.getServiceInterfaceQName()) == false) { - LOGGER.error("Cannot find qName {} with factory name {}, found {}", serviceReference.getServiceInterfaceQName(), moduleIdentifier.getFactoryName(), serviceInterfaceQNames); + LOG.error("Cannot find qName {} with factory name {}, found {}", serviceReference.getServiceInterfaceQName(), moduleIdentifier.getFactoryName(), serviceInterfaceQNames); throw new IllegalArgumentException("Cannot find service interface " + serviceReference.getServiceInterfaceQName() + " within factory " + moduleIdentifier.getFactoryName()); } @@ -466,11 +477,11 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe } private synchronized void removeServiceReference(final ServiceReference serviceReference) throws InstanceNotFoundException { - LOGGER.debug("Removing service reference {} from {}", serviceReference, this); + LOG.debug("Removing service reference {} from {}", serviceReference, this); assertWritable(); // is the qName known? if (allQNames.contains(serviceReference.getServiceInterfaceQName()) == false) { - LOGGER.error("Cannot find qname {} in {}", serviceReference.getServiceInterfaceQName(), allQNames); + LOG.error("Cannot find qname {} in {}", serviceReference.getServiceInterfaceQName(), allQNames); throw new IllegalArgumentException("Cannot find service interface " + serviceReference.getServiceInterfaceQName()); } ModuleIdentifier removed = refNames.remove(serviceReference); @@ -519,7 +530,7 @@ public class ServiceReferenceRegistryImpl implements CloseableServiceReferenceRe private Set findServiceReferencesLinkingTo(final ObjectName moduleObjectName, final Set serviceInterfaceQNames) { String factoryName = ObjectNameUtil.getFactoryName(moduleObjectName); if (serviceInterfaceQNames == null) { - LOGGER.warn("Possible error in code: cannot find factoryName {} in {}, object name {}", factoryName, factoryNamesToQNames, moduleObjectName); + LOG.warn("Possible error in code: cannot find factoryName {} in {}, object name {}", factoryName, factoryNamesToQNames, moduleObjectName); throw new IllegalStateException("Possible error in code: cannot find annotations of existing factory " + factoryName); } String instanceName = ObjectNameUtil.getInstanceName(moduleObjectName);