You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/06/16 22:43:57 UTC

svn commit: r955373 - in /subversion/trunk/subversion/bindings/javahl: native/CreateJ.cpp native/EnumMapper.cpp native/EnumMapper.h src/org/apache/subversion/javahl/ReposNotifyInformation.java

Author: hwright
Date: Wed Jun 16 20:43:57 2010
New Revision: 955373

URL: http://svn.apache.org/viewvc?rev=955373&view=rev
Log:
JavaHL: Expand the repository notify information class to include all the
information from the underlying C struct.

[ in subversion/bindings/javahl/ ]
* native/CreateJ.cpp
  (ReposNotifyInformation): Update the constructor method signature, and convert
    the remaining C struct members.
 
* native/EnumMapper.h,
  native/EnumMapper.cpp
  (mapReposNotifyNodeAction): New.

* src/org/apache/subversion/javahl/ReposNotifyInformation.java
  (shard, newRevision, oldRevision, nodeAction, path): New.
  (ReposNotifyInformation): Add the new parameter values.
  (getShard, getNewRevision, getOldRevision, getNodeAction, getPath): New.
  (NodeAction): New.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
    subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp
    subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java

Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp?rev=955373&r1=955372&r2=955373&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp Wed Jun 16 20:43:57 2010
@@ -710,7 +710,9 @@ CreateJ::ReposNotifyInformation(const sv
     {
       midCT = env->GetMethodID(clazz, "<init>",
                                "(L"JAVA_PACKAGE"/ReposNotifyInformation$Action;"
-                               "JLjava/lang/String;)V");
+                               "JLjava/lang/String;JJJ"
+                               "L"JAVA_PACKAGE"/ReposNotifyInformation$NodeAction;"
+                               "Ljava/lang/String;)V");
       if (JNIUtil::isJavaExceptionThrown() || midCT == 0)
         POP_AND_RETURN_NULL;
     }
@@ -725,9 +727,23 @@ CreateJ::ReposNotifyInformation(const sv
     POP_AND_RETURN_NULL;
 
   jlong jRevision = (jlong)reposNotify->revision;
+  jlong jShard = (jlong)reposNotify->shard;
+  jlong jnewRevision = (jlong)reposNotify->new_revision;
+  jlong joldRevision = (jlong)reposNotify->old_revision;
+
+  jobject jnodeAction = EnumMapper::mapReposNotifyNodeAction(
+                                                    reposNotify->node_action);
+  if (JNIUtil::isJavaExceptionThrown())
+    POP_AND_RETURN_NULL;
+
+  jstring jpath = JNIUtil::makeJString(reposNotify->path);
+  if (JNIUtil::isJavaExceptionThrown())
+    POP_AND_RETURN_NULL;
 
   // call the Java method
-  jobject jInfo = env->NewObject(clazz, midCT, jAction, jRevision, jWarning);
+  jobject jInfo = env->NewObject(clazz, midCT, jAction, jRevision, jWarning,
+                                 jShard, jnewRevision, joldRevision,
+                                 jnodeAction, jpath);
   if (JNIUtil::isJavaExceptionThrown())
     POP_AND_RETURN_NULL;
 

Modified: subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp?rev=955373&r1=955372&r2=955373&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp Wed Jun 16 20:43:57 2010
@@ -76,6 +76,12 @@ jobject EnumMapper::mapNotifyAction(svn_
   return mapEnum(JAVA_PACKAGE"/ClientNotifyInformation$Action", (int) action);
 }
 
+jobject EnumMapper::mapReposNotifyNodeAction(svn_node_action action)
+{
+  // We're assuming a valid value for the C enum above
+  return mapEnum(JAVA_PACKAGE"/ReposNotifyInformation$NodeAction", (int) action);
+}
+
 /**
  * Map a C repos notify action constant to the Java constant.
  */

Modified: subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h?rev=955373&r1=955372&r2=955373&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h Wed Jun 16 20:43:57 2010
@@ -53,6 +53,7 @@ class EnumMapper
   static jint mapCommitMessageStateFlags(apr_byte_t flags);
   static jobject mapNotifyState(svn_wc_notify_state_t state);
   static jobject mapNotifyAction(svn_wc_notify_action_t action);
+  static jobject mapReposNotifyNodeAction(svn_node_action action);
   static jobject mapReposNotifyAction(svn_repos_notify_action_t action);
   static jobject mapNodeKind(svn_node_kind_t nodeKind);
   static jobject mapNotifyLockState(svn_wc_notify_lock_state_t state);

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java?rev=955373&r1=955372&r2=955373&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java (original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java Wed Jun 16 20:43:57 2010
@@ -23,7 +23,6 @@
 
 package org.apache.subversion.javahl;
 
-import java.util.Map;
 import java.util.EventObject;
 
 /**
@@ -57,6 +56,16 @@ public class ReposNotifyInformation exte
      * The warning text.
      */
     private String warning;
+    
+    private long shard;
+    
+    private long newRevision;
+    
+    private long oldRevision;
+    
+    private NodeAction nodeAction;
+    
+    private String path;
 
     /**
      * This constructor is to be used by the native code.
@@ -64,12 +73,20 @@ public class ReposNotifyInformation exte
      * @param action The {@link NotifyAction} which triggered this event.
      * @param revision potentially the revision.
      */
-    public ReposNotifyInformation(Action action, long revision, String warning)
+    public ReposNotifyInformation(Action action, long revision, String warning,
+                                  long shard, long newRevision,
+                                  long oldRevision, NodeAction nodeAction,
+                                  String path)
     {
         super(action);
         this.action = action;
         this.revision = revision;
         this.warning = warning;
+        this.shard = shard;
+        this.newRevision = newRevision;
+        this.oldRevision = oldRevision;
+        this.nodeAction = nodeAction;
+        this.path = path;
     }
 
     /**
@@ -95,7 +112,32 @@ public class ReposNotifyInformation exte
     {
         return warning;
     }
+    
+    public long getShard()
+    {
+       return shard;
+    }
+    
+    public long getNewRevision()
+    {
+       return newRevision;
+    }
+    
+    public long getOldRevision()
+    {
+       return oldRevision;
+    }
 
+    public NodeAction getNodeAction()
+    {
+       return nodeAction;
+    }
+    
+    public String getPath()
+    {
+       return path;
+    }
+    
     /**
      * The type of action triggering the notification
      */
@@ -149,4 +191,12 @@ public class ReposNotifyInformation exte
         /** Upgrade has started. */
         upgrade_start;
     }
+    
+    public enum NodeAction
+    {
+         svn_node_action_change,
+         svn_node_action_add,
+         svn_node_action_delete,
+         svn_node_action_replace;
+    }
 }