jaugment2.mediaplayer
Class MediaPlayerService

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--jaugment2.jini.simpleService.simpleService
                          |
                          +--jaugment2.mediaplayer.MediaPlayerService

public class MediaPlayerService
extends simpleService
implements java.rmi.Remote, LookupEventListener

See Also:
Serialized Form

Inner Class Summary
static interface MediaPlayerService.endOfSongListener
           
private  class MediaPlayerService.listener
           
static interface MediaPlayerService.PlayerIF
           
static interface MediaPlayerService.States
           
 
Inner classes inherited from class jaugment2.jini.simpleService.simpleService
simpleService.myServiceIDListener
 
Field Summary
private static boolean debugMessages
           
private  SimpleLandlord landLord
           
private  java.util.LinkedList[] listenerRegistrations
           
private  MediaDB mediaDB
           
protected  MediaPlayerService.PlayerIF player
           
protected  java.util.LinkedList players
           
protected  java.util.LinkedList playlist
           
protected  int playlistpos
           
protected  SemiNatRepresentation seminat
           
private  SimpleLandlord.LeaseListener simpleLeaselistener
          Helper-class for our Landlord.
protected  int state
           
protected  java.util.Hashtable usermacros
          A hashtable storing macros expanding to media/playlist-URLs the user defined.
 
Fields inherited from class jaugment2.jini.simpleService.simpleService
bindings, fallback_attrSets, jmngr, ldm, lrm, persistentState, proxy, sid, simpleservicedebugMessages
 
Fields inherited from class java.rmi.server.UnicastRemoteObject
csf, port, portFactoryParamTypes, portParamTypes, serialVersionUID, ssf
 
Fields inherited from class java.rmi.server.RemoteServer
log, logname, serialVersionUID
 
Fields inherited from class java.rmi.server.RemoteObject
ref, serialVersionUID
 
Constructor Summary
MediaPlayerService()
           
MediaPlayerService(net.jini.core.discovery.LookupLocator firstLocator)
           
 
Method Summary
 net.jini.core.lease.Lease addListener(net.jini.core.event.RemoteEventListener listener, java.rmi.MarshalledObject handback, int registerfor)
          Subscribe for events
 void addMedia(java.net.URL u)
          Add a URL to the media-db
 void addToPlaylist(java.net.URL data, int pos)
          Add the given URL to the playlist at the given position
 void destroy()
          stop this service, destroy any persistent storage and exit
protected  void finalize()
           
private  void fireEvent(int type, java.lang.Object obj)
           
 void freePlaylist()
          remove all ele,ments from the playlist
 java.net.URL[] getPlaylist()
          return a copy of the playlist
 int getPlaylistPos()
          return the current position in the playlist
private  void loadMe()
           
 void pause()
          hole/resume playback
 void play(int pos)
          Play the given Element from the playlist
 void removeFromPlaylist(int pos)
          Remove the given Element from the playlist
 void restart()
          restart this service once it has been stopped
 void ServiceChangedEvent(LookupEventEvent evt)
           
 void ServiceFoundEvent(LookupEventEvent evt)
           
 void ServiceGoneEvent(LookupEventEvent evt)
           
 java.net.URL[] simpleMediaSearch(java.lang.String what)
          search the media-db with a search-string
 void stop()
          Play the given Element from the playlist
 void stop(boolean exit)
          stop this service.
 
Methods inherited from class jaugment2.jini.simpleService.simpleService
, deinit, deinitBindings, getProxy, getServiceItem, getStorageLocation, init, initBindings, initBindings, load, save, setStorageLocation
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, readObject, reexport, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub, writeObject
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

state

protected int state

debugMessages

private static final boolean debugMessages

seminat

protected SemiNatRepresentation seminat

player

protected MediaPlayerService.PlayerIF player

players

protected java.util.LinkedList players

playlist

protected java.util.LinkedList playlist

playlistpos

