Class SvnOperationFactory

java.lang.Object
org.tmatesoft.svn.core.wc2.SvnOperationFactory
All Implemented Interfaces:
ISvnOperationOptionsProvider

public class SvnOperationFactory extends Object implements ISvnOperationOptionsProvider
Represents factory for the Svn* operations. Contains corresponding create*() methods for all supported operations. Provides operation options by implementing ISvnOperationOptionsProvider interface. Handles working copy access and provides access to it getWcContext(), isAutoCloseContext(). Has set of working copy utility methods: getWorkingCopyRoot(File, boolean), isWorkingCopyRoot(File), isVersionedDirectory(File), detectWcGeneration(File, boolean), setPrimaryWcGeneration(SvnWcGeneration), isPrimaryWcGenerationOnly()
Version:
1.7
Author:
TMate Software Ltd.
  • Constructor Details

    • SvnOperationFactory

      public SvnOperationFactory()
      Creates operation factory and initializes it with empty context.
    • SvnOperationFactory

      public SvnOperationFactory(org.tmatesoft.svn.core.internal.wc17.SVNWCContext context)
      Creates operation factory and initializes it with context. If context is set, retrieves its options and eventHandler and sets autoCloseContext to false, otherwise sets autoCloseContext to true.
      Parameters:
      context - operation's context
  • Method Details

    • isAutoCloseContext

      public boolean isAutoCloseContext()
      Returns whether to dispose context when operation finishes.
      Returns:
      true if the context should be disposed, otherwise false
    • setAutoCloseContext

      public void setAutoCloseContext(boolean autoCloseContext)
      Sets whether to dispose context when operation finishes.
      Parameters:
      autoCloseContext - true if the context should be disposed, otherwise false
    • getAuthenticationManager

      public ISVNAuthenticationManager getAuthenticationManager()
      Gets operation's authentication manager. If not set, creates default authentication manager.
      Specified by:
      getAuthenticationManager in interface ISvnOperationOptionsProvider
      Returns:
      authentication manager
    • getCanceller

      public ISVNCanceller getCanceller()
      Gets the cancel handler of the operation. If client's canceler is not set, returns eventHandler as a canceler.
      Specified by:
      getCanceller in interface ISvnOperationOptionsProvider
      Returns:
      cancel handler
    • getEventHandler

      public ISVNEventHandler getEventHandler()
      Gets the event handler for the operation. This event handler will be dispatched SVNEvent objects to provide detailed information about actions and progress state of version control operations. If wcContext is set, returns SVNWCContext.getEventHandler()
      Specified by:
      getEventHandler in interface ISvnOperationOptionsProvider
      Returns:
      handler for events
      See Also:
    • getOperationHandler

      public ISvnOperationHandler getOperationHandler()
      Get a callback that is called before and after each operation
      Returns:
      a callback that is called before and after each operation
    • getRepositoryPool

      public ISVNRepositoryPool getRepositoryPool()
      Gets the pool of repositories. If pool is not created, creates DefaultSVNRepositoryPool with the authentication manager, options, and autoDisposeRepositoryPool = true.
      Specified by:
      getRepositoryPool in interface ISvnOperationOptionsProvider
      Returns:
      pool of repositories
    • getOptions

      public ISVNOptions getOptions()
      Gets operation's options. If options are not set, creates default readonly options.
      Specified by:
      getOptions in interface ISvnOperationOptionsProvider
      Returns:
      options of the operation
    • setAuthenticationManager

      public void setAuthenticationManager(ISVNAuthenticationManager authenticationManager)
      Sets operation's authentication manager. If repositoryPool is set, set its authentication manager to this value.
      Parameters:
      authenticationManager - authentication manager
    • setCanceller

      public void setCanceller(ISVNCanceller canceller)
      Sets the cancel handler of the operation.
      Parameters:
      canceller - cancel handler
    • setEventHandler

      public void setEventHandler(ISVNEventHandler eventHandler)
      Sets the event handler for the operation. This event handler will be dispatched SVNEvent objects to provide detailed information about actions and progress state of version control operations. If wcContext is set, sets its event handler to this one. If wcContext is not set, disposes it.
      Parameters:
      eventHandler - handler for events
      See Also:
    • setOptions

      public void setOptions(ISVNOptions options)
      Sets operation's options and disposes working copy context.
      Parameters:
      options - options of the operation
    • setRepositoryPool

      public void setRepositoryPool(ISVNRepositoryPool repositoryPool)
      Sets pool of repositories. If repositoryPool is not nullsets autoDisposeRepositoryPool to false, otherwise to true
      Parameters:
      repositoryPool - pool of repositories
    • setOperationHandler

      public void setOperationHandler(ISvnOperationHandler operationHandler)
      Sets a callback that is called before and after each operation
      Parameters:
      operationHandler - callback to call before and after operation
    • dispose

      public void dispose()
      Disposes context and repository pool if needed.
    • createAnnotate

      public SvnAnnotate createAnnotate()
      Creates annotate operation.
      Returns:
      new SvnAnnotate object
    • createCat

      public SvnCat createCat()
      Creates cat operation.
      Returns:
      new SvnCat object
    • createImport

      public SvnImport createImport()
      Creates import operation.
      Returns:
      new SvnImport object
    • createCopy

      public SvnCopy createCopy()
      Creates copy operation.
      Returns:
      new SvnCat object
    • createRemoteCopy

      public SvnRemoteCopy createRemoteCopy()
      Creates remote copy operation.
      Returns:
      new SvnRemoteCopy object
    • createRemoteMkDir

      public SvnRemoteMkDir createRemoteMkDir()
      Creates remote make directory operation.
      Returns:
      new SvnRemoteMkDir object
    • createRemoteSetProperty

      public SvnRemoteSetProperty createRemoteSetProperty()
      Creates remote set property operation.
      Returns:
      new SvnRemoteSetProperty object
    • createSetChangelist

      public SvnSetChangelist createSetChangelist()
      Creates set changelist operation.
      Returns:
      new SvnSetChangelist object
    • createGetChangelistPaths

      public SvnGetChangelistPaths createGetChangelistPaths()
      Creates get changelist paths operation.
      Returns:
      new SvnGetChangelistPaths object
    • createSetLock

      public SvnSetLock createSetLock()
      Creates set lock operation.
      Returns:
      new SvnSetLock object
    • createUnlock

      public SvnUnlock createUnlock()
      Creates unlock operation.
      Returns:
      new SvnUnlock object
    • createUpgrade

      public SvnUpgrade createUpgrade()
      Creates upgrade operation.
      Returns:
      new SvnUpgrade object
    • createGetInfo

      public SvnGetInfo createGetInfo()
      Creates get info operation.
      Returns:
      new SvnGetInfo object
    • createGetProperties

      public SvnGetProperties createGetProperties()
      Creates get properties operation.
      Returns:
      new SvnGetProperties object
    • createGetStatus

      public SvnGetStatus createGetStatus()
      Creates get status operation.
      Returns:
      new SvnGetStatus object
    • createUpdate

      public SvnUpdate createUpdate()
      Creates update operation.
      Returns:
      new SvnUpdate object
    • createSwitch

      public SvnSwitch createSwitch()
      Creates switch operation.
      Returns:
      new SvnSwitch object
    • createCheckout

      public SvnCheckout createCheckout()
      Creates checkout operation.
      Returns:
      new SvnCheckout object
    • createRelocate

      public SvnRelocate createRelocate()
      Creates relocate operation.
      Returns:
      new SvnRelocate object
    • createExport

      public SvnExport createExport()
      Creates export operation.
      Returns:
      new SvnExport object
    • createScheduleForAddition

      public SvnScheduleForAddition createScheduleForAddition()
      Creates add operation.
      Returns:
      new SvnScheduleForAddition object
    • createCommit

      public SvnCommit createCommit()
      Creates commit operation.
      Returns:
      new SvnCommit object
    • createScheduleForRemoval

      public SvnScheduleForRemoval createScheduleForRemoval()
      Creates delete operation.
      Returns:
      new SvnScheduleForRemoval object
    • createMarkReplaced

      public SvnMarkReplaced createMarkReplaced()
      Creates mark replaced operation.
      Returns:
      new SvnMarkReplaced object
    • createRevert

      public SvnRevert createRevert()
      Creates revert operation.
      Returns:
      new SvnRevert object
    • createSetProperty

      public SvnSetProperty createSetProperty()
      Creates set property operation.
      Returns:
      new SvnSetProperty object
    • createLog

      public SvnLog createLog()
      Creates log operation.
      Returns:
      new SvnLog object
    • createMkDir

      public SvnRemoteMkDir createMkDir()
      Creates remote make directory operation.
      Returns:
      new SvnRemoteMkDir object
    • createRemoteDelete

      public SvnRemoteDelete createRemoteDelete()
      Creates remote delete operation.
      Returns:
      new SvnRemoteDelete object
    • createMerge

      public SvnMerge createMerge()
      Creates merge operation.
      Returns:
      new SvnMerge object
    • createDiff

      public SvnDiff createDiff()
      Creates diff operation.
      Returns:
      new SvnDiff object
    • createPatch

      public SvnPatch createPatch()
      Creates patch operation.
      Returns:
      new SvnPatch object
    • createDiffSummarize

      public SvnDiffSummarize createDiffSummarize()
      Creates diff summarize operation.
      Returns:
      new SvnDiffSummarize object
    • createSuggestMergeSources

      public SvnSuggestMergeSources createSuggestMergeSources()
      Creates suggest merge sources operation.
      Returns:
      new SvnSuggestMergeSources object
    • createGetMergeInfo

      public SvnGetMergeInfo createGetMergeInfo()
      Creates get merge info operation.
      Returns:
      new SvnGetMergeInfo object
    • createLogMergeInfo

      public SvnLogMergeInfo createLogMergeInfo()
      Creates log merge info operation.
      Returns:
      new SvnLogMergeInfo object
    • createResolve

      public SvnResolve createResolve()
      Creates resolve operation.
      Returns:
      new SvnResolve object
    • createCleanup

      public SvnCleanup createCleanup()
      Creates cleanup operation.
      Returns:
      new SvnCleanup object
    • createList

      public SvnList createList()
      Creates list operation.
      Returns:
      new SvnList object
    • createCanonicalizeUrls

      public SvnCanonicalizeUrls createCanonicalizeUrls()
      Creates canonicalize URLs operation.
      Returns:
      new SvnCanonicalizeUrls object
    • createRepositoryDump

      public SvnRepositoryDump createRepositoryDump()
      Creates repository dump administrative operation.
      Returns:
      new SvnRepositoryDump object
    • createRepositoryCreate

      public SvnRepositoryCreate createRepositoryCreate()
      Creates repository create administrative operation.
      Returns:
      new SvnRepositoryCreate object
    • createRepositoryHotCopy

      public SvnRepositoryHotCopy createRepositoryHotCopy()
      Creates repository hot copy administrative operation.
      Returns:
      new SvnRepositoryHotCopy object
    • createRepositoryLoad

      public SvnRepositoryLoad createRepositoryLoad()
      Creates repository load administrative operation.
      Returns:
      new SvnRepositoryLoad object
    • createRepositoryListLocks

      public SvnRepositoryListLocks createRepositoryListLocks()
      Creates administrative operation for retrieving list of locks from the repository.
      Returns:
      new SvnRepositoryListLocks object
    • createRepositoryListTransactions

      public SvnRepositoryListTransactions createRepositoryListTransactions()
      Creates administrative operation for retrieving list of transactions from the repository.
      Returns:
      new SvnRepositoryListTransactions object
    • createRepositoryPack

      public SvnRepositoryPack createRepositoryPack()
      Creates repository pack administrative operation.
      Returns:
      new SvnRepositoryPack object
    • createRepositoryRecover

      public SvnRepositoryRecover createRepositoryRecover()
      Creates repository recover administrative operation.
      Returns:
      new SvnRepositoryRecover object
    • createRepositoryRemoveLocks

      public SvnRepositoryRemoveLocks createRepositoryRemoveLocks()
      Creates repository remove locks administrative operation.
      Returns:
      new SvnRepositoryRemoveLocks object
    • createRepositoryRemoveTransactions

      public SvnRepositoryRemoveTransactions createRepositoryRemoveTransactions()
      Creates repository remove transactions administrative operation.
      Returns:
      new SvnRepositoryRemoveTransactions object
    • createRepositorySetUUID

      public SvnRepositorySetUUID createRepositorySetUUID()
      Creates repository set UUID administrative operation.
      Returns:
      new SvnRepositorySetUUID object
    • createRepositoryUpgrade

      public SvnRepositoryUpgrade createRepositoryUpgrade()
      Creates repository upgrade administrative operation.
      Returns:
      new SvnRepositoryUpgrade object
    • createRepositoryVerify

      public SvnRepositoryVerify createRepositoryVerify()
      Creates repository verify administrative operation.
      Returns:
      new SvnRepositoryVerify object
    • createRepositoryInitialize

      public SvnRepositoryInitialize createRepositoryInitialize()
      Creates initialize synchronization operation.
      Returns:
      new SvnRepositoryInitialize object
    • createRepositorySyncInfo

      public SvnRepositorySyncInfo createRepositorySyncInfo()
      Creates operation for retrieving repository synchronization info.
      Returns:
      new SvnRepositorySyncInfo object
    • createRepositoryCopyRevisionProperties

      public SvnRepositoryCopyRevisionProperties createRepositoryCopyRevisionProperties()
      Creates copy revision properties synchronization operation.
      Returns:
      new SvnRepositoryCopyRevisionProperties object
    • createRepositorySynchronize

      public SvnRepositorySynchronize createRepositorySynchronize()
      Creates repository synchronize operation.
      Returns:
      new SvnRepositorySynchronize object
    • createRepositoryFilter

      public SvnRepositoryFilter createRepositoryFilter()
      Creates dumpfilter operation.
      Returns:
      new SvnRepositoryFilter object
    • createRepositoryGetAuthor

      public SvnRepositoryGetAuthor createRepositoryGetAuthor()
      Creates operation for retrieving author from the repository.
      Returns:
      new SvnRepositoryGetAuthor object
    • createRepositoryGetDate

      public SvnRepositoryGetDate createRepositoryGetDate()
      Creates operation for retrieving date from the repository.
      Returns:
      new SvnRepositoryGetDate object
    • createRepositoryGetInfo

      public SvnRepositoryGetInfo createRepositoryGetInfo()
      Creates operation for retrieving info from the repository.
      Returns:
      new SvnRepositoryGetInfo object
    • createRepositoryGetLock

      public SvnRepositoryGetLock createRepositoryGetLock()
      Creates operation for retrieving the lock from the repository.
      Returns:
      new SvnRepositoryGetLock object
    • createRepositoryGetLog

      public SvnRepositoryGetLog createRepositoryGetLog()
      Creates operation for retrieving repository log.
      Returns:
      new SvnRepositoryGetLog object
    • createRepositoryGetUUID

      public SvnRepositoryGetUUID createRepositoryGetUUID()
      Creates operation for retrieving repository UUID.
      Returns:
      new SvnRepositoryGetUUID object
    • createRepositoryGetYoungest

      public SvnRepositoryGetYoungest createRepositoryGetYoungest()
      Creates operation for retrieving the latest revision from the repository.
      Returns:
      new SvnRepositoryGetYoungest object
    • createRepositoryGetProperty

      public SvnRepositoryGetProperty createRepositoryGetProperty()
      Creates operation for retrieving property from the repository.
      Returns:
      new SvnRepositoryGetProperty object
    • createRepositoryGetRevisionProperty

      public SvnRepositoryGetRevisionProperty createRepositoryGetRevisionProperty()
      Creates operation for retrieving revision property from the repository.
      Returns:
      new SvnRepositoryGetRevisionProperty object
    • createRepositoryGetProperties

      public SvnRepositoryGetProperties createRepositoryGetProperties()
      Creates operation for retrieving properties from the repository.
      Returns:
      new SvnRepositoryGetProperties object
    • createRepositoryGetCat

      public SvnRepositoryCat createRepositoryGetCat()
      Creates operation for retrieving file contents from the repository.
      Returns:
      new SvnRepositoryCat object
    • createRepositoryGetChanged

      public SvnRepositoryGetChanged createRepositoryGetChanged()
      Creates operation for retrieving changed paths from the repository.
      Returns:
      new SvnRepositoryGetChanged object
    • createRepositoryGetChangedDirectories

      public SvnRepositoryGetChangedDirectories createRepositoryGetChangedDirectories()
      Creates operation for retrieving changed directories from the repository.
      Returns:
      new SvnRepositoryGetChangedDirectories object
    • createRepositoryGetDiff

      public SvnRepositoryGetDiff createRepositoryGetDiff()
      Creates repository diff operation.
      Returns:
      new SvnRepositoryGetDiff object
    • createRepositoryGetHistory

      public SvnRepositoryGetHistory createRepositoryGetHistory()
      Creates operation for retrieving the history from the repository.
      Returns:
      new SvnRepositoryGetHistory object
    • createRepositoryGetTree

      public SvnRepositoryGetTree createRepositoryGetTree()
      Creates operation for retrieving items tree from the repository.
      Returns:
      new SvnRepositoryGetTree object
    • createRepositoryGetRevisionProperties

      public SvnRepositoryGetRevisionProperties createRepositoryGetRevisionProperties()
      Creates operation for retrieving revision properties from the repository.
      Returns:
      new SvnRepositoryGetRevisionProperties object
    • createGetRepositoryFileSize

      public SvnRepositoryGetFileSize createGetRepositoryFileSize()
      Creates operation for retrieving file size from the repository
      Returns:
      new SvnRepositoryGetFileSize object
    • createGetStatusSummary

      public SvnGetStatusSummary createGetStatusSummary()
      Creates get status summary operation.
      Returns:
      new SvnStatusSummary object
    • createSetWCDbVersion

      public SvnSetWCDbVersion createSetWCDbVersion()
    • setAutoDisposeRepositoryPool

      public void setAutoDisposeRepositoryPool(boolean dispose)
      Sets whether to dispose repository pool on dispose() call. This flag has sense only if repositoryPool field is not null. Otherwise the flag value can be overwritten by setRepositoryPool(ISVNRepositoryPool) or getRepositoryPool() calls.
      Parameters:
      dispose - whether to dispose repository pool on dispose() call
    • run

      protected Object run(SvnOperation<?> operation) throws SVNException
      Throws:
      SVNException
    • getImplementation

      protected ISvnOperationRunner<?,SvnOperation<?>> getImplementation(SvnOperation<?> operation) throws SVNException
      Throws:
      SVNException
    • isPrimaryWcGenerationOnly

      public boolean isPrimaryWcGenerationOnly()
      Returns whether the operations should work only on primary working copy generation (for example only on SVN 1.7 working copy) or on both primary and secondary generations.
      Returns:
      true operations should work only on primary working copy generation, if false both primary and secondary generations are supported
    • isAssertRefCount

      public boolean isAssertRefCount()
    • registerOperationRunner

      protected void registerOperationRunner(Class<?> operationClass, ISvnOperationRunner<?,? extends SvnOperation<?>> runner)
    • isWorkingCopyRoot

      public static boolean isWorkingCopyRoot(File versionedDir)
      Detects whether the versioned directory is working copy root.
      Parameters:
      versionedDir - directory to check
      Returns:
      true if the directory is working copy root, otherwise false
    • isVersionedDirectory

      public static boolean isVersionedDirectory(File directory)
      Detects whether the directory is versioned directory.
      Parameters:
      directory - directory to check
      Returns:
      true if the directory is versioned directory, otherwise false
    • isVersionedDirectory

      public static boolean isVersionedDirectory(File directory, boolean isAdditionMode)
      Detects whether the directory is versioned directory in or (not in) the addition mode.
      Parameters:
      directory - directory to check
      isAdditionMode - true if it is addition mode, otherwise false
      Returns:
      true if the directory is versioned directory, otherwise false
    • getWorkingCopyRoot

      public static File getWorkingCopyRoot(File versionedDir, boolean stopOnExternals) throws SVNException
      Searches working copy root path by the versioned directory.
      Parameters:
      versionedDir - versioned directory
      stopOnExternals - true if externals should not be searched, otherwise false
      Returns:
      working copy root
      Throws:
      SVNException
    • detectWcGeneration

      public static org.tmatesoft.svn.core.internal.wc2.SvnWcGeneration detectWcGeneration(File path, boolean climbUp) throws SVNException
      Detects working copy generation (1.6 or 1.7 format) by the working copy path. Recursively searches the by path's parents up to the root if climbUp is true.
      Parameters:
      path - working copy path
      climbUp - true if search recursively in path's parents, otherwise false
      Returns:
      working copy generation
      Throws:
      SVNException
    • detectWcGeneration

      public static org.tmatesoft.svn.core.internal.wc2.SvnWcGeneration detectWcGeneration(File path, boolean climbUp, boolean isAdditionMode) throws SVNException
      Detects working copy generation (1.6 or 1.7 format) by the working copy path in (not in) the addition mode. Recursively searches the by path's parents up to the root if climbUp is true.
      Parameters:
      path - working copy path
      climbUp - true if search recursively in path's parents, otherwise false
      isAdditionMode - true if it is addition mode, otherwise false
      Returns:
      working copy generation
      Throws:
      SVNException
    • getWcContext

      public org.tmatesoft.svn.core.internal.wc17.SVNWCContext getWcContext()
      Returns working copy context.
      Returns:
      working copy context
    • getPrimaryWcGeneration

      public org.tmatesoft.svn.core.internal.wc2.SvnWcGeneration getPrimaryWcGeneration()
      Returns primary (default) working copy generation.
      Returns:
      working copy generation
    • getSecondaryWcGeneration

      public org.tmatesoft.svn.core.internal.wc2.SvnWcGeneration getSecondaryWcGeneration()
      Returns secondary working copy generation.
      Returns:
      working copy generation
    • setPrimaryWcGeneration

      public void setPrimaryWcGeneration(org.tmatesoft.svn.core.internal.wc2.SvnWcGeneration primaryWcGeneration)
      (Re)sets primary (default) working copy generation. If primaryWcGeneration is not null, registers operations' runners.
      Parameters:
      primaryWcGeneration -
    • setWcGenerationSticky

      public void setWcGenerationSticky(boolean isWcGenerationSticky)
      When set to true, first encountered working copy generation becomes 'sticky' for this instance of SvnOperationFactory and no working copy format detection will be performed for subsequent operation.
      Parameters:
      isWcGenerationSticky -
    • isWcGenerationSticky

      public boolean isWcGenerationSticky()
      Returns:
      true when this instance of SvnOperationFactory
      See Also: