HEADER

biouml.modules.genenet.access
Class MGL_Connection_Client

biouml.modules.genenet.access.MGL_Connection
  |
  +--biouml.modules.genenet.access.MGL_Connection_Client

public class MGL_Connection_Client
extends MGL_Connection

Provides access to the MGL server. The application (applet) should has only one MGL_ConnectionClient.

To provide more rapid access to the MGL server application can open the session using the function openSession While the session is opened, the connection (socket) is not closed, when disconnect function is called.

closeSession close the session, if the _sessionLevel = 0.

close close the session in any case.

Example:

MGL_ConectionClient connection = new MGL_ConnectionClient();
try
{
connection.openSession();               // _sessionLevel = 1
connection.openSession();           // _sessionLevel = 2
connection.connect();              // open the connection
...
connection.disconnect()         // do nothing, because _sessionLevel > 0
connection.closeSession();          // _sessionLevel = 1
connection.closeSession();              // _sessionLevel = 0, close the connection
}
finally()
{
connection.close();                     // close the connection in any case
// _sessionLevel = 0
}

Version: 2.4.6, 28 March 2000

Field Summary
 final static intMGL_PORT
           

Fields inherited from class biouml.modules.genenet.access.MGL_Connection
ACCELERATOR, DB_DEFAULT_FIELDS, DB_DESCRIPTION, DB_ENTRIES_SET_BY_AC, DB_ENTRIES_SET_BY_ID, DB_ENTRY_BY_AC, DB_ENTRY_BY_ID, DB_ENTRY_VERSIONS, DB_EXECUTE_QUERY, DB_GENENET_DESCRIPTION, DB_GENENET_LIST_ID, DB_GENENET_SCHEME, DB_LIST, DB_LIST_ID, DB_REMOVE_ENTRY, DB_SET, DB_SIZE, DB_WRITE_ENTRIES_SET, DB_WRITE_ENTRY, DISCONNECT, ERROR, OK

Constructor Summary
MGL_Connection_Client(String address, String dbCurrent)
          Constructs the MGL_Connection_Client with specified database NAME for transfer and text panel to display prompts.
MGL_Connection_Client(String address)
          Constructs the MGL_Connection_Client with text panel to display prompts.

Method Summary
 voidclose()
          Closes the connection in any case.
 voidcloseSession()
          Closes the session.
 voidconnect()
          Opens the connection with the MGL server.
 voiddisconnect()
          Close the connection.
 StringgetDatabaseDescription()
          Returns the current database description.
 StringgetDatabaseList()
          Returns a list of database NAMEs loaded on the MGL server.
 StringgetDefaultFieldsDescription()
          Returns default fields description.
 StringgetEntriesSetByAC(String ac)
          Returns the set of required entries by their accession numbers.
 StringgetEntriesSetByID(String id)
          Returns the set of required entries by their identifiers.
 StringgetEntryByAC(String ac)
          Returns the required entry by its accession number.
 StringgetEntryByID(String id)
          Returns the required entry by its identifcator.
 DataInputStreamgetGeneNetDescription()
          Recieves the GeneNet database description.
 DataInputStreamgetGeneNetListID()
          Recieves the lists of identifiers for all tables from the GeneNet database description.
 DataInputStreamgetGeneNetScheme(String id)
          Recieves the GeneNet scheme by its identifier and all entries listed in it.
 ListgetListID()
          Returns the list of identificators for all entries in current database.
 intgetSize()
          Returns the number of entries in the database.
 voidopenSession()
          Opens the session.
 StringremoveEntry(String id)
          Removes the required entry by its identifcator.
 synchronized Stringrequest(int command, String argument, boolean readAnswer)
          Opens the connection with the MGL server, sends request, reads the answer, check it, and close the connection.
 synchronized Stringrequest(int command, String dbName, String argument, boolean readAnswer)
           
 voidsetDatabase(String dbName)
          Set up for data transfer the required database.
 voidwriteEntriesSet(String entries)
          Write the set of entries.
 voidwriteEntry(String entry)
          Write the entry.

Methods inherited from class biouml.modules.genenet.access.MGL_Connection
readStringUTF, writeStringUTF

Field Detail

MGL_PORT

public final static int MGL_PORT
Constructor Detail

MGL_Connection_Client

public MGL_Connection_Client(String address, String dbCurrent)
Constructs the MGL_Connection_Client with specified database NAME for transfer and text panel to display prompts.
Parameters:
addres - the MGL Server address
dbCurrent - database NAME for transfer
pText - text panel to display prompts
See Also:
setDatabase(java.lang.String)

