Class SvnCommitPacket

java.lang.Object
org.tmatesoft.svn.core.wc2.SvnCommitPacket

public class SvnCommitPacket extends java.lang.Object
Represents storage for SvnCommitItem objects which represent information on versioned items intended for being committed to a repository.

Used by commit-related operations to collect and hold information on paths that are to be committed. Each SvnCommitPacket is committed in a single transaction.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private java.util.Map<SVNURL,java.util.Collection<SvnCommitItem>>
     
    private java.util.Map<java.lang.String,SvnCommitItem>
     
    private java.lang.Object
     
    private java.util.Map<SVNURL,java.lang.String>
     
     
    private java.util.concurrent.atomic.AtomicInteger
     
    private java.util.Set<java.lang.String>
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    Creates a commit packet and initializes its fields with empty lists.
    private
    SvnCommitPacket(java.util.Map<SVNURL,java.util.Collection<SvnCommitItem>> items, java.util.Map<java.lang.String,SvnCommitItem> itemsByPath, java.lang.Object lockingContext, java.util.Map<SVNURL,java.lang.String> lockTokens, ISvnCommitRunner runner, java.util.Set<java.lang.String> skippedPaths)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    addItem(java.io.File path, SVNNodeKind kind, SVNURL repositoryRoot, java.lang.String repositoryPath, long revision, java.lang.String copyFromPath, long copyFromRevision, java.io.File movedFromAbsPath, int flags)
    Adds commit item with the path, kind, repository root URL, repository path, revision number, copied from path, copied from revision number, flags to the commit packet.
    addItem(java.io.File path, SVNURL rootUrl, SVNNodeKind kind, SVNURL url, long revision, SVNURL copyFromUrl, long copyFromRevision, int flags)
    Adds commit item with the path, repository root URL, kind, URL, revision number, revision number, copied from path, copied from revision number, flags to the commit packet.
    void
    addItem(SvnCommitItem item, SVNURL repositoryRoot)
    Adds commit item to the commit packet with the repository root URL.
    void
    Disposes the commit packet, if commit runner is set method calls ISvnCommitRunner#disposeCommitPacket(Object) with the commit packet
    getItem(java.io.File path)
    Returns the commit item with the path
    private java.lang.String
    getItemKey(SvnCommitItem item, SVNURL rootURL, boolean combinePackets)
     
    java.util.Collection<SvnCommitItem>
    Returns all commit items in the commit packet with the corresponding repository root URL
    java.lang.Object
    Returns commit packet's locking context.
    java.util.Map<SVNURL,java.lang.String>
    Returns all lock tokens of commit packet.
    java.util.Collection<SVNURL>
    Returns all unique repository root URLs of all commit items in the commit packet
    Returns commit packet's runner.
    boolean
    hasItem(java.io.File path)
    Tests if the commit packet contains the commit item with the path
    boolean
    Tests whether the commit packet has commit items.
    boolean
    isEmpty(SVNURL repositoryRootUrl)
    Tests whether the commit packet has commit items with the repository root URL.
    boolean
    isItemSkipped(java.io.File file)
     
    boolean
     
     
    void
    setItemSkipped(java.io.File file, boolean skipped)
     
    void
    setLockingContext(ISvnCommitRunner commitRunner, java.lang.Object context)
     
    void
    setLockTokens(java.util.Map<SVNURL,java.lang.String> lockTokens)
    Sets commit packet's lock tokens, containing the information about locks within commit packet URLs.
    (package private) SvnCommitPacket[]
    split(boolean combinePackets)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • items

      private java.util.Map<SVNURL,java.util.Collection<SvnCommitItem>> items
    • itemsByPath

      private java.util.Map<java.lang.String,SvnCommitItem> itemsByPath
    • lockingContext

      private java.lang.Object lockingContext
    • runner

      private ISvnCommitRunner runner
    • lockTokens

      private java.util.Map<SVNURL,java.lang.String> lockTokens
    • skippedPaths

      private java.util.Set<java.lang.String> skippedPaths
    • sharedIndex

      private java.util.concurrent.atomic.AtomicInteger sharedIndex
  • Constructor Details

    • SvnCommitPacket

      public SvnCommitPacket()
      Creates a commit packet and initializes its fields with empty lists.
    • SvnCommitPacket

      private SvnCommitPacket(java.util.Map<SVNURL,java.util.Collection<SvnCommitItem>> items, java.util.Map<java.lang.String,SvnCommitItem> itemsByPath, java.lang.Object lockingContext, java.util.Map<SVNURL,java.lang.String> lockTokens, ISvnCommitRunner runner, java.util.Set<java.lang.String> skippedPaths)
  • Method Details

    • hasItem

      public boolean hasItem(java.io.File path)
      Tests if the commit packet contains the commit item with the path
      Parameters:
      path - the path of the commit item to test
      Returns:
      true if commit item with the path is contained in the commit packet, otherwise false
    • getItem

      public SvnCommitItem getItem(java.io.File path)
      Returns the commit item with the path
      Parameters:
      path - the path of the commit item
      Returns:
      commit item
    • getRepositoryRoots

      public java.util.Collection<SVNURL> getRepositoryRoots()
      Returns all unique repository root URLs of all commit items in the commit packet
      Returns:
      unmodifiable list of URLs of the commit packet
    • getItems

      public java.util.Collection<SvnCommitItem> getItems(SVNURL url)
      Returns all commit items in the commit packet with the corresponding repository root URL
      Returns:
      unmodifiable list of commit items containing info of versioned items to be committed
    • addItem

      public void addItem(SvnCommitItem item, SVNURL repositoryRoot)
      Adds commit item to the commit packet with the repository root URL.
      Parameters:
      item - commit item
      repositoryRoot - repository root URL
    • addItem

      public SvnCommitItem addItem(java.io.File path, SVNNodeKind kind, SVNURL repositoryRoot, java.lang.String repositoryPath, long revision, java.lang.String copyFromPath, long copyFromRevision, java.io.File movedFromAbsPath, int flags) throws SVNException
      Adds commit item with the path, kind, repository root URL, repository path, revision number, copied from path, copied from revision number, flags to the commit packet.
      Parameters:
      path - path of the commit item
      kind - node kind of the commit item
      repositoryRoot - repository root URL of the commit item
      repositoryPath - repository path of the commit item
      revision - revision number of the commit item
      copyFromPath - path from those commit item was copied
      copyFromRevision - revision of the repository item from those commit item was copied
      flags - commit item flags
      Returns:
      newly created commit item with initialized fields
      Throws:
      SVNException - if URL parse error occurred
    • addItem

      public SvnCommitItem addItem(java.io.File path, SVNURL rootUrl, SVNNodeKind kind, SVNURL url, long revision, SVNURL copyFromUrl, long copyFromRevision, int flags) throws SVNException
      Adds commit item with the path, repository root URL, kind, URL, revision number, revision number, copied from path, copied from revision number, flags to the commit packet.
      Parameters:
      path - path of the commit item
      rootUrl - repository root URL of the commit item
      kind - node kind of the commit item
      url - repository URL of the commit item
      revision - revision number of the commit item
      copyFromUrl - url from those commit item was copied
      copyFromRevision - revision of the repository item from those commit item was copied
      flags - commit item flags
      Returns:
      newly created commit item with initialized fields
      Throws:
      SVNException - if URL parse error occurred
    • setLockingContext

      public void setLockingContext(ISvnCommitRunner commitRunner, java.lang.Object context)
      Parameters:
      commitRunner -
      context -
    • dispose

      public void dispose() throws SVNException
      Disposes the commit packet, if commit runner is set method calls ISvnCommitRunner#disposeCommitPacket(Object) with the commit packet
      Throws:
      SVNException
    • setLockTokens

      public void setLockTokens(java.util.Map<SVNURL,java.lang.String> lockTokens)
      Sets commit packet's lock tokens, containing the information about locks within commit packet URLs.
      Parameters:
      lockTokens - hash of URL, lock tokens for this URL
    • getLockTokens

      public java.util.Map<SVNURL,java.lang.String> getLockTokens()
      Returns all lock tokens of commit packet.
      Returns:
      hash of URL, lock tokens
    • isEmpty

      public boolean isEmpty()
      Tests whether the commit packet has commit items.
      Returns:
      true if the commit packet has no commit items, otherwise false
    • isEmpty

      public boolean isEmpty(SVNURL repositoryRootUrl)
      Tests whether the commit packet has commit items with the repository root URL.
      Returns:
      true if the commit packet has no commit items with the repository root, otherwise false
    • getLockingContext

      public java.lang.Object getLockingContext()
      Returns commit packet's locking context.
      Returns:
      the locking context for the commit packet
    • getRunner

      public ISvnCommitRunner getRunner()
      Returns commit packet's runner.
      Returns:
      the runner for the commit packet
    • setItemSkipped

      public void setItemSkipped(java.io.File file, boolean skipped)
    • isItemSkipped

      public boolean isItemSkipped(java.io.File file)
    • removeSkippedItems

      public SvnCommitPacket removeSkippedItems()
    • split

      SvnCommitPacket[] split(boolean combinePackets) throws SVNException
      Throws:
      SVNException
    • getItemKey

      private java.lang.String getItemKey(SvnCommitItem item, SVNURL rootURL, boolean combinePackets) throws SVNException
      Throws:
      SVNException
    • isLastPacket

      public boolean isLastPacket()