org.abstracthorizon.danube.webdav.fs
Class FSLockingMechanism

java.lang.Object
  extended by org.abstracthorizon.danube.webdav.lock.impl.SimpleInMemoryLockingMechanism
      extended by org.abstracthorizon.danube.webdav.fs.FSLockingMechanism
All Implemented Interfaces:
LockingMechanism

public class FSLockingMechanism
extends SimpleInMemoryLockingMechanism

Locking mechanism that locks files on the file system by using RandomAccessFile to open the file with "rw" attributes. Unlocking is done by closing that file.

Note: So far it is confirmed that it works only on Windows machines

Author:
Daniel Sendula

Field Summary
protected  Map<Object,RandomAccessFile> fsLocks
          Map of locks
 
Fields inherited from class org.abstracthorizon.danube.webdav.lock.impl.SimpleInMemoryLockingMechanism
harvestMinimumInterval, lockResources, nextHarvested, resourcesLocks, tokenLocks
 
Fields inherited from interface org.abstracthorizon.danube.webdav.lock.LockingMechanism
SCOPE_EXCLUSIVE, SCOPE_NONE, SCOPE_SHARED, TYPE_WRITE
 
Constructor Summary
FSLockingMechanism()
          Constructor
 
Method Summary
 boolean lockResource(Lock lock, Object resource)
          Locks the file
 void unlockResources(Lock lock)
          Unlocks the file
 
Methods inherited from class org.abstracthorizon.danube.webdav.lock.impl.SimpleInMemoryLockingMechanism
createLock, createLockImpl, findLock, getHarvestMinimumInterval, getLocks, getResources, getSupportedLockScopes, harvestLocks, isAccessAllowed, isLocked, removeLock, removeLocks, setHarvestMinimumInterval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fsLocks

protected Map<Object,RandomAccessFile> fsLocks
Map of locks

Constructor Detail

FSLockingMechanism

public FSLockingMechanism()
Constructor

Method Detail

lockResource

public boolean lockResource(Lock lock,
                            Object resource)
Locks the file

Specified by:
lockResource in interface LockingMechanism
Overrides:
lockResource in class SimpleInMemoryLockingMechanism
Parameters:
lock - lock
resource - a file
Returns:
true if file is locked

unlockResources

public void unlockResources(Lock lock)
Unlocks the file

Specified by:
unlockResources in interface LockingMechanism
Overrides:
unlockResources in class SimpleInMemoryLockingMechanism
Parameters:
lock - lock


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.