MGL_Connection_Client

public MGL_Connection_Client(String address)
Constructs the MGL_Connection_Client with text panel to display prompts.
Parameters:
addres - the MGL Server address
pText - text panel to display prompts
See Also:
setDatabase(java.lang.String)
Method Detail

close

public void close()
Closes the connection in any case.
See Also:
MGL_ConnectionClient, openSession(), closeSession()

closeSession

public void closeSession()
Closes the session.
See Also:
MGL_ConnectionClient, openSession(), close()

connect

public void connect()
throws java.io.IOException
Opens the connection with the MGL server.

disconnect

public void disconnect()
Close the connection.
See Also:
MGL_ConnectionClient, openSession(), closeSession(), close()

getDatabaseDescription

public String getDatabaseDescription()
throws java.io.IOException
Returns the current database description.
See Also:
MGL_ConnectionServer#sendDatabaseDescription, Database

getDatabaseList

public String getDatabaseList()
throws java.io.IOException
Returns a list of database NAMEs loaded on the MGL server.
See Also:
MGL_ConnectionServer#getDatabaseList

getDefaultFieldsDescription

public String getDefaultFieldsDescription()
throws java.io.IOException
Returns default fields description.
See Also:
MGL_ConnectionServer#sendDefaultFieldsDescription, Database#defaultFieldsDescription

getEntriesSetByAC

public String getEntriesSetByAC(String ac)
throws java.io.IOException
Returns the set of required entries by their accession numbers.
See Also:
MGL_ConnectionServer#EntriesSetAC

getEntriesSetByID

public String getEntriesSetByID(String id)
throws java.io.IOException
Returns the set of required entries by their identifiers.
See Also:
MGL_ConnectionServer#EntriesSetByID

getEntryByAC

public String getEntryByAC(String ac)
throws java.io.IOException
Returns the required entry by its accession number.
See Also:
MGL_ConnectionServer#sendEntry, Database#getEntryByAC

getEntryByID

public String getEntryByID(String id)
throws java.io.IOException
Returns the required entry by its identifcator.
See Also:
MGL_ConnectionServer#sendEntry, Database#getEntryByID

getGeneNetDescription

public DataInputStream getGeneNetDescription()
throws java.io.IOException
Recieves the GeneNet database description.
See Also:
MGL_ConnectionServer#sendGeneNetDescription

getGeneNetListID

public DataInputStream getGeneNetListID()
throws java.io.IOException
Recieves the lists of identifiers for all tables from the GeneNet database description.
See Also:
MGL_ConnectionServer#sendGeneNetListID

getGeneNetScheme

public DataInputStream getGeneNetScheme(String id)
throws java.io.IOException
Recieves the GeneNet scheme by its identifier and all entries listed in it.
See Also:
MGL_ConnectionServer#sendGeneNetScheme

getListID

public List getListID()
throws java.io.IOException
Returns the list of identificators for all entries in current database.
See Also:
MGL_ConnectionServer#sendListID, Database#getListID

getSize

public int getSize()
throws java.io.IOException
Returns the number of entries in the database.
See Also:
MGL_ConnectionServer#sendSize, Database#getSize

openSession

public void openSession()
Opens the session.
See Also:
MGL_ConnectionClient, closeSession(), close()

removeEntry

public String removeEntry(String id)
throws java.io.IOException
Removes the required entry by its identifcator.
See Also:
MGL_ConnectionServer#removeEntry, Database#removeEntry

request

public synchronized String request(int command, String argument, boolean readAnswer)
throws java.io.IOException
Opens the connection with the MGL server, sends request, reads the answer, check it, and close the connection.
Parameters:
command - request command (cod)
argument - request argument
See Also:
MGL_Connection

request

public synchronized String request(int command, String dbName, String argument, boolean readAnswer)
throws java.io.IOException

setDatabase

public void setDatabase(String dbName)
throws java.io.IOException
Set up for data transfer the required database.
Parameters:
dbNAME - dtatabase NAME used by client & server
See Also:
MGL_ConnectionServer#setDatabase, Database#getName

writeEntriesSet

public void writeEntriesSet(String entries)
throws java.io.IOException
Write the set of entries.
See Also:
MGL_ConnectionServer#writeEntriesSet

writeEntry

public void writeEntry(String entry)
throws java.io.IOException
Write the entry.
See Also:
MGL_ConnectionServer#writeEntry

Association Links

to Class java.lang.String

The Internet address of the MGL server.

to Class java.lang.String

The database name that in current use.

to Class java.lang.String

Databases default fields description.

FOOTER

BOTTOM