Class CommitEditor

java.lang.Object
org.apache.subversion.javahl.JNIObject
org.apache.subversion.javahl.remote.CommitEditor
All Implemented Interfaces:
ISVNEditor

public class CommitEditor
extends JNIObject
implements ISVNEditor
Implementation of ISVNEditor that drives commits.
Since:
1.9
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.subversion.javahl.ISVNEditor

    ISVNEditor.GetNodeKindCallback, ISVNEditor.ProvideBaseCallback, ISVNEditor.ProvidePropsCallback
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected RemoteSession session
    Stores a reference to the session that created this editor.

    Fields inherited from class org.apache.subversion.javahl.JNIObject

    cppAddr
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected CommitEditor​(long cppAddr, RemoteSession session)
    This constructor is called from the factory to get an instance.
  • Method Summary

    Modifier and Type Method Description
    void abort()
    Signal that the edit transmission was not successful.
    void addAbsent​(String relativePath, NodeKind kind, long replacesRevision)
    Create an "absent" node of kind kind at relativePath.
    void addDirectory​(String relativePath, Iterable<String> children, Map<String,​byte[]> properties, long replacesRevision)
    Create a new directory at relativePath.
    void addFile​(String relativePath, Checksum checksum, InputStream contents, Map<String,​byte[]> properties, long replacesRevision)
    Create a new file at relativePath.
    void addSymlink​(String relativePath, String target, Map<String,​byte[]> properties, long replacesRevision)
    Note: Not implemented.
    void alterDirectory​(String relativePath, long revision, Iterable<String> children, Map<String,​byte[]> properties)
    Alter the properties of the directory at relativePath.
    void alterFile​(String relativePath, long revision, Checksum checksum, InputStream contents, Map<String,​byte[]> properties)
    Alter the contents and/or the properties of the file at relativePath with revision as its expected revision.
    void alterSymlink​(String relativePath, long revision, String target, Map<String,​byte[]> properties)
    Note: Not implemented.
    void complete()
    Signal that the edit has been completed successfully.
    void copy​(String sourceRelativePath, long sourceRevision, String destinationRelativePath, long replacesRevision)
    Move the node at sourceRelativePath to destinationRelativePath.
    void delete​(String relativePath, long revision)
    Delete the existing node at relativePath, expected to be identical to revision revision of that path.
    void dispose()
    Release the native peer (should not depend on finalize), and abort the edit if it has not been completed yet.
    void finalize()  
    void move​(String sourceRelativePath, long sourceRevision, String destinationRelativePath, long replacesRevision)
    Move the node at sourceRelativePath to destinationRelativePath.

    Methods inherited from class java.lang.Object

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

    • session

      protected RemoteSession session
      Stores a reference to the session that created this editor.
  • Constructor Details

    • CommitEditor

      protected CommitEditor​(long cppAddr, RemoteSession session)
      This constructor is called from the factory to get an instance.
  • Method Details

    • dispose

      public void dispose()
      Description copied from interface: ISVNEditor
      Release the native peer (should not depend on finalize), and abort the edit if it has not been completed yet.
      Specified by:
      dispose in interface ISVNEditor
    • addDirectory

      public void addDirectory​(String relativePath, Iterable<String> children, Map<String,​byte[]> properties, long replacesRevision) throws ClientException
      Description copied from interface: ISVNEditor
      Create a new directory at relativePath. The immediate parent of relativePath is expected to exist.

      For descriptions of properties and replacesRevision, see #addFile().

      A complete listing of the immediate children of relativePath that will be added subsequently is given in children. children is a collection of const strings, each giving the basename of an immediate child. It is an error to pass null for children; use an empty collection to indicate that the new directory will have no children.

      Specified by:
      addDirectory in interface ISVNEditor
      Throws:
      ClientException
    • addFile

      public void addFile​(String relativePath, Checksum checksum, InputStream contents, Map<String,​byte[]> properties, long replacesRevision) throws ClientException
      Description copied from interface: ISVNEditor
      Create a new file at relativePath. The immediate parent of relativePath is expected to exist.

      The file's contents are specified in contents which has a checksum matching checksum. Both values must be non-null.

      Set the properties of the new file to properties. If no properties are being set on the new file, properties must be empty. It is an error to pass null for properties.

      If this add is expected to replace a previously existing file, symlink or directory at relativePath, the revision number of the node to be replaced must be given in replacesRevision. Otherwise, replacesRevision must be Revision.SVN_INVALID_REVNUM.

      Note: It is not allowed to call a "delete" followed by an "add" on the same path. Instead, an "add" with replacesRevision set accordingly must be used.

      Note: The contents stream's lifetime must not extend beyond the scope of this function. An implementation must close the stream after consuming its contents.

      Specified by:
      addFile in interface ISVNEditor
      Throws:
      ClientException
    • addSymlink

      public void addSymlink​(String relativePath, String target, Map<String,​byte[]> properties, long replacesRevision) throws ClientException
      Note: Not implemented.
      Specified by:
      addSymlink in interface ISVNEditor
      Throws:
      ClientException
    • addAbsent

      public void addAbsent​(String relativePath, NodeKind kind, long replacesRevision) throws ClientException
      Description copied from interface: ISVNEditor
      Create an "absent" node of kind kind at relativePath. The immediate parent of relativePath is expected to exist. For a description of replacesRevision, see #addFile().
      Specified by:
      addAbsent in interface ISVNEditor
      Throws:
      ClientException
    • alterDirectory

      public void alterDirectory​(String relativePath, long revision, Iterable<String> children, Map<String,​byte[]> properties) throws ClientException
      Description copied from interface: ISVNEditor
      Alter the properties of the directory at relativePath.

      revision specifies the revision at which the receiver should expect to find this node. That is, relativePath at the start of the whole edit and relativePath at revision must lie within the same node-rev (aka location history segment). This information may be used to catch an attempt to alter and out-of-date directory. If the directory does not have a corresponding revision in the repository (e.g. it has not yet been committed), then revision should be Revision.SVN_INVALID_REVNUM.

      If any changes to the set of children will be made in the future of the edit drive, then children must specify the resulting set of children. See #addDirectory() for the format of children. If not changes will be made, then NULL may be specified.

      For a description of properties, see #addFile(). If no changes to the properties will be made (ie. only future changes to the set of children), then properties may be null.

      Specified by:
      alterDirectory in interface ISVNEditor
      Throws:
      ClientException
    • alterFile

      public void alterFile​(String relativePath, long revision, Checksum checksum, InputStream contents, Map<String,​byte[]> properties) throws ClientException
      Description copied from interface: ISVNEditor
      Alter the contents and/or the properties of the file at relativePath with revision as its expected revision. See #alterDirectory() for more information about revision.

      If contents is non-null, then the stream will be copied to the file, and its checksum must match checksum (which must also be non-null). If contents is null, then checksum must also be null, and no change will be applied to the file's contents.

      If properties is non-null, then the properties will be applied.

      For a description of checksum and contents, see #addFile().

      This function allows properties to be null, but the parameter is otherwise described by #addFile().

      Note: The contents stream's lifetime must not extend beyond the scope of this function. An implementation must close the stream after consuming its contents.

      Specified by:
      alterFile in interface ISVNEditor
      Throws:
      ClientException
    • alterSymlink

      public void alterSymlink​(String relativePath, long revision, String target, Map<String,​byte[]> properties) throws ClientException
      Note: Not implemented.
      Specified by:
      alterSymlink in interface ISVNEditor
      Throws:
      ClientException
    • delete

      public void delete​(String relativePath, long revision) throws ClientException
      Description copied from interface: ISVNEditor
      Delete the existing node at relativePath, expected to be identical to revision revision of that path.
      Specified by:
      delete in interface ISVNEditor
      Throws:
      ClientException
    • copy

      public void copy​(String sourceRelativePath, long sourceRevision, String destinationRelativePath, long replacesRevision) throws ClientException
      Description copied from interface: ISVNEditor
      Move the node at sourceRelativePath to destinationRelativePath.

      For a description of replacesRevision, see #addFile().

      Note: See the general instructions on paths for this API. Sice the sourceRelativePath argument must generally be able to reference any node in the repository, the implication is that the editor's root must be the repository root.

      Specified by:
      copy in interface ISVNEditor
      Throws:
      ClientException
    • move

      public void move​(String sourceRelativePath, long sourceRevision, String destinationRelativePath, long replacesRevision) throws ClientException
      Description copied from interface: ISVNEditor
      Move the node at sourceRelativePath to destinationRelativePath.

      sourceRevision specifies the revision at which the receiver should expect to find this node. That is, sourceRelativePath at the start of the whole edit andsourceRelativePath at sourceRevision must lie within the same node-rev (aka history-segment). This is just like the #delete().

      For a description of replacesRevision, see #addFile().

      Specified by:
      move in interface ISVNEditor
      Throws:
      ClientException
    • complete

      public void complete() throws ClientException
      Description copied from interface: ISVNEditor
      Signal that the edit has been completed successfully. After this method is called, the editor is considered closed.
      Specified by:
      complete in interface ISVNEditor
      Throws:
      ClientException
    • abort

      public void abort() throws ClientException
      Description copied from interface: ISVNEditor
      Signal that the edit transmission was not successful. After this method is called, the editor is considered closed.
      Specified by:
      abort in interface ISVNEditor
      Throws:
      ClientException
    • finalize

      public void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable