org.stanwood.media.store
Interface IStore

All Superinterfaces:
IExtension
All Known Implementing Classes:
MemoryStore, MP4ITunesStore, RemoteMacOSXItunesStore, SapphireStore, XMLStore2

public interface IStore
extends IExtension

Stores are similar too sources, except that they are also writable. Once information has been retrieved from a source, it is written too a store. Next time the information is needed, it can be retrieved from the store. This makes retrieving information a lot faster.


Method Summary
 void cacheEpisode(java.io.File rootMediaDir, java.io.File episodeFile, IEpisode episode)
          This is used to write a episode or special too the store
 void cacheFilm(java.io.File rootMediaDir, java.io.File filmFile, IFilm film, java.lang.Integer part)
          This is used to write a film to the store.
 void cacheSeason(java.io.File rootMediaDir, java.io.File episodeFile, ISeason season)
          This is used to write a season too the store.
 void cacheShow(java.io.File rootMediaDir, java.io.File episodeFile, IShow show)
          This is used to write a show too the store.
 void fileDeleted(MediaDirectory dir, java.io.File file)
          This is called when a file is deleted from a media directory
 void fileUpdated(MediaDirectory mediaDirectory, java.io.File file)
          This is called when a file is updated within a media directory.
 IEpisode getEpisode(java.io.File rootMediaDir, java.io.File episodeFile, ISeason season, int episodeNum)
          This gets a episode from the store.
 IEpisode getEpisode(MediaDirectory dir, java.io.File file)
          This is used to get a episode from a store via it's file name.
 IFilm getFilm(java.io.File rootMediaDir, java.io.File filmFile, java.lang.String filmId)
          This will get a film from the store.
 IFilm getFilm(MediaDirectory dir, java.io.File file)
          This is used to get a film from a store via it's file name.
 java.lang.String getParameter(java.lang.String key)
          Used to get the value of a source parameter.
 ISeason getSeason(java.io.File rootMediaDir, java.io.File episodeFile, IShow show, int seasonNum)
          This will get a season from the store.
 IShow getShow(java.io.File rootMediaDir, java.io.File episodeFile, java.lang.String showId)
          This will get a show from the store.
 IEpisode getSpecial(java.io.File rootMediaDir, java.io.File episodeFile, ISeason season, int specialNumber)
          This gets a special episode from the store.
 void init(Controller controller, java.io.File nativeDir)
          Called to initialise the stores and check all their resources can be found.
 java.util.Collection<IEpisode> listEpisodes(MediaDirConfig dirConfig, IProgressMonitor monitor)
          This is used to list all the episodes within the store if the store supports the operation.
 java.util.Collection<IFilm> listFilms(MediaDirConfig dirConfig, IProgressMonitor monitor)
          This is used to list all the films within the store if the store supports the operation.
 void performedActions(MediaDirectory dir)
          This is called after all the actions on all the media files have been performed so that the store can clean up any stale data.
 void renamedFile(java.io.File rootMediaDir, java.io.File oldFile, java.io.File newFile)
          This is used when a file that holds a episode or film has been renamed
 SearchResult searchMedia(java.lang.String name, Mode mode, java.lang.Integer part, MediaDirConfig dirConfig, java.io.File mediaFile)
          Used to search for store for media
 void setParameter(java.lang.String key, java.lang.String value)
          Used to set source parameters.
 void upgrade(MediaDirectory mediaDirectory)
          This is called to check if a upgrade is needed and perform the upgrade if required
 

Method Detail

cacheEpisode

void cacheEpisode(java.io.File rootMediaDir,
                  java.io.File episodeFile,
                  IEpisode episode)
                  throws StoreException
This is used to write a episode or special too the store

Parameters:
episode - The episode or special too write
episodeFile - the file witch the episode is stored in
rootMediaDir - This is the directory which is the root of media, this can be the current directory if it was not specified on the command line.
Throws:
StoreException - Thrown if their is a problem with the store

cacheSeason

void cacheSeason(java.io.File rootMediaDir,
                 java.io.File episodeFile,
                 ISeason season)
                 throws StoreException
This is used to write a season too the store.

Parameters:
season - The season too write
episodeFile - The file the episode is stored in
rootMediaDir - This is the directory which is the root of media, this can be the current directory if it was not specified on the command line.
Throws:
StoreException - Thrown if their is a problem with the store

cacheShow

void cacheShow(java.io.File rootMediaDir,
               java.io.File episodeFile,
               IShow show)
               throws StoreException
