Ask Your Question

Recommended way to instantiate implemented instances of the ModuleIdentifier and the DependencyResolver?

asked 2014-06-18 14:07:26 -0700

CobyS gravatar image

updated 2014-06-19 21:18:26 -0700

org.opendaylight.controller.config.api.ModuleIdentifier identifier org.opendaylight.controller.config.api.DependencyResolver

I need to pass them to a constructor in order to create a consumer object that I want. Where should I obtain these? The only class that appears to return dependency resolvers is a DependencyResolverFactory. The only DependencyResolverFactory implementation appears to be "DependencyResolverManager"."DependencyResolverManager" takes a ton of parameters(TransactionIdentifier, TransactionStatus, ServiceReferenceReadableRegistry??)that seem incredibly overkill or not even relevant for resolving dependencies. Is this the only way to do this?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-06-23 04:57:43 -0700

tolvecky gravatar image

First make sure you are using config system infrastructure as described in .

When you write a yang file and generate bindings, you will end up with at least one ModuleFactory and a Module. DependencyResolver will be passed by config-manager to ModuleFactory#createModule methods, you pass it to the Module and can use it there.

Regarding ModuleIdentifier, it consists of factory name (ModuleFactory#getImplementationName), and instance name that is normally passed in the createModule method.

To explain DependencyResolverFactory : this is passed to ModuleFactory'#getDefaultModules, but I would suggest on avoiding default modules and using regular module creation using createModule in most cases.

edit flag offensive delete publish link more


Okay. I understand the fact that the DependencyResolver will be passed by the config-manager.. but how does it do this. I basically have a module constructor that takes both the ModuleIdentifier and the dependencyResolver. Do you have a small code example?

CobyS ( 2014-06-24 08:52:55 -0700 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2014-06-18 14:07:26 -0700

Seen: 707 times

Last updated: Jun 23 '14