public class AuthenticatingConnection extends AbstractProxyConnection
AbstractProxyConnection.ProxiedChangeListener
Modifier and Type | Field and Description |
---|---|
static String |
ADMIN_DB_NAME
The name of the administration database.
|
myConfig
COMMAND_COLLECTION, OPEN_PROP_NAME
Constructor and Description |
---|
AuthenticatingConnection(Connection connection,
MongoDbConfiguration config)
Creates a new AuthenticatingConnection.
|
Modifier and Type | Method and Description |
---|---|
protected Connection |
getProxiedConnection()
Returns the proxiedConnection value.
|
String |
send(Callback<Reply> reply,
Message... messages)
Sends a message on the connection.
|
protected int |
toInt(Element element)
Converts a
NumericElement into an int value. |
String |
toString() |
addPending, addPropertyChangeListener, close, drainPending, flush, getPendingCount, isIdle, isOpen, onExceptin, raiseErrors, removePropertyChangeListener, shutdown, waitForClosed
public static final String ADMIN_DB_NAME
public AuthenticatingConnection(Connection connection, MongoDbConfiguration config)
connection
- The connection to ensure gets authenticated as needed.config
- The MongoDB client configuration.public String send(Callback<Reply> reply, Message... messages) throws MongoDbException
Forwards the call to the proxied Connection
.
Makes sure the connection is authenticated for the current database before forwarding to the proxied connection.
send
in interface Connection
send
in class AbstractProxyConnection
reply
- The callback to notify of responses to the messages. May be
null
.messages
- The messages to send on the connection. The messages will be
sent one after the other and are guaranteed to be contiguous
and have sequential message ids.MongoDbException
- On an error sending the message.public String toString()
Overridden to return the socket information.
protected Connection getProxiedConnection()
Overridden to give access to the proxied connections to tests.
getProxiedConnection
in class AbstractProxyConnection
protected int toInt(Element element)
NumericElement
into an int value. If not a
NumericElement
then -1 is returned.element
- The element to convert.Copyright © 2011-2012 Allanbank Consulting, Inc.. All Rights Reserved.