de.anneck.jcast.listeners
Class XMMS_ListenerThread

java.lang.Object
  |
  +--de.anneck.jcast.core.AbstractThread
        |
        +--de.anneck.jcast.listeners.AbstractListenerThread
              |
              +--de.anneck.jcast.listeners.XMMS_ListenerThread
All Implemented Interfaces:
java.lang.Cloneable, org.apache.avalon.framework.configuration.Configurable, IListener, IListenerThread, ISignal, IStartable, ITCP_Listener, ITCP_XMMS_Listener, IThread, java.lang.Runnable

public class XMMS_ListenerThread
extends AbstractListenerThread
implements ITCP_XMMS_Listener

The XMMS_ListenerThread sends all receiving data over the network to an XMMS client. This special listener will enables for example UDP TitleStreaming. If there are other special "features" of XMMS, this is the place to implement them.

Version:
$Revision: 1.12 $
Author:

Fields inherited from class de.anneck.jcast.listeners.AbstractListenerThread
m_byte, m_cache, m_channel, m_controller, m_Identifying_Name, m_source, m_stats
 
Fields inherited from class de.anneck.jcast.core.AbstractThread
m_class, m_log, m_mutex, m_name, m_prio, m_state
 
Fields inherited from interface de.anneck.jcast.listeners.ITCP_XMMS_Listener
MESSAGE, TITLE
 
Fields inherited from interface de.anneck.jcast.core.IThread
RUNNING, STOPPED, WAITING
 
Fields inherited from interface de.anneck.jcast.core.ISignal
BUSY, CHANNEL_IS_BUSY, CHANNEL_IS_READY, CLIENT_DISCONNECTED, HELO, READY, SOURCE_GONE
 
Constructor Summary
XMMS_ListenerThread()
          Creates new SimpleListenerThread
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures the Listenerthread with the configuration object.
 void doWork()
          Executes whatever this thread is supposed to do
 java.net.Socket getOutSocket()
          Returns the socket the client is connected to.
 void sendMessage(java.lang.String header, java.lang.String message)
          Sends a header to the client using UDP.
 void setOutSocket(java.net.Socket outSocket)
          Sets the client socket for this listener.
 void setPlayingFileLocation(java.lang.String filelocation)
          XMMS can send UDP title streams, if source is not able to provide ID3 tags to read from, XMMS can try to get Artist/Album/Title information from the file-location.
 void setUDPPort(int udpPort)
          Set the UDP Port.
 
Methods inherited from class de.anneck.jcast.listeners.AbstractListenerThread
clone, equals, getChannel, getIdentifyingName, getSource, hashCode, receive, receiveSignal, setChannel, setIdentifyingName, setSource, signal, subscribeChannel, subscribeSource, toString
 
Methods inherited from class de.anneck.jcast.core.AbstractThread
checkState, doKill, doRestart, doStart, doStop, getAllThreads, getThreadClass, getThreadName, getThreadPriority, isRunning, isStopped, isWaiting, run, setState, setThreadPriority
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.anneck.jcast.core.IThread
checkState, doKill, doRestart, doStart, doStop, getThreadClass, getThreadName, getThreadPriority, isRunning, isStopped, isWaiting, setState, setThreadPriority
 
Methods inherited from interface java.lang.Runnable
run
 

Constructor Detail

XMMS_ListenerThread

public XMMS_ListenerThread()
Creates new SimpleListenerThread
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Configures the Listenerthread with the configuration object.
Overrides:
configure in class AbstractListenerThread
Parameters:
configuration - A valid configuration object.
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - Error during configuration.

doWork

public void doWork()
            throws java.lang.Exception
Executes whatever this thread is supposed to do
Throws:
java.lang.Exception - Error during work.

setOutSocket

public void setOutSocket(java.net.Socket outSocket)
Sets the client socket for this listener. This method will also generate all needed information for this listener, available from the socket. (InetAddress, etc)
Specified by:
setOutSocket in interface ITCP_Listener
Parameters:
outSocket - The client socket.

getOutSocket

public java.net.Socket getOutSocket()
Returns the socket the client is connected to. return The socket of the listener
Specified by:
getOutSocket in interface ITCP_Listener

setUDPPort

public void setUDPPort(int udpPort)
Set the UDP Port.
Specified by:
setUDPPort in interface ITCP_XMMS_Listener
Parameters:
udpPort - The udp port.

sendMessage

public void sendMessage(java.lang.String header,
                        java.lang.String message)
Sends a header to the client using UDP. Example:
 ...
 sendMessage("x-audiocast-streamtitle","Blind Guardian - Valhalla");
 ...
 
Specified by:
sendMessage in interface ITCP_XMMS_Listener
Parameters:
message - The header to send.

setPlayingFileLocation

public void setPlayingFileLocation(java.lang.String filelocation)
XMMS can send UDP title streams, if source is not able to provide ID3 tags to read from, XMMS can try to get Artist/Album/Title information from the file-location.
Specified by:
setPlayingFileLocation in interface ITCP_XMMS_Listener
Parameters:
filelocation - The location of the file, full path to it.