gov.nasa.gsfc.drl.rtstps.server
Class AbstractServer

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by gov.nasa.gsfc.drl.rtstps.server.AbstractServer
All Implemented Interfaces:
RtStpsServices, java.io.Serializable, java.lang.Runnable, java.rmi.Remote
Direct Known Subclasses:
TcpServer, UdpServer

public abstract class AbstractServer
extends java.rmi.server.UnicastRemoteObject
implements RtStpsServices, java.lang.Runnable

This is an abstract RT-STPS server. It supports only one pipeline thread.

See Also:
Serialized Form

Field Summary
private  Builder builder
           
protected  FrameSynchronizer fs
           
private  Logger logger
           
protected  java.lang.Thread runner
           
protected  boolean running
           
private static long serialVersionUID
           
protected  ServerState state
           
protected  StatusBlock[] statusBlocks
           
private  java.lang.String xmlDirectory
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
protected AbstractServer()
          Create an RT-STPS server.
 
Method Summary
private  void build(java.io.Reader r)
          Build a pipeline from a configuration.
 java.lang.String getConfigurationName()
          Get the name of the currently loaded configuration.
 StatusBlock[] getStatus()
          Get the current status from the last-used pipeline.
 java.lang.String[] getStatusToString()
          Get the current status pre-bundled as a String[]
 boolean isEnabled()
          Is the server loaded and enabled?
 void load(char[] configuration)
          Load a configuration.
 void load(java.lang.String configuration)
          Load a configuration.
 void loadFile(java.lang.String filename)
          Load a configuration from a file that is local to the server.
 void log(java.lang.String message)
          Log a message.
abstract  void run()
          This thread method gets data from the input socket and sends it down the pipeline if it exists.
 void setEnabled(boolean enable)
          Enable or disable data processing.
 void stopServer()
          Stop the RT-STPS server.
 void unload()
          Unload a configuration.
 void zeroStatus()
          Set all clearable status counters to zero.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, 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
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

fs

protected FrameSynchronizer fs

running

protected boolean running

runner

protected java.lang.Thread runner

statusBlocks

protected StatusBlock[] statusBlocks

state

protected ServerState state

builder

private Builder builder

logger

private Logger logger

xmlDirectory

private java.lang.String xmlDirectory
Constructor Detail

AbstractServer

protected AbstractServer()
                  throws java.rmi.RemoteException
Create an RT-STPS server. This class contains core server functions. Note that it now processes the optional site.properties file in setting up the logger.

Throws:
java.rmi.RemoteException
Method Detail

log

public final void log(java.lang.String message)
Log a message.


getConfigurationName

public java.lang.String getConfigurationName()
                                      throws java.rmi.RemoteException
Get the name of the currently loaded configuration.

Specified by:
getConfigurationName in interface RtStpsServices
Returns:
null if none is loaded.
Throws:
java.rmi.RemoteException

isEnabled

public boolean isEnabled()
                  throws java.rmi.RemoteException
Is the server loaded and enabled?

Specified by:
isEnabled in interface RtStpsServices
Throws:
java.rmi.RemoteException

setEnabled

public void setEnabled(boolean enable)
                throws java.rmi.RemoteException
Enable or disable data processing.

Specified by:
setEnabled in interface RtStpsServices
Throws:
java.rmi.RemoteException

unload

public void unload()
            throws java.rmi.RemoteException
Unload a configuration.

Specified by:
unload in interface RtStpsServices
Throws:
java.rmi.RemoteException

load

public void load(java.lang.String configuration)
          throws java.rmi.RemoteException
Load a configuration.

Specified by:
load in interface RtStpsServices
Throws:
java.rmi.RemoteException

load

public void load(char[] configuration)
          throws java.rmi.RemoteException
Load a configuration.

Specified by:
load in interface RtStpsServices
Throws:
java.rmi.RemoteException

loadFile

public void loadFile(java.lang.String filename)
              throws java.rmi.RemoteException
Load a configuration from a file that is local to the server.

Specified by:
loadFile in interface RtStpsServices
Throws:
java.rmi.RemoteException

build

private void build(java.io.Reader r)
            throws java.rmi.RemoteException
Build a pipeline from a configuration.

Throws:
java.rmi.RemoteException

stopServer

public void stopServer()
                throws java.rmi.RemoteException
Stop the RT-STPS server.

Specified by:
stopServer in interface RtStpsServices
Throws:
java.rmi.RemoteException

zeroStatus

public void zeroStatus()
                throws java.rmi.RemoteException
Set all clearable status counters to zero.

Specified by:
zeroStatus in interface RtStpsServices
Throws:
java.rmi.RemoteException

getStatus

public StatusBlock[] getStatus()
                        throws java.rmi.RemoteException
Get the current status from the last-used pipeline. Within a session, the number and identity of the status blocks and the number and identity of the contained status items will not change. Only the status item values may change. However, when a session changes and a new configuration is loaded, then all of these elements will change.

Specified by:
getStatus in interface RtStpsServices
Returns:
If no configuration has been loaded into the server, then this method returns null. Otherwise it returns the status of the last created pipeline, even post-session.
Throws:
java.rmi.RemoteException

getStatusToString

public java.lang.String[] getStatusToString()
                                     throws java.rmi.RemoteException
Get the current status pre-bundled as a String[]

Specified by:
getStatusToString in interface RtStpsServices
Throws:
java.rmi.RemoteException

run

public abstract void run()
This thread method gets data from the input socket and sends it down the pipeline if it exists. It discards the data if the pipeline is null.

Specified by:
run in interface java.lang.Runnable