java.lang.Object
org.jempeg.empeg.emptool.PlayerDatabase
- All Implemented Interfaces:
- java.util.EventListener, org.jempeg.empeg.protocol.event.ProtocolListenerIfc, org.jempeg.empeg.protocol.event.TuneDatabaseListenerIfc
- public class PlayerDatabase
- extends java.lang.Object
- implements org.jempeg.empeg.protocol.event.ProtocolListenerIfc, org.jempeg.empeg.protocol.event.TuneDatabaseListenerIfc
PlayerDatabase is the primary interface to manipulating and
querying the database of songs and playlists on the Empeg.
It also provides the low-level implementation of downloading
and synchronization to the Empeg.
- Version:
- $Revision: 1.23 $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CONNECT_TIMEOUT
private static final int CONNECT_TIMEOUT
- See Also:
- Constant Field Values
RESTART_TIMEOUT
private static final int RESTART_TIMEOUT
- See Also:
- Constant Field Values
myClient
private org.jempeg.empeg.protocol.ProtocolClient myClient
myListener
private DatabaseProgressListenerIfc myListener
myConfig
private org.jempeg.empeg.core.DynamicConfigFile myConfig
myConfigChanged
private boolean myConfigChanged
myTagNames
private DatabaseTags myTagNames
myFIDs
private FIDNodeMap myFIDs
myRestoreFile
private java.io.File myRestoreFile
myTotalSize
private long myTotalSize
myTotalFree
private long myTotalFree
myRepairTagsList
private java.util.Vector myRepairTagsList
myIdentity
private org.jempeg.empeg.protocol.PlayerIdentity myIdentity
PlayerDatabase
public PlayerDatabase(org.jempeg.empeg.protocol.ProtocolClient _client)
PlayerDatabase
public PlayerDatabase(org.jempeg.empeg.protocol.ProtocolClient _client,
DatabaseProgressListenerIfc _listener)
PlayerDatabase
public PlayerDatabase(java.io.File _restoreFile)
PlayerDatabase
public PlayerDatabase(java.io.File _restoreFile,
DatabaseProgressListenerIfc _listener)
getUniqueID
public java.lang.String getUniqueID(long _fid)
throws java.io.IOException
- Returns the globally unique id for the given FID.
isDirty
public boolean isDirty()
- Returns whether or not any nodes in this database are dirty.
isTagRepairRequired
public boolean isTagRepairRequired()
- Returns whether or not there are nodes that require
tags to be repaired. This would be the case if
the user is upgrading from an older version of
Emplode. To repair the nodes, call repairTags.
repairTags
public void repairTags()
- Repairs the nodes that have missing frame tags.
clearTags
protected void clearTags()
removeFIDs
protected void removeFIDs()
throws java.io.IOException
getClient
public org.jempeg.empeg.protocol.ProtocolClient getClient()
setListener
public void setListener(DatabaseProgressListenerIfc _listener)
getListener
public DatabaseProgressListenerIfc getListener()
backup
public void backup(java.io.File _backupFile)
throws java.io.IOException
restore
public void restore(java.io.File _restoreFile)
throws java.lang.ClassNotFoundException,
java.io.IOException
getNode
public AbstractFIDNode getNode(int _fid)
getNode
public AbstractFIDNode getNode(java.lang.String _gfid)
findFreeFID
public int findFreeFID()
getTagNumber
public int getTagNumber(java.lang.String _name)
getTagName
public java.lang.String getTagName(int _tag)
addTag
public int addTag(java.lang.String _name)
getTagNames
public DatabaseTags getTagNames()
getTypeTag
public int getTypeTag()
getTitleTag
public int getTitleTag()
addFID
public boolean addFID(int _fid,
AbstractFIDNode _node)
throws java.io.IOException
removeFID
public boolean removeFID(int _fid)
throws java.io.IOException
tagIndexFound
public void tagIndexFound(org.jempeg.empeg.protocol.event.TuneDatabaseIndexEvent _event)
- Specified by:
tagIndexFound in interface org.jempeg.empeg.protocol.event.TuneDatabaseListenerIfc
getNodeMap
public FIDNodeMap getNodeMap()
getRootPlaylist
public FIDPlaylist getRootPlaylist()
getPlaylist
public FIDPlaylist getPlaylist(int _fid)
databaseEntryFound
public boolean databaseEntryFound(org.jempeg.empeg.protocol.event.TuneDatabaseEntryEvent _event)
- Specified by:
databaseEntryFound in interface org.jempeg.empeg.protocol.event.TuneDatabaseListenerIfc
isRepairRequired
protected boolean isRepairRequired(AbstractFIDNode _node)
progressReported
public void progressReported(org.jempeg.empeg.protocol.event.ProtocolActivityEvent _event)
- Specified by:
progressReported in interface org.jempeg.empeg.protocol.event.ProtocolListenerIfc
warningReported
public void warningReported(org.jempeg.empeg.protocol.event.ProtocolWarningEvent _event)
- Specified by:
warningReported in interface org.jempeg.empeg.protocol.event.ProtocolListenerIfc
ensureBasicTags
public void ensureBasicTags()
getConfig
public java.lang.String getConfig()
throws java.io.IOException
getConfigFile
public org.jempeg.empeg.core.DynamicConfigFile getConfigFile()
throws java.io.IOException
setConfigFile
public void setConfigFile(org.jempeg.empeg.core.DynamicConfigFile _configFile)
setConfigValue
public void setConfigValue(java.lang.String _section,
java.lang.String _key,
java.lang.String _value)
throws java.io.IOException
createRootPlaylist
protected FIDPlaylist createRootPlaylist()
throws java.io.IOException
checkRootLists
public int checkRootLists()
throws java.io.IOException
readFID
public AbstractFIDNode readFID(int _fid,
NodeTags _tags)
throws java.lang.IllegalArgumentException,
java.io.IOException
repair
public int repair(boolean _doRepair)
throws java.io.IOException
logFreeSpace
public void logFreeSpace()
throws java.io.IOException
getTotalSize
public long getTotalSize()
getTotalFree
public long getTotalFree()
getTotalUsed
public long getTotalUsed()
adjustFreeSpace
public void adjustFreeSpace(long _size)
download
public int download(boolean _rebuildOnFail)
throws java.io.IOException
needRebuild
protected int needRebuild(boolean _rebuildOnFail,
boolean _doRebuild)
throws java.io.IOException
synchronize
public void synchronize()
throws java.io.IOException
synchronizeReadOnly
protected void synchronizeReadOnly()
throws java.io.IOException
rebuildDatabase
public void rebuildDatabase()
throws java.io.IOException
readOnly
protected void readOnly()
throws java.io.IOException