Package elisa :: Package core :: Module resource_manager :: Class ResourceManager

Class ResourceManager

source code


Provide access to resources through the use of ResourceProvider components that make use of various data sources.

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
elisa.core.utils.defer.Deferred
register_component(self, component)
Register a new component.
source code
elisa.core.utils.defer.Deferred
unregister_component(self, component)
Unregister a component.
source code
 
get_resource_provider_by_path(self, path)
Return the registered resource provider that corresponds to the given component path.
source code
tuple of elisa.core.components.model.Model elisa.core.utils.defer.Deferred
get(self, uri, context_model=None)
Return a resource that uri is pointing to.
source code
elisa.core.utils.defer.Deferred
post(self, uri, **parameters)
Update the resource pointed by uri with parameters.
source code
elisa.core.utils.defer.Deferred
put(self, source_uri, container_uri, source_model=None, **kwargs)
Put one resource into another.
source code
elisa.core.utils.defer.Deferred
delete(self, uri)
Delete the resource that uri is pointing to.
source code

Inherited from extern.log.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

    Inherited from manager.Manager
 
clean(self) source code
 
plugin_status_changed_cb(self, plugin, status)
Callback meant to be invoked (by the plugin registry) when the status of a plugin has changed.
source code
Class Variables
str entry_point = 'elisa.core.components.resource_provider'
the entry point listing providers in plugins

Inherited from extern.log.log.Loggable: logCategory

Instance Variables
    Inherited from manager.Manager
list of elisa.core.component.Component components
components currently registered in the manager
Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

register_component(self, component)

source code 

Register a new component.

When trying to register a component twice, an AlreadyRegistered failure will be returned.

Parameters:
  • component - the component to register
Returns: elisa.core.utils.defer.Deferred
a deferred fired when the component is registered
Overrides: manager.Manager.register_component
(inherited documentation)

unregister_component(self, component)

source code 

Unregister a component.

When trying to unregister a component that is not registered, a CannotUnregister failure will be returned.

Parameters:
  • component - the component to unregister
Returns: elisa.core.utils.defer.Deferred
a deferred fired when the component is unregistered
Overrides: manager.Manager.unregister_component
(inherited documentation)

get_resource_provider_by_path(self, path)

source code 

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).

Parameters:
  • path (str) - the full component path for the resource provider

get(self, uri, context_model=None)

source code 

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.

Parameters:
  • uri (elisa.core.media_uri.MediaUri) - URI pointing to the resource
  • context_model (elisa.core.components.model.Model) - the 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.
Returns: tuple of elisa.core.components.model.Model elisa.core.utils.defer.Deferred
a new model and a deferred fired when the model is fully loaded
Raises:

post(self, uri, **parameters)

source code 

Update the resource pointed by uri with parameters.

Parameters:
Returns: elisa.core.utils.defer.Deferred
a deferred fired when the parameters got posted
Raises:

put(self, source_uri, container_uri, source_model=None, **kwargs)

source code 

Put one resource into another. Both resources are identified with URIs.

Parameters:
  • source_uri (elisa.core.media_uri.MediaUri) - URI pointing to the resource that should be put into the other one
  • container_uri (elisa.core.media_uri.MediaUri) - URI pointing to the resource that should receive the resource
  • source_model (elisa.core.components.model.Model) - Often 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
  • kwargs - resource provider specific keyword options
Returns: elisa.core.utils.defer.Deferred
a deferred fired when the resource got put
Raises:

delete(self, uri)

source code 

Delete the resource that uri is pointing to.

Parameters:
Returns: elisa.core.utils.defer.Deferred
a deferred fired when the resource got deleted
Raises: