writer.addProperty(GitLexicon.TITLE, fileCommit.getShortMessage());
// Create the BinaryValue ...
ObjectId fileObjectId = tw.getObjectId(0);
ObjectLoader fileLoader = repository.open(fileObjectId);
BinaryKey key = new BinaryKey(fileObjectId.getName());
BinaryValue value = values.binaryFor(key, fileLoader.getSize());
if (value == null) {
// It wasn't found in the binary store ...
if (fileLoader.isLarge()) {
// Too large to hold in memory, so use the binary store (which reads the file immediately) ...
value = values.binaryFrom(fileLoader.openStream());
} else {
// This is small enough to fit into a byte[], but it still may be pretty big ...
value = new GitBinaryValue(fileObjectId, fileLoader, connector.getSourceName(), name,
connector.getMimeTypeDetector());
}
}
writer.addProperty(JcrLexicon.DATA, value);
if (connector.includeMimeType()) {
try {
String filename = spec.parameter(spec.parameterCount() - 1); // the last is 'jcr:content'
String mimeType = value.getMimeType(filename);
if (mimeType != null) writer.addProperty(JcrLexicon.MIMETYPE, mimeType);
} catch (RepositoryException e) {
// do nothing
} catch (IOException e) {
// do nothing