org.bff.javampd
Class MPDAdmin

java.lang.Object
  extended by org.bff.javampd.MPDAdmin

public class MPDAdmin
extends java.lang.Object

MPDAdmin represents a administrative controller to a MPD server. To obtain an instance of the class you must use the getMPDAdmin method from the MPD connection class. This class does not have a public constructor (singleton model) so the object must be obtained from the connection object.


Method Summary
 void addMPDChangeListener(MPDChangeListener mcl)
          Adds a MPDChangeListener to this object to receive MPDChangeEvents.
protected  void fireMPDChangeEvent(int id)
          Sends the appropriate MPDChangeEvent to all registered MPDChangeListeners.
 int getDaemonUpTime()
          Returns the daemon uptime in seconds.
 void killMPD()
          Kills the mpd connection.
 void removePlayerChangedListener(MPDChangeListener mcl)
          Removes a MPDChangeListener from this object.
 void updateDatabase()
          Updates the MPD database by searching the mp3 directory for new music and removing the old music.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addMPDChangeListener

public void addMPDChangeListener(MPDChangeListener mcl)
Adds a MPDChangeListener to this object to receive MPDChangeEvents.

Parameters:
mcl - the MPDChangeListener to add

removePlayerChangedListener

public void removePlayerChangedListener(MPDChangeListener mcl)
Removes a MPDChangeListener from this object.

Parameters:
mcl - the MPDChangeListener to remove

fireMPDChangeEvent

protected void fireMPDChangeEvent(int id)
Sends the appropriate MPDChangeEvent to all registered MPDChangeListeners.

Parameters:
id - the event id to send

killMPD

public void killMPD()
             throws MPDConnectionException,
                    MPDAdminException
Kills the mpd connection.

Throws:
MPDConnectionException - if there is a problem sending the command
MPDAdminException - if the MPD response contains an error

updateDatabase

public void updateDatabase()
                    throws MPDConnectionException,
                           MPDAdminException
Updates the MPD database by searching the mp3 directory for new music and removing the old music.

Throws:
MPDConnectionException - if there is a problem sending the command
MPDAdminException - if the MPD response contains an error

getDaemonUpTime

public int getDaemonUpTime()
                    throws MPDConnectionException,
                           MPDAdminException
Returns the daemon uptime in seconds.

Returns:
the daemon uptime in seconds
Throws:
MPDAdminException - if the MPD response contains an error
MPDConnectionException - if there is a problem sending the command