content = File.createTempFile(prefix, null, null);
content.deleteOnExit();
FileOutputStream out = new FileOutputStream(content);
getRepositorySession().exportSystemView(item.getPath(), out, false, true);
out.close();
properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTLENGTH, new Long(content.length())));
properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, "text/xml"));
} catch (IOException e) {
log.error("Error while property initialization: "+e.getMessage());
} catch (RepositoryException e) {
log.error("Error while property initialization: "+e.getMessage());
}
Node n = (Node)item;
// overwrite the default modificationtime if possible
try {
if (n.hasProperty(JcrConstants.JCR_LASTMODIFIED)) {
setModificationTime(n.getProperty(JcrConstants.JCR_LASTMODIFIED).getLong());
}
} catch (RepositoryException e) {
log.warn("Error while accessing jcr:lastModified property");
}
// overwrite the default creation date if possible
try {
if (n.hasProperty(JcrConstants.JCR_CREATED)) {
long creationTime = n.getProperty(JcrConstants.JCR_CREATED).getValue().getLong();
properties.add(new DefaultDavProperty(DavPropertyName.CREATIONDATE,
DavConstants.creationDateFormat.format(new Date(creationTime))));
}
} catch (RepositoryException e) {
log.warn("Error while accessing jcr:created property");
}
// add node-specific resource properties
try {
properties.add(new NodeTypeProperty(JCR_PRIMARYNODETYPE, n.getPrimaryNodeType(), false));
properties.add(new NodeTypeProperty(JCR_MIXINNODETYPES, n.getMixinNodeTypes(), false));
properties.add(new DefaultDavProperty(JCR_INDEX, new Integer(n.getIndex()), true));
addHrefProperty(JCR_REFERENCES, n.getReferences(), true);
if (n.isNodeType(JcrConstants.MIX_REFERENCEABLE)) {
properties.add(new DefaultDavProperty(JCR_UUID, n.getUUID(), true));
}
} catch (RepositoryException e) {
log.error("Failed to retrieve primary nodetype property: " + e.getMessage());
}
try {