# Class e.c.m.MetadataManager(Manager):

Part of elisa.core.metadata_manager View In Hierarchy

The MetadataManager can be queried for a given metadata request to fill a model.

It will go sequentially through all the registered metadata capabilities that are able to handle the request until the expected metadata is filled.

Line # | Kind | Name | Docs
--- | --- | --- | ---
46 | Method | register_component | Register a new metadata capability.
69 | Method | get_metadata | Try to retrieve the requested metadata and populate the model with it.

Inherited from Manager:

Line # | Kind | Name | Docs
--- | --- | --- | ---
54 | Method | __init__ | Initialize the _components instance variable and the
63 | Method | load_components | Load a list of components in sequence.
105 | Method | start | Start a loop or something to initialize the Manager. Can
112 | Method | stop | Stop clean and remove all registered components.
147 | Method | unregister_component | Unregister a component from the Manager

def register_component(self, capability):
overrides elisa.core.manager.Manager.register_component

Register a new metadata capability.

The internal list of capabilities is always kept sorted by decreasing rank.

Parameters | capability | an instance of a metadata capability to register (type: `elisa.core.components.metadata_capability.MetadataCapability` )

def get_metadata(self, model, check_callback):

Try to retrieve the requested metadata and populate the model with it.

All the capabilities able to handle the request are tried sequentially in decreasing order of capability rank until all the requested metadata is retrieved or all the capabilities have been tried. If all the capabilities have been tried and the requested metadata remains incomplete, the IncompleteMetadataResponse exception will be raised.

Parameters | model | the model that should be populated with the metadata (type: a subclass of `elisa.core.components.model.Model` )
| check_callback | A function called after each capability.get_metadata was called and has answered. The only parameter is the model itself. The callback should check whether we can stop processing this model as all desired values are set (by returning True) or if the manager should keep on processing the model. (type: callable )
Returns | a deferred fired when the metadata retrieval is complete (type: `elisa.core.utils.defer.Deferred` )
Raises | IncompleteMetadataResponse | when the requested metadata remains incomplete