Package mungbean.protocol.message

Examples of mungbean.protocol.message.CommandRequest


    public boolean isMaster() {
        try {
            return execute(new DBConversation<Boolean>() {
                @Override
                public Boolean execute(Connection connection) {
                    CommandResponse response = connection.execute(new CommandRequest("$cmd", "ismaster"));
                    Object value = response.get("ismaster");
                    return value.equals(1L) || Boolean.TRUE.equals(value);
                }
            });
        } catch (RuntimeIOException e) {
View Full Code Here


    @Override
    protected boolean isValid(Connection connection) {
        if (settings.validateConnections()) {
            try {
                connection.execute(new CommandRequest("ismaster"));
            } catch (RuntimeIOException e) {
                return false;
            }
        }
        return true;
View Full Code Here

    public String password() {
        return password;
    }

    public void authenticate(DBConnection connection) {
        final String nonce = (String) connection.execute(new CommandRequest(database(), "getnonce")).get("nonce");
        LinkedHashMap<String, Object> authenticationParameters = authenticationRequest(nonce);
        CommandResponse value = connection.execute(new CommandRequest(database(), authenticationParameters, CommandRequest.DEFAULT_CODERS));
        if (!value.get("ok").equals(1D)) {
            throw new MongoException("Authentication failed for database " + database(), value);
        }
    }
View Full Code Here

            }
        });
    }

    private <ResponseType> ResponseType executeCommand(AbstractCommand<ResponseType> command, Connection connection) {
        CommandResponse response = connection.execute(new CommandRequest(dbName, command.requestMap(AbstractDBCollection.this), queryCoders));
        if (response == null) {
            throw new NotFoundException("Value not returned for command: " + command);
        }
        Object result = response.get("ok");
        if (!result.equals(1D) && !result.equals(Boolean.TRUE)) {
View Full Code Here

TOP

Related Classes of mungbean.protocol.message.CommandRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.