Package com.imaginea.mongodb.services.impl

Examples of com.imaginea.mongodb.services.impl.DatabaseServiceImpl


    @Produces(MediaType.APPLICATION_JSON)
    public String getDbStats(@PathParam("dbName") final String dbName, @QueryParam("connectionId") final String connectionId, @Context final HttpServletRequest request) throws JSONException {

        String response = new ResponseTemplate().execute(logger, connectionId, request, new ResponseCallback() {
            public Object execute() throws Exception {
                DatabaseService databaseService = new DatabaseServiceImpl(connectionId);
                return databaseService.getDbStats(dbName);
            }
        });
        return response;
    }
View Full Code Here


    public String getDbList(@QueryParam("connectionId") final String connectionId, @Context final HttpServletRequest request) {

        String response = new ResponseTemplate().execute(logger, connectionId, request, new ResponseCallback() {
            public Object execute() throws Exception {
                // TODO Using Service Provider
                DatabaseService databaseService = new DatabaseServiceImpl(connectionId);
                return databaseService.getDbList();
            }
        });
        return response;
    }
View Full Code Here

            InvalidHTTPRequestException e = new InvalidHTTPRequestException(ErrorCodes.ACTION_PARAMETER_ABSENT, "ACTION_PARAMETER_ABSENT");
            return formErrorResponse(logger, e);
        }
        String response = new ResponseTemplate().execute(logger, connectionId, request, new ResponseCallback() {
            public Object execute() throws Exception {
                DatabaseService databaseService = new DatabaseServiceImpl(connectionId);
                String status = null;
                RequestMethod method = null;
                for (RequestMethod m : RequestMethod.values()) {
                    if ((m.toString()).equals(action)) {
                        method = m;
                        break;
                    }
                }
                switch (method) {
                    case PUT: {
                        status = databaseService.createDb(dbName);
                        break;
                    }
                    case DELETE: {
                        status = databaseService.dropDb(dbName);
                        break;
                    }
                    default: {
                        status = "Action parameter value is wrong";
                        break;
View Full Code Here

                    if (lastIndexOfDot + 1 == cmdStr.length()) {
                        // In this case the cmsStr = db.collectionName.
                        throw new InvalidMongoCommandException(ErrorCodes.COMMAND_EMPTY, "Command is empty");
                    }
                    String command = cmdStr.substring(lastIndexOfDot + 1, cmdStr.length());
                    DatabaseService databaseService = new DatabaseServiceImpl(connectionId);
                    int docsLimit = Integer.parseInt(limit);
                    int docsSkip = Integer.parseInt(skip);
                    String jsonStr = query.substring(startIndex + 1, endIndex);
                    return databaseService.executeQuery(dbName, command, jsonStr, fields, sortBy, docsLimit, docsSkip);
                }
            });
        return response;
    }
View Full Code Here

                JSONObject jsonResponse = new JSONObject();
                try {
                    jsonResponse.put("username", connectionDetails.getUsername());
                    jsonResponse.put("host", connectionDetails.getHostIp());
                    jsonResponse.put("port", connectionDetails.getHostPort());
                    jsonResponse.put("dbNames", new DatabaseServiceImpl(connectionId).getDbList());
                    jsonResponse.put("authMode", connectionDetails.isAuthMode());
                    jsonResponse.put("hasAdminLoggedIn", connectionDetails.isAdminLogin());
                } catch (JSONException e) {
                    logger.error(e);
                }
View Full Code Here

    @Before
    public void instantiateTestClass() throws ApplicationException {
        connectionId = loginAndGetConnectionId(request);
        // Class to be tested
        testDatabaseService = new DatabaseServiceImpl(connectionId);
    }
View Full Code Here

TOP

Related Classes of com.imaginea.mongodb.services.impl.DatabaseServiceImpl

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.