|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.harvard.mgh.purcell.gCLINE.data.Lock
public class Lock
Deal with the locking and unlocking of a folder.
Field Summary | |
---|---|
private Record |
data
|
private ErrorManager |
error
This allows us to pass errors |
private StartFrame |
frame
|
private java.lang.String |
key
The key of this particular instance of the lock. |
private java.io.File |
lockFile
The lock file. |
private org.apache.log4j.Logger |
logger
A logger for this clas |
private java.lang.String |
remoteFile
The directory that the remote lock file is in |
static java.lang.String |
UNLOCKED_KEY
|
Constructor Summary | |
---|---|
Lock(StartFrame givenFrame,
Record d)
Create a lock from a string representing the local file and set the new key. |
Method Summary | |
---|---|
boolean |
availableLock()
|
private java.lang.String |
getKey()
Get the key for this instance of the lock |
boolean |
hasLock()
|
boolean |
lockFile()
Write the key to the lock file. |
private java.lang.String |
readLock()
Read the lock code from the file. |
boolean |
stealLock()
|
boolean |
unlockFile()
Write a blank file to the lock file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String UNLOCKED_KEY
private org.apache.log4j.Logger logger
private ErrorManager error
private java.lang.String key
private java.io.File lockFile
private java.lang.String remoteFile
private Record data
private StartFrame frame
Constructor Detail |
---|
public Lock(StartFrame givenFrame, Record d)
givenFrame
- The main frame this lock is
attached to.d
- the Record that this lock is associated with.Method Detail |
---|
public boolean availableLock()
public boolean hasLock()
public boolean stealLock()
private java.lang.String getKey()
private java.lang.String readLock()
public boolean lockFile()
public boolean unlockFile()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |