Package org.apache.jackrabbit.webdav.lock

Examples of org.apache.jackrabbit.webdav.lock.LockInfo


     * @param timeout
     * @param isDeep
     */
    public LockMethod(String uri, Scope lockScope, Type lockType, String owner,
                      long timeout, boolean isDeep) throws IOException {
        this(uri, new LockInfo(lockScope, lockType, owner, timeout, isDeep));
    }
View Full Code Here


            PutMethod put = new PutMethod(testuri);
            put.setRequestEntity(new StringRequestEntity("1"));
            status = this.client.executeMethod(put);
            assertTrue("status: " + status, status == 200 || status == 201 || status == 204);

            LockMethod lock = new LockMethod(testuri, new LockInfo(
                    Scope.EXCLUSIVE, Type.WRITE, "testcase", 10000, true));
            status = this.client.executeMethod(lock);
            assertEquals("status", 200, status);
            locktoken = lock.getLockToken();
            assertNotNull(locktoken);
View Full Code Here

     * @throws DavException
     */
    protected void doLock(WebdavRequest request, WebdavResponse response,
                          DavResource resource) throws IOException, DavException {

        LockInfo lockInfo = request.getLockInfo();
        if (lockInfo.isRefreshLock()) {
            // refresh any matching existing locks
            ActiveLock[] activeLocks = resource.getLocks();
            List<ActiveLock> lList = new ArrayList<ActiveLock>();
            for (ActiveLock activeLock : activeLocks) {
                // adjust lockinfo with type/scope retrieved from the lock.
                lockInfo.setType(activeLock.getType());
                lockInfo.setScope(activeLock.getScope());

                DavProperty<?> etagProp = resource.getProperty(DavPropertyName.GETETAG);
                String etag = etagProp != null ? String.valueOf(etagProp.getValue()) : "";
                if (request.matchesIfHeader(resource.getHref(), activeLock.getToken(), etag)) {
                    lList.add(resource.refreshLock(lockInfo, activeLock.getToken()));
View Full Code Here

     * @param timeout
     * @param isDeep
     */
    public LockMethod(String uri, Scope lockScope, Type lockType, String owner,
                      long timeout, boolean isDeep) throws IOException {
        this(uri, new LockInfo(lockScope, lockType, owner, timeout, isDeep));
    }
View Full Code Here

     * @throws DavException
     */
    protected void doLock(WebdavRequest request, WebdavResponse response,
                          DavResource resource) throws IOException, DavException {

        LockInfo lockInfo = request.getLockInfo();
        if (lockInfo.isRefreshLock()) {
            // refresh any matching existing locks
            ActiveLock[] activeLocks = resource.getLocks();
            List<ActiveLock> lList = new ArrayList<ActiveLock>();
            for (ActiveLock activeLock : activeLocks) {
                // adjust lockinfo with type/scope retrieved from the lock.
                lockInfo.setType(activeLock.getType());
                lockInfo.setScope(activeLock.getScope());

                DavProperty<?> etagProp = resource.getProperty(DavPropertyName.GETETAG);
                String etag = etagProp != null ? String.valueOf(etagProp.getValue()) : "";
                if (request.matchesIfHeader(resource.getHref(), activeLock.getToken(), etag)) {
                    lList.add(resource.refreshLock(lockInfo, activeLock.getToken()));
View Full Code Here

    public void testLock()
        throws Exception
    {
        assertEquals(0, resource.getLocks().length);
      
        LockInfo info = new LockInfo(Scope.EXCLUSIVE, Type.WRITE, "/", 0, false);
        lockManager.createLock(info, resource);
       
        assertEquals(1, resource.getLocks().length);
    }
View Full Code Here

    public void testLockIfResourceUnlockable()
        throws Exception
    {
        assertEquals(0, resource.getLocks().length);
      
        LockInfo info = new LockInfo(Scope.SHARED, Type.WRITE, "/", 0, false);
        try
        {
            lockManager.createLock(info, resource);
            fail("Did not throw dav exception");
        }
View Full Code Here

    }
   
    public void testGetLock()
        throws Exception
    {
        LockInfo info = new LockInfo(Scope.EXCLUSIVE, Type.WRITE, "/", 0, false);
        lockManager.createLock(info, resource);
       
        assertEquals(1, resource.getLocks().length);
       
        //Lock should exist
View Full Code Here

   
   
    public void testRefreshLockThrowsExceptionIfNoLockIsPresent()
        throws Exception
    {
        LockInfo info = new LockInfo(Scope.EXCLUSIVE, Type.WRITE, "/", 0, false);
       
        assertEquals(0, resource.getLocks().length);      
       
        try
        {
View Full Code Here

    }
   
    public void testRefreshLock()
        throws Exception
    {
        LockInfo info = new LockInfo(Scope.EXCLUSIVE, Type.WRITE, "/", 0, false);
       
        assertEquals(0, resource.getLocks().length);
       
        lockManager.createLock(info, resource);
       
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.webdav.lock.LockInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.