Part of elisa.core.components.resource_provider View In Hierarchy
Known subclasses: elisa.core.tests.test_resource_manager.FooResourceProvider, elisa.plugins.amazon.resource_provider.AmazonResourceProvider, elisa.plugins.avahi.avahi_resource_provider.AvahiResourceProvider, elisa.plugins.base.local_resource.LocalResource, elisa.plugins.coherence.coherence_resource.CoherenceResource, elisa.plugins.coherence.upnp_resource.UpnpResource, elisa.plugins.daap.daap_resource_provider.DaapResourceProvider, elisa.plugins.database.media_scanner.MediaScanner, elisa.plugins.discogs.discogs_resource.DiscogsResource, elisa.plugins.elisa_updater.resource_provider.UpdaterResourceProvider, elisa.plugins.filtered_shares.filtered_shares_resource.FilteredSharesResource, elisa.plugins.flickr.resource_provider.FlickrResourceProvider, elisa.plugins.hal.hal_resource.HALResource, elisa.plugins.ipod.ipod_resource.IpodResource, elisa.plugins.search.search_metaresource_provider.SearchMetaresourceProvider, elisa.plugins.shoutcast.shoutcast_resource.ShoutcastResource, elisa.plugins.smbwin32.smbwin32_resource.SmbWin32Resource, elisa.plugins.themoviedb.resource_provider.TheMovieDBResourceProvider, elisa.plugins.thetvdb.resource_provider.TheTvDBResourceProvider, elisa.plugins.tutorials.amazon.resource_provider.AmazonResourceProvider, elisa.plugins.wmd.wmd_resource.WMDResource, elisa.plugins.youtube.resource_provider.YoutubeResourceProvider
Accessing a resource is done through a URI that points to it. Possible operations on resources are defined by the REST principles and allow retrieval, creation, update and removal of resources.
For more information about REST, Roy Fielding's thesis is helpful: http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
A resource can be identified with a URI. This is also called a pointer or a link.
Example:
You could have a list of music albums stored at some place designated by the following URI:
elisa://localhost/albums
When the user decides to access the resource behind this URI, a
retrieval request is sent to the
elisa.resource_manager.ResourceManager
. It holds all the
ResourceProviders and forwards the request to one that can handle it. This
is made possible by trying to match the URI to their regular
expressions.
A resource in Elisa is stored as a elisa.core.components.model.Model
.
The chosen ResourceProvider returns the Model (in this example, it would be
something like an AlbumsListModel) and starts to fill it asynchronously.
When it is complete, the elisa.core.utils.defer.Deferred
is
fired.
Class Variables | supported_uri | regular expression defining what URIs a ResourceProvider can handle (type: str ) |
Line # | Kind | Name | Docs |
---|---|---|---|
78 | Method | get | Return a resource that uri is pointing to. A URI can point
to |
103 | Method | post | Update the resource pointed by uri with
parameters . |
116 | Method | put | Put one resource into another. Both resources are identified with URIs. |
138 | Method | delete | Delete a Resource represented by a URI. |
Inherited from Component:
Line # | Kind | Name | Docs |
---|---|---|---|
85 | Class | PathDescriptor | Undocumented |
97 | Class Method | create | Create and initialize the component. |
130 | Method | initialize | Initialize the component. |
142 | Method | clean | Clean the component. |
Inherited from Loggable (via Component):
Line # | Kind | Name | Docs |
---|---|---|---|
81 | Method | __init__ | Undocumented |
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 | URI pointing to the resource
(type: elisa.core.media_uri.MediaUri
) |
context_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.
(type: elisa.core.components.model.Model
) | |
Returns | a 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
) |
uri
with
parameters
.Parameters | uri | URI pointing to the resource to update
(type: elisa.core.media_uri.MediaUri
) |
parameters | parameters of the resource that should be updated | |
Returns | a deferred fired when the parameters got posted
(type: elisa.core.utils.defer.Deferred
) |
Parameters | source_uri | URI pointing to the resource that should be put into the other one
(type: elisa.core.media_uri.MediaUri
) |
container_uri | URI pointing to the resource that should receive the resource
(type: elisa.core.media_uri.MediaUri
) | |
source_model | Often the resource behind the source_uri is already existing as a
model-representation. To prevent from doing a 'get' for the given
source_uri this model can also be given to the put request.
(type: elisa.core.components.model.Model
) | |
Returns | a deferred fired when the resource got put
(type: elisa.core.utils.defer.Deferred
) |
Parameters | uri | URI pointing to the resource that should be deleted
(type: elisa.media_uri.MediaUri
) |
Returns | a deferred fired when the resource got deleted
(type: elisa.core.utils.defer.Deferred
) |