|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jdo.impl.fostore.FOStoreServerConnectionImpl
This class implements the FOStoreServerConnection contract. It is used in two modes: local and remote. In local mode, the default constructor is used. In remote mode, the constructor that takes a Socket is used. The connection after construction does not contain any information about the data store. After the login request is successfully executed, the Database information is known. Subsequent requests know the Database.
Field Summary | |
private FOStoreInput |
clientDataInput
Used by server to read client's requests. |
private java.lang.String |
dbname
The local database name. |
private FOStoreDatabase |
fodb
The local database |
(package private) static org.apache.commons.logging.Log |
logger
Logger |
private static org.apache.jdo.util.I18NHelper |
msg
I18N support. |
private boolean |
okToReleaseDatabase
Indicates if releaseDatabase can really do so. |
private java.lang.String |
root
Root in filesystem at which database will be created. |
private FOStoreOutput |
serverData
Used by server to write its replies. |
private java.net.Socket |
socket
The socket over which we communicate to the client. |
private java.io.DataInputStream |
socketDataInputStream
The input stream from the socket. |
private java.io.OutputStream |
socketOutputStream
The output stream from the socket. |
Constructor Summary | |
FOStoreServerConnectionImpl()
Creates new FOStoreServerConnectionImpl for the local case. |
|
FOStoreServerConnectionImpl(java.net.Socket socket,
java.lang.String root)
Creates new FOStoreServerConnectionImpl for the remote case. |
Method Summary | |
boolean |
addExtent(DBExtent dbExtent)
Adds the extent to this connections set of extents that have been changed during a transaction. |
void |
close()
Close this connection; release all resources. |
void |
closeDatabase()
Close the database associated with this connection. |
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. |
private java.lang.String |
databasePath(java.lang.String dbname)
|
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()
Provides a DataInput from which the local client can read the server's replies. |
void |
openDatabase(java.lang.String dbname,
java.lang.String user,
long timestamp,
byte[] secret,
boolean create)
Open the database if it exists, and verify the user authentication. |
void |
processRequests()
Process requests from client. |
void |
readInputFromClient()
Read the input stream from the socket. |
(package private) void |
releaseDatabase()
Release the database associated with this connection. |
void |
rollback()
Rolls back the work done in this connection. |
void |
sendToClient()
Sends all the reply data to the client. |
void |
setClientInput(FOStoreInput fi)
Set client data stream. |
void |
setOkToReleaseDatabase(boolean ok)
Indicates whether or not releaseDatabase can actually release the database. |
void |
writeOutputToClient()
Writes the output to the client socket. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final org.apache.jdo.util.I18NHelper msg
static final org.apache.commons.logging.Log logger
private FOStoreOutput serverData
private FOStoreInput clientDataInput
private final java.net.Socket socket
private final java.lang.String root
private java.io.DataInputStream socketDataInputStream
private java.io.OutputStream socketOutputStream
private java.lang.String dbname
private FOStoreDatabase fodb
private boolean okToReleaseDatabase
Constructor Detail |
public FOStoreServerConnectionImpl()
public FOStoreServerConnectionImpl(java.net.Socket socket, java.lang.String root)
Method Detail |
public void commit() throws FOStoreDatabaseException
commit
in interface FOStoreServerConnection
FOStoreDatabaseException
public void rollback() throws FOStoreDatabaseException
rollback
in interface FOStoreServerConnection
FOStoreDatabaseException
public Reply createReply(RequestId requestId) throws java.io.IOException
createReply
in interface FOStoreServerConnection
java.io.IOException
public FOStoreInput getInputFromClient()
getInputFromClient
in interface FOStoreServerConnection
public void readInputFromClient() throws java.io.IOException
FOStoreServerConnection
readInputFromClient
in interface FOStoreServerConnection
java.io.IOException
public void sendToClient() throws java.io.IOException, FOStoreDatabaseException
FOStoreServerConnection
sendToClient
in interface FOStoreServerConnection
java.io.IOException
FOStoreDatabaseException
FOStoreServerConnection.sendToClient()
public boolean addExtent(DBExtent dbExtent)
addExtent
in interface FOStoreServerConnection
public void openDatabase(java.lang.String dbname, java.lang.String user, long timestamp, byte[] secret, boolean create) throws FOStoreDatabaseException, java.lang.InterruptedException
openDatabase
in interface FOStoreServerConnection
FOStoreDatabaseException
java.lang.InterruptedException
public FOStoreDatabase getDatabase()
getDatabase
in interface FOStoreServerConnection
public FOStoreOutput getOutputForClient()
getOutputForClient
in interface FOStoreServerConnection
public java.io.DataInput getOutputFromServer()
getOutputFromServer
in interface FOStoreServerConnection
public void writeOutputToClient() throws java.io.IOException
writeOutputToClient
in interface FOStoreServerConnection
java.io.IOException
public void setClientInput(FOStoreInput fi)
FOStoreServerConnection
setClientInput
in interface FOStoreServerConnection
public void processRequests()
FOStoreServerConnection
processRequests
in interface FOStoreServerConnection
public void setOkToReleaseDatabase(boolean ok)
setOkToReleaseDatabase
in interface FOStoreServerConnection
void releaseDatabase() throws java.lang.InterruptedException
java.lang.InterruptedException
public void closeDatabase() throws FOStoreDatabaseException
closeDatabase
in interface FOStoreServerConnection
FOStoreDatabaseException
public void close() throws FOStoreDatabaseException
FOStoreDatabaseException
private final java.lang.String databasePath(java.lang.String dbname)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |