org.tmatesoft.svn.core.wc2
Class SvnOperation<V>

java.lang.Object
  extended by org.tmatesoft.svn.core.wc2.SvnOperation<V>
Type Parameters:
V - type of returning value in run() method
All Implemented Interfaces:
ISvnOperationOptionsProvider
Direct Known Subclasses:
AbstractSvnUpdate, SvnCanonicalizeUrls, SvnCat, SvnCleanup, SvnCopy, SvnDiff, SvnGetMergeInfo, SvnGetStatusSummary, SvnMarkReplaced, SvnMerge, SvnReceivingOperation, SvnRelocate, SvnRepositoryOperation, SvnRepositorySyncInfo, SvnResolve, SvnRevert, SvnScheduleForAddition, SvnScheduleForRemoval, SvnSetChangelist, 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:

Those methods are:

See Also:
org.tmatesoft.svn.core.wc2

Constructor Summary
protected SvnOperation(SvnOperationFactory factory)
           
 
Method Summary
 void addTarget(SvnTarget target)
          Adds one target to the operation's targets.
 void cancel()
          Cancels the operation.
protected  void ensureArgumentsAreValid()
           
protected  void ensureEnoughTargets()
           
protected  void ensureHomohenousTargets()
           
 java.util.Collection<java.lang.String> getApplicableChangelists()
          Gets changelists to operate only on members of.
 ISVNAuthenticationManager getAuthenticationManager()
          Gets operation's authentication manager, provided by SvnOperationFactory.getAuthenticationManager().
 ISVNCanceller getCanceller()
          Gets the cancel handler of the operation, provided by SvnOperationFactory.getCanceller().
 SVNDepth getDepth()
          Gets the limit of the operation by depth.
 ISVNEventHandler getEventHandler()
          Gets the event handler for the operation, provided by SvnOperationFactory.getEventHandler().
 SvnTarget getFirstTarget()
          Returns first target of the operation.
protected  int getMaximumTargetsCount()
           
protected  int getMinimumTargetsCount()
           
protected  java.io.File getOperationalWorkingCopy()
           
 SvnOperationFactory getOperationFactory()
          Gets the factory that created the operation.
 ISVNOptions getOptions()
          Gets operation's options, provided by SvnOperationFactory.getOptions().
 ISVNRepositoryPool getRepositoryPool()
          Gets the operation's pool of repositories, provided by SvnOperationFactory.getRepositoryPool().
 SVNRevision getRevision()
          Gets revision to operate on.
 java.util.Collection<SvnTarget> getTargets()
          Returns all targets of the operation.
 boolean hasFileTargets()
          Analyzes the targets and returns whether or not operation has at least one file in targets.
 boolean hasLocalTargets()
          Gets whether or not the operation has local targets.
 boolean hasRemoteTargets()
          Gets whether or not the operation has remote targets.
protected  void initDefaults()
           
 boolean isCancelled()
          Gets whether or not the operation is cancelled.
 boolean isChangesWorkingCopy()
          Gets whether the operation changes working copy
 boolean isSleepForTimestamp()
          Gets whether or not the operation should sleep after if fails.
 boolean isUseParentWcFormat()
          Gets whether or not to use parent working copy format.
protected  boolean needsHomohenousTargets()
           
 V run()
          Executes the operation.
 void setApplicalbeChangelists(java.util.Collection<java.lang.String> changelists)
          Sets changelists to operate only on members of.
 void setDepth(SVNDepth depth)
          Sets the limit of the operation by depth.
 void setRevision(SVNRevision revision)
          Sets revision of the operation.
 void setSingleTarget(SvnTarget target)
          Sets one target of the operation.
 void setSleepForTimestamp(boolean isSleepForTimestamp)
          Sets whether or not the operation should sleep after if fails.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SvnOperation

protected SvnOperation(SvnOperationFactory factory)
Method Detail

getEventHandler

public ISVNEventHandler getEventHandler()
Gets the event handler for the operation, provided by SvnOperationFactory.getEventHandler(). This event handler will be dispatched SVNEvent objects to provide detailed information about actions and progress state of version control operations performed by run() method of SVN* operation classes.

Specified by:
getEventHandler in interface ISvnOperationOptionsProvider
Returns:
handler for events
See Also:
ISVNEventHandler

getOptions

public ISVNOptions getOptions()
Gets operation's options, provided by SvnOperationFactory.getOptions().

Specified by:
getOptions in interface ISvnOperationOptionsProvider
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 equals SVNRevision.UNDEFINED, the operation's revision will be SVNRevision.WORKING if target(s) are local; it will be will be SVNRevision.HEAD it 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:
true if the operation has local targets, otherwise false

hasRemoteTargets

public boolean hasRemoteTargets()
Gets whether or not the operation has remote targets.

Returns:
true if the operation has remote targets, otherwise false

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 checking isCancelled state. If canceler is set, ISVNCanceller.checkCancelled() is called, otherwise SVNCancelException is raised at the point of checking isCancelled state.


isCancelled

public boolean isCancelled()
Gets whether or not the operation is cancelled.

Returns:
true if the operation is cancelled, otherwise false

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 by SvnOperationFactory.getRepositoryPool().

Specified by:
getRepositoryPool in interface ISvnOperationOptionsProvider
Returns:
pool of repositories

getAuthenticationManager

public ISVNAuthenticationManager getAuthenticationManager()
Gets operation's authentication manager, provided by SvnOperationFactory.getAuthenticationManager().

Specified by:
getAuthenticationManager in interface ISvnOperationOptionsProvider
Returns:
authentication manager

getCanceller

public ISVNCanceller getCanceller()
Gets the cancel handler of the operation, provided by SvnOperationFactory.getCanceller().

Specified by:
getCanceller in interface ISvnOperationOptionsProvider
Returns:
cancel handler
See Also:
cancel()

isSleepForTimestamp

public boolean isSleepForTimestamp()
Gets whether or not the operation should sleep after if fails.

Returns:
true if the operation should sleep, otherwise false
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 - true if the operation should sleep, otherwise false
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:
true if operation has at least one file in targets, otherwise false

isUseParentWcFormat

public boolean isUseParentWcFormat()
Gets whether or not to use parent working copy format.

Returns:
true if parent working copy format should be used, otherwise false

isChangesWorkingCopy

public boolean isChangesWorkingCopy()
Gets whether the operation changes working copy

Returns:
true if the operation changes the working copy, otherwise false

getOperationalWorkingCopy

protected java.io.File getOperationalWorkingCopy()