jreceiver.common.rec.source
Class TuneRec

java.lang.Object
  |
  +--jreceiver.common.rec.BaseRec
        |
        +--jreceiver.common.rec.source.SourceRec
              |
              +--jreceiver.common.rec.source.TuneRec
All Implemented Interfaces:
Hashable, Rec, Selectable, Source, Tune
Direct Known Subclasses:
FtuneRec, StuneRec

public abstract class TuneRec
extends SourceRec
implements Tune, Selectable

Abstract class to provide basic implementation of Tune interface

Version:
$Revision: 1.4 $ $Date: 2003/04/27 23:14:31 $
Author:
Reed Esau

Field Summary
protected  Album m_album
           
protected  Artist m_artist
           
protected  int m_bitrate
           
protected  Comment m_comment
           
protected  Composer m_composer
           
protected  int m_data_offset
           
protected  java.util.Vector m_genres
           
protected  boolean m_is_checked
          is the item selected in the form?
protected  int m_trackno
           
protected  int m_tune_type
          File (1), Station (2) or CD-based (4)
protected  int m_year
           
 
Fields inherited from class jreceiver.common.rec.source.SourceRec
m_content_url, m_direct_uri, m_dst_mime, m_duration, m_mime, m_site_id, m_src_id, m_src_type, m_title
 
Fields inherited from interface jreceiver.common.rec.source.Tune
HKEY_ALBUM, HKEY_BITRATE, HKEY_COMMENT, HKEY_COMPOSER, HKEY_CONTENT_TYPE, HKEY_DATA_OFFSET, HKEY_LEAD_PERFORMER, HKEY_TRACK_NUMBER, HKEY_TUNE_TYPE, HKEY_YEAR, POPULATE_ALBUM, POPULATE_ARTIST, POPULATE_COMMENTS, POPULATE_COMPOSER, POPULATE_GENRELIST, TUNE_TYPE_ALL, TUNE_TYPE_CD_BASED, TUNE_TYPE_FILE, TUNE_TYPE_STATION
 
Fields inherited from interface jreceiver.common.rec.source.Source
DEFAULT_URL, FORCE_PLAYLIST_URL, HKEY_CONTENT_URL, HKEY_DIRECT_URI, HKEY_DST_MIME, HKEY_DURATION, HKEY_MIME, HKEY_SITE_ID, HKEY_SRC_ID, HKEY_SRC_TYPE, HKEY_TITLE, MAX_SRC_ID, MIN_SRC_ID, POPULATE_CONTENT_URL, POPULATE_DIRECT_URI, POPULATE_MEXTERNAL, POPULATE_MFILE, SRCTYPE_PLAYLIST, SRCTYPE_TUNE, SRCTYPE_UNDEFINED
 
Fields inherited from interface jreceiver.common.rec.Rec
HKEY_KEY, NO_LIMIT
 
Fields inherited from interface jreceiver.common.rec.Selectable
HKEY_CHECKED
 
Constructor Summary
  TuneRec()
          ctor - default (for use with beanutils)
protected TuneRec(java.util.Hashtable hash)
          ctor - construct from a hashtable, usually retrieved via XML-RPC
protected TuneRec(int src_id, java.lang.String mime, int tune_type)
          ctor - minimalist
protected TuneRec(int src_id, java.lang.String mime, int duration, int tune_type, java.lang.String title, org.esau.ptarmigan.util.PtarURI direct_uri, java.net.URL content_url)
          ctor
protected TuneRec(int src_id, java.lang.String mime, int duration, int tune_type, java.lang.String title, org.esau.ptarmigan.util.PtarURI direct_uri, java.net.URL content_url, java.util.Vector genres, int bitrate)
          ctor
protected TuneRec(int src_id, java.lang.String mime, int duration, int tune_type, java.lang.String title, org.esau.ptarmigan.util.PtarURI direct_uri, java.net.URL content_url, java.util.Vector genres, int bitrate, int data_offset, int trackno, int year, Artist artist, Album album, Composer composer, Comment comment)
          ctor
 
