Class RefDirectoryUpdate
- java.lang.Object
-
- org.eclipse.jgit.lib.RefUpdate
-
- org.eclipse.jgit.internal.storage.file.RefDirectoryUpdate
-
class RefDirectoryUpdate extends RefUpdate
Updates any reference stored byRefDirectory.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jgit.lib.RefUpdate
RefUpdate.Result
-
-
Field Summary
Fields Modifier and Type Field Description private RefDirectorydatabaseprivate LockFilelockprivate booleanshouldDeref
-
Constructor Summary
Constructors Constructor Description RefDirectoryUpdate(RefDirectory r, Ref ref)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RefUpdate.ResultdoDelete(RefUpdate.Result status)Do deleteprotected RefUpdate.ResultdoLink(java.lang.String target)Do linkprotected RefUpdate.ResultdoUpdate(RefUpdate.Result status)Do updateprotected RefDirectorygetRefDatabase()Get the reference database this update modifies.protected RepositorygetRepository()Get the repository storing the database's objects.private java.lang.StringtoResultString(RefUpdate.Result status)protected booleantryLock(boolean deref)Try to acquire the lock on the reference.protected voidunlock()Releases the lock taken byRefUpdate.tryLock(boolean)if it succeeded.-
Methods inherited from class org.eclipse.jgit.lib.RefUpdate
delete, delete, disableRefLog, forceUpdate, getExpectedOldObjectId, getName, getNewObjectId, getOldObjectId, getPushCertificate, getRef, getRefLogIdent, getRefLogMessage, getResult, isDetachingSymbolicRef, isForceRefLog, isForceUpdate, isRefLogIncludingResult, link, setCheckConflicting, setDetachingSymbolicRef, setExpectedOldObjectId, setForceRefLog, setForceUpdate, setNewObjectId, setOldObjectId, setPushCertificate, setRefLogIdent, setRefLogMessage, update, update
-
-
-
-
Field Detail
-
database
private final RefDirectory database
-
shouldDeref
private boolean shouldDeref
-
lock
private LockFile lock
-
-
Constructor Detail
-
RefDirectoryUpdate
RefDirectoryUpdate(RefDirectory r, Ref ref)
-
-
Method Detail
-
getRefDatabase
protected RefDirectory getRefDatabase()
Get the reference database this update modifies.- Specified by:
getRefDatabasein classRefUpdate- Returns:
- the reference database this update modifies.
-
getRepository
protected Repository getRepository()
Get the repository storing the database's objects.- Specified by:
getRepositoryin classRefUpdate- Returns:
- the repository storing the database's objects.
-
tryLock
protected boolean tryLock(boolean deref) throws java.io.IOExceptionTry to acquire the lock on the reference.If the locking was successful the implementor must set the current identity value by calling
RefUpdate.setOldObjectId(ObjectId).- Specified by:
tryLockin classRefUpdate- Parameters:
deref- true if the lock should be taken against the leaf level reference; false if it should be taken exactly against the current reference.- Returns:
- true if the lock was acquired and the reference is likely protected from concurrent modification; false if it failed.
- Throws:
java.io.IOException- the lock couldn't be taken due to an unexpected storage failure, and not because of a concurrent update.
-
unlock
protected void unlock()
Releases the lock taken byRefUpdate.tryLock(boolean)if it succeeded.
-
doUpdate
protected RefUpdate.Result doUpdate(RefUpdate.Result status) throws java.io.IOException
Do update- Specified by:
doUpdatein classRefUpdate- Parameters:
status- aRefUpdate.Resultobject.- Returns:
result- Throws:
java.io.IOException
-
toResultString
private java.lang.String toResultString(RefUpdate.Result status)
-
doDelete
protected RefUpdate.Result doDelete(RefUpdate.Result status) throws java.io.IOException
Do delete- Specified by:
doDeletein classRefUpdate- Parameters:
status- aRefUpdate.Resultobject.- Returns:
result- Throws:
java.io.IOException
-
doLink
protected RefUpdate.Result doLink(java.lang.String target) throws java.io.IOException
Do link- Specified by:
doLinkin classRefUpdate- Parameters:
target- aStringobject.- Returns:
RefUpdate.Result.NEWon success.- Throws:
java.io.IOException
-
-