public LockToken lock ( boolean isShared , String depth , int timeout , String owner ) throws DAVException { // Define the request context. IContext context = newContext ( ) ; context . setDepth ( depth ) ; context . setTimeout ( timeout ) ; // Create the request body. Document document = newDocument ( ) ; LockInfo lockinfo = LockInfo . create ( document ) ; lockinfo . setIsShared ( isShared ) ; // Add the owner if it is given. if ( owner != null ) { Owner ownerEditor = lockinfo . setOwner ( ) ; ownerEditor . getElement ( ) . appendChild ( document . createTextNode ( owner ) ) ; } // Send the lock request. IResponse response = null ; try { response = davClient . lock ( locator , context , document ) ; examineResponse ( response ) ; } catch ( IOException e ) { throw new SystemException ( e ) ; } finally { closeResponse ( response ) ; } // Extract the token from the resulting context. LockToken token = new LockToken ( response . getContext ( ) . getLockToken ( ) ) ; //fServerManager.addLock(newURL(fLocator.getResourceURL()), token, depth); return token ; }
Lock this resource using the specified parameters .