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 Log |
LOG
The logger for the authenticator.
|
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.
|
void |
send(Message message1,
Message message2,
ReplyCallback replyCallback)
Sends a message on the connection.
|
void |
send(Message message,
ReplyCallback replyCallback)
Sends a message on the connection.
|
String |
toString() |
addPropertyChangeListener, close, flush, getPendingCount, getServerName, isAvailable, isIdle, isOpen, isShuttingDown, onExceptin, raiseErrors, removePropertyChangeListener, shutdown, waitForClosed
public static final String ADMIN_DB_NAME
public static final Log LOG
public AuthenticatingConnection(Connection connection, MongoClientConfiguration config)
connection
- The connection to ensure gets authenticated as needed.config
- The MongoDB client configuration.public void send(Message message1, Message message2, ReplyCallback 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 void send(Message message, ReplyCallback 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 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–2014 Allanbank Consulting, Inc.. All rights reserved.