subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1499168 - in /subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl: ./ native/ src/org/apache/subversion/javahl/ src/org/apache/subversion/javahl/callback/ src/org/apache/subversion/javahl/remote/
Date Wed, 03 Jul 2013 00:48:23 GMT
Author: brane
Date: Wed Jul  3 00:48:22 2013
New Revision: 1499168

URL: http://svn.apache.org/r1499168
Log:
On the javahl-1.7-extensions branch: Sync JavaHL with trunk up to r1499159.

Added:
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/RemoteStatus.java
      - copied unchanged from r1499159, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/RemoteStatus.java
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java
      - copied, changed from r1499159, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java
Removed:
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/UpdateReporter.java
Modified:
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/   (props changed)
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/CreateJ.cpp
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/CreateJ.h
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.cpp
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.h
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java
    subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java

Propchange: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/
------------------------------------------------------------------------------
  Merged /subversion/trunk/subversion/bindings/javahl:r1497786-1499159

Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/CreateJ.cpp?rev=1499168&r1=1499167&r2=1499168&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/CreateJ.cpp
(original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/CreateJ.cpp
Wed Jul  3 00:48:22 2013
@@ -1085,7 +1085,7 @@ CreateJ::RevisionRangeList(apr_array_hea
 }
 
 jobject
-CreateJ::StringSet(apr_array_header_t *strings)
+CreateJ::StringSet(const apr_array_header_t *strings)
 {
   std::vector<jobject> jstrs;
 

Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/CreateJ.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/CreateJ.h?rev=1499168&r1=1499167&r2=1499168&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/CreateJ.h
(original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/CreateJ.h
Wed Jul  3 00:48:22 2013
@@ -84,7 +84,7 @@ class CreateJ
   RevisionRangeList(apr_array_header_t *ranges);
 
   static jobject
-  StringSet(apr_array_header_t *strings);
+  StringSet(const apr_array_header_t *strings);
 
   static jobject
   PropertyMap(apr_hash_t *prop_hash);

Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1499168&r1=1499167&r2=1499168&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.cpp
(original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.cpp
Wed Jul  3 00:48:22 2013
@@ -705,11 +705,11 @@ bool JNIUtil::isJavaExceptionThrown()
   return false;
 }
 
-const char *
-JNIUtil::thrownExceptionToCString(SVN::Pool &in_pool)
+namespace {
+const char* exception_to_cstring(apr_pool_t* pool)
 {
   const char *msg;
-  JNIEnv *env = getEnv();
+  JNIEnv *env = JNIUtil::getEnv();
   if (env->ExceptionCheck())
     {
       jthrowable t = env->ExceptionOccurred();
@@ -718,12 +718,12 @@ JNIUtil::thrownExceptionToCString(SVN::P
         {
           jclass clazz = env->FindClass("java/lang/Throwable");
           getMessage = env->GetMethodID(clazz, "getMessage",
-                                        "(V)Ljava/lang/String;");
+                                        "()Ljava/lang/String;");
           env->DeleteLocalRef(clazz);
         }
       jstring jmsg = (jstring) env->CallObjectMethod(t, getMessage);
       JNIStringHolder tmp(jmsg);
-      msg = tmp.pstrdup(in_pool.getPool());
+      msg = tmp.pstrdup(pool);
       // ### Conditionally add t.printStackTrace() to msg?
     }
   else
@@ -732,6 +732,24 @@ JNIUtil::thrownExceptionToCString(SVN::P
     }
   return msg;
 }
+} // anonymous namespace
+
+const char *
+JNIUtil::thrownExceptionToCString(SVN::Pool &in_pool)
+{
+  return exception_to_cstring(in_pool.getPool());
+}
+
+svn_error_t*
+JNIUtil::checkJavaException(apr_status_t errorcode)
+{
+  if (!getEnv()->ExceptionCheck())
+    return SVN_NO_ERROR;
+  svn_error_t* err = svn_error_create(errorcode, NULL, NULL);
+  err->message = apr_psprintf(err->pool, _("Java exception: %s"),
+                              exception_to_cstring(err->pool));
+  return err;
+}
 
 /**
  * Create a Java string from a native UTF-8 string.

Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.h?rev=1499168&r1=1499167&r2=1499168&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.h
(original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.h
Wed Jul  3 00:48:22 2013
@@ -41,6 +41,8 @@ class SVNBase;
 struct svn_string_t;
 struct svn_error_t;
 
+#include "svn_error.h"
+
 #define JAVA_PACKAGE "org/apache/subversion/javahl"
 
 /**
@@ -108,6 +110,12 @@ class JNIUtil
   static const char *thrownExceptionToCString(SVN::Pool &in_pool);
 
   /**
+   * Check if a Java exception was thrown and convert it to a
+   * Subversion error, using @a errorcode as the generic error code.
+   */
+  static svn_error_t* checkJavaException(apr_status_t errorcode);
+
+  /**
    * Throw a Java exception corresponding to err, and run
    * svn_error_clear() on err.
    */
@@ -300,4 +308,10 @@ class JNIUtil
     }                                                   \
   } while (0)
 
+#define SVN_JNI_CATCH(statement, errorcode)             \
+  do {                                                  \
+    do { statement; } while(0);                         \
+    SVN_ERR(JNIUtil::checkJavaException((errorcode)));  \
+  } while(0)
+
 #endif  // JNIUTIL_H

Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp?rev=1499168&r1=1499167&r2=1499168&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp
(original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp
Wed Jul  3 00:48:22 2013
@@ -640,13 +640,11 @@ RemoteSession::getDirectory(jlong jrevis
 // TODO: update
 // TODO: switch
 
-jobject
-RemoteSession::status(jstring jstatus_target,
+void
+RemoteSession::status(jobject jthis, jstring jstatus_target,
                       jlong jrevision, jobject jdepth,
-                      jobject jstatus_editor)
-{
-  return NULL;
-}
+                      jobject jstatus_editor, jobject jreporter)
+{}
 
 // TODO: diff
 

Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h?rev=1499168&r1=1499167&r2=1499168&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h
(original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h
Wed Jul  3 00:48:22 2013
@@ -82,9 +82,9 @@ class RemoteSession : public SVNBase
     // TODO: getMergeinfo
     // TODO: update
     // TODO: switch
-    jobject status(jstring jstatus_target,
-                   jlong jrevision, jobject jdepth,
-                   jobject jstatus_editor);
+    void status(jobject jthis, jstring jstatus_target,
+                jlong jrevision, jobject jdepth,
+                jobject jstatus_editor, jobject jreporter);
     // TODO: diff
     void getLog(jobject jpaths, jlong jstartrev, jlong jendrev, jint jlimit,
                 jboolean jstrict_node_history, jboolean jdiscover_changed_paths,

Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp?rev=1499168&r1=1499167&r2=1499168&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
(original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
Wed Jul  3 00:48:22 2013
@@ -217,16 +217,17 @@ Java_org_apache_subversion_javahl_remote
 // TODO: update
 // TODO: switch
 
-JNIEXPORT jobject JNICALL
-Java_org_apache_subversion_javahl_remote_RemoteSession_status(
-    JNIEnv *env, jobject jthis, jstring jstatus_target,
-    jlong jrevision, jobject jdepth, jobject jstatus_editor)
+JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_remote_RemoteSession_nativeStatus(
+    JNIEnv *env, jobject jthis, jstring jstatus_target, jlong jrevision,
+    jobject jdepth, jobject jstatus_editor, jobject jreporter)
 {
-  JNIEntry(SVNReposAccess, doStatus);
+  JNIEntry(SVNReposAccess, nativeStatus);
   RemoteSession *ras = RemoteSession::getCppObject(jthis);
-  CPPADDR_NULL_PTR(ras, NULL);
+  CPPADDR_NULL_PTR(ras,);
 
-  return ras->status(jstatus_target, jrevision, jdepth, jstatus_editor);
+  ras->status(jthis, jstatus_target, jrevision, jdepth,
+              jstatus_editor, jreporter);
 }
 
 // TODO: diff

Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java?rev=1499168&r1=1499167&r2=1499168&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java
(original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java
Wed Jul  3 00:48:22 2013
@@ -273,40 +273,42 @@ public interface ISVNEditor
               String destinationRelativePath,
               long replacesRevision)
             throws ClientException;
-    /**
-     * Perform a rotation among multiple nodes in the target tree.
-     * <p>
-     * The <code>elements</code> list specifies the nodes in the tree
-     * which are located at a path and expected to be at a specific
-     * revision. These nodes are simultaneously moved in a rotation
-     * pattern.  For example, the node at index 0
-     * <code>elements</code> will be moved to the relative path
-     * specified at index 1 of <code>elements</code>. The node at
-     * index 1 will be moved to the location at index 2. The node at
-     * index N-1 will be moved to the relative path specified at index 0.
-     * <p>
-     * The simplest form of this operation is to swap nodes A and
-     * B. One may think to move A to a temporary location T, then move
-     * B to A, then move T to B. However, this last move violations
-     * the Once Rule by moving T (which had already by edited by the
-     * move from A). In order to keep the restrictions against
-     * multiple moves of a single node, the rotation operation is
-     * needed for certain types of tree edits.
-     *
-     * @throws ClientException
-     */
-    void rotate(Iterable<RotatePair> elements) throws ClientException;
 
-    public static final class RotatePair
-    {
-        public RotatePair(String relativePath, long revision)
-        {
-            this.relativePath = relativePath;
-            this.revision = revision;
-        }
-        public final String relativePath;
-        public final long revision;
-    }
+// Not implemented in the native API
+//    /**
+//     * Perform a rotation among multiple nodes in the target tree.
+//     * <p>
+//     * The <code>elements</code> list specifies the nodes in the tree
+//     * which are located at a path and expected to be at a specific
+//     * revision. These nodes are simultaneously moved in a rotation
+//     * pattern.  For example, the node at index 0
+//     * <code>elements</code> will be moved to the relative path
+//     * specified at index 1 of <code>elements</code>. The node at
+//     * index 1 will be moved to the location at index 2. The node at
+//     * index N-1 will be moved to the relative path specified at index 0.
+//     * <p>
+//     * The simplest form of this operation is to swap nodes A and
+//     * B. One may think to move A to a temporary location T, then move
+//     * B to A, then move T to B. However, this last move violations
+//     * the Once Rule by moving T (which had already by edited by the
+//     * move from A). In order to keep the restrictions against
+//     * multiple moves of a single node, the rotation operation is
+//     * needed for certain types of tree edits.
+//     *
+//     * @throws ClientException
+//     */
+//    void rotate(Iterable<RotatePair> elements) throws ClientException;
+//
+//    public static final class RotatePair
+//    {
+//        public RotatePair(String relativePath, long revision)
+//        {
+//            this.relativePath = relativePath;
+//            this.revision = revision;
+//        }
+//        public final String relativePath;
+//        public final long revision;
+//    }
 
     /**
      * Signal that the edit has been completed successfully.

Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java?rev=1499168&r1=1499167&r2=1499168&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
(original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
Wed Jul  3 00:48:22 2013
@@ -289,8 +289,8 @@ public interface ISVNRemote
      * or the HEAD revision if <code>revision</code> is
      * {@link org.apache.subversion.javahl.types.Revision#SVN_INVALID_REVNUM}.
      * <p>
-     * The client begins by providing a <code>statusEditor</code> to
-     * the remote session; this editor must contain knowledge of where
+     * The client begins by providing a <code>receiver</code> to
+     * the remote session; this object must contain knowledge of where
      * the change will begin in the working copy.
      * <p>
      * In return, the client receives an {@link ISVNReporter}
@@ -298,14 +298,12 @@ public interface ISVNRemote
      * calls to its methods.
      * <p>
      * When finished, the client calls {@link ISVNReporter#finishReport}.
-     * This results in a complete drive of <code>statusEditor</code>,
-     * ending with {@link ISVNEditor#complete()}, to report,
-     * essentially, what would be modified in the working copy were
-     * the client to perform an update.  <code>statusTarget</code> is
-     * an optional single path component that restricts the scope of
-     * the status report to an entry in the directory represented by
-     * the session's URL, or empty if the entire directory is meant to
-     * be examined.
+     * This results in <code>receiver</code> being called once for
+     * every path in the working copy that is different from the
+     * repository. <code>statusTarget</code> is an optional single
+     * path component that restricts the scope of the status report to
+     * an entry in the directory represented by the session's URL, or
+     * empty if the entire directory is meant to be examined.
      * <p>
      * Get status as deeply as <code>depth</code> indicates.  If
      * <code>depth</code> is
@@ -317,8 +315,8 @@ public interface ISVNRemote
      * <p>
      * The caller may not perform any operations using this session
      * before finishing the report, and may not perform any operations
-     * using this session from within the editing operations of
-     * <code>statusEditor</code>.
+     * using this session from within the implementation of
+     * <code>receiver</code>.
      * <p>
      * <b>Note:</b> The reporter provided by this function does
      * <em>not</em> supply copy-from information to the editor
@@ -332,7 +330,7 @@ public interface ISVNRemote
      */
     ISVNReporter status(String statusTarget,
                         long revision, Depth depth,
-                        ISVNEditor statusEditor)
+                        RemoteStatus receiver)
             throws ClientException;
 
     // TODO: diff

Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java?rev=1499168&r1=1499167&r2=1499168&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java
(original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReporter.java
Wed Jul  3 00:48:22 2013
@@ -134,16 +134,22 @@ public interface ISVNReporter
                   String lockToken)
             throws ClientException;
 
-
     /**
      * The report driver calls this when the state report is finished.
      * Any directories or files not explicitly "set" are assumed to be
      * at the baseline revision originally passed into do_update(). No
      * other reporting functions, including {@link abortReport()},
      * should be called after calling this function.
+     *
+     * @return The target revision of the resulting editor drive. In
+     *         the case of {@link ISVNRemote#status}, this is the
+     *         revision against which the status call was performed;
+     *         in the case of {@link ISVNRemote#update}, it is the
+     *         revision updated to.
+     *
      * @throws ClientException
      */
-    void finishReport() throws ClientException;
+    long finishReport() throws ClientException;
 
     /**
      * If an error occurs during a report, this routine should cause

Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java?rev=1499168&r1=1499167&r2=1499168&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java
(original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java
Wed Jul  3 00:48:22 2013
@@ -131,10 +131,8 @@ public class CommitEditor extends JNIObj
         notimplemented("move");
     }
 
-    public void rotate(Iterable<RotatePair> elements) throws ClientException
-    {
-        notimplemented("rotate");
-    }
+//    public void rotate(Iterable<RotatePair> elements)
+//            throws ClientException;
 
     public void complete() throws ClientException
     {

Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java?rev=1499168&r1=1499167&r2=1499168&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java
(original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java
Wed Jul  3 00:48:22 2013
@@ -57,6 +57,17 @@ public class RemoteSession extends JNIOb
             }
             editorReference = null;
         }
+        if (reporterReference != null)
+        {
+            // Deactivate the open reporter
+            ISVNReporter rp = reporterReference.get();
+            if (rp != null)
+            {
+                rp.dispose();
+                reporterReference.clear();
+            }
+            reporterReference = null;
+        }
         nativeDispose();
     }
 
@@ -114,13 +125,10 @@ public class RemoteSession extends JNIOb
                                       boolean keepLocks)
             throws ClientException
     {
-        if (editorReference != null && editorReference.get() != null)
-            throw new IllegalStateException("An editor is already active");
-
+        check_inactive(editorReference, reporterReference);
         ISVNEditor ed =
             CommitEditor.createInstance(this, revisionProperties,
                                         commitCallback, lockTokens, keepLocks);
-
         if (editorReference != null)
             editorReference.clear();
         editorReference = new WeakReference<ISVNEditor>(ed);
@@ -155,10 +163,24 @@ public class RemoteSession extends JNIOb
     // TODO: update
     // TODO: switch
 
-    public native ISVNReporter status(String statusTarget,
-                                      long revision, Depth depth,
-                                      ISVNEditor statusEditor)
-            throws ClientException;
+    public ISVNReporter status(String statusTarget,
+                               long revision, Depth depth,
+                               RemoteStatus receiver)
+            throws ClientException
+    {
+        check_inactive(editorReference, reporterReference);
+        StateReporter rp = StateReporter.createInstance(this);
+
+        // At this point, the reporter is not active/valid.
+        //StatusEditor editor = new StatusEditor(receiver);
+        //nativeStatus(statusTarget, revision, depth, editor, rp);
+        // Now it should be valid.
+
+        if (reporterReference != null)
+            reporterReference.clear();
+        reporterReference = new WeakReference<ISVNReporter>(rp);
+        return rp;
+    }
 
     // TODO: diff
 
@@ -219,12 +241,16 @@ public class RemoteSession extends JNIOb
                                       OutputStream contents,
                                       Map<String, byte[]> properties)
             throws ClientException;
-
     private native long nativeGetDirectory(long revision, String path,
                                            int direntFields,
                                            Map<String, DirEntry> dirents,
                                            Map<String, byte[]> properties)
             throws ClientException;
+    private native void nativeStatus(String statusTarget,
+                                     long revision, Depth depth,
+                                     ISVNEditor statusEditor,
+                                     ISVNReporter reporter)
+            throws ClientException;
     private native boolean nativeHasCapability(String capability)
             throws ClientException;
 
@@ -235,18 +261,19 @@ public class RemoteSession extends JNIOb
     private class RemoteSessionContext extends OperationContext {}
 
     /*
-     * A reference to the current open editor. We need this in order
+     * A reference to the current active editor. We need this in order
      * to dispose/abort the editor when the session is disposed. And
-     * furthermore, there can be only one editor active at any time.
+     * furthermore, there can be only one editor or reporter active at
+     * any time.
      */
     private WeakReference<ISVNEditor> editorReference;
 
     /*
-     * The commit editor callse this when disposed to clear the
+     * The commit editor calls this when disposed to clear the
      * reference. Note that this function will be called during our
      * dispose, so make sure they don't step on each others' toes.
      */
-    void disposeEditor(CommitEditor editor)
+    void disposeEditor(ISVNEditor editor)
     {
         if (editorReference == null)
             return;
@@ -259,6 +286,31 @@ public class RemoteSession extends JNIOb
     }
 
     /*
+     * A reference to the current active reporter. We need this in
+     * order to dispose/abort the report when the session is
+     * disposed. And furthermore, there can be only one reporter or
+     * editor active at any time.
+     */
+    private WeakReference<ISVNReporter> reporterReference;
+
+    /*
+     * The update reporter calls this when disposed to clear the
+     * reference. Note that this function will be called during our
+     * dispose, so make sure they don't step on each others' toes.
+     */
+    void disposeReporter(ISVNReporter reporter)
+    {
+        if (reporterReference == null)
+            return;
+        ISVNReporter rp = reporterReference.get();
+        if (rp == null)
+            return;
+        if (rp != reporter)
+            throw new IllegalStateException("Disposing unknown reporter");
+        reporterReference.clear();
+    }
+
+    /*
      * Private helper methods.
      */
     private final static void maybe_clear(Map clearable)
@@ -270,4 +322,14 @@ public class RemoteSession extends JNIOb
                 // ignored
             }
     }
+
+    private final static
+        void check_inactive(WeakReference<ISVNEditor> editorReference,
+                            WeakReference<ISVNReporter> reporterReference)
+    {
+        if (editorReference != null && editorReference.get() != null)
+            throw new IllegalStateException("An editor is already active");
+        if (reporterReference != null && reporterReference.get() != null)
+            throw new IllegalStateException("A reporter is already active");
+    }
 }

Copied: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java
(from r1499159, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java?p2=subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java&p1=subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java&r1=1499159&r2=1499168&rev=1499168&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java
(original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java
Wed Jul  3 00:48:22 2013
@@ -36,32 +36,43 @@ import org.apache.subversion.javahl.Clie
  */
 public class StateReporter extends JNIObject implements ISVNReporter
 {
-    public void dispose()
+    public void dispose() {/* TODO: */}
+
+    public void setPath(String path,
+                        long revision,
+                        Depth depth,
+                        boolean startEmpty,
+                        String lockToken)
+            throws ClientException
     {
-        session.disposeReporter(this);
-        nativeDispose();
+        throw new RuntimeException("Not implemented: setPath");
     }
 
-    public native void setPath(String path,
-                               long revision,
-                               Depth depth,
-                               boolean startEmpty,
-                               String lockToken)
-        throws ClientException;
-
-    public native void deletePath(String path) throws ClientException;
+    public void deletePath(String path) throws ClientException
+    {
+        throw new RuntimeException("Not implemented: deletePath");
+    }
 
-    public native void linkPath(String url,
-                                String path,
-                                long revision,
-                                Depth depth,
-                                boolean startEmpty,
-                                String lockToken)
-        throws ClientException;
+    public void linkPath(String url,
+                         String path,
+                         long revision,
+                         Depth depth,
+                         boolean startEmpty,
+                         String lockToken)
+            throws ClientException
+    {
+        throw new RuntimeException("Not implemented: linkPath");
+    }
 
-    public native long finishReport() throws ClientException;
+    public long finishReport() throws ClientException
+    {
+        throw new RuntimeException("Not implemented: finishReport");
+    }
 
-    public native void abortReport() throws ClientException;
+    public void abortReport() throws ClientException
+    {
+        throw new RuntimeException("Not implemented: abortReport");
+    }
 
     /**
      * This factory method called from RemoteSession.status and friends.
@@ -70,20 +81,9 @@ public class StateReporter extends JNIOb
         StateReporter createInstance(RemoteSession session)
             throws ClientException
     {
-        long cppAddr = nativeCreateInstance();
-        return new StateReporter(cppAddr, session);
+        return null;
     }
 
-    @Override
-    public native void finalize() throws Throwable;
-
-    /*
-     * Wrapped private native implementation declarations.
-     */
-    private native void nativeDispose();
-    private static final native long nativeCreateInstance()
-        throws ClientException;
-
     /**
      * This constructor is called from the factory method.
      */



Mime
View raw message