protected DAVPropStat[] getPropStat(DAVRequest request,
Document doc,
DAVProperties dp)
{
DAVProperties props = DAVFactory.createProperties(doc);
DAVProperties nfprops = null;
Element[] els = dp.getProperties();
int len = els.length;
for (int i = 0 ; i < len ; i++) {
Element el = els[i];
String ns = el.getNamespaceURI();
String propname = el.getLocalName();
if ((ns == null) || (ns.equals(WEBDAV.NAMESPACE_URI))) {
// live property
if (propname.equals(DAVNode.CREATIONDATE_NODE)) {
addCreationDate(props);
} else if (propname.equals(DAVNode.DISPLAYNAME_NODE)) {
addDisplayName(props);
} else if (propname.equals(DAVNode.GETCONTENTLANGUAGE_NODE)) {
addContentLanguage(props);
} else if (propname.equals(DAVNode.GETCONTENTTYPE_NODE)) {
addContentType(props);
} else if (propname.equals(DAVNode.GETCONTENTLENGTH_NODE)) {
addContentLength(props);
} else if (propname.equals(DAVNode.GETETAG_NODE)) {
addETag(props);
} else if (propname.equals(DAVNode.GETLASTMODIFIED_NODE)) {
addLastModified(props);
} else if (propname.equals(DAVNode.LOCKDISCOVERY_NODE)) {
addLockDiscovery(request, props);
} else if (propname.equals(DAVNode.RESOURCETYPE_NODE)) {
addResourceType(props);
} else if (propname.equals(DAVNode.SOURCE_NODE)) {
// FIXME
} else if (propname.equals(DAVNode.SUPPORTEDLOCK_NODE)) {
addSupportedLock(props);
} else { // property not found
if (nfprops == null) {
nfprops = DAVFactory.createProperties(doc);
}
Element e;
e = doc.createElementNS("http://www.w3.org/Jigsaw/Webdav/",
propname);
e.setPrefix("F");
nfprops.addNodeNS(nfprops.getNode(), (Node) e);
}
} else {
// dead property
Document pdoc = (Document)getDeadPropertiesIndex().get(ns);
if (pdoc != null) {
Element prop = pdoc.getDocumentElement();
DAVProperties dpns = DAVFactory.createProperties(prop);
Node pnode = dpns.getNodeNS(propname, ns);
if (pnode != null) {
props.addNodeNS(doc.importNode(pnode, true));
}
}
}