final UserManagementService ums = (UserManagementService) collection.getService("UserManagementService", "1.0");
final Resource res = collection.getResource(new AnyURIValue(args[1].getStringValue()).toXmldbURI().toString());
if (res != null) {
final String lockUser = ums.hasUserLock(res);
if (lockUser != null && isCalledAs("clear-lock")) {
ums.unlockResource(res);
}
return lockUser == null ? Sequence.EMPTY_SEQUENCE : new StringValue(lockUser);
} else {
logger.error("Unable to locate resource " + args[1].getStringValue());
throw new XPathException(this, "Unable to locate resource " + args[1].getStringValue());