This is used to write a show too the store.

Parameters:
show - The show too write
episodeFile - The file the episode is stored in
rootMediaDir - This is the directory which is the root of media, this can be the current directory if it was not specified on the command line.
Throws:
StoreException - Thrown if their is a problem with the store

cacheFilm

void cacheFilm(java.io.File rootMediaDir,
               java.io.File filmFile,
               IFilm film,
               java.lang.Integer part)
               throws StoreException
This is used to write a film to the store.

Parameters:
filmFile - The file which the film is stored in
film - The film to write
part - The part number of the film
rootMediaDir - This is the directory which is the root of media, this can be the current directory if it was not specified on the command line.
Throws:
StoreException - Thrown if their is a problem with the store

getEpisode

IEpisode getEpisode(java.io.File rootMediaDir,
                    java.io.File episodeFile,
                    ISeason season,
                    int episodeNum)
                    throws StoreException,
                           java.net.MalformedURLException,
                           java.io.IOException
This gets a episode from the store. If it can't be found, then it will return null;

Parameters:
episodeFile - the file which the episode is stored in
season - The season the episode belongs too
episodeNum - The number of the episode too get
rootMediaDir - This is the directory which is the root of media, this can be the current directory if it was not specified on the command line.
Returns:
The episode, or null if it can't be found
Throws:
StoreException - Thrown if their is a problem with the store
java.net.MalformedURLException - Thrown if their is a problem creating URL's
java.io.IOException - Thrown if their is a I/O related problem.

getSeason

ISeason getSeason(java.io.File rootMediaDir,
                  java.io.File episodeFile,
                  IShow show,
                  int seasonNum)
                  throws StoreException,
                         java.io.IOException
This will get a season from the store. If the season can't be found, then it will return null.

Parameters:
episodeFile - the file which the episode is stored in
show - The show the season belongs too
seasonNum - The number of the season that is to be fetched
rootMediaDir - This is the directory which is the root of media, this can be the current directory if it was not specified on the command line.
Returns:
The season if it can be found, otherwise null.
Throws:
StoreException - Thrown if their is a problem with the store
java.io.IOException - Thrown if their is a I/O related problem.

getShow

IShow getShow(java.io.File rootMediaDir,
              java.io.File episodeFile,
              java.lang.String showId)
              throws StoreException,
                     java.net.MalformedURLException,
                     java.io.IOException
This will get a show from the store. If the season can't be found, then it will return null.

Parameters:
episodeFile - the file which the episode is stored in
showId - The id of the show to get.
rootMediaDir - This is the directory which is the root of media, this can be the current directory if it was not specified on the command line.
Returns:
The show if it can be found, otherwise null.
Throws:
StoreException - Thrown if their is a problem with the store
java.net.MalformedURLException - Thrown if their is a problem creating URL's
java.io.IOException - Thrown if their is a I/O related problem.

getSpecial

IEpisode getSpecial(java.io.File rootMediaDir,
                    java.io.File episodeFile,
                    ISeason season,
                    int specialNumber)
                    throws java.net.MalformedURLException,
                           java.io.IOException,
                           StoreException
This gets a special episode from the store. If it can't be found, then it will return null;

Parameters:
episodeFile - the file which the episode is stored in
season - The season the special episode belongs too
specialNumber - The number of the special episode too get
rootMediaDir - This is the directory which is the root of media, this can be the current directory if it was not specified on the command line.
Returns:
The special episode, or null if it can't be found
Throws:
StoreException - Thrown if their is a problem with the store
java.net.MalformedURLException - Thrown if their is a problem creating URL's
java.io.IOException - Thrown if their is a I/O related problem.

searchMedia

SearchResult searchMedia(java.lang.String name,
                         Mode mode,
                         java.lang.Integer part,
                         MediaDirConfig dirConfig,
                         java.io.File mediaFile)
                         throws StoreException
Used to search for store for media

Parameters:
name - The search term
mode - The mode of the search
part - The part number to search for
dirConfig - The Media directory configuration
mediaFile - The media file the search is associated with
Returns:
The search result or NULL if it could not be found
Throws:
StoreException - Thrown if their is a problem with the store

renamedFile

void renamedFile(java.io.File rootMediaDir,
                 java.io.File oldFile,
                 java.io.File newFile)
                 throws StoreException
This is used when a file that holds a episode or film has been renamed

