Package ca.carleton.gcrc.couch.client

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


    this.atlasName = atlasName;
    this.mailDelivery = mailDelivery;
//    this.couchDb = couchDb;
   
    // Set up user database access
    CouchClient couchClient = couchDb.getClient();
    userDesignDocument = UserDesignDocumentImpl.getUserDesignDocument(couchClient);
  }
View Full Code Here


    this.atlasName = atlasName;
    this.mailDelivery = mailDelivery;
   
    // Set up user database access
    CouchClient couchClient = couchDb.getClient();
    userDesignDocument = UserDesignDocumentImpl.getUserDesignDocument(couchClient);
  }
View Full Code Here

      for(Cookie cookie : cookies){
        contextCookie.setCookie(cookie.getName(), cookie.getValue());
      }
    }
   
    CouchClient client = documentDesign.getDatabase().getClient();
   
    CouchFactory factory = new CouchFactory();
    CouchClient userClient = factory.getClient(contextCookie, client);
   
    CouchSession session = userClient.getSession();
    CouchAuthenticationContext authContext = session.getAuthenticationContext();
   
    return authContext;
  }
View Full Code Here

      GlobalSettings gs
      ,AtlasProperties atlasProperties
      ) throws Exception {
     
      // Create couch client
      CouchClient couchClient = null;
      {
        Properties couchClientProps = new Properties();
        couchClientProps.put("couchdb.server", atlasProperties.getCouchDbUrl().toExternalForm());
        couchClientProps.put("couchdb.user", atlasProperties.getCouchDbAdminUser());
        couchClientProps.put("couchdb.password", atlasProperties.getCouchDbAdminPassword());
   
        CouchFactory couchFactory = new CouchFactory();
        couchClient = couchFactory.getClient(couchClientProps);
      }
     
      // Get _user database from Couch Client
      CouchDb couchDb = null;
      {
        String dbName = "_users";
        if( false == couchClient.databaseExists(dbName) ) {
          throw new Exception("Unable to access _users database");
        }
        couchDb = couchClient.getDatabase(dbName);
      }
     
      DocumentUpdateProcess updateProcess = new DocumentUpdateProcess(couchDb);
      DocumentUpdateListener l = new UpdateProgress(gs);
      updateProcess.setListener(l);
View Full Code Here

  }

  public CouchClient createCouchClient() throws Exception {
   
    // Create couch client
    CouchClient couchClient = null;
    {
      Properties couchClientProps = new Properties();
      couchClientProps.put("couchdb.server", server);
     
      if( null != user && null != password ) {
        couchClientProps.put("couchdb.user", user);
        couchClientProps.put("couchdb.password", password);
      }
 
      CouchFactory couchFactory = new CouchFactory();
      couchClient = couchFactory.getClient(couchClientProps);
     
      // Verify that we can connect to the server
      try {
        couchClient.validateContext();
      } catch(Exception e) {
        throw new Exception("Unable to connect to the server. Probably a problem with server URL, user name or password.",e);
      }
    }
    return couchClient;
View Full Code Here

    return couchClient;
  }

  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);
    }
    return couchDb;
  }
View Full Code Here

    GlobalSettings gs
    ,AtlasProperties atlasProperties
    ) throws Exception {
   
    // Create couch client
    CouchClient couchClient = null;
    {
      Properties couchClientProps = new Properties();
      couchClientProps.put("couchdb.server", atlasProperties.getCouchDbUrl().toExternalForm());
      couchClientProps.put("couchdb.user", atlasProperties.getCouchDbAdminUser());
      couchClientProps.put("couchdb.password", atlasProperties.getCouchDbAdminPassword());
 
      CouchFactory couchFactory = new CouchFactory();
      couchClient = couchFactory.getClient(couchClientProps);
     
      // Verify that we can connect to the server
      try {
        couchClient.validateContext();
      } catch(Exception e) {
        throw new Exception("Unable to connect to the server. Probably wrong user name or password.",e);
      }
    }
    return couchClient;
View Full Code Here

  static public CouchDb createCouchDb(
    GlobalSettings gs
    ,AtlasProperties atlasProperties
    ) 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);
      }
      couchDb = couchClient.getDatabase(dbName);
    }
    return couchDb;
  }
View Full Code Here

    this.atlasName = atlasName;
    this.mailDelivery = mailDelivery;
//    this.couchDb = couchDb;
   
    // Set up user database access
    CouchClient couchClient = couchDb.getClient();
    userDesignDocument = UserDesignDocumentImpl.getUserDesignDocument(couchClient);
  }
View Full Code Here

    this.atlasName = atlasName;
    this.mailDelivery = mailDelivery;
//    this.couchDb = couchDb;
   
    // Set up user database access
    CouchClient couchClient = couchDb.getClient();
    userDesignDocument = UserDesignDocumentImpl.getUserDesignDocument(couchClient);
  }
View Full Code Here

TOP

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

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.