Package com.imaginea.mongodb.exceptions

Examples of com.imaginea.mongodb.exceptions.ApplicationException


    @Override
    public void disconnectConnection(String connectionId) throws ApplicationException {
        String[] split = connectionId.split("_");
        if (split.length != 2) {
            throw new ApplicationException(ErrorCodes.INVALID_CONNECTION, "Invalid Connection");
        }
        String connectionDetailsHashCode = String.valueOf(split[1]);
        Collection<MongoConnectionDetails> mongoConnectionDetailsList = allConnectionDetails.get(connectionDetailsHashCode);
        if (mongoConnectionDetailsList == null) {
            throw new ApplicationException(ErrorCodes.INVALID_CONNECTION, "Invalid Connection");
        }
        Iterator<MongoConnectionDetails> mongoConnectionDetailsIterator = mongoConnectionDetailsList.iterator();
        while (mongoConnectionDetailsIterator.hasNext()) {
            MongoConnectionDetails mongoConnectionDetails = mongoConnectionDetailsIterator.next();
            if (connectionId.equals(mongoConnectionDetails.getConnectionId())) {
                mongoConnectionDetailsIterator.remove();
                return;
            }
        }
        throw new ApplicationException(ErrorCodes.INVALID_CONNECTION, "Invalid Connection");
    }
View Full Code Here


                                   @FormParam("databases") final String databases, @Context final HttpServletRequest request) {

        String response = ErrorTemplate.execute(logger, new ResponseCallback() {
            public Object execute() throws Exception {
                if ("".equals(host) || "".equals(mongoPort)) {
                    ApplicationException e = new ApplicationException(ErrorCodes.MISSING_LOGIN_FIELDS, "Missing Login Fields");
                    return formErrorResponse(logger, e);
                }
                HttpSession session = request.getSession();
                Set<String> existingConnectionIdsInSession = (Set<String>) session.getAttribute("existingConnectionIdsInSession");
View Full Code Here

                    }
                }
                switch (method) {
                    case PUT: {
                        if ("".equals(documentData)) {
                            ApplicationException e = new DocumentException(ErrorCodes.DOCUMENT_DOES_NOT_EXIST, "Document Data Missing in Request Body");
                            result = formErrorResponse(logger, e);
                        } else {
                            DBObject document = (DBObject) JSON.parse(documentData);
                            result = documentService.insertDocument(dbName, collectionName, document);
                        }
                        break;
                    }
                    case DELETE: {
                        if ("".equals(_id)) {
                            ApplicationException e = new DocumentException(ErrorCodes.DOCUMENT_DOES_NOT_EXIST, "Document Data Missing in Request Body");
                            result = formErrorResponse(logger, e);
                        } else {
                            result = documentService.deleteDocument(dbName, collectionName, _id);
                        }
                        break;
                    }
                    case POST: {
                        if ("".equals(_id) || "".equals(keys)) {
                            ApplicationException e = new DocumentException(ErrorCodes.DOCUMENT_DOES_NOT_EXIST, "Document Data Missing in Request Body");
                            formErrorResponse(logger, e);
                        } else {
                            // New Document Keys
                            DBObject newDoc = (DBObject) JSON.parse(keys);
                            result = documentService.updateDocument(dbName, collectionName, _id, newDoc);
View Full Code Here

                                }
                                // Db not populate by test Cases
                                mongoInstance.dropDatabase(dbName);
                            } catch (MongoException m) // while dropping Db
                            {
                                throw  new ApplicationException(ErrorCodes.QUERY_EXECUTION_EXCEPTION, "Error Testing Document List", m.getCause());
                            }
                            return null;
                        }
                    });
            }
View Full Code Here

                                // Delete the document
                                mongoInstance.getDB(dbName).getCollection(collectionName).remove(documentName);

                            } catch (MongoException m) // while dropping Db
                            {
                                ApplicationException e = new ApplicationException(ErrorCodes.DOCUMENT_CREATION_EXCEPTION, "Error Testing Document insert", m.getCause());
                                throw e;
                            }
                            return null;
                        }
                    });
View Full Code Here

                                // Delete the document
                                mongoInstance.getDB(dbName).getCollection(collectionName).remove(newDocument);

                            } catch (MongoException m) // while dropping Db
                            {
                                ApplicationException e = new ApplicationException(ErrorCodes.DOCUMENT_UPDATE_EXCEPTION, "Error Testing Document update", m.getCause());
                                throw e;
                            }
                            return null;
                        }
                    });
View Full Code Here

//                  }
//                }

                            } catch (MongoException m) // while dropping Db
                            {
                                ApplicationException e = new ApplicationException(ErrorCodes.DOCUMENT_DELETION_EXCEPTION, "Error Testing Document delete", m.getCause());
                                throw e;
                            }
                            return null;
                        }
                    });
View Full Code Here

                                    assert (collNames.contains(collName));
                                    mongoInstance.dropDatabase(dbName);
                                }
                            }
                        } catch (MongoException m) {
                            ApplicationException e = new ApplicationException(ErrorCodes.GET_COLLECTION_LIST_EXCEPTION, "GET_COLLECTION_LIST_EXCEPTION", m.getCause());
                            throw e;
                        }
                        return null;
                    }
                });
View Full Code Here

                                    assert (collNames.contains(collName));
                                    mongoInstance.dropDatabase(dbName);
                                }
                            }
                        } catch (MongoException m) {
                            ApplicationException e = new ApplicationException(ErrorCodes.COLLECTION_CREATION_EXCEPTION, "COLLECTION_CREATION_EXCEPTION", m.getCause());
                            throw e;
                        }
                        return null;
                    }
                });
View Full Code Here

                                    assert (!collNames.contains(collName));
                                }
                            }
                        } catch (MongoException m) {
                            ApplicationException e = new ApplicationException(ErrorCodes.COLLECTION_DELETION_EXCEPTION, "COLLECTION_DELETION_EXCEPTION", m.getCause());
                            throw e;
                        }
                        return null;
                    }
                });
View Full Code Here

TOP

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

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.