Exemplo n.º 1
0
 @Override
 public synchronized void commit() throws RepositoryException {
   try {
     try {
       if (blobVersion != null) {
         try {
           blobVersion.prepare();
         } catch (IOException exc) {
           throw new BlobConflictException(exc);
         }
       }
       super.commit();
       if (blobVersion != null) {
         blobVersion.commit();
         blobVersion = null;
       }
     } finally {
       if (blobVersion != null) {
         blobVersion.rollback();
       }
     }
   } catch (IOException e) {
     throw new BlobStoreException(e);
   }
 }
Exemplo n.º 2
0
 @Override
 public synchronized void setAutoCommit(boolean auto) throws RepositoryException {
   if (!auto && isAutoCommit()) {
     try {
       try {
         if (blobVersion != null) {
           try {
             blobVersion.prepare();
           } catch (IOException exc) {
             throw new BlobConflictException(exc);
           }
         }
         super.setAutoCommit(auto);
         if (blobVersion != null) {
           blobVersion.commit();
           blobVersion = null;
         }
       } finally {
         if (blobVersion != null) {
           blobVersion.rollback();
           blobVersion = null;
         }
       }
     } catch (IOException e) {
       throw new BlobStoreException(e);
     }
   } else {
     super.setAutoCommit(auto);
   }
 }
Exemplo n.º 3
0
 public synchronized BlobObject getBlobObject(final String uri) throws RepositoryException {
   if (blobs == null) throw new RepositoryException("No configured blob store");
   try {
     if (blobVersion == null && isAutoCommit()) {
       return blobs.open(uri);
     } else if (blobVersion == null) {
       URI version = getVersionBundle();
       if (version == null) {
         blobVersion = blobs.newVersion();
       } else {
         blobVersion = blobs.newVersion(version.stringValue());
       }
       return blobVersion.open(uri);
     } else {
       return blobVersion.open(uri);
     }
   } catch (IOException exc) {
     throw new RepositoryException(exc);
   }
 }
Exemplo n.º 4
0
 @Override
 public synchronized void rollback() throws RepositoryException {
   if (blobVersion != null) {
     try {
       blobVersion.rollback();
     } catch (IOException e) {
       throw new RepositoryException(e.toString(), e);
     }
   }
   super.rollback();
   cachedObjects.clear();
 }