Package ca.carleton.gcrc.couch.client

Examples of ca.carleton.gcrc.couch.client.CouchDb


    if( null == dumpDir ) {
      throw new Exception("--dump-dir must be specified");
    }
   
    // Get CouchDb client
    CouchDb couchDb = dumpSettings.createCouchDb();
   
    // Create dump process
    DumpListener listener = new DumpListener( dumpSettings.getOutStream() );
    DbDumpProcess dumpProcess = new DbDumpProcess(couchDb, dumpDir);
    List<String> docIds = dumpSettings.getDocIds();
View Full Code Here


    if( null == dumpDir ) {
      throw new Exception("--dump-dir must be specified");
    }
   
    // Get CouchDb client
    CouchDb couchDb = dumpSettings.createCouchDb();
   
    // Create restore process
    DbRestoreListener listener = new RestoreListener(dumpSettings.getOutStream());
    DbRestoreProcess restoreProcess = new DbRestoreProcess(couchDb, dumpDir);
    restoreProcess.setListener(listener);
View Full Code Here

  public CouchDb createCouchDb() throws Exception {
   
    CouchClient couchClient = createCouchClient();
   
    // Get database from Couch Client
    CouchDb couchDb = null;
    {
      if( false == couchClient.databaseExists(dbName) ) {
        throw new Exception("Can not find a database with the name: "+dbName);
      }
      couchDb = couchClient.getDatabase(dbName);
View Full Code Here

    ) throws Exception {
   
    CouchClient couchClient = createCouchClient(gs, atlasProperties);
   
    // Get database from Couch Client
    CouchDb couchDb = null;
    {
      String dbName = atlasProperties.getCouchDbName();
      if( false == couchClient.databaseExists(dbName) ) {
        couchClient.createDatabase(dbName);
      }
View Full Code Here

    }
   
    // Load properties for atlas
    AtlasProperties atlasProperties = AtlasProperties.fromAtlasDir(atlasDir);
   
    CouchDb couchDb = CommandSupport.createCouchDb(gs, atlasProperties);
   
    if( selectSkeletonDocuments ){
      SkeletonDocumentsDetector docFinder = new SkeletonDocumentsDetector(couchDb,gs);
      docIds.addAll( docFinder.getSkeletonDocIds() );
    }
View Full Code Here

    gs.getOutStream().println("Restoring from "+dumpDir.getAbsolutePath());

    // Load properties for atlas
    AtlasProperties atlasProperties = AtlasProperties.fromAtlasDir(atlasDir);
   
    CouchDb couchDb = CommandSupport.createCouchDb(gs, atlasProperties);
   
    DbRestoreListener listener = new RestoreListener(gs.getOutStream());
   
    DbRestoreProcess restoreProcess = new DbRestoreProcess(couchDb, dumpDir);
    restoreProcess.setListener(listener);
View Full Code Here

    for(Cookie cookie : cookies){
      contextCookie.setCookie(cookie.getName(), cookie.getValue());
    }
   
    CouchFactory factory = new CouchFactory();
    CouchDb couchDb = factory.getDb(contextCookie, userDb);

    CouchSession session = couchDb.getClient().getSession();
    CouchUserContext userContext = session.getCurrentUserContext();
   
    return userContext;
  }
View Full Code Here

  }
 
  private void activity() {
    JSONObject agreementDoc = null;
    try {
      CouchDb db = documentDbDesignDocument.getDatabase();
      boolean exist = db.documentExists("org.nunaliit.user_agreement");
      if( exist ) {
        agreementDoc = db.getDocument("org.nunaliit.user_agreement");
      } else {
        logger.error("User agreement document not found in database");
        waitMillis(60 * 1000); // wait a minute
        return;
      };
View Full Code Here

        throw new ServletException("Unable to find design document source for user auth");
      }
    }
   
    try {
      CouchDb userDb = couchClient.getDatabase("_users");
      DocumentUpdateProcess updateProcess = new DocumentUpdateProcess(userDb);
      updateProcess.setListener(UpdateListener._singleton);
     
      FSEntry fileEntry = new FSEntryFile(ddDir);
      Document doc = DocumentFile.createDocument(fileEntry);
View Full Code Here

  }

  private void initUserDesignDocument(ServletContext servletContext) throws ServletException {
    // Update document
    try {
      CouchDb userDb = couchClient.getDatabase("_users");
      UserDesignDocumentImpl.updateDesignDocument(userDb);
    } catch(Exception e) {
      throw new ServletException("Error while updating user design document",e);
    }
  }
View Full Code Here

TOP

Related Classes of ca.carleton.gcrc.couch.client.CouchDb

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.