|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ICollection
A collection strategy. Allows read-only access to underlying storage of artists, albums, tracks and genres.
The implementation must be thread-safe - any method may be called from
multiple threads at once. The methods should periodically check for
interrupted state and throw InterruptedException
(or other kind of
exception) if they are interrupted.
Method Summary | |
---|---|
CategoryItem |
deserializeItem(String serializedItem)
Deserializes item serialized by serializeItem(CategoryItem) . |
List<TrackMetadataBean> |
findTracks(Map<CategoryEnum,String> criteria)
Search for tracks using given criteria search. |
Map<String,String> |
fixLocations(Collection<String> locations)
Given locations became invalid and need fixing. |
List<CategoryItem> |
getCategoryList(CategoryEnum request,
CategoryItem context,
String substring,
boolean sortByYear)
Returns category list matching given criteria. |
String |
getName()
Returns short descriptive name of this collection backend. |
Statistics |
getStatistics()
Returns statistics for this collection. |
List<TrackMetadataBean> |
getTracks(CategoryItem context)
Returns all tracks contained in given category. |
boolean |
isLocal()
Checks if the underlying strategy uses local resources to retrieve metadata (a DB backend), or it uses remote access to a server (for example Ampache). |
IDynamicPlaylistTrackProvider |
newTrackProvider(Random random)
Returns a new instance of the track provider. |
List<TrackMetadataBean> |
searchTracks(String substring)
Search song which Song Title, Artist Name, Album Name or Genre Name contains given substring. |
String |
serializeItem(CategoryItem item)
Returns ID returned by this collection in the CategoryItem.id as
String. |
boolean |
supportsLocationFix()
Serves for optimalization purposes only: checks if this collection can perform obsolete locations fixup or
not. |
Method Detail |
---|
boolean isLocal()
true
if the collection queries will tend to be
performed fast, false
otherwise.String getName()
List<TrackMetadataBean> getTracks(CategoryItem context) throws CollectionException, InterruptedException
context
- search in context of this item. Must not be null
.
null
, may be empty.
CollectionException
- thrown when the collection fails to return items.
InterruptedException
- when interrupted.List<CategoryItem> getCategoryList(CategoryEnum request, CategoryItem context, String substring, boolean sortByYear) throws CollectionException, InterruptedException
request
- the category to search for. Must not be null
.context
- search in context of this item. May be null
- in
this case all categories are returned.substring
- if not null
then all category names must contain
this substring.sortByYear
- if true
then the result category list is sorted
by year, then by name. If false
then sorted only
by name. Ignored when the request
parameter is
not an album.
null
, may be empty.
CollectionException
- thrown when the collection fails to return items.
InterruptedException
- when interrupted.List<TrackMetadataBean> searchTracks(String substring) throws CollectionException, InterruptedException
substring
- the substring to search for.
null
, may be empty.
Sorted in no particular order.
CollectionException
- thrown when the collection fails to return items.
InterruptedException
- when interrupted.Statistics getStatistics() throws CollectionException, InterruptedException
null
.
CollectionException
- thrown when the collection fails to return items.
InterruptedException
- when interrupted.String serializeItem(CategoryItem item)
CategoryItem.id
as
String. This item will only be used to perform searches - you should thus
preserve minimum information from the category item. This functionality
is only used by AmpacheServer
. You do not need to store the
CategoryItem.category
- it will be overwritten.
item
- the item to convert
CategoryItem deserializeItem(String serializedItem)
serializeItem(CategoryItem)
.
This item will be used to perform search only. This functionality is only
used by AmpacheServer
. You do not need to store the
CategoryItem.category
- it will be overwritten.
serializedItem
- the item to deserialize
IDynamicPlaylistTrackProvider newTrackProvider(Random random)
null
if this collection does not provide this functionality.
It is caller's responsibility to close the provider.
random
- initially provide tracks using this random value.
null
.List<TrackMetadataBean> findTracks(Map<CategoryEnum,String> criteria) throws CollectionException, InterruptedException
criteria
- the criteria, must not be null
. AND operator is
used if multiple criteria are specified. String values are
matched as substrings.
CollectionException
- thrown when the collection fails to return items.
InterruptedException
- when interrupted.boolean supportsLocationFix()
obsolete locations fixup
or
not.
true
if fixLocations(Collection)
is
supported, false
if the collection cannot fix the
locations, or the fix operation is not applicable to this
collection.Map<String,String> fixLocations(Collection<String> locations) throws CollectionException, InterruptedException
Given locations became invalid and need fixing.
MediaPlayer
detected an error while playing first location URL
from given location list. All given locations might thus have become
invalid. The collection is asked to fix these locations: it should
re-connect to the server (if any) and/or perform any required steps. If
any of these locations became completely invalid the method is free to
omit them in the result map. If the collection is unable to fix given
location then just pass input location.
Invoked asynchronously. This method will receive only locations provided
earlier by track
lookup methods such as
findTracks(Map)
.
locations
- the list of (possibly) invalid locations. Never
null
nor empty.
null
.
CollectionException
- thrown when this collection is unable to fix the locations.
InterruptedException
- thrown when interrupted.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |