Class JavaHLSvnRepository

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

    public class JavaHLSvnRepository
    extends java.lang.Object
    implements com.zfabrik.svnaccess.ISvnRepository
    Implementation of ISvnRepository over JavaHL. This class depends on the JavaHL API and may not be loaded unless that is present. A word on paths:
    • In CR paths don't have leading slashes
    • Repo URLs never have trailing slashes
    • Field Summary

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

        HEAD
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close the client instance
      void export​(java.lang.String path, long revision, java.io.File targetDir)
      Export relative to CR
      java.lang.String getBaseUrl()  
      void getContent​(java.lang.String path, long pegRevision, long revision, com.zfabrik.svnaccess.IStreamHandler streamHandler)
      Retrieve relative to CR
      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)
      Info on path in CR
      int list​(java.lang.String path, long pegRevision, long revision, com.zfabrik.svnaccess.IDirEntryHandler dirEntryHandler)
      List relative to CR
      int log​(java.lang.String path, long revision, long revisionFrom, long revisionTo, com.zfabrik.svnaccess.ISvnLogEntryHandler logEntryHandler)
      Log on path in CR
      static void main​(java.lang.String[] args)  
      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)
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • JavaHLSvnRepository

        public JavaHLSvnRepository()
    • Method Detail

      • 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
        Info on path in CR
        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 revision,
                       long revisionFrom,
                       long revisionTo,
                       com.zfabrik.svnaccess.ISvnLogEntryHandler logEntryHandler)
                throws java.io.IOException
        Log on path in CR
        Specified by:
        log in interface com.zfabrik.svnaccess.ISvnRepository
        Parameters:
        path - path relative to CR-root
        revision - 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
        List relative to CR
        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
        Retrieve relative to CR
        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 revision,
                           java.io.File targetDir)
                    throws java.io.IOException
        Export relative to CR
        Specified by:
        export in interface com.zfabrik.svnaccess.ISvnRepository
        Parameters:
        path - path relative to component repository URL
        revision - 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
      • close

        public void close()
                   throws java.io.IOException
        Close the client instance
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object