I was told the patch did not make it to the list.  Trying again with a
.txt extensions.

On Fri, Feb 12, 2010 at 11:08 AM, Mark Phippard <markp...@gmail.com> wrote:
> Renaming the JavaHL classes and providing compatibility wrappers for
> the old classes has allowed us to make some changes in the new
> classes, such as dropping deprecated classes and renaming things etc.
> I took the opportunity to ask the SVNKit developers if there was
> anything more we could do to help them.  They provide a pure-Java
> implementation of the JavaHL interface and I know they ran into a few
> areas in our code where we did things that made this difficult.
>
> They provided me the attached patch and accompanying explanation of
> the changes.  It all makes sense to me, but I thought I would run it
> by the list.  A lot of these items, such as creating an interface for
> SVNAdmin, are really obvious.  Maybe the constructor change will be
> more controversial, but I think it reflects what needs to be done if
> the JavaHL interface is truly meant to be something that could have
> alternate implementations.
>
> Here is there explanation of the changes in the patch:
>
> 1. Changed all package local constructors to public ones. This will let
> SVNKit keep as much of the SVNKit-code out of the Subversion namespace
> as possible. Also, current version is not consistent in that aspect, for
> instance Status class constructor is public while Info2 class has
> package local one.
>
> 2. Added ISVNAdmin interface and made SVNAdmin implement it.
>
> As you know, there are two ways SVNKit could be used:
>
> 1. User removes svn-javahl.jar and replaces it with svnkit-javahl.jar.
> In this case original JavaHL classes are replaced with SVNKit ones, in
> particular SVNClient, SVNAdmin, Path and (in this new version) Version
> and NativeResources. This is not preferred way to use SVNKit and I would
> talk of it as of a deprecated one. With that approach it is not possible
> to switch between implementations without use of a custom class loader.
>
> 2. Another, preferred approach, is to work with JavaHL API using its
> interfaces (ISVNClient) and only depend on particular implementation
> where instance of certain implementation is instantiated.
>
> So, to enable second approach for users who'd like to use SVNAdmin I've
> added ISVNAdmin interface and made SVNAdmin class implement it. I also
> moved constant and callback interface defined in the SVNAdmin class to
> the new ISVNAdmin interface.
>
> 3. NativeResources.version field made private and instead
> NativeResources.getVersion() method added.
>
> This modification will let SVNKit provide a replacement of
> NativeResources class for the "deprecated" approach along with custom
> getVersion() method implementation.
>
> Please let me know what you think on my proposal and whether it will be
> possible to include this patch into the new version of the API.
>
> --
> Thanks
>
> Mark Phippard
> http://markphip.blogspot.com/
>



-- 
Thanks

Mark Phippard
http://markphip.blogspot.com/
Index: 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictDescriptor.java
===================================================================
--- 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictDescriptor.java
 (revision 909462)
+++ 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictDescriptor.java
 (working copy)
@@ -92,7 +92,7 @@
     private ConflictVersion srcRightVersion;
 
     /** This constructor should only be called from JNI code. */
