org.apache.jdo.impl.fostore
Interface FOStoreServerConnection

All Superinterfaces:
FOStoreConnection
All Known Implementing Classes:
FOStoreServerConnectionImpl

interface FOStoreServerConnection
extends FOStoreConnection

A connection as used by a server/store. It provides a means of getting the client's input, and of writing reply data back to the client.

Author:
Dave Bristor

Method Summary
 boolean addExtent(DBExtent dbExtent)
          Adds the extent to this connections set of extents that have been changed during a transaction.
 void closeDatabase()
          Close the database.
 void commit()
          Commits the work done in this connection.
 Reply createReply(RequestId requestId)
          Provides a Reply to which the server can write replies to the client's requests.
 FOStoreDatabase getDatabase()
          Provides the database to be used by the server using this connection.
 FOStoreInput getInputFromClient()
          Provides a DataInput from which the server can read the client's requests.
 FOStoreOutput getOutputForClient()
          Provides a DataOutput to which the server can write data for the client.
 java.io.DataInput getOutputFromServer()
          Provide the output from the server to the client reply handler.
 void openDatabase(java.lang.String dbname, java.lang.String user, long timestamp, byte[] secret, boolean create)
          Log in to the database.
 void processRequests()
          Process requests from client.
 void readInputFromClient()
          Read the input stream from the socket.
 void rollback()
          Rolls back the work done in this connection.
 void sendToClient()
          Sends all the reply data to the client.
 void setClientInput(FOStoreInput in)
          Set client data stream.
 void setOkToReleaseDatabase(boolean ok)
          Indicates whether or not it is OK to release a database after a message's contents are processed.
 void writeOutputToClient()
          Write the output from the server to the socket
 

Method Detail

getInputFromClient

public FOStoreInput getInputFromClient()
Provides a DataInput from which the server can read the client's requests.

Returns:
DataInput for reading requests.

getOutputForClient

public FOStoreOutput getOutputForClient()
Provides a DataOutput to which the server can write data for the client. This is not normally used for writing data associated with a single reply (use createReply for that purpose).

Returns:
FOStoreOutput for writing data to client.

createReply

public Reply createReply(RequestId requestId)
                  throws java.io.IOException
Provides a Reply to which the server can write replies to the client's requests.

Returns:
Reply object for writing information about one reply.
Throws:
java.io.IOException

addExtent

public boolean addExtent(DBExtent dbExtent)
Adds the extent to this connections set of extents that have been changed during a transaction.


commit

public void commit()
            throws FOStoreDatabaseException
Commits the work done in this connection.

Throws:
FOStoreDatabaseException

rollback

public void rollback()
              throws FOStoreDatabaseException
Rolls back the work done in this connection.

Throws:
FOStoreDatabaseException

sendToClient

public void sendToClient()
                  throws java.io.IOException,
                         FOStoreDatabaseException
Sends all the reply data to the client.

Throws:
java.io.IOException
FOStoreDatabaseException

getDatabase

public FOStoreDatabase getDatabase()
Provides the database to be used by the server using this connection.

Returns:
A database.

setClientInput

public void setClientInput(FOStoreInput in)
                    throws java.io.IOException
Set client data stream. Only used in local case.

Throws:
java.io.IOException

processRequests

public void processRequests()
Process requests from client.


openDatabase

public void openDatabase(java.lang.String dbname,
                         java.lang.String user,
                         long timestamp,
                         byte[] secret,
                         boolean create)
                  throws java.lang.InterruptedException,
                         FOStoreDatabaseException
Log in to the database.

Throws:
java.lang.InterruptedException
FOStoreDatabaseException

getOutputFromServer

public java.io.DataInput getOutputFromServer()
Provide the output from the server to the client reply handler.


writeOutputToClient

public void writeOutputToClient()
                         throws java.io.IOException
Write the output from the server to the socket

Throws:
java.io.IOException

readInputFromClient

public void readInputFromClient()
                         throws java.io.IOException
Read the input stream from the socket.

Throws:
java.io.IOException

closeDatabase

public void closeDatabase()
                   throws FOStoreDatabaseException
Close the database. Each open connection will perform this operation; only the last open connection to be closed will actually close the database.

Throws:
FOStoreDatabaseException

setOkToReleaseDatabase

public void setOkToReleaseDatabase(boolean ok)
Indicates whether or not it is OK to release a database after a message's contents are processed.