if (responses.length != 1) {
throw new ItemNotFoundException("Unable to retrieve the PropertyInfo. No such property " + uri);
}
MultiStatusResponse response = responses[0];
DavPropertySet props = response.getProperties(DavServletResponse.SC_OK);
int propertyType = PropertyType.valueFromName(props.get(JCR_TYPE).getValue().toString());
if (propertyType == PropertyType.BINARY) {
DavProperty<?> lengthsProp = props.get(JCR_LENGTHS);
if (lengthsProp != null) {
// multivalued binary property
long[] lengths = ValueUtil.lengthsFromXml(lengthsProp.getValue());
QValue[] qValues = new QValue[lengths.length];
for (int i = 0 ; i < lengths.length ; i ++) {
qValues[i] = getQValueFactory(sessionInfo).create(lengths[i], uri, i);
}
return new PropertyInfoImpl(propertyId, p, propertyType, qValues);
} else {
// single valued binary property
long length = Long.parseLong(props.get(JCR_LENGTH).getValue().toString());
QValue qValue = getQValueFactory(sessionInfo).create(length, uri, 0) ;
return new PropertyInfoImpl(propertyId, p, propertyType, qValue);
}
} else if (props.contains(JCR_GET_STRING)) {
// single valued non-binary property
String str = props.get(JCR_GET_STRING).getValue().toString();
QValue qValue = ValueFormat.getQValue(str, propertyType, getNamePathResolver(sessionInfo), getQValueFactory(sessionInfo));
return new PropertyInfoImpl(propertyId, p, propertyType, qValue);
} else {
// multivalued non-binary property or some other property that
// didn't expose the JCR_GET_STRING dav property.