net.sf.dict4j.command
Class AbstractCommand

java.lang.Object
  extended by net.sf.dict4j.command.AbstractCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
AbstractDataCommand, AuthCommand, ClientCommand, OptionCommand, QuitCommand, ShowDatabaseInfoCommand, StatusCommand

public abstract class AbstractCommand
extends java.lang.Object
implements Command


Field Summary
protected  int responseCode
           
protected  java.lang.String responseStatus
           
 
Constructor Summary
AbstractCommand()
           
 
Method Summary
protected  void checkResponseCodeForServerException(ResponseEnum responseEnum)
           
 int getResponseCode()
           
protected  ResponseEnum getResponseEnum(int code, ResponseEnum[] enums)
           
protected abstract  ResponseEnum[] getResponseHeaderCodes()
           
protected  ResponseEnum getResponseHeaderEnum(int code)
           
 java.lang.String getResponseStatus()
           
protected abstract  java.lang.String getString()
           
protected  void parseResponse(java.lang.String response)
           
protected  void parseResponseHeader(java.lang.String header)
           
protected  void receiveHeader(DictTransport transport)
           
 void send(DictTransport transport)
           
protected static java.lang.String stripQuotes(java.lang.String value)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

responseCode

protected int responseCode

responseStatus

protected java.lang.String responseStatus
Constructor Detail

AbstractCommand

public AbstractCommand()
Method Detail

send

public void send(DictTransport transport)
Specified by:
send in interface Command

receiveHeader

protected void receiveHeader(DictTransport transport)

checkResponseCodeForServerException

protected void checkResponseCodeForServerException(ResponseEnum responseEnum)
                                            throws DictServerException
Throws:
DictServerException

getResponseEnum

protected ResponseEnum getResponseEnum(int code,
                                       ResponseEnum[] enums)

getResponseHeaderEnum

protected ResponseEnum getResponseHeaderEnum(int code)

parseResponseHeader

protected void parseResponseHeader(java.lang.String header)

parseResponse

protected void parseResponse(java.lang.String response)

stripQuotes

protected static java.lang.String stripQuotes(java.lang.String value)

getResponseHeaderCodes

protected abstract ResponseEnum[] getResponseHeaderCodes()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getString

protected abstract java.lang.String getString()

getResponseCode

public int getResponseCode()
Specified by:
getResponseCode in interface Command

getResponseStatus

public java.lang.String getResponseStatus()
Specified by:
getResponseStatus in interface Command