Ejemplo n.º 1
0
 protected Blob getValueBlob(T state) throws PropertyException {
   BlobInfo blobInfo = getBlobInfo(state);
   BlobManager blobManager = Framework.getService(BlobManager.class);
   try {
     return blobManager.readBlob(blobInfo, getRepositoryName());
   } catch (IOException e) {
     throw new PropertyException("Cannot get blob info for: " + blobInfo.key, e);
   }
 }
Ejemplo n.º 2
0
 // note, in the proxy case baseDoc may be different from the doc in the map
 @Override
 public void flush(Document baseDoc) {
   // first, write all updated blobs
   for (Entry<BaseDocument<T>, List<Pair<T, Blob>>> en : blobWriteInfosPerDoc.entrySet()) {
     BaseDocument<T> doc = en.getKey();
     for (Pair<T, Blob> pair : en.getValue()) {
       T state = pair.getLeft();
       Blob blob = pair.getRight();
       doc.setValueBlob(state, blob);
     }
   }
   // then inform the blob manager about the changed xpaths
   BlobManager blobManager = Framework.getService(BlobManager.class);
   blobManager.notifyChanges(baseDoc, xpaths);
 }
Ejemplo n.º 3
0
 protected void setValueBlob(T state, Blob blob) throws PropertyException {
   BlobInfo blobInfo = new BlobInfo();
   if (blob != null) {
     BlobManager blobManager = Framework.getService(BlobManager.class);
     try {
       blobInfo.key = blobManager.writeBlob(blob, this);
     } catch (IOException e) {
       throw new PropertyException("Cannot get blob info for: " + blob, e);
     }
     blobInfo.filename = blob.getFilename();
     blobInfo.mimeType = blob.getMimeType();
     blobInfo.encoding = blob.getEncoding();
     blobInfo.digest = blob.getDigest();
     blobInfo.length = blob.getLength() == -1 ? null : Long.valueOf(blob.getLength());
   }
   setBlobInfo(state, blobInfo);
 }