Aggregator aggregator = fs.getAggregateManager().getAggregator(aggregate.getNode(), null);
boolean needsDir = true;
if (aggregator instanceof FileAggregator) {
needsDir = false;
// TODO - copy-pasted from FileAggregator, and really does not belong here...
Node content = aggregate.getNode();
if (content.isNodeType(JcrConstants.NT_FILE)) {
content = content.getNode(JcrConstants.JCR_CONTENT);
}
String mimeType = null;
if (content.hasProperty(JcrConstants.JCR_MIMETYPE)) {
try {
mimeType = content.getProperty(JcrConstants.JCR_MIMETYPE).getString();
} catch (RepositoryException e) {
// ignore
}
}
if (mimeType == null) {
// guess mime type from name
mimeType = MimeTypes.getMimeType(aggregate.getNode().getName(),
MimeTypes.APPLICATION_OCTET_STREAM);
}
needsDir = !MimeTypes.matches(aggregate.getNode().getName(), mimeType,
MimeTypes.APPLICATION_OCTET_STREAM);
if (!needsDir) {
if (content.hasProperty(JcrConstants.JCR_MIXINTYPES)) {
for (Value v : content.getProperty(JcrConstants.JCR_MIXINTYPES).getValues()) {
if (!v.getString().equals(JcrConstants.MIX_LOCKABLE)) {
needsDir = true;
break;
}
}