protected int playlistpos

usermacros

protected java.util.Hashtable usermacros
A hashtable storing macros expanding to media/playlist-URLs the user defined. vtjTextField1.getText()jTextField1.getText()jTextField1.getText()jTextField1.getText()

listenerRegistrations

private java.util.LinkedList[] listenerRegistrations

simpleLeaselistener

private SimpleLandlord.LeaseListener simpleLeaselistener
Helper-class for our Landlord.

landLord

private SimpleLandlord landLord

mediaDB

private MediaDB mediaDB
Constructor Detail

MediaPlayerService

public MediaPlayerService()
                   throws java.rmi.RemoteException

MediaPlayerService

public MediaPlayerService(net.jini.core.discovery.LookupLocator firstLocator)
                   throws java.rmi.RemoteException
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class simpleService

getPlaylistPos

public int getPlaylistPos()
                   throws java.rmi.RemoteException
return the current position in the playlist

getPlaylist

public java.net.URL[] getPlaylist()
                           throws java.rmi.RemoteException
return a copy of the playlist

freePlaylist

public void freePlaylist()
                  throws java.rmi.RemoteException
remove all ele,ments from the playlist

restart

public void restart()
             throws java.lang.Exception
restart this service once it has been stopped
Overrides:
restart in class simpleService
See Also:
stop

stop

public void stop(boolean exit)
          throws java.lang.Exception
stop this service. If exit is false all references to this service are still valid but it has deregistered everywhere. (this includes the RMI-activation-daemon)
Overrides:
stop in class simpleService
Parameters:
exit - stop running
See Also:
restart, destroy

destroy

public void destroy()
             throws java.rmi.RemoteException
stop this service, destroy any persistent storage and exit
Overrides:
destroy in class simpleService

loadMe

private void loadMe()

addToPlaylist

public void addToPlaylist(java.net.URL data,
                          int pos)
                   throws java.rmi.RemoteException,
                          java.lang.IllegalArgumentException,
                          java.lang.IllegalStateException
Add the given URL to the playlist at the given position

removeFromPlaylist

public void removeFromPlaylist(int pos)
                        throws java.rmi.RemoteException,
                               java.lang.IllegalArgumentException,
                               java.lang.IllegalStateException
Remove the given Element from the playlist

play

public void play(int pos)
          throws java.rmi.RemoteException,
                 java.lang.IllegalArgumentException,
                 java.lang.IllegalStateException
Play the given Element from the playlist

stop

public void stop()
          throws java.rmi.RemoteException,
                 java.lang.IllegalArgumentException,
                 java.lang.IllegalStateException
Play the given Element from the playlist

pause

public void pause()
           throws java.rmi.RemoteException,
                  java.lang.IllegalArgumentException,
                  java.lang.IllegalStateException
hole/resume playback

fireEvent

private void fireEvent(int type,
                       java.lang.Object obj)

addListener

public net.jini.core.lease.Lease addListener(net.jini.core.event.RemoteEventListener listener,
                                             java.rmi.MarshalledObject handback,
                                             int registerfor)
                                      throws java.rmi.RemoteException,
                                             net.jini.core.lease.LeaseDeniedException,
                                             java.lang.IllegalStateException
Subscribe for events

ServiceFoundEvent

public void ServiceFoundEvent(LookupEventEvent evt)
Specified by:
ServiceFoundEvent in interface LookupEventListener

ServiceGoneEvent

public void ServiceGoneEvent(LookupEventEvent evt)
Specified by:
ServiceGoneEvent in interface LookupEventListener

ServiceChangedEvent

public void ServiceChangedEvent(LookupEventEvent evt)
Specified by:
ServiceChangedEvent in interface LookupEventListener

addMedia

public void addMedia(java.net.URL u)
Add a URL to the media-db

simpleMediaSearch

public java.net.URL[] simpleMediaSearch(java.lang.String what)
search the media-db with a search-string