Package v7db.files.spi

Examples of v7db.files.spi.StoredContent


    ReferenceTracking refs = new MongoReferenceTracking(mongo.getDB("test")
        .getCollection("v7files.refs"));

    Object owner = new DBRef(null, "test", "test");

    refs.updateReferences(owner, new StoredContent(new byte[20], 1000));

    assertMockMongoFieldContains(new byte[20], "test.v7files.refs", owner,
        "refs");
    assertMockMongoFieldContains(new byte[20], "test.v7files.refs", owner,
        "refHistory");
View Full Code Here


    Mongo mongo = getMongo();

    ReferenceTracking refs = new MongoReferenceTracking(mongo.getDB("test")
        .getCollection("v7files.refs"));

    refs.updateReferences("x", new StoredContent(new byte[20], 1000));

    assertMockMongoFieldContains(new byte[20], "test.v7files.refs", "x",
        "refs");
    assertMockMongoFieldContains(new byte[20], "test.v7files.refs", "x",
        "refHistory");
View Full Code Here

      return new InlineContent(inline);
    }
    byte[] sha = (byte[]) metaData.get("sha");
    if (sha == null)
      return null;
    return new StoredContent(sha, BSONUtils.getRequiredLong(metaData,
        "length"));
  }
View Full Code Here

      return base;

    }

    if (pointer instanceof StoredContent) {
      StoredContent p = (StoredContent) pointer;
      byte[] sha = p.getBaseSHA();

      Content base = getContent(sha);
      if (base == null)
        throw new IllegalArgumentException("base SHA not found: "
            + Hex.encodeHexString(sha));

      if (p.getLength() != base.getLength()) {
        return new OffsetAndLength(base, 0, p.getLength());
      }

      return base;

    }
View Full Code Here

    long existing = contentCollection.count(new BasicDBObject(_ID, sha));
    if (existing == 0) {
      x.put(_ID, sha);
      contentCollection.insert(x, WriteConcern.SAFE);
    }
    return new StoredContent(sha, length);
  }
View Full Code Here

    String store = MapUtils.getString(data, "store");
    if (store == null || "raw".equals(store)) {
      if (data.containsKey("in"))
        return InlineContent.deserialize(data);
      if (data.containsKey("sha")) {
        return new StoredContent((byte[]) data.get("sha"), MapUtils
            .getRequiredLong(data, "length")).loadOrLazyLoad(this,
            8 * 1024);
      }
      throw new UnsupportedOperationException(data.toString());
    }
View Full Code Here

TOP

Related Classes of v7db.files.spi.StoredContent

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.