com.neoworks.jukex.tracksource
Interface TrackSourcePipelineElement

All Superinterfaces:
java.io.Serializable, TrackSource
All Known Subinterfaces:
Playlist, SearchPipelineElement
All Known Implementing Classes:
AnnoyingPipelineElement, AudioBannerPipelineElement, InMemoryPlaylist, JukeXPlaylist, SearchRandomiserPipelineElement, TrackSourcePipelineElementSkeleton

public interface TrackSourcePipelineElement
extends TrackSource, java.io.Serializable

An object which can be present in a pipeline of TrackSources.

Author:
Nigel Atkinson (nigel@neoworks.com)
, Nick Vincent (nick@neoworks.com)

Method Summary
 void disable()
          Disable this element
 void enable()
          Enable this element
 TrackSourcePipelineElement getNextTrackSource()
          Get the next TrackSourcePipelineElement
 java.util.Map getState()
          Get the current state of this PipelineElement for persisting
 java.util.List peekTracks(int count)
          Peek at the next count tracks from this TrackSourcePipelineElement
 boolean removeTrack(int index)
          Remove a Track from this PipelineElement
 void setName(java.lang.String name)
          Set the name of this element
 TrackSourcePipelineElement setNextTrackSource(TrackSourcePipelineElement next)
          Tells this tracksource of a new link in the chain
 TrackSourcePipelineElement setOwner(TrackSourcePipeline pipe)
          Set which TrackSourcePipeline this PipelineElement is currently a part of
 boolean setState(java.util.Map state)
          Load the configuration of this PipelineElement
 boolean storeState(java.sql.Connection conn)
          Persist the current state of the PipelineElement into the database
 
Methods inherited from interface com.neoworks.jukex.tracksource.TrackSource
clone, getDescription, getName, getNextTrack, getSummary, isEnabled
 

Method Detail

setNextTrackSource

public TrackSourcePipelineElement setNextTrackSource(TrackSourcePipelineElement next)
Tells this tracksource of a new link in the chain

Returns:
The previous TrackSource

getNextTrackSource

public TrackSourcePipelineElement getNextTrackSource()
Get the next TrackSourcePipelineElement

Returns:
The next TrackSourcePipelineElement

removeTrack

public boolean removeTrack(int index)
Remove a Track from this PipelineElement

Parameters:
index - The index of the Track to remove
Returns:
Success

peekTracks

public java.util.List peekTracks(int count)
Peek at the next count tracks from this TrackSourcePipelineElement

Parameters:
count - The number of Tracks to peek ahead at
Returns:
A List of Track objects

setOwner

public TrackSourcePipelineElement setOwner(TrackSourcePipeline pipe)
Set which TrackSourcePipeline this PipelineElement is currently a part of

Parameters:
pipe - The TrackSourcePipeline to which you now belong
Returns:
The PipelineElement, to allow for chaining of calls

getState

public java.util.Map getState()
Get the current state of this PipelineElement for persisting

Returns:
a String keyed Map of objects representing the state of this PipelineElement, e.g. for a Playlist this would be information allowing the reconstruction of the current playlist queue.

setState

public boolean setState(java.util.Map state)
Load the configuration of this PipelineElement

Parameters:
state - a Map of values keyed by Strings representing the state of this PipelineElement.
Returns:
success

storeState

public boolean storeState(java.sql.Connection conn)
Persist the current state of the PipelineElement into the database

Parameters:
conn - The database connection to use, which must have AutoCommit disabled
Returns:
success

disable

public void disable()
Disable this element


enable

public void enable()
Enable this element


setName

public void setName(java.lang.String name)
Set the name of this element

Parameters:
name - The name of this Pipeline Element