Package org.tmatesoft.svn.core.wc2
Class SvnOperation<V>
- java.lang.Object
-
- org.tmatesoft.svn.core.wc2.SvnOperation<V>
-
- Type Parameters:
V- type of returning value inrun()method
- All Implemented Interfaces:
ISvnOperationOptionsProvider
- Direct Known Subclasses:
AbstractSvnUpdate,SvnCanonicalizeUrls,SvnCat,SvnCleanup,SvnCopy,SvnDiff,SvnGetMergeInfo,SvnGetStatusSummary,SvnMarkReplaced,SvnMerge,SvnPatch,SvnReceivingOperation,SvnRelocate,SvnRepositoryOperation,SvnRepositorySyncInfo,SvnResolve,SvnRevert,SvnScheduleForAddition,SvnScheduleForRemoval,SvnSetChangelist,SvnSetWCDbVersion,SvnSuggestMergeSources,SvnUpgrade
public class SvnOperation<V> extends java.lang.Object implements ISvnOperationOptionsProvider
Base class for all Svn* operations. Encapsulates mostly used parameters, operation state, different methods used by implementations. Those parameters includes:- operation's target(s)
- operation's revision
- operation's depth
- operation's changelists
- whether to sleep after operation fails
- base implementation of
runmethod, starts the operation execution - methods for access to the factory that created the object and its options, event handler, canceler
- variety of methods for getting, setting, recognition operation's targets
- cancel the operation
- access to the authentication manager
- Version:
- 1.7
- Author:
- TMate Software Ltd.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSvnOperation(SvnOperationFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTarget(SvnTarget target)Adds one target to the operation's targets.voidcancel()Cancels the operation.protected voidensureArgumentsAreValid()protected voidensureEnoughTargets()protected voidensureHomohenousTargets()java.util.Collection<java.lang.String>getApplicableChangelists()Gets changelists to operate only on members of.ISVNAuthenticationManagergetAuthenticationManager()Gets operation's authentication manager, provided bySvnOperationFactory.getAuthenticationManager().ISVNCancellergetCanceller()Gets the cancel handler of the operation, provided bySvnOperationFactory.getCanceller().SVNDepthgetDepth()Gets the limit of the operation by depth.ISVNEventHandlergetEventHandler()Gets the event handler for the operation, provided bySvnOperationFactory.getEventHandler().SvnTargetgetFirstTarget()Returns first target of the operation.protected intgetMaximumTargetsCount()protected intgetMinimumTargetsCount()protected java.io.FilegetOperationalWorkingCopy()SvnOperationFactorygetOperationFactory()Gets the factory that created the operation.ISVNOptionsgetOptions()Gets operation's options, provided bySvnOperationFactory.getOptions().ISVNRepositoryPoolgetRepositoryPool()Gets the operation's pool of repositories, provided bySvnOperationFactory.getRepositoryPool().SVNRevisiongetRevision()Gets revision to operate on.SqlJetPagerJournalModegetSqliteJournalMode()java.util.Collection<SvnTarget>getTargets()Returns all targets of the operation.booleanhasFileTargets()Analyzes the targets and returns whether or not operation has at least one file in targets.booleanhasLocalTargets()Gets whether or not the operation has local targets.booleanhasRemoteTargets()Gets whether or not the operation has remote targets.protected voidinitDefaults()booleanisCancelled()Gets whether or not the operation is cancelled.booleanisChangesWorkingCopy()Gets whether the operation changes working copybooleanisSleepForTimestamp()Gets whether or not the operation should sleep after if fails.booleanisUseParentWcFormat()Gets whether or not to use parent working copy format.protected booleanneedsHomohenousTargets()Vrun()Executes the operation.voidsetApplicalbeChangelists(java.util.Collection<java.lang.String> changelists)Sets changelists to operate only on members of.voidsetDepth(SVNDepth depth)Sets the limit of the operation by depth.voidsetRevision(SVNRevision revision)Sets revision of the operation.voidsetSingleTarget(SvnTarget target)Sets one target of the operation.voidsetSleepForTimestamp(boolean isSleepForTimestamp)Sets whether or not the operation should sleep after if fails.voidsetSqliteJournalMode(SqlJetPagerJournalMode journalMode)
-
-
-
Constructor Detail
-
SvnOperation
protected SvnOperation(SvnOperationFactory factory)
-
-
Method Detail
-
getEventHandler
public ISVNEventHandler getEventHandler()
Gets the event handler for the operation, provided bySvnOperationFactory.getEventHandler(). This event handler will be dispatchedSVNEventobjects to provide detailed information about actions and progress state of version control operations performed byrun()method ofSVN*operation classes.- Specified by:
getEventHandlerin interfaceISvnOperationOptionsProvider- Returns:
- handler for events
- See Also:
ISVNEventHandler
-
getOptions
public ISVNOptions getOptions()
Gets operation's options, provided bySvnOperationFactory.getOptions().- Specified by:
getOptionsin interfaceISvnOperationOptionsProvider- Returns:
- options of the operation
-
initDefaults
protected void initDefaults()
-
setSingleTarget
public void setSingleTarget(SvnTarget target)
Sets one target of the operation.- Parameters:
target- target of the operation- See Also:
SvnTarget
-
addTarget
public void addTarget(SvnTarget target)
Adds one target to the operation's targets.- Parameters:
target- target of the operation- See Also:
SvnTarget
-
getTargets
public java.util.Collection<SvnTarget> getTargets()
Returns all targets of the operation.- Returns:
- targets of the operation
- See Also:
SvnTarget
-
getFirstTarget
public SvnTarget getFirstTarget()
Returns first target of the operation.- Returns:
- first target of the operation
- See Also:
SvnTarget
-
setDepth
public void setDepth(SVNDepth depth)
Sets the limit of the operation by depth.- Parameters:
depth- depth of the operation
-
getDepth
public SVNDepth getDepth()
Gets the limit of the operation by depth.- Returns:
- depth of the operation
-
setRevision
public void setRevision(SVNRevision revision)
Sets revision of the operation. In most cases if revision equalsSVNRevision.UNDEFINED, the operation's revision will beSVNRevision.WORKINGif target(s) are local; it will be will beSVNRevision.HEADit targets are remote.- Parameters:
revision- revision of the operation
-
getRevision
public SVNRevision getRevision()
Gets revision to operate on.- Returns:
- revision of the operation
- See Also:
setRevision(SVNRevision)
-
setApplicalbeChangelists
public void setApplicalbeChangelists(java.util.Collection<java.lang.String> changelists)
Sets changelists to operate only on members of.- Parameters:
changelists- changelists of the operation
-
getApplicableChangelists
public java.util.Collection<java.lang.String> getApplicableChangelists()
Gets changelists to operate only on members of.- Returns:
- changelists of the operation
-
getOperationFactory
public SvnOperationFactory getOperationFactory()
Gets the factory that created the operation.- Returns:
- creation factory of the operations
-
hasLocalTargets
public boolean hasLocalTargets()
Gets whether or not the operation has local targets.- Returns:
trueif the operation has local targets, otherwisefalse
-
hasRemoteTargets
public boolean hasRemoteTargets()
Gets whether or not the operation has remote targets.- Returns:
trueif the operation has remote targets, otherwisefalse
-
ensureEnoughTargets
protected void ensureEnoughTargets() throws SVNException- Throws:
SVNException
-
getMinimumTargetsCount
protected int getMinimumTargetsCount()
-
getMaximumTargetsCount
protected int getMaximumTargetsCount()
-
cancel
public void cancel()
Cancels the operation. Execution of operation will be stopped at the next point of checkingisCancelledstate. If canceler is set,ISVNCanceller.checkCancelled()is called, otherwiseSVNCancelExceptionis raised at the point of checkingisCancelledstate.
-
isCancelled
public boolean isCancelled()
Gets whether or not the operation is cancelled.- Returns:
trueif the operation is cancelled, otherwisefalse
-
run
public V run() throws SVNException
Executes the operation.- Returns:
- result depending on operation type
- Throws:
SVNException
-
ensureArgumentsAreValid
protected void ensureArgumentsAreValid() throws SVNException- Throws:
SVNException
-
needsHomohenousTargets
protected boolean needsHomohenousTargets()
-
ensureHomohenousTargets
protected void ensureHomohenousTargets() throws SVNException- Throws:
SVNException
-
getRepositoryPool
public ISVNRepositoryPool getRepositoryPool()
Gets the operation's pool of repositories, provided bySvnOperationFactory.getRepositoryPool().- Specified by:
getRepositoryPoolin interfaceISvnOperationOptionsProvider- Returns:
- pool of repositories
-
getAuthenticationManager
public ISVNAuthenticationManager getAuthenticationManager()
Gets operation's authentication manager, provided bySvnOperationFactory.getAuthenticationManager().- Specified by:
getAuthenticationManagerin interfaceISvnOperationOptionsProvider- Returns:
- authentication manager
-
getCanceller
public ISVNCanceller getCanceller()
Gets the cancel handler of the operation, provided bySvnOperationFactory.getCanceller().- Specified by:
getCancellerin interfaceISvnOperationOptionsProvider- Returns:
- cancel handler
- See Also:
cancel()
-
isSleepForTimestamp
public boolean isSleepForTimestamp()
Gets whether or not the operation should sleep after if fails.- Returns:
trueif the operation should sleep, otherwisefalse- Since:
- 1.7
- See Also:
SvnUpdate
-
setSleepForTimestamp
public void setSleepForTimestamp(boolean isSleepForTimestamp)
Sets whether or not the operation should sleep after if fails.- Parameters:
isSleepForTimestamp-trueif the operation should sleep, otherwisefalse- Since:
- 1.7
- See Also:
SvnUpdate
-
hasFileTargets
public boolean hasFileTargets()
Analyzes the targets and returns whether or not operation has at least one file in targets.- Returns:
trueif operation has at least one file in targets, otherwisefalse
-
isUseParentWcFormat
public boolean isUseParentWcFormat()
Gets whether or not to use parent working copy format.- Returns:
trueif parent working copy format should be used, otherwisefalse
-
isChangesWorkingCopy
public boolean isChangesWorkingCopy()
Gets whether the operation changes working copy- Returns:
trueif the operation changes the working copy, otherwisefalse
-
getSqliteJournalMode
public SqlJetPagerJournalMode getSqliteJournalMode()
-
setSqliteJournalMode
public void setSqliteJournalMode(SqlJetPagerJournalMode journalMode)
-
getOperationalWorkingCopy
protected java.io.File getOperationalWorkingCopy()
-
-