Public Member Functions | |
Connection (Socket socket, Map openSessions, boolean verboseOutput) | |
void | run () |
Protected Member Functions | |
boolean | associateWithSession (String sessionName) |
ArrayList | createSubDBRuleStrings (String subDBName, ArrayList rules) |
boolean | processCLOSE (ArrayList header, ArrayList body) |
boolean | processGET (ArrayList header, ArrayList body) throws IOException |
boolean | processGET_CONSISTENCIES (ArrayList header, ArrayList body) throws IOException |
boolean | processGET_CONSISTENCY (ArrayList header) throws IOException |
boolean | processGET_DBCONTENT (ArrayList header) throws IOException |
boolean | processGET_DBSTATS (ArrayList header) throws IOException |
boolean | processGET_DIAGENV (ArrayList header) throws IOException |
boolean | processGET_FDGSTATS (ArrayList header) throws IOException |
boolean | processGET_MINDIAG (ArrayList header) throws IOException |
boolean | processPOST (ArrayList header, ArrayList body) throws IOException |
boolean | processPOST_FDG (ArrayList header, ArrayList body, boolean replace, String[] firstLine) throws IOException |
boolean | processPOST_SENTENCES (ArrayList header, ArrayList body, boolean replace, String[] firstLine) throws IOException |
boolean | processRequest (ArrayList header, ArrayList body) throws IOException |
void | removeFromSession () |
void | sendBadRequestResponse () |
void | sendBadRequestResponse (String detailedMsg) |
void | sendParseErrorResponse (int lineNo) |
void | sendResponse (int errorCode, String msg, ArrayList header, ArrayList body) throws IOException |
boolean | validSubDBName (String subDBName) |
void | writeLineBreak (OutputStream stream) throws IOException |
Protected Attributes | |
Map | openSessions |
DataOutputStream | outputStream |
Session | session |
Socket | socket |
int | state |
boolean | verboseOutput |
Static Protected Attributes | |
static final String | MSG_ILLEGAL_ASS = "Illegal assumption" |
static final String | MSG_ILLEGAL_HEADER = "Illegal request header" |
static final String | MSG_ILLEGAL_RULE = "Syntax of logical sentence incorrect" |
static final String | MSG_INTERNAL_SERVER_ERROR = "Internal server error" |
static final String | MSG_OK = "OK" |
static final long | SLEEP_MS = 20 |
static final int | STATE_CLOSED = 2 |
static final int | STATE_DB_CHANGED = 1 |
static final int | STATE_WAIT_FIRST_POST = 0 |
Manages a connection to the ATP server and handles client requests.
This class is responsible for maintaining a connection to a client. Client requests are processed, the necessary calls to the theorem prover are made, and when the connection is closed, the socket is released.
This class encapsulates the communication protocol.
Definition at line 47 of file Connection.java.
ATPInterface.Connection.Connection | ( | Socket | socket, |
Map | openSessions, | ||
boolean | verboseOutput | ||
) | [inline] |
Constructor creating a connection for the passed socket.
Parameter openSessions: see Server.openSessions
Definition at line 88 of file Connection.java.
boolean ATPInterface.Connection.associateWithSession | ( | String | sessionName | ) | [inline, protected] |
Definition at line 498 of file Connection.java.
ArrayList ATPInterface.Connection.createSubDBRuleStrings | ( | String | subDBName, |
ArrayList | rules | ||
) | [inline, protected] |
Definition at line 753 of file Connection.java.
boolean ATPInterface.Connection.processCLOSE | ( | ArrayList | header, |
ArrayList | body | ||
) | [inline, protected] |
Definition at line 1106 of file Connection.java.
boolean ATPInterface.Connection.processGET | ( | ArrayList | header, |
ArrayList | body | ||
) | throws IOException [inline, protected] |
Definition at line 521 of file Connection.java.
boolean ATPInterface.Connection.processGET_CONSISTENCIES | ( | ArrayList | header, |
ArrayList | body | ||
) | throws IOException [inline, protected] |
Definition at line 767 of file Connection.java.
boolean ATPInterface.Connection.processGET_CONSISTENCY | ( | ArrayList | header | ) | throws IOException [inline, protected] |
Definition at line 841 of file Connection.java.
boolean ATPInterface.Connection.processGET_DBCONTENT | ( | ArrayList | header | ) | throws IOException [inline, protected] |
Definition at line 674 of file Connection.java.
boolean ATPInterface.Connection.processGET_DBSTATS | ( | ArrayList | header | ) | throws IOException [inline, protected] |
Definition at line 603 of file Connection.java.
boolean ATPInterface.Connection.processGET_DIAGENV | ( | ArrayList | header | ) | throws IOException [inline, protected] |
Definition at line 901 of file Connection.java.
boolean ATPInterface.Connection.processGET_FDGSTATS | ( | ArrayList | header | ) | throws IOException [inline, protected] |
Definition at line 577 of file Connection.java.
boolean ATPInterface.Connection.processGET_MINDIAG | ( | ArrayList | header | ) | throws IOException [inline, protected] |
Definition at line 1009 of file Connection.java.
boolean ATPInterface.Connection.processPOST | ( | ArrayList | header, |
ArrayList | body | ||
) | throws IOException [inline, protected] |
Definition at line 292 of file Connection.java.
boolean ATPInterface.Connection.processPOST_FDG | ( | ArrayList | header, |
ArrayList | body, | ||
boolean | replace, | ||
String[] | firstLine | ||
) | throws IOException [inline, protected] |
Definition at line 367 of file Connection.java.
boolean ATPInterface.Connection.processPOST_SENTENCES | ( | ArrayList | header, |
ArrayList | body, | ||
boolean | replace, | ||
String[] | firstLine | ||
) | throws IOException [inline, protected] |
Definition at line 424 of file Connection.java.
boolean ATPInterface.Connection.processRequest | ( | ArrayList | header, |
ArrayList | body | ||
) | throws IOException [inline, protected] |
Processes an incoming request consisting of a header and a body.
The header and the body are passed as string collections. This method considers only the first line of the header, then calls the appropriate methods, for example processPOST() for POST requests.
The return value denote if the request was successful (correct). The processXY() methods are responsible for creating and sending the response to the request.
Definition at line 259 of file Connection.java.
void ATPInterface.Connection.removeFromSession | ( | ) | [inline, protected] |
Definition at line 228 of file Connection.java.
void ATPInterface.Connection.run | ( | ) | [inline] |
The run-method of the thread which handles incoming requests on this connection.
This method has a loop which runs until a CLOSE request is received. The header and the body of each incoming request is read (but not processed!). For different kinds of request, different methods are called.
Finally, the socket is closed, and this connection is removed from the session it is associated with. If there are no other connections related to this session, then the session is closed (forever).
Definition at line 110 of file Connection.java.
void ATPInterface.Connection.sendBadRequestResponse | ( | ) | [inline, protected] |
Definition at line 1120 of file Connection.java.
void ATPInterface.Connection.sendBadRequestResponse | ( | String | detailedMsg | ) | [inline, protected] |
Definition at line 1128 of file Connection.java.
void ATPInterface.Connection.sendParseErrorResponse | ( | int | lineNo | ) | [inline, protected] |
Definition at line 1138 of file Connection.java.
void ATPInterface.Connection.sendResponse | ( | int | errorCode, |
String | msg, | ||
ArrayList | header, | ||
ArrayList | body | ||
) | throws IOException [inline, protected] |
Definition at line 1149 of file Connection.java.
boolean ATPInterface.Connection.validSubDBName | ( | String | subDBName | ) | [inline, protected] |
Definition at line 572 of file Connection.java.
void ATPInterface.Connection.writeLineBreak | ( | OutputStream | stream | ) | throws IOException [inline, protected] |
Definition at line 1115 of file Connection.java.
final String ATPInterface.Connection.MSG_ILLEGAL_ASS = "Illegal assumption" [static, protected] |
Definition at line 60 of file Connection.java.
final String ATPInterface.Connection.MSG_ILLEGAL_HEADER = "Illegal request header" [static, protected] |
Definition at line 58 of file Connection.java.
final String ATPInterface.Connection.MSG_ILLEGAL_RULE = "Syntax of logical sentence incorrect" [static, protected] |
Definition at line 59 of file Connection.java.
final String ATPInterface.Connection.MSG_INTERNAL_SERVER_ERROR = "Internal server error" [static, protected] |
Definition at line 62 of file Connection.java.
final String ATPInterface.Connection.MSG_OK = "OK" [static, protected] |
Definition at line 61 of file Connection.java.
Map ATPInterface.Connection.openSessions [protected] |
Definition at line 71 of file Connection.java.
DataOutputStream ATPInterface.Connection.outputStream [protected] |
Definition at line 68 of file Connection.java.
Session ATPInterface.Connection.session [protected] |
Definition at line 74 of file Connection.java.
final long ATPInterface.Connection.SLEEP_MS = 20 [static, protected] |
Definition at line 55 of file Connection.java.
Socket ATPInterface.Connection.socket [protected] |
Definition at line 65 of file Connection.java.
int ATPInterface.Connection.state [protected] |
Definition at line 77 of file Connection.java.
final int ATPInterface.Connection.STATE_CLOSED = 2 [static, protected] |
Definition at line 52 of file Connection.java.
final int ATPInterface.Connection.STATE_DB_CHANGED = 1 [static, protected] |
Definition at line 51 of file Connection.java.
final int ATPInterface.Connection.STATE_WAIT_FIRST_POST = 0 [static, protected] |
Definition at line 50 of file Connection.java.
boolean ATPInterface.Connection.verboseOutput [protected] |
Definition at line 80 of file Connection.java.