Package com.imaginea.mongodb.exceptions

Examples of com.imaginea.mongodb.exceptions.MongoConnectionException


                int port = 0;
                try {
                    port = Integer.parseInt(mongoPort);
                } catch (NumberFormatException e) {
                    throw new MongoConnectionException(ErrorCodes.INVALID_PORT, "You have entered an invalid port number !");
                }
                ConnectionDetails connectionDetails = new ConnectionDetails(host, port, user, password, databases);
                String connectionId = null;
                try {
                    connectionId = authService.authenticate(connectionDetails, existingConnectionIdsInSession);
                } catch (IllegalArgumentException m) {
                    throw new MongoConnectionException(ErrorCodes.INVALID_ARGUMENT, "You have entered an invalid data !");
                } catch (MongoInternalException m) {
                    // Throws when cannot connect to localhost.com
                    throw new MongoConnectionException(ErrorCodes.HOST_UNKNOWN, m.getMessage());
                } catch (MongoException m) {
                    throw new MongoConnectionException(ErrorCodes.MONGO_CONNECTION_EXCEPTION, "Connection Failed. Check if MongoDB is running at the given host and port.");
                }
                if (existingConnectionIdsInSession == null) {
                    existingConnectionIdsInSession = new HashSet<String>();
                    session.setAttribute("existingConnectionIdsInSession", existingConnectionIdsInSession);
                }
View Full Code Here

TOP

Related Classes of com.imaginea.mongodb.exceptions.MongoConnectionException

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.