Method Summary
 void addComment(java.lang.String str)
          add a comment, starting with the summary and then text
 void addGenre(java.lang.String genre)
          assign a single genre
static SourceRec createInstance(java.util.Hashtable hash)
          Create a TuneRec object preserved as a hash that has arrived over an XML-RPC connection or similar.
static SourceRec createInstance(java.lang.String mime, int duration, int tune_type, java.lang.String title, java.util.Vector genres, int bitrate, int data_offset, int trackno, int year, Artist artist, Album album, Composer composer, Comment comment)
          Create a basic TuneRec object of the specified type.
 Album getAlbum()
          obtain the album
 java.lang.String getAlbumStr()
          obtain the album name, (used for display in jsp)
 Artist getArtist()
          obtain the lead performer
 java.lang.String getArtistStr()
          obtain the artist name, (used for display in jsp)
 int getBitrate()
          obtain the 'bitrate'
 boolean getChecked()
          get the current select state
 Comment getComment()
          obtain the comment
 java.lang.String getCommentStr()
          assign the comment
 Composer getComposer()
          obtain the composer
 java.lang.String getComposerStr()
          obtain the composer name, (used for display in jsp)
 int getDataOffset()
          obtain the offset in the music file where the mpeg data starts.
 java.util.Vector getGenres()
          obtain the genres
 java.lang.String getGenreStr()
          obtain the genre list, as a comma-delimited string (used for display)
 boolean getIsCdBasedTune()
           
 boolean getIsStationTune()
           
 boolean getIsTuneFile()
           
 int getTrackNo()
          obtain the 'trackno'
 int getTuneType()
          obtain the 'type' of the tune (Tune.TUNE_TYPE_*)
 int getYear()
          obtain the 'year'
static java.util.Vector reconstitute(java.util.Vector vector)
          Reconstitute each DtuneRec object that appears as a hash in the list.
 void setAlbum(Album album)
          assign the album
 void setAlbum(java.lang.String album)
          assign the album (as a String)
 void setArtist(Artist artist)
          assign the lead performer
 void setArtist(java.lang.String artist)
          assign the lead performer (as a String)
 void setBitrate(int bitrate)
          assign the 'bitrate'
 void setChecked(boolean is_checked)
          set the select state
 void setComment(Comment comment)
          assign the comment
 void setComposer(Composer composer)
          assign the composer
 void setComposer(java.lang.String composer)
          assign the composer (as a String)
 void setDataOffset(int data_offset)
          assign the offset in the music file where the mpeg data starts.
 void setGenres(java.util.Vector genres)
          assign the genres
 void setTrackNo(int trackno)
          assign the 'trackno'
 void setTuneType(int tune_type)
          assign the 'type' of the tune (Tune.TUNE_TYPE_*)
 void setYear(int year)
          assign the 'year'
 java.util.Hashtable toHash()
          Store the object as a hash suitable for transport over an XML-RPC connection or similar.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class jreceiver.common.rec.source.SourceRec
getContentSystemId, getContentURL, getDirectSystemId, getDirectURI, getDstMime, getDuration, getFile, getFileExtension, getFileName, getFilePath, getIsLocal, getIsOffsite, getIsPlaylist, getIsTune, getKey, getMime, getSiteId, getSrcId, getTitle, getType, setContentURL, setDirectURI, setDirectURI, setDuration, setKey, setMime, setSrcId, setTitle
 
Methods inherited from class jreceiver.common.rec.BaseRec
dissolve, dissolveMap, find, find, find, find
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jreceiver.common.rec.source.Source
getContentSystemId, getContentURL, getDirectSystemId, getDirectURI, getDstMime, getDuration, getFile, getFileExtension, getFileName, getFilePath, getIsLocal, getIsOffsite, getIsPlaylist, getIsTune, getMime, getSiteId, getSrcId, getTitle, getType, setContentURL, setDirectURI, setDirectURI, setDuration, setMime, setSrcId, setTitle
 
