}
private void writeLockDiscoveryElements(ITransaction transaction,
XMLWriter generatedXML, String path) {
LockedObject lo = _resourceLocks.getLockedObjectByPath(transaction,
path);
if (lo != null && !lo.hasExpired()) {
generatedXML.writeElement("DAV::lockdiscovery", XMLWriter.OPENING);
generatedXML.writeElement("DAV::activelock", XMLWriter.OPENING);
generatedXML.writeElement("DAV::locktype", XMLWriter.OPENING);
generatedXML.writeProperty("DAV::" + lo.getType());
generatedXML.writeElement("DAV::locktype", XMLWriter.CLOSING);
generatedXML.writeElement("DAV::lockscope", XMLWriter.OPENING);
if (lo.isExclusive()) {
generatedXML.writeProperty("DAV::exclusive");
} else {
generatedXML.writeProperty("DAV::shared");
}
generatedXML.writeElement("DAV::lockscope", XMLWriter.CLOSING);
generatedXML.writeElement("DAV::depth", XMLWriter.OPENING);
if (_depth == INFINITY) {
generatedXML.writeText("Infinity");
} else {
generatedXML.writeText(String.valueOf(_depth));
}
generatedXML.writeElement("DAV::depth", XMLWriter.CLOSING);
String[] owners = lo.getOwner();
if (owners != null) {
for (int i = 0; i < owners.length; i++) {
generatedXML.writeElement("DAV::owner", XMLWriter.OPENING);
generatedXML.writeElement("DAV::href", XMLWriter.OPENING);
generatedXML.writeText(owners[i]);
generatedXML.writeElement("DAV::href", XMLWriter.CLOSING);
generatedXML.writeElement("DAV::owner", XMLWriter.CLOSING);
}
} else {
generatedXML.writeElement("DAV::owner", XMLWriter.NO_CONTENT);
}
int timeout = (int) (lo.getTimeoutMillis() / 1000);
String timeoutStr = new Integer(timeout).toString();
generatedXML.writeElement("DAV::timeout", XMLWriter.OPENING);
generatedXML.writeText("Second-" + timeoutStr);
generatedXML.writeElement("DAV::timeout", XMLWriter.CLOSING);
String lockToken = lo.getID();
generatedXML.writeElement("DAV::locktoken", XMLWriter.OPENING);
generatedXML.writeElement("DAV::href", XMLWriter.OPENING);
generatedXML.writeText("opaquelocktoken:" + lockToken);
generatedXML.writeElement("DAV::href", XMLWriter.CLOSING);