acedb
Class Aceconnect

java.lang.Object
  extended byacedb.Aceconnect
All Implemented Interfaces:
Constants

public class Aceconnect
extends java.lang.Object
implements Constants

The Aceconnect class is the driver for interacting the socket aceserver. The key methods are login and talk. All command defined in tace can be executed through talk.


Field Summary
protected  java.io.DataInputStream socketIns
           
 
Fields inherited from interface acedb.Constants
ACESERV_MSGDATA, ACESERV_MSGENCORE, ACESERV_MSGFAIL, ACESERV_MSGKILL, ACESERV_MSGOK, ACESERV_MSGREQ, RESULT_BACKWARD, RESULT_FORWARD, RESULT_RANDOM
 
Constructor Summary
Aceconnect(java.net.Socket socket)
           
 
Method Summary
 void close()
          Close the socket and associated streams.
 void dumpSocketInfo()
          for debuging
 int execCommand(java.lang.String msg)
          Send query command to Saceserver and return the Status of the command execution; use getMessage() to get the message.
 java.lang.String execData(java.lang.String data)
          I don't know what type of data should be send through this channel.
 java.lang.String getMessage()
          returns the message body as String.
 java.lang.String getMsgType()
          The client only consructs ACESERV_MSGREQ, ACESERV_MSGENCORE for requesting information.
 int getMsgTypeInt()
          returns the message type as int defined in Constants.java
 boolean isClosed()
          to see that this connection is closed or not
 boolean login(java.lang.String user, java.lang.String pwd)
          signing on to the server.
 void quit()
          Terminate the server.
protected  int sendCommand(java.lang.String msg)
          Sends commands to server and read the header from the socket.
 java.lang.String sendData(java.lang.String msg)
          Send data to be parsed into the server database.
 void shutdown()
          Tell the server to shutdown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socketIns

protected java.io.DataInputStream socketIns
Constructor Detail

Aceconnect

public Aceconnect(java.net.Socket socket)
Method Detail

getMsgType

public java.lang.String getMsgType()
The client only consructs ACESERV_MSGREQ, ACESERV_MSGENCORE for requesting information. The other types are only defined on the server side, such as ACESERV_MSGOK.


getMsgTypeInt

public int getMsgTypeInt()
returns the message type as int defined in Constants.java


getMessage

public java.lang.String getMessage()
returns the message body as String. Could be very long


login

public boolean login(java.lang.String user,
                     java.lang.String pwd)
signing on to the server. You need to obtain username and password from the database (acedb) administrator. You can use anonymous with no password to login if the database provide world-read access


execCommand

public int execCommand(java.lang.String msg)
Send query command to Saceserver and return the Status of the command execution; use getMessage() to get the message. You can use all the commands that are taken by tace. Return type is a string defined by ACESERVER indicating the status of the command execution. The actual message should be retrieved by calling Aceconnect.getMessage(). getMessage

Returns:
the status of acedb command

execData

public java.lang.String execData(java.lang.String data)
I don't know what type of data should be send through this channel. May be *.ace files contents.


sendCommand

protected int sendCommand(java.lang.String msg)
Sends commands to server and read the header from the socket.

Returns:
String representing the status of command.

sendData

public java.lang.String sendData(java.lang.String msg)
Send data to be parsed into the server database. Right now there is now way to send messages longer than maxBytes long. Message must be broken into < maxBytes to be sent separately. Each message must be self contained and should not be truncated. There is no way of telling the server that there are more comming, such as the ENCORE message.

Returns:
MESSAGE_TYPE String, string version is easier for debug

quit

public void quit()
Terminate the server.


shutdown

public void shutdown()
Tell the server to shutdown.


isClosed

public boolean isClosed()
to see that this connection is closed or not


close

public void close()
Close the socket and associated streams.


dumpSocketInfo

public void dumpSocketInfo()
for debuging