Package ca.carleton.gcrc.couch.app

Examples of ca.carleton.gcrc.couch.app.DigestComputer


      ) throws Exception {
   
    UpdateSpecifier result = new UpdateSpecifier();
   
    // Select digest computer
    DigestComputer dc = new DigestComputerSha1();
   
    // Verify main document
    if( schedule == DocumentUpdateProcess.Schedule.UPDATE_FORCED ){
      result.setDocumentModified(true);
    } else if( null == targetDoc ) {
      // Document creation
      result.setDocumentModified(true);
    } else {
      String sourceDigest = documentDigest.getDocDigest();
      String targetDigest = dc.computeDigestFromJsonObject(targetDoc);
      if( false == sourceDigest.equals(targetDigest) ){
        result.setDocumentModified(true);
      }
    }
View Full Code Here


      ) throws Exception {
   
    UpdateSpecifier result = new UpdateSpecifier();
   
    // Select digest computer
    DigestComputer dc = new DigestComputerSha1();
   
    // Verify main document
    if( schedule == DocumentUpdateProcess.Schedule.UPDATE_FORCED ){
      result.setDocumentModified(true);
    } else if( null == targetDoc ) {
      // Document creation
      result.setDocumentModified(true);
    } else {
      String sourceDigest = documentDigest.getDocDigest();
      String targetDigest = dc.computeDigestFromJsonObject(targetDoc);
      if( false == sourceDigest.equals(targetDigest) ){
        result.setDocumentModified(true);
      }
    }
View Full Code Here

      // has changed
      return true;
    }
   
    // Check type
    DigestComputer digestComputer = null;
    {
      String type = targetManifest.optString("type");
      if( null == type ){
        // Has been modified sine type is missing
        return true;
       
      } else if( DigestComputerSha1.DIGEST_COMPUTER_TYPE.equals(type) ) {
        digestComputer = sha1DigestComputer;
       
      } else {
        // Unrecognized type. Assume it was changed
        return true;
      }
    }
   
    try {
      String computedDigest = digestComputer.computeDigestFromJsonObject(targetDoc);
      if( false == computedDigest.equals(targetDigest) ) {
        // Digests are different. It was changed
        return true;
      }
    } catch(Exception e) {
View Full Code Here

TOP

Related Classes of ca.carleton.gcrc.couch.app.DigestComputer

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.