Methods inherited from interface jreceiver.common.rec.Rec
getKey, setKey
 

Field Detail

m_tune_type

protected int m_tune_type
File (1), Station (2) or CD-based (4)

m_data_offset

protected int m_data_offset

m_bitrate

protected int m_bitrate

m_trackno

protected int m_trackno

m_year

protected int m_year

m_artist

protected Artist m_artist

m_album

protected Album m_album

m_composer

protected Composer m_composer

m_comment

protected Comment m_comment

m_genres

protected java.util.Vector m_genres

m_is_checked

protected boolean m_is_checked
is the item selected in the form?
Constructor Detail

TuneRec

public TuneRec()
ctor - default (for use with beanutils)

TuneRec

protected TuneRec(int src_id,
                  java.lang.String mime,
                  int tune_type)
ctor - minimalist

TuneRec

protected TuneRec(int src_id,
                  java.lang.String mime,
                  int duration,
                  int tune_type,
                  java.lang.String title,
                  org.esau.ptarmigan.util.PtarURI direct_uri,
                  java.net.URL content_url)
ctor

TuneRec

protected TuneRec(int src_id,
                  java.lang.String mime,
                  int duration,
                  int tune_type,
                  java.lang.String title,
                  org.esau.ptarmigan.util.PtarURI direct_uri,
                  java.net.URL content_url,
                  java.util.Vector genres,
                  int bitrate)
ctor

TuneRec

protected TuneRec(int src_id,
                  java.lang.String mime,
                  int duration,
                  int tune_type,
                  java.lang.String title,
                  org.esau.ptarmigan.util.PtarURI direct_uri,
                  java.net.URL content_url,
                  java.util.Vector genres,
                  int bitrate,
                  int data_offset,
                  int trackno,
                  int year,
                  Artist artist,
                  Album album,
                  Composer composer,
                  Comment comment)
ctor

TuneRec

protected TuneRec(java.util.Hashtable hash)
           throws RecException
ctor - construct from a hashtable, usually retrieved via XML-RPC
Method Detail

toHash

public java.util.Hashtable toHash()
Store the object as a hash suitable for transport over an XML-RPC connection or similar.

Use DtuneRec(Hashtable) to transform the data back into an object of this type.

Specified by:
toHash in interface Hashable
Overrides:
toHash in class SourceRec
Following copied from interface: jreceiver.common.rec.Hashable
Returns:
 

getTuneType

public int getTuneType()
obtain the 'type' of the tune (Tune.TUNE_TYPE_*)
Specified by:
getTuneType in interface Tune

setTuneType

public void setTuneType(int tune_type)
assign the 'type' of the tune (Tune.TUNE_TYPE_*)
Specified by:
setTuneType in interface Tune

getDataOffset

public int getDataOffset()
obtain the offset in the music file where the mpeg data starts. 0 if starts at beginning of file.

Specified by:
getDataOffset in interface Tune
Returns:
a byte offset where the mpeg data begins

setDataOffset

public void setDataOffset(int data_offset)
assign the offset in the music file where the mpeg data starts.
Specified by:
setDataOffset in interface Tune

getBitrate

public int getBitrate()
obtain the 'bitrate'

units are in kbps, e.g., 80 == 80kbps

Specified by:
getBitrate in interface Tune

setBitrate

public void setBitrate(int bitrate)
assign the 'bitrate'

units are in kbps, e.g., 80 == 80kbps

Specified by:
setBitrate in interface Tune

getTrackNo

public int getTrackNo()
obtain the 'trackno'
Specified by:
getTrackNo in interface Tune

setTrackNo

public void setTrackNo(int trackno)
assign the 'trackno'
Specified by:
setTrackNo in interface Tune

getYear

public int getYear()
obtain the 'year'
Specified by:
getYear in interface Tune

setYear

public void setYear(int year)
assign the 'year'
Specified by:
setYear in interface Tune

getArtist

public Artist getArtist()
obtain the lead performer
Specified by:
getArtist in interface Tune

setArtist

