@Override
public BSONObject handleCommand(Channel channel, String databaseName, String command, BSONObject query)
throws MongoServerException {
if (command.equalsIgnoreCase("whatsmyuri")) {
BSONObject response = new BasicBSONObject();
InetSocketAddress remoteAddress = (InetSocketAddress) channel.remoteAddress();
response.put("you", remoteAddress.getAddress().getHostAddress() + ":" + remoteAddress.getPort());
Utils.markOkay(response);
return response;
} else if (command.equalsIgnoreCase("ismaster")) {
BSONObject response = new BasicBSONObject("ismaster", Boolean.TRUE);
response.put("maxBsonObjectSize", Integer.valueOf(BsonConstants.MAX_BSON_OBJECT_SIZE));
response.put("maxMessageSizeBytes", Integer.valueOf(MongoWireProtocolHandler.MAX_MESSAGE_SIZE_BYTES));
response.put("localTime", new Date());
Utils.markOkay(response);
return response;
} else if (command.equalsIgnoreCase("buildinfo")) {
BSONObject response = new BasicBSONObject("version", Utils.join(VERSION, '.'));
response.put("versionArray", VERSION);
response.put("maxBsonObjectSize", Integer.valueOf(BsonConstants.MAX_BSON_OBJECT_SIZE));
Utils.markOkay(response);
return response;
}
if (databaseName.equals("admin")) {