public class AuthenticatingConnection extends AbstractProxyConnection
AbstractProxyConnection.ProxiedChangeListener
Modifier and Type | Field and Description |
---|---|
static String |
ADMIN_DB_NAME
The name of the administration database.
|
static Logger |
LOG
The logger for the authenticator.
|
myConfig
COMMAND_COLLECTION, OPEN_PROP_NAME
Constructor and Description |
---|
AuthenticatingConnection(Connection connection,
MongoClientConfiguration config)
Creates a new AuthenticatingConnection.
|
Modifier and Type | Method and Description |
---|---|
protected Connection |
getProxiedConnection()
Returns the proxiedConnection value.
|
String |
send(Message message,
Callback<Reply> replyCallback)
Sends a message on the connection.
|
String |
send(Message message1,
Message message2,
Callback<Reply> replyCallback)
Sends a message on the connection.
|
String |
toString() |
addPending, addPropertyChangeListener, close, drainPending, flush, getPendingCount, getServerName, isIdle, isOpen, onExceptin, raiseErrors, removePropertyChangeListener, shutdown, waitForClosed
public static final String ADMIN_DB_NAME
public static final Logger LOG
public AuthenticatingConnection(Connection connection, MongoClientConfiguration config)
connection
- The connection to ensure gets authenticated as needed.config
- The MongoDB client configuration.public String send(Message message, Callback<Reply> replyCallback) 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
message
- The message to send on the connection.replyCallback
- The callback to notify of responses to the messages. May be
null
.MongoDbException
- On an error sending the message.public String send(Message message1, Message message2, Callback<Reply> replyCallback) 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
message1
- The first message to send on the connection.message2
- The second message to send on the connection.replyCallback
- The callback to notify of responses to the message2
.
May be null
.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
Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.