switch (lockType) {
case LOCK_CREATION:
if (lockInfo_lockType.equals(E_TRANSACTION)) {
try {
NamespaceConfig namespaceConfig = token
.getNamespaceConfig();
toLockSubject = getToLockSubject();
if (lockDate == null)
lockDate = new Date((new Date()).getTime()
+ ((long) lockDuration * 1000L));
NodeLock lockToken = new NodeLock(toLockSubject.getUri(),((SubjectNode)security.getPrincipal(slideToken)).getUri(),
namespaceConfig.getCreateObjectAction().getUri(), lockDate,
inheritance, NodeLock.LOCAL, lockInfo_lockOwner);
token.setTransactionTimeout(lockDuration * 1000);
Transaction transaction = token.getTransactionManager().suspend();
//String txId = lockToken.getLockId();
String fullTxId = "<" + S_LOCK_TOKEN + lockToken.getLockId() + ">";
ExternalTransactionContext.registerContext(fullTxId, transaction);
slideToken.setExternalTx();
resp.setHeader("Lock-Token", fullTxId);
showLockDiscoveryInfo(lockToken);
} catch (Exception e) {
int statusCode = getErrorCode(e);
sendError(statusCode, e);
throw new WebdavException(statusCode);
}
} else if (lockInfo_lockType.equals(E_WRITE)) {
try {
if (!checkIfHeaders()) {
return;
}
NamespaceConfig namespaceConfig = token
.getNamespaceConfig();
toLockSubject = getToLockSubject();
NodeLock lockToken = null;
inheritance = (depth != 0);
boolean exclusive = !(lockInfo_lockScope.equals(E_SHARED));
if (lockDate == null)
lockDate = new Date((new Date()).getTime()
+ ((long) lockDuration * 1000L));
lockToken = new NodeLock(toLockSubject,
(SubjectNode) security.getPrincipal(slideToken),
namespaceConfig.getCreateObjectAction(), lockDate,
inheritance, exclusive, lockInfo_lockOwner);
lock.lock(slideToken, lockToken);
// Set the lock-token header
// [RFC 2518, 9.5] " The Lock-Token response header is used