com.altair.hwm.database.sql.protocol
Class DBProtocol

java.lang.Object
  extended by com.altair.hwm.database.sql.protocol.DBProtocol

public class DBProtocol
extends java.lang.Object

Title: DBProtocol

Description: This class represents the protocol followed between the server and the client. It also contains constants used in the protocol. The protocol followed is: . The code will let the receiver know what packet follows. This is used by the server and the client

Company: Altair Engineering, inc.


Field Summary
static int PROTOCOL_CXN
          This is the code used when a cxn packet is to be sent
static int PROTOCOL_DBREP
          This is the code used when the server replies to a db request by sending a db reply packet
static int PROTOCOL_DBREQ
          This is the code used when a SQL request packet is to be sent
static int PROTOCOL_ERROR
          This is the code used by the server when a request fails and no other packet follows it
static int PROTOCOL_SUCCESS
          This is the code used by the server when a request succeeeds and no other packet follows it
 
Constructor Summary
DBProtocol(java.io.ObjectOutputStream objOutStream, java.io.ObjectInputStream objInStream)
          Constructor
 
Method Summary
 java.lang.Object GetPacket()
          Gets the packet which was read
 int GetPacketType()
          Gets the type of the packet
 int RecvPacket()
          Receives the packet from the server/client
 void SendPacket(int nType, java.lang.Object objData)
          Sends the packet to the client/server
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROTOCOL_CXN

public static final int PROTOCOL_CXN
This is the code used when a cxn packet is to be sent

See Also:
Constant Field Values

PROTOCOL_DBREQ

public static final int PROTOCOL_DBREQ
This is the code used when a SQL request packet is to be sent

See Also:
Constant Field Values

PROTOCOL_DBREP

public static final int PROTOCOL_DBREP
This is the code used when the server replies to a db request by sending a db reply packet

See Also:
Constant Field Values

PROTOCOL_ERROR

public static final int PROTOCOL_ERROR
This is the code used by the server when a request fails and no other packet follows it

See Also:
Constant Field Values

PROTOCOL_SUCCESS

public static final int PROTOCOL_SUCCESS
This is the code used by the server when a request succeeeds and no other packet follows it

See Also:
Constant Field Values
Constructor Detail

DBProtocol

public DBProtocol(java.io.ObjectOutputStream objOutStream,
                  java.io.ObjectInputStream objInStream)
Constructor

Parameters:
objOutStream - The output stream to write to
objInStream - The input stream to read from
Method Detail

GetPacket

public java.lang.Object GetPacket()
Gets the packet which was read

Returns:
Object The packet that was read based on the type

GetPacketType

public int GetPacketType()
Gets the type of the packet

Returns:
int The type of the packet read

SendPacket

public void SendPacket(int nType,
                       java.lang.Object objData)
                throws java.sql.SQLException
Sends the packet to the client/server

Parameters:
nType - The type of packet
objData - The actual packet to be sent throws SQLException
Throws:
java.sql.SQLException

RecvPacket

public int RecvPacket()
               throws java.sql.SQLException
Receives the packet from the server/client

Returns:
int The type of packet throws SQLException
Throws:
java.sql.SQLException