Parameters:
rootMediaDir - This is the directory which is the root of media, this can be the current directory if it was not specified on the command line.
oldFile - The old file
newFile - The new file
Throws:
StoreException - Thrown if their is a problem renaming files

getFilm

IFilm getFilm(java.io.File rootMediaDir,
              java.io.File filmFile,
              java.lang.String filmId)
              throws StoreException,
                     java.net.MalformedURLException,
                     java.io.IOException
This will get a film from the store. If the film can't be found, then it will return null.

Parameters:
filmFile - The file the film is located in.
filmId - The id of the film
rootMediaDir - This is the directory which is the root of media, this can be the current directory if it was not specified on the command line.
Returns:
The film, or null if it can't be found
Throws:
StoreException - Thrown if their is a problem retrieving the data
java.net.MalformedURLException - Thrown if their is a problem creating URL's
java.io.IOException - Thrown if their is a I/O related problem.

setParameter

void setParameter(java.lang.String key,
                  java.lang.String value)
                  throws StoreException

Used to set source parameters. If the key is not supported by this source, then a SourceException is thrown.

Parameters:
key - The key of the parameter
value - The value of the parameter
Throws:
StoreException - Throw if the key is not supported by this store.

getParameter

java.lang.String getParameter(java.lang.String key)
                              throws StoreException

Used to get the value of a source parameter. If the key is not supported by this source, then a SourceException is thrown.

Parameters:
key - The key of the parameter
Returns:
The value of the parameter
Throws:
StoreException - Throw if the key is not supported by this store.

performedActions

void performedActions(MediaDirectory dir)
                      throws StoreException
This is called after all the actions on all the media files have been performed so that the store can clean up any stale data.

Parameters:
dir - The media directory
Throws:
StoreException - Thrown if their is a problem

fileDeleted

void fileDeleted(MediaDirectory dir,
                 java.io.File file)
                 throws StoreException
This is called when a file is deleted from a media directory

Parameters:
dir - The media directory
file - The file
Throws:
StoreException - Thrown if their is a problem

getEpisode

IEpisode getEpisode(MediaDirectory dir,
                    java.io.File file)
                    throws StoreException
This is used to get a episode from a store via it's file name. If it can't be found, then this will return null.

Parameters:
dir - The media directory
file - The media file
Returns:
The episode or null if it can't be found
Throws:
StoreException - Thrown if their are any problems

getFilm

IFilm getFilm(MediaDirectory dir,
              java.io.File file)
              throws StoreException
This is used to get a film from a store via it's file name. If it can't be found, then this will return null.

Parameters:
dir - The media directory
file - The media file
Returns:
The film or null if it can't be found
Throws:
StoreException - Thrown if their are any problems

init

void init(Controller controller,
          java.io.File nativeDir)
          throws StoreException
Called to initialise the stores and check all their resources can be found. This is called before performing any actions.

Parameters:
controller - The media controller
nativeDir - The native folder been used or configured. Null if can't be found
Throws:
StoreException - Thrown if their are any problems

listEpisodes

java.util.Collection<IEpisode> listEpisodes(MediaDirConfig dirConfig,
                                            IProgressMonitor monitor)
                                            throws StoreException
This is used to list all the episodes within the store if the store supports the operation. It this store can't list episodes, then it will return null

Parameters:
dirConfig - The media directory configuration
monitor - The progress monitor
Returns:
Null or a list of episodes in the store
Throws:
StoreException - Thrown if their are any problems

listFilms

java.util.Collection<IFilm> listFilms(MediaDirConfig dirConfig,
                                      IProgressMonitor monitor)
                                      throws StoreException
This is used to list all the films within the store if the store supports the operation. It this store can't list films, then it will return null

Parameters:
dirConfig - The media directory configuration
monitor - The progress monitor
Returns:
Null or a list of films in the store
Throws:
StoreException - Thrown if their are any problems

upgrade

void upgrade(MediaDirectory mediaDirectory)
             throws StoreException
This is called to check if a upgrade is needed and perform the upgrade if required

Parameters:
mediaDirectory - The media directory been upgraded
Throws:
StoreException - Thrown if thier are any problems

fileUpdated

void fileUpdated(MediaDirectory mediaDirectory,
                 java.io.File file)
                 throws StoreException
This is called when a file is updated within a media directory. This is typically called during the upgrade process if the meta data in the file has changed.

Parameters:
mediaDirectory - The media directory the file belongs to
file - The media file
Throws:
StoreException - Thrown if their are any problems