public void setArtist(Artist artist)
assign the lead performer
Specified by:
setArtist in interface Tune

setArtist

public void setArtist(java.lang.String artist)
assign the lead performer (as a String)

getArtistStr

public java.lang.String getArtistStr()
obtain the artist name, (used for display in jsp)
Specified by:
getArtistStr in interface Tune

getAlbum

public Album getAlbum()
obtain the album
Specified by:
getAlbum in interface Tune

setAlbum

public void setAlbum(Album album)
assign the album
Specified by:
setAlbum in interface Tune

setAlbum

public void setAlbum(java.lang.String album)
assign the album (as a String)

getAlbumStr

public java.lang.String getAlbumStr()
obtain the album name, (used for display in jsp)
Specified by:
getAlbumStr in interface Tune

getComposer

public Composer getComposer()
obtain the composer
Specified by:
getComposer in interface Tune

setComposer

public void setComposer(Composer composer)
assign the composer
Specified by:
setComposer in interface Tune

setComposer

public void setComposer(java.lang.String composer)
assign the composer (as a String)

getComposerStr

public java.lang.String getComposerStr()
obtain the composer name, (used for display in jsp)
Specified by:
getComposerStr in interface Tune

getComment

public Comment getComment()
obtain the comment
Specified by:
getComment in interface Tune

setComment

public void setComment(Comment comment)
assign the comment
Specified by:
setComment in interface Tune

addComment

public void addComment(java.lang.String str)
add a comment, starting with the summary and then text

getCommentStr

public java.lang.String getCommentStr()
assign the comment

getGenres

public java.util.Vector getGenres()
obtain the genres
Specified by:
getGenres in interface Tune

setGenres

public void setGenres(java.util.Vector genres)
assign the genres
Specified by:
setGenres in interface Tune

addGenre

public void addGenre(java.lang.String genre)
assign a single genre
Specified by:
addGenre in interface Tune

getGenreStr

public java.lang.String getGenreStr()
obtain the genre list, as a comma-delimited string (used for display)
Specified by:
getGenreStr in interface Tune

getChecked

public boolean getChecked()
Description copied from interface: Selectable
get the current select state
Specified by:
getChecked in interface Selectable
Following copied from interface: jreceiver.common.rec.Selectable
Returns:
boolean true if the item has been selected by the user; false otherwise

setChecked

public void setChecked(boolean is_checked)
Description copied from interface: Selectable
set the select state
Specified by:
setChecked in interface Selectable
Following copied from interface: jreceiver.common.rec.Selectable
Parameters:
is_checked -  

getIsTuneFile

public boolean getIsTuneFile()
Specified by:
getIsTuneFile in interface Tune

getIsStationTune

public boolean getIsStationTune()
Specified by:
getIsStationTune in interface Tune

getIsCdBasedTune

public boolean getIsCdBasedTune()
Specified by:
getIsCdBasedTune in interface Tune

toString

public java.lang.String toString()
Description copied from interface: Hashable
Returns a string representation of the object.
Specified by:
toString in interface Hashable
Overrides:
toString in class SourceRec

createInstance

public static SourceRec createInstance(java.util.Hashtable hash)
                                throws RecException
Create a TuneRec object preserved as a hash that has arrived over an XML-RPC connection or similar.

The hash should have been created with toHash().


createInstance

public static SourceRec createInstance(java.lang.String mime,
                                       int duration,
                                       int tune_type,
                                       java.lang.String title,
                                       java.util.Vector genres,
                                       int bitrate,
                                       int data_offset,
                                       int trackno,
                                       int year,
                                       Artist artist,
                                       Album album,
                                       Composer composer,
                                       Comment comment)
                                throws RecException
Create a basic TuneRec object of the specified type.

reconstitute

public static java.util.Vector reconstitute(java.util.Vector vector)
                                     throws RecException,
                                            java.net.MalformedURLException
Reconstitute each DtuneRec object that appears as a hash in the list.


Copyright © 2001-2002 Reed Esau, All Rights Reserved.