Package ca.carleton.gcrc.couch.client

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


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


  private void initExport(ServletContext servletContext) throws ServletException {

    try {
      ExportConfiguration config = new ExportConfiguration();
      CouchDb couchDb = couchDd.getDatabase();
      config.setCouchDb(couchDb);
      CouchDesignDocument atlasDesign = couchDb.getDesignDocument("atlas");
      config.setAtlasDesignDocument(atlasDesign);
      servletContext.setAttribute(ExportConfiguration.CONFIGURATION_KEY, config);

    } catch(Exception e) {
      logger.error("Error configuring export service",e);
View Full Code Here

  private void initDate(ServletContext servletContext) throws ServletException {

    try {
      DateServletConfiguration config = new DateServletConfiguration();
      CouchDb couchDb = couchDd.getDatabase();
      config.setCouchDb(couchDb);
      CouchDesignDocument atlasDesign = couchDb.getDesignDocument("atlas");
      config.setAtlasDesignDocument(atlasDesign);
      servletContext.setAttribute(DateServletConfiguration.CONFIGURATION_KEY, config);

    } catch(Exception e) {
      logger.error("Error configuring export service",e);
View Full Code Here

  public void setSubmissionDbEnabled(boolean submissionDbEnabled){
    this.submissionDbEnabled = submissionDbEnabled;
  }
 
  public AtlasInfo getNunaliitAtlas(String databaseName) throws Exception {
    CouchDb db = couchClient.getDatabase(databaseName);
    JSONObject atlasDesign = db.getDocument("_design/atlas");
    JSONObject nunaliit = atlasDesign.optJSONObject("nunaliit");
    String atlasName = nunaliit.getString("name");
    boolean restricted = nunaliit.optBoolean("restricted",false);
    String submissionDbName = nunaliit.optString("submissionDbName",null);
    boolean submissionDbEnabled = nunaliit.optBoolean("submissionDbEnabled",false);
View Full Code Here

   
    if( atlasInfo.isRestricted() ){
      roles.add(atlasInfo.getAtlasName() + "_user");
    }
   
    CouchDb atlasDb = couchClient.getDatabase(atlasInfo.getDatabaseName());
    CouchDesignDocument atlasDesign = atlasDb.getDesignDocument("atlas");

    // Roles from layer definitions
    {
      CouchQuery query = new CouchQuery();
      query.setViewName("layer-definitions");
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);
      for(String docId : docFinder.getSkeletonDocIds()){
        if( couchDb.documentExists(docId) ){
          docIds.add(docId);
        } else {
          gs.getOutStream().println("Skeleton document "+docId+" has been removed from the database");
        }
      }
View Full Code Here

  static public UserDesignDocumentImpl getUserDesignDocument(CouchClient couchClient) throws Exception {
    if( false == couchClient.databaseExists("_users") ) {
      throw new Exception("_users database not found");
    }
   
    CouchDb userDb = couchClient.getDatabase("_users");
    return getUserDesignDocument(userDb);
  }
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();
    CouchAuthenticationContext userContext = session.getAuthenticationContext();
   
    return userContext;
  }
View Full Code Here

  }
 
  private void activity() {
    JSONObject agreementDoc = null;
    try {
      CouchDb db = documentDbDesignDocument.getDatabase();
      boolean exist = db.documentExists(DOC_ID_NUNALIIT_USER_AGREEMENT);
      if( exist ) {
        agreementDoc = db.getDocument(DOC_ID_NUNALIIT_USER_AGREEMENT);
      } else {
        logger.error("User agreement document not found in database");
        waitMillis(DELAY_ERROR); // wait a minute
        return;
      };
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.