org.jpop.net
Class PoplogDocProtocol

java.lang.Object
  extended byorg.jpop.net.PoplogDocProtocol
All Implemented Interfaces:
ProtocolInterface

public class PoplogDocProtocol
extends java.lang.Object
implements ProtocolInterface

Version:
1.0
Author:
dsm

Field Summary
static java.lang.String CLOSE_REQUEST
          The string that indicates the connection is finished
static java.lang.String ERROR_MESG
          Prepended to the response string to indicate the nature of the message.
static java.lang.String POP_SERVER
          The name of the pop11 server program
static java.lang.String PROCESS_NAME
          THe name of the process we will run to get documentation
static java.lang.String SERVER_MESG
          Prepended to the response string to indicate the nature of the message.
static java.lang.String TEXT_MESG
          Prepended to the response string to indicate the nature of the message.
static java.lang.String WARNING_MESG
          Prepended to the response string to indicate the nature of the message.
 
Constructor Summary
PoplogDocProtocol(ServerInfo serverInfo)
          Constructor for PoplogDocProtocol
 
Method Summary
 java.lang.String getCloseConnectionRequestString()
          Gets the close connection request string attribute of the PoplogDocProtocol class
 java.io.BufferedReader getDoc(java.lang.String docRequest)
          Gets the doc requested
 java.io.BufferedReader getList(java.lang.String listRequest)
          Gets the list requested
 java.io.BufferedReader getProcessErr()
          Gets the process err attribute of the PoplogDocProtocol object
static java.lang.String prepareErrorMessage(java.lang.Exception e)
          Makes an exception that can be sent through the net to a client in the proper format
 void println(java.lang.String s)
          Print a line to the IOControl's stdin
 java.lang.String processRequest(java.lang.String request)
          Processes a request from a client
 void processRespawned()
          To be overriden by a subclass.
 java.lang.String readStderrLine()
          Read a line from the IOControl's stderr
 java.lang.String readStdoutLine()
          Read a line from the IOControl's stdout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROCESS_NAME

public static final java.lang.String PROCESS_NAME
THe name of the process we will run to get documentation

See Also:
Constant Field Values

POP_SERVER

public static final java.lang.String POP_SERVER
The name of the pop11 server program

See Also:
Constant Field Values

CLOSE_REQUEST

public static final java.lang.String CLOSE_REQUEST
The string that indicates the connection is finished

See Also:
Constant Field Values

WARNING_MESG

public static final java.lang.String WARNING_MESG
Prepended to the response string to indicate the nature of the message. Forwarded from ProtocolPrefixes for ease of use.

See Also:
Constant Field Values

ERROR_MESG

public static final java.lang.String ERROR_MESG
Prepended to the response string to indicate the nature of the message. Forwarded from ProtocolPrefixes for ease of use.

See Also:
Constant Field Values

TEXT_MESG

public static final java.lang.String TEXT_MESG
Prepended to the response string to indicate the nature of the message. Forwarded from ProtocolPrefixes for ease of use.

See Also:
Constant Field Values

SERVER_MESG

public static final java.lang.String SERVER_MESG
Prepended to the response string to indicate the nature of the message. Forwarded from ProtocolPrefixes for ease of use.

See Also:
Constant Field Values
Constructor Detail

PoplogDocProtocol

public PoplogDocProtocol(ServerInfo serverInfo)
Constructor for PoplogDocProtocol

Parameters:
serverInfo - server info
Method Detail

prepareErrorMessage

public static java.lang.String prepareErrorMessage(java.lang.Exception e)
Makes an exception that can be sent through the net to a client in the proper format

Parameters:
e - The exception
Returns:
a string formatter for an error message to send back to the client

getProcessErr

public java.io.BufferedReader getProcessErr()
Gets the process err attribute of the PoplogDocProtocol object

Returns:
The processErr value

getCloseConnectionRequestString

public java.lang.String getCloseConnectionRequestString()
Gets the close connection request string attribute of the PoplogDocProtocol class

Specified by:
getCloseConnectionRequestString in interface ProtocolInterface
Returns:
The closeConnectionRequestString value

getList

public java.io.BufferedReader getList(java.lang.String listRequest)
                               throws ServerException
Gets the list requested

Parameters:
listRequest - the list args request from the client (LIST [args]) -> getList(args)
Returns:
The list
Throws:
ServerException

getDoc

public java.io.BufferedReader getDoc(java.lang.String docRequest)
                              throws ServerException
Gets the doc requested

Parameters:
docRequest - the doc args request from the client (OPEN [args]) -> getDoc(args)
Returns:
The doc
Throws:
ServerException

processRespawned

public void processRespawned()
To be overriden by a subclass. Use as event handler for the process being killed and restarted, like for getProcessErr()


processRequest

public java.lang.String processRequest(java.lang.String request)
Processes a request from a client

Specified by:
processRequest in interface ProtocolInterface
Parameters:
request - The request to process
Returns:
the result of the processing

readStdoutLine

public java.lang.String readStdoutLine()
Read a line from the IOControl's stdout

Returns:
A line read from stdout or null if the end of stream has been reached

readStderrLine

public java.lang.String readStderrLine()
Read a line from the IOControl's stderr

Returns:
A line read from stderr or null if the end of stream has been reached

println

public void println(java.lang.String s)
Print a line to the IOControl's stdin

Parameters:
s - The line to print