com.mongodb
Interface DBConnector

All Known Implementing Classes:
DBTCPConnector

public interface DBConnector

Interface that provides the ability to exchange request/response with the database


Method Summary
 com.mongodb.Response call(DB db, DBCollection coll, com.mongodb.OutMessage m)
          does a read operation on the database
 com.mongodb.Response call(DB db, DBCollection coll, com.mongodb.OutMessage m, ServerAddress hostNeeded)
          does a read operation on the database
 com.mongodb.Response call(DB db, DBCollection coll, com.mongodb.OutMessage m, ServerAddress hostNeeded, int retries)
          does a read operation on the database
 boolean isOpen()
          returns true if the connector is in a usable state
 void requestDone()
          terminates the "consistent request".
 void requestEnsureConnection()
          Ensures that a connection exists for the "consistent request"
 void requestStart()
          initiates a "consistent request" on the thread.
 WriteResult say(DB db, com.mongodb.OutMessage m, WriteConcern concern)
          does a write operation
 WriteResult say(DB db, com.mongodb.OutMessage m, WriteConcern concern, ServerAddress hostNeeded)
          does a write operation
 

Method Detail

requestStart

void requestStart()
initiates a "consistent request" on the thread. Once this has been called, the connector will ensure that the same underlying connection is always used for a given thread. This happens until requestStop() is called.


requestDone

void requestDone()
terminates the "consistent request".


requestEnsureConnection

void requestEnsureConnection()
Ensures that a connection exists for the "consistent request"


say

WriteResult say(DB db,
                com.mongodb.OutMessage m,
                WriteConcern concern)
                throws MongoException
does a write operation

Parameters:
db - the database
m - the request message
concern - the write concern
Returns:
the write result
Throws:
MongoException

say

WriteResult say(DB db,
                com.mongodb.OutMessage m,
                WriteConcern concern,
                ServerAddress hostNeeded)
                throws MongoException
does a write operation

Parameters:
db - the database
m - the request message
concern - the write concern
hostNeeded - specific server to connect to
Returns:
the write result
Throws:
MongoException

call

com.mongodb.Response call(DB db,
                          DBCollection coll,
                          com.mongodb.OutMessage m)
                          throws MongoException
does a read operation on the database

Parameters:
db - the database
coll - the collection
m - the request message
Returns:
the read response
Throws:
MongoException

call

com.mongodb.Response call(DB db,
                          DBCollection coll,
                          com.mongodb.OutMessage m,
                          ServerAddress hostNeeded)
                          throws MongoException
does a read operation on the database

Parameters:
db - the database
coll - the collection
m - the request message
hostNeeded - specific server to connect to
Returns:
the read result
Throws:
MongoException

call

com.mongodb.Response call(DB db,
                          DBCollection coll,
                          com.mongodb.OutMessage m,
                          ServerAddress hostNeeded,
                          int retries)
                          throws MongoException
does a read operation on the database

Parameters:
db - the database
coll - the collection
m - the request message
hostNeeded - specific server to connect to
retries - number of retries in case of error
Returns:
the read result
Throws:
MongoException

isOpen

boolean isOpen()
returns true if the connector is in a usable state

Returns: