org.openmuc.mux.dataserver
Class DataSocketServer

java.lang.Object
  extended by java.lang.Thread
      extended by org.openmuc.mux.dataserver.DataSocketServer
All Implemented Interfaces:
java.lang.Runnable

public class DataSocketServer
extends java.lang.Thread

Simple ASCII based socket server for access to measured data. The protocol is kept simple so it can be used my humans via telnet. The IP and port the server will listen can be configured by the OSGi/Java properties "org.openmuc.mux.dataserver.ip" and "org.openmuc.mux.dataserver.port". The default port is 9200. If no IP address is configuered the server will listen to all IPs of the system.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static int STATE_ERROR
           
static int STATE_LISTEN
           
static int STATE_UNBOUND
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DataSocketServer(DataManagerServiceTracker store, java.util.Properties props)
          Create new Server and connect to a DataManagerServiceTracker
 
Method Summary
protected  void connectionClosed(Connection con)
          Callback method to be called by Connection objects if the connection is closed by timeout or on clients request.
 int getServerState()
          Get the state of the server.
 void run()
          The main server thread.
protected  void stopServer()
          Stop the server.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATE_UNBOUND

public static int STATE_UNBOUND

STATE_LISTEN

public static int STATE_LISTEN

STATE_ERROR

public static int STATE_ERROR
Constructor Detail

DataSocketServer

public DataSocketServer(DataManagerServiceTracker store,
                        java.util.Properties props)
Create new Server and connect to a DataManagerServiceTracker

Parameters:
store -
Method Detail

getServerState

public int getServerState()
Get the state of the server.

Returns:
state one of STATE_UNBOUND, STATE_LISTEN or STATE_ERROR

run

public void run()
The main server thread.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

connectionClosed

protected void connectionClosed(Connection con)
Callback method to be called by Connection objects if the connection is closed by timeout or on clients request.

Parameters:
con - The calling Connection object

stopServer

protected void stopServer()
Stop the server. Close all client sockets. Called by bundle activator.