Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mitre.cvw
Class CVWServerComm  view CVWServerComm download CVWServerComm.java

java.lang.Object
  extended byorg.mitre.cvw.CVWServerComm

public class CVWServerComm
extends java.lang.Object

This class processes all communication from and to the CVW server.

Version:
1.0

Field Summary
(package private)  CVWCoordinator applet
           
(package private)  boolean connValid
           
(package private)  java.net.Socket cvwSock
           
(package private)  java.lang.String host
           
(package private)  boolean idleState
           
private static CVWServerComm instance
           
(package private)  int iport
           
(package private)  NetThread netThread
           
(package private)  java.lang.String serverName
           
 
Constructor Summary
(package private) CVWServerComm(java.lang.String hst, java.lang.String port)
          Constructor
 
Method Summary
 void closeConnection()
          Closes the connection to the CVW server.
 boolean connectionValid()
          Returns whether the connection to the CVW server is valid.
 void displayError(java.lang.String errorString, java.lang.String title)
          Displays an error in a dialog box.
static java.lang.String escapeText(int end, java.lang.String str, char c)
          Processes text to be sent to the CVW server so that given a character, all occurences of it will be escaped.
static CVWServerComm getInstance()
           
 java.lang.String getServerHost()
          Returns the host name of the CVW server.
 java.lang.String getServerName()
          Returns the name of the CVW server.
 int getServerPort()
          Returns the port of the CVW server.
 java.net.Socket getSocket()
          Returns the current socket to the CVW server.
 void openConnection()
          Opens the connection to the CVW server.
static java.lang.String parseBarDelimitedStringFromServer(java.lang.String barDelim)
          Parses through a bar delimited string from the CVW server, checking for beginning and ending bars and adds space between consecutive bars.
 MCPCommand parseMCP(java.lang.String mcpLine)
          Creates a MCP command based on a line of commuication from the CVW server.
static java.lang.String prepTextForServer(java.lang.String oldText)
          Prepares the text being sent to the CVW serverby searching for special characters and escaping them and then wrapping the entire text in double quotes.
 void processMCP(java.lang.String theLine)
          Processes the communication line which represents MCP from the CVW server converting it to a MCP command and then acting upon the MCP.
 void receiveLine(java.lang.String theLine)
          Receives communication from the CVW server one line at a time.
 java.lang.String removeEscapeChars(int end, java.lang.String str)
          Removes the escape characters that the CVW server addes to the values in the key: value pairs of the MCP command.
 java.lang.String removeQuotesFromServer(int end, java.lang.String str)
          Removes double quotes (") that the CVW server addes whenever a value in the key:value pair needs it.
static java.lang.String replaceCRsForServer(int end, java.lang.String str)
          Changed >>!<< with "\n&quoyt;
 void sendCmdToServer(java.lang.String cmd)
          Sends a command to the CVW server if the connection is valid.
 void sendIdle(java.lang.String text)
          Sends the idle command to the CVW server and sets the idle state
static void sendMCPCmdToServer(java.lang.String cmd)
          Sends a MCP command to CVW server with no parameters.
static void sendMCPCmdToServer(java.lang.String cmd, java.lang.String rest)
          Sends a MCP command to CVW server with provided parameters, inserting the auth code.
static void sendRawCmdToServer(java.lang.String cmd)
          Sends a non-mcp command to the CVW server.
 void startThread()
          Starts the communication thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cvwSock

java.net.Socket cvwSock

netThread

NetThread netThread

applet

CVWCoordinator applet

connValid

boolean connValid

iport

int iport

host

java.lang.String host

idleState

boolean idleState

serverName

java.lang.String serverName

instance

private static CVWServerComm instance
Constructor Detail

CVWServerComm

CVWServerComm(java.lang.String hst,
              java.lang.String port)
Constructor

Method Detail

escapeText

public static java.lang.String escapeText(int end,
                                          java.lang.String str,
                                          char c)
Processes text to be sent to the CVW server so that given a character, all occurences of it will be escaped.


replaceCRsForServer

public static java.lang.String replaceCRsForServer(int end,
                                                   java.lang.String str)
Changed >>!<< with "\n&quoyt;


prepTextForServer

public static java.lang.String prepTextForServer(java.lang.String oldText)
Prepares the text being sent to the CVW serverby searching for special characters and escaping them and then wrapping the entire text in double quotes. Currently, the characters needing to be escaped are: \n, \r, \, ", :


parseBarDelimitedStringFromServer

public static java.lang.String parseBarDelimitedStringFromServer(java.lang.String barDelim)
Parses through a bar delimited string from the CVW server, checking for beginning and ending bars and adds space between consecutive bars. known .. if the first user has a blank fullname, it gets stripped from the mcp processor, and the string starts w/a |. known .. if the last user has a blank fullname, it gets stripped from the mcp processor, and the string ends w/a |.


getInstance

public static CVWServerComm getInstance()

sendMCPCmdToServer

public static void sendMCPCmdToServer(java.lang.String cmd)
Sends a MCP command to CVW server with no parameters.


sendMCPCmdToServer

public static void sendMCPCmdToServer(java.lang.String cmd,
                                      java.lang.String rest)
Sends a MCP command to CVW server with provided parameters, inserting the auth code.


sendRawCmdToServer

public static void sendRawCmdToServer(java.lang.String cmd)
Sends a non-mcp command to the CVW server.


startThread

public void startThread()
Starts the communication thread.


getSocket

public java.net.Socket getSocket()
Returns the current socket to the CVW server.


getServerName

public java.lang.String getServerName()
Returns the name of the CVW server.


getServerHost

public java.lang.String getServerHost()
Returns the host name of the CVW server.


getServerPort

public int getServerPort()
Returns the port of the CVW server.


connectionValid

public boolean connectionValid()
Returns whether the connection to the CVW server is valid.


openConnection

public void openConnection()
Opens the connection to the CVW server.


closeConnection

public void closeConnection()
Closes the connection to the CVW server.


displayError

public void displayError(java.lang.String errorString,
                         java.lang.String title)
Displays an error in a dialog box.


sendIdle

public void sendIdle(java.lang.String text)
Sends the idle command to the CVW server and sets the idle state


sendCmdToServer

public void sendCmdToServer(java.lang.String cmd)
Sends a command to the CVW server if the connection is valid.


receiveLine

public void receiveLine(java.lang.String theLine)
Receives communication from the CVW server one line at a time. This does some processing if the line does not start with #$#, otherwise it is processed by the processMCP method.


processMCP

public void processMCP(java.lang.String theLine)
Processes the communication line which represents MCP from the CVW server converting it to a MCP command and then acting upon the MCP.


parseMCP

public MCPCommand parseMCP(java.lang.String mcpLine)
Creates a MCP command based on a line of commuication from the CVW server. This basically looks for key: value pairs and creates a hashtable of them.


removeEscapeChars

public java.lang.String removeEscapeChars(int end,
                                          java.lang.String str)
Removes the escape characters that the CVW server addes to the values in the key: value pairs of the MCP command.


removeQuotesFromServer

public java.lang.String removeQuotesFromServer(int end,
                                               java.lang.String str)
Removes double quotes (") that the CVW server addes whenever a value in the key:value pair needs it.