livePropElement != DAVElement.BASELINE_RELATIVE_PATH) {
return DAVInsertPropAction.NOT_SUPP;
}
String value = null;
DAVResourceURI uri = resource.getResourceURI();
if (livePropElement == DAVElement.GET_LAST_MODIFIED || livePropElement == DAVElement.CREATION_DATE) {
if (resource.getType() == DAVResourceType.PRIVATE && resource.getKind() == DAVResourceKind.VCC) {
return DAVInsertPropAction.NOT_SUPP;
}
if (livePropElement == DAVElement.CREATION_DATE) {
try {
value = SVNDate.formatDate(getLastModifiedTime2(resource));
} catch (SVNException svne) {
return DAVInsertPropAction.NOT_DEF;
}
} else if (livePropElement == DAVElement.GET_LAST_MODIFIED) {
try {
value = SVNDate.formatRFC1123Date(getLastModifiedTime2(resource));
} catch (SVNException svne) {
return DAVInsertPropAction.NOT_DEF;
}
}
value = SVNEncodingUtil.xmlEncodeCDATA(value, true);
} else if (livePropElement == DAVElement.CREATOR_DISPLAY_NAME) {
if (resource.getType() == DAVResourceType.PRIVATE && resource.getKind() == DAVResourceKind.VCC) {
return DAVInsertPropAction.NOT_SUPP;
}
long committedRev = -1;
if (resource.isBaseLined() && resource.getType() == DAVResourceType.VERSION) {
committedRev = resource.getRevision();
} else if (resource.getType() == DAVResourceType.REGULAR || resource.getType() == DAVResourceType.WORKING ||
resource.getType() == DAVResourceType.VERSION) {
try {
committedRev = resource.getCreatedRevisionUsingFS(null);
} catch (SVNException svne) {
value = "###error###";
}
} else {
return DAVInsertPropAction.NOT_SUPP;
}
String lastAuthor = null;
try {
lastAuthor = resource.getAuthor(committedRev);
} catch (SVNException svne) {
value = "###error###";
}
if (lastAuthor == null) {
return DAVInsertPropAction.NOT_DEF;
}
value = SVNEncodingUtil.xmlEncodeCDATA(lastAuthor, true);
} else if (livePropElement == DAVElement.GET_CONTENT_LANGUAGE) {
return DAVInsertPropAction.NOT_SUPP;
} else if (livePropElement == DAVElement.GET_CONTENT_LENGTH) {
if (resource.isCollection() || resource.isBaseLined()) {
return DAVInsertPropAction.NOT_SUPP;
}
long fileSize = 0;
try {
fileSize = resource.getContentLength(null);
value = String.valueOf(fileSize);
} catch (SVNException e) {
value = "0";
}
} else if (livePropElement == DAVElement.GET_CONTENT_TYPE) {
if (resource.isBaseLined() && resource.getType() == DAVResourceType.VERSION) {
return DAVInsertPropAction.NOT_SUPP;
}
if (resource.getType() == DAVResourceType.PRIVATE && resource.getKind() == DAVResourceKind.VCC) {
return DAVInsertPropAction.NOT_SUPP;
}
if (resource.isCollection()) {
value = DAVResource.DEFAULT_COLLECTION_CONTENT_TYPE;
} else {
SVNPropertyValue contentType = null;
try {
contentType = resource.getProperty(null, SVNProperty.MIME_TYPE);
} catch (SVNException svne) {
//
}
if (contentType != null) {
value = contentType.getString();
} else if (!resource.isSVNClient() && getRequest().getContentType() != null) {
value = getRequest().getContentType();
} else {
value = DAVResource.DEFAULT_FILE_CONTENT_TYPE;
}
try {
SVNPropertiesManager.validateMimeType(value);
} catch (SVNException svne) {
return DAVInsertPropAction.NOT_DEF;
}
}
} else if (livePropElement == DAVElement.GET_ETAG) {
if (resource.getType() == DAVResourceType.PRIVATE && resource.getKind() == DAVResourceKind.VCC) {
return DAVInsertPropAction.NOT_SUPP;
}
value = resource.getETag();
} else if (livePropElement == DAVElement.AUTO_VERSION) {
if (getConfig().isAutoVersioning()) {
value = DEFAULT_AUTOVERSION_LINE;
} else {
return DAVInsertPropAction.NOT_DEF;
}
} else if (livePropElement == DAVElement.BASELINE_COLLECTION) {
if (resource.getType() != DAVResourceType.VERSION || !resource.isBaseLined()) {
return DAVInsertPropAction.NOT_SUPP;
}
value = DAVPathUtil.buildURI(uri.getContext(), DAVResourceKind.BASELINE_COLL, resource.getRevision(), null,
true);
} else if (livePropElement == DAVElement.CHECKED_IN) {
String s = null;
if (resource.getType() == DAVResourceType.PRIVATE && resource.getKind() == DAVResourceKind.VCC) {
long revNum = -1;
try {
revNum = resource.getLatestRevision();
s = DAVPathUtil.buildURI(uri.getContext(), DAVResourceKind.BASELINE, revNum, null, false);
StringBuffer buf = SVNXMLUtil.openCDataTag(SVNXMLUtil.DAV_NAMESPACE_PREFIX, DAVElement.HREF.getName(), s,
null, true, true, null);
value = buf.toString();
} catch (SVNException svne) {
value = "###error###";
}
} else if (resource.getType() != DAVResourceType.REGULAR) {
return DAVInsertPropAction.NOT_SUPP;
} else {
long revToUse = DAVServletUtil.getSafeCreatedRevision((FSRevisionRoot) resource.getRoot(), uri.getPath());
s = DAVPathUtil.buildURI(uri.getContext(), DAVResourceKind.VERSION, revToUse, uri.getPath(), false);
StringBuffer buf = SVNXMLUtil.openCDataTag(SVNXMLUtil.DAV_NAMESPACE_PREFIX, DAVElement.HREF.getName(), s,
null, true, true, null);
value = buf.toString();
}
} else if (livePropElement == DAVElement.VERSION_CONTROLLED_CONFIGURATION) {
if (resource.getType() != DAVResourceType.REGULAR) {
return DAVInsertPropAction.NOT_SUPP;
}
value = DAVPathUtil.buildURI(uri.getContext(), DAVResourceKind.VCC, -1, null, true);
} else if (livePropElement == DAVElement.VERSION_NAME) {
if (resource.getType() != DAVResourceType.VERSION && !resource.isVersioned()) {
return DAVInsertPropAction.NOT_SUPP;
}
if (resource.getType() == DAVResourceType.PRIVATE && resource.getKind() == DAVResourceKind.VCC) {
return DAVInsertPropAction.NOT_SUPP;
}
if (resource.isBaseLined()) {
value = String.valueOf(resource.getRevision());
} else {
try {
long committedRev = resource.getCreatedRevisionUsingFS(null);
value = String.valueOf(committedRev);
value = SVNEncodingUtil.xmlEncodeCDATA(value, true);
} catch (SVNException svne) {
value = "###error###";
}
}
} else if (livePropElement == DAVElement.BASELINE_RELATIVE_PATH) {
if (resource.getType() != DAVResourceType.REGULAR) {
return DAVInsertPropAction.NOT_SUPP;
}
value = SVNEncodingUtil.xmlEncodeCDATA(DAVPathUtil.dropLeadingSlash(uri.getPath()), true);
} else if (livePropElement == DAVElement.MD5_CHECKSUM) {
if (!resource.isCollection() && !resource.isBaseLined() && (resource.getType() == DAVResourceType.REGULAR ||
resource.getType() == DAVResourceType.VERSION || resource.getType() == DAVResourceType.WORKING)) {
try {
value = resource.getMD5Checksum(null);