HEADER

biouml.modules.genenet.access
Class MGL_Connection

Direct Known Subclasses:
MGL_Connection_Client

public class MGL_Connection

MGL Connection is the core of MGL client & server. General scheme of MGL client & server work.

Client                          Server
---------------------           -------------------------------
[1.]  opens the session

2.   opens the connection     ->     opens the connection

3.   sends the command        ->     receives the command and calls
corresponding function

[4.]  sends the command        ->     the function receives parameters
parameters

5.   recieves answer state    <-     the function or server sends
( ok / error )                  answer state ( ok / error )

6.   receives the answer      <-     the functions sends the answer

7.   closes the connection
if the session
- is not opened      ->     closes the connection
- is opened

[8.]  close the session         ->    closes the connection
Note. If the session is open, the close connection command really doesn't close the connection. The connection will be closed by the close session command. It is used to speed up data transfer, when series of requests to the server is occured.

Version: 2.4.6, 27 March 2000

Field Summary
 final static intACCELERATOR
           
 final static intDB_DEFAULT_FIELDS
           
 final static intDB_DESCRIPTION
           
 final static intDB_ENTRIES_SET_BY_AC
           
 final static intDB_ENTRIES_SET_BY_ID
           
 final static intDB_ENTRY_BY_AC
           
 final static intDB_ENTRY_BY_ID
           
 final static intDB_ENTRY_VERSIONS
           
 final static intDB_EXECUTE_QUERY
           
 final static intDB_GENENET_DESCRIPTION
           
 final static intDB_GENENET_LIST_ID
           
 final static intDB_GENENET_SCHEME
           
 final static intDB_LIST
           
 final static intDB_LIST_ID
           
 final static intDB_REMOVE_ENTRY
           
 final static intDB_SET
           
 final static intDB_SIZE
           
 final static intDB_WRITE_ENTRIES_SET
           
 final static intDB_WRITE_ENTRY
           
 final static intDISCONNECT
           
 final static intERROR
           
 final static intOK
          The OK (all correct message).

Method Summary
 final static synchronized StringreadStringUTF(InputStream inputstream)
          Reads in a string from the specified data input stream.
 final static synchronized voidwriteStringUTF(OutputStream outputstream, String s)
          Writes a string to the underlying output stream using UTF-8 encoding in a machine-independent manner.

Field Detail

ACCELERATOR

public final static int ACCELERATOR

DB_DEFAULT_FIELDS

public final static int DB_DEFAULT_FIELDS
See Also:
MGL_ConnectionClient#getDefaultFieldsDescription, MGL_ConnectionServer#sendDefaultFieldsDescription

DB_DESCRIPTION

public final static int DB_DESCRIPTION
See Also:
MGL_ConnectionClient#getDatabaseDescription, MGL_ConnectionServer#sendDatabaseDescription

DB_ENTRIES_SET_BY_AC

public final static int DB_ENTRIES_SET_BY_AC
See Also:
MGL_ConnectionClient#getEntriesSetByAC, MGL_ConnectionServer#sendEntriesSet

DB_ENTRIES_SET_BY_ID

public final static int DB_ENTRIES_SET_BY_ID
See Also:
MGL_ConnectionClient#getEntriesSetByID, MGL_ConnectionServer#sendEntriesSet

DB_ENTRY_BY_AC

public final static int DB_ENTRY_BY_AC
See Also:
MGL_ConnectionClient#getEntryByAC, MGL_ConnectionServer#sendEntry

DB_ENTRY_BY_ID

public final static int DB_ENTRY_BY_ID
See Also:
MGL_ConnectionClient#getEntryByID, MGL_ConnectionServer#sendEntry

DB_ENTRY_VERSIONS

public final static int DB_ENTRY_VERSIONS
See Also:
MGL_ConnectionClient#getEntryVersions, MGL_ConnectionServer#sendEntryVersions

DB_EXECUTE_QUERY

public final static int DB_EXECUTE_QUERY
See Also:
MGL_ConnectionClient#executeQuery, MGL_ConnectionServer#executeQuery

DB_GENENET_DESCRIPTION

public final static int DB_GENENET_DESCRIPTION
See Also:
MGL_ConnectionClient#getGeneNetDescription, MGL_ConnectionServer#sendGeneNetDescription

DB_GENENET_LIST_ID

public final static int DB_GENENET_LIST_ID
See Also:
MGL_ConnectionClient#getGeneNetListID, MGL_ConnectionServer#sendGeneNetListID

DB_GENENET_SCHEME

public final static int DB_GENENET_SCHEME
See Also:
MGL_ConnectionClient#getGeneNetScheme, MGL_ConnectionServer#sendGeneNetScheme

DB_LIST

public final static int DB_LIST
See Also:
MGL_ConnectionClient#getDatabaseList, MGL_ConnectionServer#sendDatabaseList

DB_LIST_ID

public final static int DB_LIST_ID
See Also:
MGL_ConnectionClient#getListID, MGL_ConnectionServer#sendListID

DB_REMOVE_ENTRY

public final static int DB_REMOVE_ENTRY
See Also:
MGL_ConnectionClient#removeEntry, MGL_ConnectionServer#removewEntry

DB_SET

public final static int DB_SET
See Also:
MGL_ConnectionClient#setDatabase, MGL_ConnectionServer#setDatabase

DB_SIZE

public final static int DB_SIZE
See Also:
MGL_ConnectionClient#getSize, MGL_ConnectionServer#sendSize

DB_WRITE_ENTRIES_SET

public final static int DB_WRITE_ENTRIES_SET
See Also:
MGL_ConnectionClient#writeEntrySet, MGL_ConnectionServer#writeEntrySet

DB_WRITE_ENTRY

public final static int DB_WRITE_ENTRY
See Also:
MGL_ConnectionClient#writeEntry, MGL_ConnectionServer#writeEntry

DISCONNECT

public final static int DISCONNECT
See Also:
MGL_ConnectionClient#disconnect, MGL_ConnectionServer#disconnect

ERROR

public final static int ERROR
See Also:
MGL_ConnectionServer#error

OK

public final static int OK
The OK (all correct message).
Method Detail

readStringUTF

public final static synchronized String readStringUTF(InputStream inputstream)
throws java.io.IOException
Reads in a string from the specified data input stream. The string has been encoded using a modified UTF-8 format.

The first two bytes are read as if by readInt. This value gives the number of following bytes that are in the encoded string, not the length of the resulting string. The following bytes are then interpreted as bytes encoding characters in the UTF-8 format and are converted into characters.

This method blocks until all the bytes are read, the end of the stream is detected, or an exception is thrown.

Parameters:
in - a input stream.
Returns: a Unicode string.
Throws:
EOFException - if the input stream reaches the end before all the bytes.
IOException - if an I/O error occurs.
UTFDataFormatException - if the bytes do not represent a valid UTF-8 encoding of a Unicode string.
See Also:
java.io.DataInputStream.readUnsignedShort()

writeStringUTF

public final static synchronized void writeStringUTF(OutputStream outputstream, String s)
throws java.io.IOException
Writes a string to the underlying output stream using UTF-8 encoding in a machine-independent manner.

First, 4 bytes are written to the output stream as if by the writeInt method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the UTF-8 encoding for the character.

Parameters:
out - OutputStream.
str - string to be written.
Throws:
IOException - if an I/O error occurs.

Association Links

to Class java.net.Socket

Socket for connection.

to Class java.io.DataInputStream

Socket input stream.

to Class java.io.DataOutputStream

Socket output stream.

FOOTER

BOTTOM