Class e.c.r.ResourceManager(Manager):

Part of elisa.core.resource_manager View In Hierarchy

Provide access to resources through the use of ResourceProvider components which make use of various data sources.
Line # Kind Name Docs
57 Method __init__ Initialize resource providers
65 Method register_component Register a new Component
73 Method unregister_component Unregister a component from the Manager
84 Method get_resource_provider_by_path Return the registered resource provider that corresponds to the given
139 Method get Return a resource that uri is pointing to. A URI can point to
168 Method post Update the resource pointed by uri with parameters.
185 Method put Put one resource into another. Both resources are identified with URIs.
213 Method delete Delete the resource that uri is pointing to.

Inherited from Manager:

Line # Kind Name Docs
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.
def __init__(self):
Initialize resource providers
def register_component(self, component):

Register a new Component

Store a new Component in our components list. Returns the result of the operation. If the component is already registered, don't register it twice.
Parameterscomponentthe Component to register (type: elisa.core.component.Component )
RaisesAlreadyRegisteredwhen the component has already been registered
TypeErrorwhen the given component is *not* of the type supported_components
def unregister_component(self, component):

Unregister a component from the Manager

Remove the Component instance from our components list if it's there. Returns the result of the operation.
Parameterscomponentthe Component to register (type: elisa.core.component.Component )
RaisesCannotUnregisterraised when the component cannot be removed
def get_resource_provider_by_path(self, path):

Return the registered resource provider that corresponds to the given component path.

This method should not be called to gain direct access to a resource provider, it is meant to be called only by capabilities at initialization time (capabilities need a reference to their "parent" resource provider).
Parameterspaththe full component path for the resource provider (type: str )
def get(self, uri, context_model=None):

Return a resource that uri is pointing to. A URI can point to any kind of resource. Resources are returned as models.

The model that is returned does not always already contain all the resource. The deferred is fired when the resource loading is complete.
ParametersuriURI pointing to the resource (type: elisa.core.media_uri.MediaUri )
context_modelthe URI often comes from a certain context. For example a URI pointing to a MusicAlbum can come from a Model that could contain the album cover or the album name. If the context_model is provided the resource_provider should try to reuse its data if possible. (type: elisa.core.components.model.Model )
Returnsa new model and a deferred fired when the model is fully loaded (type: tuple of elisa.core.components.model.Model elisa.core.utils.defer.Deferred )
RaisesNoMatchingResourceProviderin case no ResourceProvider has a matching regular expression for uri
def post(self, uri, **parameters):
Update the resource pointed by uri with parameters.
ParametersuriURI pointing to the resource to update (type: elisa.core.media_uri.MediaUri )
parametersparameters of the resource that should be updated
Returnsa deferred fired when the parameters got posted (type: elisa.core.utils.defer.Deferred )
RaisesNoMatchingResourceProviderin case no ResourceProvider has a matching regular expression for uri
def put(self, source_uri, container_uri, source_model=None):
Put one resource into another. Both resources are identified with URIs.
Parameterssource_uriURI pointing to the resource that should be put into the other one (type: elisa.core.media_uri.MediaUri )
container_uriURI pointing to the resource that should receive the resource (type: elisa.core.media_uri.MediaUri )
source_modelOften the resource behind the source_uri already exists as a Model. In order to avoid retrieving the resource pointed by source_uri that model can be passed to the put request (type: elisa.core.components.model.Model )
Returnsa deferred fired when the resource got put (type: elisa.core.utils.defer.Deferred )
RaisesNoMatchingResourceProviderin case no ResourceProvider has a matching regular expression for the container_uri
def delete(self, uri):
Delete the resource that uri is pointing to.
ParametersuriURI pointing to the resource that should be deleted (type: elisa.core.media_uri.MediaUri )
Returnsa deferred fired when the resource got deleted (type: elisa.core.utils.defer.Deferred )
RaisesNoMatchingResourceProviderin case no ResourceProvider has a matching regular expression for uri
API Documentation for Elisa Media Center, generated by pydoctor at 2008-09-29 19:14:29.