@Override
protected void initProperties() {
super.initProperties();
if (exists()) {
try {
Property prop = (Property)item;
int type = prop.getType();
// set the content type
String contentType;
if (isMultiple()) {
contentType = IOUtil.buildContentType("text/xml","utf-8");
} else {
contentType = IOUtil.buildContentType(JcrValueType.contentTypeFromType(type), "utf-8");
}
properties.add(new DefaultDavProperty<String>(DavPropertyName.GETCONTENTTYPE, contentType));
// add jcr-specific resource properties
properties.add(new DefaultDavProperty<String>(JCR_TYPE, PropertyType.nameFromValue(type)));
if (isMultiple()) {
properties.add(new ValuesProperty(prop.getValues()));
properties.add(new LengthsProperty(prop.getLengths()));
} else {
properties.add(new ValuesProperty(prop.getValue()));
long length = prop.getLength();
properties.add(new DefaultDavProperty<String>(JCR_LENGTH, String.valueOf(length), true));
}
} catch (RepositoryException e) {
log.error("Failed to retrieve resource properties: "+e.getMessage());
}