-    ConflictDescriptor(String path, int conflictKind, int nodeKind,
+    public ConflictDescriptor(String path, int conflictKind, int nodeKind,
                        String propertyName, boolean isBinary, String mimeType,
                        int action, int reason, int operation,
                        String basePath, String theirPath,
Index: 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictVersion.java
===================================================================
--- 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictVersion.java
    (revision 909462)
+++ 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ConflictVersion.java
    (working copy)
@@ -41,7 +41,7 @@
     private int nodeKind;
 
     /** This constructor should only be called from JNI code. */
-    ConflictVersion(String reposURL, long pegRevision, String pathInRepos,
+    public ConflictVersion(String reposURL, long pegRevision, String 
pathInRepos,
                     int nodeKind)
     {
         this.reposURL = reposURL;
Index: 
subversion/bindings/javahl/src/org/apache/subversion/javahl/LogMessage.java
===================================================================
--- subversion/bindings/javahl/src/org/apache/subversion/javahl/LogMessage.java 
(revision 909462)
+++ subversion/bindings/javahl/src/org/apache/subversion/javahl/LogMessage.java 
(working copy)
@@ -106,7 +106,7 @@
      * @param message      the log message text
      * @since 1.5
      */
-    LogMessage(ChangePath[] cp, long r, String a, long t, String m)
+    public LogMessage(ChangePath[] cp, long r, String a, long t, String m)
     {
         changedPaths = cp;
         revision = r;
Index: 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNAdmin.java
===================================================================
--- subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNAdmin.java  
(revision 0)
+++ subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNAdmin.java  
(revision 0)
@@ -0,0 +1,279 @@
+/**
+ * @copyright
+ * ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one
+ *    or more contributor license agreements.  See the NOTICE file
+ *    distributed with this work for additional information
+ *    regarding copyright ownership.  The ASF licenses this file
+ *    to you under the Apache License, Version 2.0 (the
+ *    "License"); you may not use this file except in compliance
+ *    with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing,
+ *    software distributed under the License is distributed on an
+ *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *    KIND, either express or implied.  See the License for the
+ *    specific language governing permissions and limitations
+ *    under the License.
+ * ====================================================================
+ * @endcopyright
+ */
+package org.apache.subversion.javahl;
+
+/**
+ * This interface offers the same commands as the svnadmin commandline
+ * client. It is implemented by SVNAdmin class.
+ */
+public interface ISVNAdmin {
+
+        /**
+         * Filesystem in a Berkeley DB
+         */
+        static String BDB = "bdb";
+
+        /**
+         * Filesystem in the filesystem
+         */
+        static String FSFS = "fsfs";
+
+        /**
+         * release the native peer (should not depend on finalize)
+         */
+        void dispose();
+
+        /**
+         * @return Version information about the underlying native libraries.
+         */
+        Version getVersion();
+
+        /**
+         * create a subversion repository.
+         * @param path                  the path where the repository will been
+         *                              created.
+         * @param disableFsyncCommit    disable to fsync at the commit (BDB).
+         * @param keepLog               keep the log files (BDB).
+         * @param configPath            optional path for user configuration 
files.
+         * @param fstype                the type of the filesystem (BDB or 
FSFS)
+         * @throws ClientException  throw in case of problem
+         */
+        void create(String path, boolean disableFsyncCommit,
+                                  boolean keepLog, String configPath,
+                                  String fstype) throws ClientException;
+
+        /**
+         * deltify the revisions in the repository
+         * @param path              the path to the repository
+         * @param start             start revision
+         * @param end               end revision
+         * @throws ClientException  throw in case of problem
+         */
+        void deltify(String path, Revision start, Revision end)
+                throws ClientException;
+
+        /**
+         * dump the data in a repository
+         * @param path              the path to the repository
+         * @param dataOut           the data will be outputed here
+         * @param errorOut          the messages will be outputed here
+         * @param start             the first revision to be dumped
+         * @param end               the last revision to be dumped
+         * @param incremental       the dump will be incremantal
+         * @throws ClientException  throw in case of problem
+         */
+        void dump(String path, IOutput dataOut,
+                         IOutput errorOut, Revision start,
+                         Revision end, boolean incremental)
+                throws ClientException;
+        
+        /**
+         * dump the data in a repository
+         * @param path              the path to the repository
+         * @param dataOut           the data will be outputed here
+         * @param errorOut          the messages will be outputed here
+         * @param start             the first revision to be dumped
+         * @param end               the last revision to be dumped
+         * @param incremental       the dump will be incremantal
+         * @param useDeltas         the dump will contain deltas between nodes
+         * @throws ClientException  throw in case of problem
+         * @since 1.5
+         */
+        void dump(String path, IOutput dataOut,
+                                IOutput errorOut, Revision start,
+                                Revision end, boolean incremental,
+                                boolean useDeltas)
+                throws ClientException;
+
+        /**
+         * make a hot copy of the repository
+         * @param path              the path to the source repository
+         * @param targetPath        the path to the target repository
+         * @param cleanLogs         clean the unused log files in the source
+         *                          repository
+         * @throws ClientException  throw in case of problem
+         */
+        void hotcopy(String path, String targetPath,
+                                   boolean cleanLogs) throws ClientException;
+
+        /**
+         * list all logfiles (BDB) in use or not)
+         * @param path              the path to the repository
+         * @param receiver          interface to receive the logfile names
+         * @throws ClientException  throw in case of problem
+         */
+        void listDBLogs(String path, MessageReceiver receiver)
+                throws ClientException;
+
+        /**
+         * list unused logfiles
+         * @param path              the path to the repository
+         * @param receiver          interface to receive the logfile names
+         * @throws ClientException  throw in case of problem
+         */
+        void listUnusedDBLogs(String path, MessageReceiver receiver)
+                throws ClientException;
+
+        /**
+         * interface to receive the messages
+         */
+        public static interface MessageReceiver
+        {
+            /**
+             * receive one message line
+             * @param message   one line of message
+             */
+            public void receiveMessageLine(String message);
+        }
+
+        /**
+         * load the data of a dump into a repository,
+         * @param path              the path to the repository
+         * @param dataInput         the data input source
+         * @param messageOutput     the target for processing messages
+         * @param ignoreUUID        ignore any UUID found in the input stream
+         * @param forceUUID         set the repository UUID to any found in the
+         *                          stream
+         * @param relativePath      the directory in the repository, where the 
data
+         *                          in put optional.
+         * @throws ClientException  throw in case of problem
+         */
+        void load(String path, IInput dataInput,
+                         IOutput messageOutput, boolean ignoreUUID,
+                         boolean forceUUID, String relativePath)
+                throws ClientException;
+
+        /**
+         * load the data of a dump into a repository,
+         * @param path              the path to the repository
+         * @param dataInput         the data input source
+         * @param messageOutput     the target for processing messages
+         * @param ignoreUUID        ignore any UUID found in the input stream
+         * @param forceUUID         set the repository UUID to any found in the
+         *                          stream
+         * @param usePreCommitHook  use the pre-commit hook when processing 
commits
+         * @param usePostCommitHook use the post-commit hook when processing 
commits
+         * @param relativePath      the directory in the repository, where the 
data
+         *                          in put optional.
+         * @throws ClientException  throw in case of problem
+         * @since 1.5
+         */
+        void load(String path, IInput dataInput,
+                                IOutput messageOutput, boolean ignoreUUID,
+                                boolean forceUUID, boolean usePreCommitHook,
+                                boolean usePostCommitHook, String relativePath)
+                throws ClientException;
+
+        /**
+         * list all open transactions in a repository
+         * @param path              the path to the repository
+         * @param receiver          receives one transaction name per call
+         * @throws ClientException  throw in case of problem
+         */
+        void lstxns(String path, MessageReceiver receiver)
+                throws ClientException;
+
+        /**
+         * recover the berkeley db of a repository, returns youngest revision
+         * @param path              the path to the repository
+         * @throws ClientException  throw in case of problem
+         */
+        long recover(String path) throws ClientException;
+
+        /**
+         * remove open transaction in a repository
+         * @param path              the path to the repository
+         * @param transactions      the transactions to be removed
+         * @throws ClientException  throw in case of problem
+         */
+        void rmtxns(String path, String [] transactions)
+                throws ClientException;
+
+        /**
+         * set the log message of a revision
+         * @param path              the path to the repository
+         * @param rev               the revision to be changed
+         * @param message           the message to be set
+         * @param bypassHooks       if to bypass all repository hooks
+         * @throws ClientException  throw in case of problem
+         * @deprecated Use setRevProp() instead.
+         */
+        void setLog(String path, Revision rev, String message,
+                                  boolean bypassHooks)
+                throws ClientException;
+
+        /**
+         * Change the value of the revision property <code>propName</code>
+         * to <code>propValue</code>.  By default, does not run
+         * pre-/post-revprop-change hook scripts.
+         *
+         * @param path The path to the repository.
+         * @param rev The revision for which to change a property value.
+         * @param propName The name of the property to change.
+         * @param propValue The new value to set for the property.
+         * @param usePreRevPropChangeHook Whether to run the
+         * <i>pre-revprop-change</i> hook script.
+         * @param usePostRevPropChangeHook Whether to run the
+         * <i>post-revprop-change</i> hook script.
+         * @throws SubversionException If a problem occurs.
+         * @since 1.5.0
+         */
+        void setRevProp(String path, Revision rev,
+                                      String propName, String propValue,
+                                      boolean usePreRevPropChangeHook,
+                                      boolean usePostRevPropChangeHook)
+                throws SubversionException;
+
+        /**
+         * Verify the repository at <code>path</code> between revisions
+         * <code>start</code> and <code>end</code>.
+         *
+         * @param path              the path to the repository
+         * @param messageOut        the receiver of all messages
+         * @param start             the first revision
+         * @param end               the last revision
+         * @throws ClientException If an error occurred.
+         */
+        void verify(String path,  IOutput messageOut,
+                                  Revision start, Revision end)
+                throws ClientException;
+
+        /**
+         * list all locks in the repository
+         * @param path              the path to the repository
+         * @throws ClientException  throw in case of problem
+         * @since 1.2
+         */
+        Lock[] lslocks(String path) throws ClientException;
+
+        /**
+         * remove multiple locks from the repository
+         * @param path              the path to the repository
+         * @param locks             the name of the locked items
+         * @throws ClientException  throw in case of problem
+         * @since 1.2
+         */
+        void rmlocks(String path, String [] locks)
+                throws ClientException;
+
+}
Index: subversion/bindings/javahl/src/org/apache/subversion/javahl/Lock.java
===================================================================
--- subversion/bindings/javahl/src/org/apache/subversion/javahl/Lock.java       
(revision 909462)
+++ subversion/bindings/javahl/src/org/apache/subversion/javahl/Lock.java       
(working copy)
@@ -80,7 +80,7 @@
      * @param creationDate      the date when the lock was created
      * @param expirationDate    the date when the lock will expire
      */
-    Lock(String owner, String path, String token, String comment,
+    public Lock(String owner, String path, String token, String comment,
          long creationDate, long expirationDate)
     {
         this.owner = owner;
Index: subversion/bindings/javahl/src/org/apache/subversion/javahl/DirEntry.java
===================================================================
--- subversion/bindings/javahl/src/org/apache/subversion/javahl/DirEntry.java   
(revision 909462)
+++ subversion/bindings/javahl/src/org/apache/subversion/javahl/DirEntry.java   
(working copy)
@@ -133,7 +133,7 @@
      * @param lastChanged           the date of the last change
      * @param lastAuthor            the author of the last change
      */
-    DirEntry(String path, String absPath, int nodeKind, long size,
+    public DirEntry(String path, String absPath, int nodeKind, long size,
              boolean hasProps, long lastChangedRevision, long lastChanged,
              String lastAuthor)
     {
Index: 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ChangePath.java
===================================================================
--- subversion/bindings/javahl/src/org/apache/subversion/javahl/ChangePath.java 
(revision 909462)
+++ subversion/bindings/javahl/src/org/apache/subversion/javahl/ChangePath.java 
(working copy)
@@ -42,7 +42,7 @@
      * @param action            action performed
      * @param nodeKind          the kind of the changed path
      */
-    ChangePath(String path, long copySrcRevision, String copySrcPath,
+    public ChangePath(String path, long copySrcRevision, String copySrcPath,
                char action, int nodeKind)
     {
         this.path = path;
Index: 
subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
===================================================================
--- subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java  
(revision 909462)
+++ subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java  
(working copy)
@@ -96,7 +96,7 @@
      */
     public Version getVersion()
     {
-        return NativeResources.version;
+        return NativeResources.getVersion();
     }
 
     /**
Index: 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ProgressEvent.java
===================================================================
--- 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ProgressEvent.java  
    (revision 909462)
+++ 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ProgressEvent.java  
    (working copy)
@@ -58,7 +58,7 @@
      * @param total The total number of bytes, or <code>-1</code> if
      * not known.
      */
-    ProgressEvent(long progress, long total)
+    public ProgressEvent(long progress, long total)
     {
         this.progress = progress;
         this.total = total;
Index: 
subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitItem.java
===================================================================
--- subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitItem.java 
(revision 909462)
+++ subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitItem.java 
(working copy)
@@ -76,7 +76,7 @@
      * @param cu    copy source url
      * @param r     revision number
      */
-    CommitItem(String p, int nk, int sf, String u, String cu, long r)
+    public CommitItem(String p, int nk, int sf, String u, String cu, long r)
     {
         path = p;
         nodeKind = nk;
Index: subversion/bindings/javahl/src/org/apache/subversion/javahl/Info2.java
===================================================================
--- subversion/bindings/javahl/src/org/apache/subversion/javahl/Info2.java      
(revision 909462)
+++ subversion/bindings/javahl/src/org/apache/subversion/javahl/Info2.java      
(working copy)
@@ -210,7 +210,7 @@
      * @param depth
      * @param treeConflict
      */
-    Info2(String path, String url, long rev, int kind, String reposRootUrl,
+    public Info2(String path, String url, long rev, int kind, String 
reposRootUrl,
           String reposUUID, long lastChangedRev, long lastChangedDate,
           String lastChangedAuthor, Lock lock, boolean hasWcInfo, int schedule,
           String copyFromUrl, long copyFromRev, long textTime, long propTime,
Index: 
subversion/bindings/javahl/src/org/apache/subversion/javahl/NotifyInformation.java
===================================================================
--- 
subversion/bindings/javahl/src/org/apache/subversion/javahl/NotifyInformation.java
  (revision 909462)
+++ 
subversion/bindings/javahl/src/org/apache/subversion/javahl/NotifyInformation.java
  (working copy)
@@ -124,7 +124,7 @@
      * @param mergeRange The range of the merge just beginning to occur.
      * @param pathPrefix A common path prefix.
      */
-    NotifyInformation(String path, int action, int kind, String mimeType,
+    public NotifyInformation(String path, int action, int kind, String 
mimeType,
                       Lock lock, String errMsg, int contentState,
                       int propState, int lockState, long revision,
                       String changelistName, RevisionRange mergeRange,
Index: subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNAdmin.java
===================================================================
--- subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNAdmin.java   
(revision 909462)
+++ subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNAdmin.java   
(working copy)
@@ -27,7 +27,7 @@
  * This class offers the same commands as the svnadmin commandline
  * client.
  */
-public class SVNAdmin
+public class SVNAdmin implements ISVNAdmin
 {
     /**
      * Load the required native library.
@@ -77,21 +77,11 @@
     protected long cppAddr;
 
     /**
-     * Filesystem in a Berkeley DB
-     */
-    public static final String BDB = "bdb";
-
-    /**
-     * Filesystem in the filesystem
-     */
-    public static final String FSFS = "fsfs";
-
-    /**
      * @return Version information about the underlying native libraries.
      */
     public Version getVersion()
     {
-        return NativeResources.version;
+        return NativeResources.getVersion();
     }
 
     /**
@@ -171,7 +161,7 @@
      * @param receiver          interface to receive the logfile names
      * @throws ClientException  throw in case of problem
      */
-    public native void listDBLogs(String path, MessageReceiver receiver)
+    public native void listDBLogs(String path, ISVNAdmin.MessageReceiver 
receiver)
             throws ClientException;
 
     /**
@@ -180,22 +170,10 @@
      * @param receiver          interface to receive the logfile names
      * @throws ClientException  throw in case of problem
      */
-    public native void listUnusedDBLogs(String path, MessageReceiver receiver)
+    public native void listUnusedDBLogs(String path, ISVNAdmin.MessageReceiver 
receiver)
             throws ClientException;
 
     /**
-     * interface to receive the messages
-     */
-    public static interface MessageReceiver
-    {
-        /**
-         * receive one message line
-         * @param message   one line of message
-         */
-        public void receiveMessageLine(String message);
-    }
-
-    /**
      * load the data of a dump into a repository,
      * @param path              the path to the repository
      * @param dataInput         the data input source
Index: 
subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java
===================================================================
--- 
subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java
    (revision 909462)
+++ 
subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java
    (working copy)
@@ -33,9 +33,19 @@
 public class NativeResources
 {
     /**
-     * Version information about the underlying native libraries.
+     * @return Version information about the underlying native libraries.
      */
-    static public Version version;
+    private static Version version;
+    
+    /**
+     * Returns version information about the underlying native libraries.
+     * 
+     * @return version
+     * 
+     */
+    public static Version getVersion() {
+        return version;
+    }
 
     /**
      * Load the required native library whose path is specified by the
Index: 
subversion/bindings/javahl/src/org/apache/subversion/javahl/DiffSummary.java
===================================================================
--- 
subversion/bindings/javahl/src/org/apache/subversion/javahl/DiffSummary.java    
    (revision 909462)
+++ 
subversion/bindings/javahl/src/org/apache/subversion/javahl/DiffSummary.java    
    (working copy)
@@ -56,7 +56,7 @@
      * @param nodeKind The type of node which changed (corresponds to
      * the {...@link NodeKind} enumeration).
      */
-    DiffSummary(String path, int diffKind, boolean propsChanged,
+    public DiffSummary(String path, int diffKind, boolean propsChanged,
                 int nodeKind)
     {
         super(path);
Index: subversion/bindings/javahl/src/org/apache/subversion/javahl/Info.java
===================================================================
--- subversion/bindings/javahl/src/org/apache/subversion/javahl/Info.java       
(revision 909462)
+++ subversion/bindings/javahl/src/org/apache/subversion/javahl/Info.java       
(working copy)
@@ -113,7 +113,7 @@
      * @param copyRev               copy source revision
      * @param copyUrl               copy source url
      */
-    Info(String name, String url, String uuid, String repository, int schedule,
+    public Info(String name, String url, String uuid, String repository, int 
schedule,
          int nodeKind, String author, long revision, long lastChangedRevision,
          Date lastChangedDate, Date lastDateTextUpdate,
          Date lastDatePropsUpdate, boolean copied,
Index: 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientException.java
===================================================================
--- 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientException.java
    (revision 909462)
+++ 
subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientException.java
    (working copy)
@@ -46,7 +46,7 @@
      * @param aprError Any associated APR error code for a wrapped
      * <code>svn_error_t</code>.
      */
-    ClientException(String message, String source, int aprError)
+    protected ClientException(String message, String source, int aprError)
     {
         super(message, source, aprError);
     }

Reply via email to