public final class DependencyResolverImpl extends Object implements DependencyResolver, Comparable<DependencyResolverImpl>
Module.getInstance()
by creating proxy that would throw exception if those methods are called
during validation. Tracks dependencies for ordering purposes.Constructor and Description |
---|
DependencyResolverImpl(ModuleIdentifier currentModule,
TransactionStatus transactionStatus,
org.opendaylight.controller.config.manager.impl.dependencyresolver.ModulesHolder modulesHolder,
ServiceReferenceReadableRegistry readableRegistry,
BindingContextProvider bindingContextProvider,
String transactionName,
MBeanServer beanServer) |
Modifier and Type | Method and Description |
---|---|
boolean |
canReuseDependency(ObjectName objectName,
JmxAttribute jmxAttribute)
Check whether a dependency will be reused or (re)created.
|
int |
compareTo(DependencyResolverImpl dependencyResolverImpl) |
Object |
getAttribute(ObjectName name,
String attribute)
Can be used during validation or commit phase to get attribute value of
dependent module.
|
ModuleIdentifier |
getIdentifier() |
<T> T |
newMXBeanProxy(ObjectName name,
Class<T> interfaceClass)
Helper method around.
|
<T extends org.opendaylight.yangtools.yang.binding.BaseIdentity> |
resolveIdentity(IdentityAttributeRef identityRef,
Class<T> expectedBaseClass)
To be used during commit phase to resolve identity-ref config attributes.
|
<T> T |
resolveInstance(Class<T> expectedType,
ObjectName dependentReadOnlyON,
JmxAttribute jmxAttribute)
To be used during commit phase to wire actual dependencies.
|
void |
validateDependency(Class<? extends AbstractServiceInterface> expectedServiceInterface,
ObjectName dependentReadOnlyON,
JmxAttribute jmxAttribute)
To be used during validation phase to validate service interface of dependent
module.
|
<T extends org.opendaylight.yangtools.yang.binding.BaseIdentity> |
validateIdentity(IdentityAttributeRef identityRef,
Class<T> expectedBaseClass,
JmxAttribute jmxAttribute)
Validate identity-ref config attribute.
|
public DependencyResolverImpl(ModuleIdentifier currentModule, TransactionStatus transactionStatus, org.opendaylight.controller.config.manager.impl.dependencyresolver.ModulesHolder modulesHolder, ServiceReferenceReadableRegistry readableRegistry, BindingContextProvider bindingContextProvider, String transactionName, MBeanServer beanServer)
public void validateDependency(Class<? extends AbstractServiceInterface> expectedServiceInterface, ObjectName dependentReadOnlyON, JmxAttribute jmxAttribute)
validateDependency
in interface DependencyResolver
expectedServiceInterface
- MBean/MXBean interface which will back the proxy object.dependentReadOnlyON
- ObjectName of dependent module without transaction name
(platformON).jmxAttribute
- for reportingpublic <T> T resolveInstance(Class<T> expectedType, ObjectName dependentReadOnlyON, JmxAttribute jmxAttribute)
DependencyResolver
resolveInstance
in interface DependencyResolver
Module.getInstance()
public boolean canReuseDependency(ObjectName objectName, JmxAttribute jmxAttribute)
DependencyResolver
canReuseDependency
in interface DependencyResolver
objectName
- ObjectName ID of a dependencyjmxAttribute
- JMXAttribute ID of a dependencypublic <T extends org.opendaylight.yangtools.yang.binding.BaseIdentity> Class<? extends T> resolveIdentity(IdentityAttributeRef identityRef, Class<T> expectedBaseClass)
DependencyResolver
resolveIdentity
in interface DependencyResolver
public <T extends org.opendaylight.yangtools.yang.binding.BaseIdentity> void validateIdentity(IdentityAttributeRef identityRef, Class<T> expectedBaseClass, JmxAttribute jmxAttribute)
DependencyResolver
validateIdentity
in interface DependencyResolver
public int compareTo(DependencyResolverImpl dependencyResolverImpl)
compareTo
in interface Comparable<DependencyResolverImpl>
public ModuleIdentifier getIdentifier()
getIdentifier
in interface org.opendaylight.yangtools.concepts.Identifiable<ModuleIdentifier>
public Object getAttribute(ObjectName name, String attribute) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException
DependencyResolver
getAttribute
in interface DependencyResolver
name
- either direct ObjectName of a Module (type=Module) or service
reference (type=ServiceReference) of dependent Moduleattribute
- String identifying attribute name in JMX. Note that attributes
start with upper case. See
JmxAttribute.getAttributeName()
MBeanException
AttributeNotFoundException
InstanceNotFoundException
ReflectionException
public <T> T newMXBeanProxy(ObjectName name, Class<T> interfaceClass)
DependencyResolver
.JMX#newMXBeanProxy(javax.management.MBeanServerConnection, javax.management.ObjectName, Class)
}.
Returns MXBean proxy for dependent module. Can be used during validation or
commit phase to inspect dependent module's attributes.newMXBeanProxy
in interface DependencyResolver
T
- type of proxy for type safe return valuename
- either direct ObjectName of a Module (type=Module) or service
reference (type=ServiceReference) of dependent ModuleinterfaceClass
- MXBean interface to be used as a proxyCopyright © 2019 OpenDaylight. All rights reserved.