use of org.opendaylight.controller.config.manager.impl.jmx.ServiceReference in project controller by opendaylight.
the class ServiceReferenceRegistryImpl method removeServiceReference.
@Override
public synchronized void removeServiceReference(final String serviceInterfaceName, final String refName) throws InstanceNotFoundException {
ServiceReference serviceReference = new ServiceReference(serviceInterfaceName, refName);
removeServiceReference(serviceReference);
}
use of org.opendaylight.controller.config.manager.impl.jmx.ServiceReference in project controller by opendaylight.
the class ServiceReferenceRegistryImpl method lookupConfigBeanByServiceInterfaceName.
@Override
public synchronized ObjectName lookupConfigBeanByServiceInterfaceName(final String serviceInterfaceQName, final String refName) {
ServiceReference serviceReference = new ServiceReference(serviceInterfaceQName, refName);
ModuleIdentifier moduleIdentifier = refNames.get(serviceReference);
if (moduleIdentifier == null) {
LOG.error("Cannot find qname {} and refName {} in {}", serviceInterfaceQName, refName, refName);
throw new IllegalArgumentException("Cannot find " + serviceReference);
}
return getObjectName(moduleIdentifier);
}
use of org.opendaylight.controller.config.manager.impl.jmx.ServiceReference in project controller by opendaylight.
the class ServiceReferenceRegistryImpl method saveServiceReference.
@Override
public synchronized ObjectName saveServiceReference(final String serviceInterfaceName, final String refName, final ObjectName moduleON) throws InstanceNotFoundException {
assertWritable();
ServiceReference serviceReference = new ServiceReference(serviceInterfaceName, refName);
return saveServiceReference(serviceReference, moduleON);
}
use of org.opendaylight.controller.config.manager.impl.jmx.ServiceReference in project controller by opendaylight.
the class ServiceReferenceRegistryImpl method findServiceReferencesLinkingTo.
private Set<ServiceReference> findServiceReferencesLinkingTo(final ObjectName moduleObjectName, final Set<String> serviceInterfaceQNames) {
String factoryName = ObjectNameUtil.getFactoryName(moduleObjectName);
if (serviceInterfaceQNames == null) {
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);
ModuleIdentifier moduleIdentifier = new ModuleIdentifier(factoryName, instanceName);
Set<ServiceReference> result = new HashSet<>();
for (Entry<ServiceReference, ModuleIdentifier> entry : refNames.entrySet()) {
if (entry.getValue().equals(moduleIdentifier)) {
result.add(entry.getKey());
}
}
return result;
}
use of org.opendaylight.controller.config.manager.impl.jmx.ServiceReference in project controller by opendaylight.
the class ServiceReferenceRegistryImpl method copy.
private static void copy(final ServiceReferenceRegistryImpl old, final ServiceReferenceRegistryImpl newRegistry, final String nullableDstTransactionName) {
for (Entry<ServiceReference, Entry<ServiceReferenceMXBeanImpl, ServiceReferenceJMXRegistration>> refNameEntry : old.managementBeans.entrySet()) {
ObjectName currentImplementation;
ObjectName currentImplementationSrc = refNameEntry.getValue().getKey().getCurrentImplementation();
if (nullableDstTransactionName != null) {
currentImplementation = ObjectNameUtil.withTransactionName(currentImplementationSrc, nullableDstTransactionName);
} else {
currentImplementation = ObjectNameUtil.withoutTransactionName(currentImplementationSrc);
}
try {
boolean skipChecks = true;
newRegistry.saveServiceReference(refNameEntry.getKey(), currentImplementation, skipChecks);
} catch (final InstanceNotFoundException e) {
LOG.error("Cannot save service reference({}, {})", refNameEntry.getKey(), currentImplementation);
throw new IllegalStateException("Possible code error", e);
}
}
}
Aggregations