Class SVNKitSvnRepository

  • All Implemented Interfaces:
    com.zfabrik.svnaccess.ISvnRepository, java.io.Closeable, java.lang.AutoCloseable

    public class SVNKitSvnRepository
    extends java.lang.Object
    implements com.zfabrik.svnaccess.ISvnRepository
    SVNKit based implementation of our Svn Repo abstraction. Requires to have SVNKit on the classpath to load and work. This implementation will be picked by SvnClientAdapterResource if an SVNKit library of version 1.7.9 or higher is found - as far as compatibility of SVNKit is established with that version.
    • Field Summary

      • Fields inherited from interface com.zfabrik.svnaccess.ISvnRepository

        HEAD
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void export​(java.lang.String path, long pegRevision, java.io.File targetDir)
      Exports the given directory content to the given target directory.
      java.lang.String getBaseUrl()  
      void getContent​(java.lang.String path, long pegRevision, long revision, com.zfabrik.svnaccess.IStreamHandler streamHandler)
      Retrieves the content of the given SVN URL and calls the given stream handler for the input stream
      java.lang.String getCRPath()  
      long getCurrentCRRevision()  
      java.lang.String getRepositoryUuid()  
      java.lang.String getSvnRootUrl()  
      com.zfabrik.svnaccess.SvnInfo info()
      returns details about the base path at HEAD revision
      com.zfabrik.svnaccess.SvnInfo info​(java.lang.String path, long pegRevision)
      returns details about a single path
      int list​(java.lang.String path, long pegRevision, long revision, com.zfabrik.svnaccess.IDirEntryHandler dirEntryHandler)
      Retrieves all direct children for the given SVN URL and calls the given resource handler for each child
      int log​(java.lang.String path, long pegRevision, long revisionFrom, long revisionTo, com.zfabrik.svnaccess.ISvnLogEntryHandler logEntryHandler)
      Retrieves all changes for the given SVN URL and the given revision range and calls the given log entry handler for each change.
      void setBaseUrl​(java.lang.String baseUrl)
      Sets the base URL - this is the z2 component repository URL
      void setPassword​(java.lang.String password)
      Sets the password (like --password)
      void setUsername​(java.lang.String username)
      Sets the username (like --username)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SVNKitSvnRepository

        public SVNKitSvnRepository()
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • getBaseUrl

        public java.lang.String getBaseUrl()
        Specified by:
        getBaseUrl in interface com.zfabrik.svnaccess.ISvnRepository
        Returns:
        the repository base URL
      • setBaseUrl

        public void setBaseUrl​(java.lang.String baseUrl)
        Description copied from interface: com.zfabrik.svnaccess.ISvnRepository
        Sets the base URL - this is the z2 component repository URL
        Specified by:
        setBaseUrl in interface com.zfabrik.svnaccess.ISvnRepository
        Parameters:
        baseUrl - base URL
      • setUsername

        public void setUsername​(java.lang.String username)
        Description copied from interface: com.zfabrik.svnaccess.ISvnRepository
        Sets the username (like --username)
        Specified by:
        setUsername in interface com.zfabrik.svnaccess.ISvnRepository
        Parameters:
        username - svn user
      • setPassword

        public void setPassword​(java.lang.String password)
        Description copied from interface: com.zfabrik.svnaccess.ISvnRepository
        Sets the password (like --password)
        Specified by:
        setPassword in interface com.zfabrik.svnaccess.ISvnRepository
        Parameters:
        password - svn password
      • getRepositoryUuid

        public java.lang.String getRepositoryUuid()
                                           throws java.io.IOException
        Specified by:
        getRepositoryUuid in interface com.zfabrik.svnaccess.ISvnRepository
        Returns:
        repository UUID
        Throws:
        java.io.IOException
      • getCurrentCRRevision

        public long getCurrentCRRevision()
                                  throws java.io.IOException
        Specified by:
        getCurrentCRRevision in interface com.zfabrik.svnaccess.ISvnRepository
        Returns:
        current SVNCR revision
        Throws:
        java.io.IOException
      • getSvnRootUrl

        public java.lang.String getSvnRootUrl()
                                       throws java.io.IOException
        Specified by:
        getSvnRootUrl in interface com.zfabrik.svnaccess.ISvnRepository
        Returns:
        SVN-Repository root URL - e.g. "http://z2-environment.net/svn/z2-environment/"
        Throws:
        java.io.IOException
      • getCRPath

        public java.lang.String getCRPath()
                                   throws java.io.IOException
        Specified by:
        getCRPath in interface com.zfabrik.svnaccess.ISvnRepository
        Returns:
        CR-path relative to SVN root URL - e.g. "/trunk/z2-base.base"
        Throws:
        java.io.IOException
      • info

        public com.zfabrik.svnaccess.SvnInfo info​(java.lang.String path,
                                                  long pegRevision)
                                           throws java.io.IOException
        Description copied from interface: com.zfabrik.svnaccess.ISvnRepository
        returns details about a single path
        Specified by:
        info in interface com.zfabrik.svnaccess.ISvnRepository
        Parameters:
        path - path relative to the component repository
        pegRevision - peg revision, use -1 for HEAD
        Returns:
        an SvnDirEntry containing the details or null if the given path does not exist in the given revision
        Throws:
        java.io.IOException
      • info

        public com.zfabrik.svnaccess.SvnInfo info()
                                           throws java.io.IOException
        Description copied from interface: com.zfabrik.svnaccess.ISvnRepository
        returns details about the base path at HEAD revision
        Specified by:
        info in interface com.zfabrik.svnaccess.ISvnRepository
        Returns:
        most current info of the base-path
        Throws:
        java.io.IOException
      • log

        public int log​(java.lang.String path,
                       long pegRevision,
                       long revisionFrom,
                       long revisionTo,
                       com.zfabrik.svnaccess.ISvnLogEntryHandler logEntryHandler)
                throws java.io.IOException
        Description copied from interface: com.zfabrik.svnaccess.ISvnRepository
        Retrieves all changes for the given SVN URL and the given revision range and calls the given log entry handler for each change. If revisionFrom is greater than revisionTo the revision order is descending, otherwise it's ascending.
        Specified by:
        log in interface com.zfabrik.svnaccess.ISvnRepository
        Parameters:
        path - path relative to CR-root
        pegRevision - peg revision, use -1 for HEAD
        revisionFrom - revision from
        revisionTo - revision to
        logEntryHandler - log entry handler is called for each changed resource
        Returns:
        number of log entries
        Throws:
        java.io.IOException - if SVN LOG fails
      • list

        public int list​(java.lang.String path,
                        long pegRevision,
                        long revision,
                        com.zfabrik.svnaccess.IDirEntryHandler dirEntryHandler)
                 throws java.io.IOException
        Description copied from interface: com.zfabrik.svnaccess.ISvnRepository
        Retrieves all direct children for the given SVN URL and calls the given resource handler for each child
        Specified by:
        list in interface com.zfabrik.svnaccess.ISvnRepository
        Parameters:
        path - path relative to CR-root
        pegRevision - peg revision, use -1 for HEAD
        revision - revision, use -1 for HEAD
        dirEntryHandler - resource handler
        Returns:
        number of dir entries
        Throws:
        java.io.IOException - if SVN URL does not exist in the given revision
      • getContent

        public void getContent​(java.lang.String path,
                               long pegRevision,
                               long revision,
                               com.zfabrik.svnaccess.IStreamHandler streamHandler)
                        throws java.io.IOException
        Description copied from interface: com.zfabrik.svnaccess.ISvnRepository
        Retrieves the content of the given SVN URL and calls the given stream handler for the input stream
        Specified by:
        getContent in interface com.zfabrik.svnaccess.ISvnRepository
        Parameters:
        path - path relative to component repository URL
        pegRevision - peg revision, use -1 for HEAD
        revision - revision
        streamHandler - stream handler
        Throws:
        java.io.IOException - if SVN URL does not exist in the given revision
      • export

        public void export​(java.lang.String path,
                           long pegRevision,
                           java.io.File targetDir)
                    throws java.io.IOException
        Description copied from interface: com.zfabrik.svnaccess.ISvnRepository
        Exports the given directory content to the given target directory. The directory will be overridden if it exists already!
        Specified by:
        export in interface com.zfabrik.svnaccess.ISvnRepository
        Parameters:
        path - path relative to component repository URL
        pegRevision - revision, use -1 for HEAD (we always use preg revision HEAD)
        targetDir - target directory
        Throws:
        java.io.IOException - if SVN URL does not exist in the given revision or targetDir refers to an existing file