org.tranche.server
Class ServerItem

java.lang.Object
  extended by org.tranche.server.ServerItem
Direct Known Subclasses:
DeleteDataItem, DeleteMetaDataItem, GetActivityLogEntriesCountItem, GetActivityLogEntriesItem, GetConfigurationItem, GetConfigurationNoSigItem, GetDataHashesItem, GetDataItem, GetMetaDataHashesItem, GetMetaDataItem, GetNetworkStatusItem, GetProjectHashesItem, HasDataItem, HasMetaDataItem, NonceItem, PingItem, RegisterServerItem, RejectedRequestItem, SetConfigurationItem, SetDataItem, SetMetaDataItem, ShutdownItem

public abstract class ServerItem
extends java.lang.Object

Abstraction of an action the server can handle.

Author:
Jayson Falkner - jfalkner@umich.edu

Field Summary
protected  java.lang.String commandName
          The name of the command.
protected  Server server
          Keeps a reference to the Server object to which this item belongs.
 
Constructor Summary
ServerItem(java.lang.String commandName, Server server)
           
 
Method Summary
abstract  void doAction(java.io.InputStream in, java.io.OutputStream out, java.lang.String clientIP)
          Handle the server's action.
 java.lang.String getName()
          Returns the name of the command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commandName

protected java.lang.String commandName

The name of the command.


server

protected Server server

Keeps a reference to the Server object to which this item belongs.

Constructor Detail

ServerItem

public ServerItem(java.lang.String commandName,
                  Server server)
Parameters:
commandName - the command name received
server - the server received
Method Detail

getName

public java.lang.String getName()

Returns the name of the command.

Returns:
the command name

doAction

public abstract void doAction(java.io.InputStream in,
                              java.io.OutputStream out,
                              java.lang.String clientIP)
                       throws java.lang.Exception

Handle the server's action.

Parameters:
in - The input stream
out - The output stream
clientIP - So the transaction can be logged with client IP address.
Throws:
java.lang.Exception


This code is free for use both commercially and non-commercially as stated in the project's license