*/
protected void initProperties() {
super.initProperties();
if (exists()) {
// resource is serialized as system-view (xml)
properties.add(new DefaultDavProperty(DavPropertyName.GETCONTENTTYPE, "text/xml"));
Node n = (Node)item;
// 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 {