subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r926179 - in /subversion/trunk/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/ src/org/tigris/subversion/javahl/
Date Mon, 22 Mar 2010 16:49:38 GMT
Author: hwright
Date: Mon Mar 22 16:49:38 2010
New Revision: 926179

URL: http://svn.apache.org/viewvc?rev=926179&view=rev
Log:
JavaHL: Enum'ize the ClientLogLevel constants.

[ in subversion/bindings/javahl/ ]
* native/EnumMapper.h,
  native/EnumMapper.cpp
  (toLogLevel): New.

* native/org_apache_subversion_javahl_SVNClient.cpp
  (Java_org_apache_subversion_javahl_SVNClient_enableLogging):
    Use the EnumMapper to decode the enum to an int.
 
* src/org/apache/subversion/javahl/ClientLogLevel.java:
  Remove.

* src/org/apache/subversion/javahl/SVNClient.java
  (enableLogging): Update param type.
  (ClientLogLevel): New, as an enum.
  (LogLevel): Remove.

* src/org/tigris/subversion/javahl/SVNClient.java
  (enableLogging): Update wrapper.

Removed:
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientLogLevel.java
Modified:
    subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp
    subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h
    subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
    subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java

Modified: subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp?rev=926179&r1=926178&r2=926179&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp Mon Mar 22 16:49:38
2010
@@ -138,6 +138,11 @@ int EnumMapper::toMergeinfoLogKind(jobje
   return getOrdinal(JAVA_PACKAGE"/MergeinfoLogKind", jLogKind);
 }
 
+int EnumMapper::toLogLevel(jobject jLogLevel)
+{
+  return getOrdinal(JAVA_PACKAGE"/SVNClient$ClientLogLevel", jLogLevel);
+}
+
 svn_depth_t EnumMapper::toDepth(jobject jdepth)
 {
   // The offset for depths is -2

Modified: subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h?rev=926179&r1=926178&r2=926179&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h Mon Mar 22 16:49:38 2010
@@ -46,6 +46,7 @@ class EnumMapper
   static svn_opt_revision_kind toRevisionKind(jobject jkind);
   static svn_wc_conflict_choice_t toConflictChoice(jobject jchoice);
   static int toMergeinfoLogKind(jobject jLogKind);
+  static int toLogLevel(jobject jLogLevel);
 
   /* Converting from C enum's */
   static jint mapCommitMessageStateFlags(apr_byte_t flags);

Modified: subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=926179&r1=926178&r2=926179&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
(original)
+++ subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
Mon Mar 22 16:49:38 2010
@@ -25,7 +25,6 @@
  */
 
 #include "../include/org_apache_subversion_javahl_SVNClient.h"
-#include "../include/org_apache_subversion_javahl_ClientLogLevel.h"
 #include "JNIUtil.h"
 #include "JNIStackElement.h"
 #include "JNIStringHolder.h"
@@ -1458,26 +1457,10 @@ JNIEXPORT void JNICALL Java_org_apache_s
 
 JNIEXPORT void JNICALL
 Java_org_apache_subversion_javahl_SVNClient_enableLogging
-(JNIEnv *env, jclass jclazz, jint jlogLevel, jstring jpath)
+(JNIEnv *env, jclass jclazz, jobject jlogLevel, jstring jpath)
 {
   JNIEntryStatic(SVNClient, enableLogging);
-  int cLevel = JNIUtil::noLog;
-  switch(jlogLevel)
-    {
-    case org_apache_subversion_javahl_ClientLogLevel_NoLog:
-      cLevel = JNIUtil::noLog;
-      break;
-    case org_apache_subversion_javahl_ClientLogLevel_ErrorLog:
-      cLevel = JNIUtil::errorLog;
-      break;
-    case org_apache_subversion_javahl_ClientLogLevel_ExceptionLog:
-      cLevel = JNIUtil::exceptionLog;
-      break;
-    case org_apache_subversion_javahl_ClientLogLevel_EntryLog:
-      cLevel = JNIUtil::entryLog;
-      break;
-    }
-  JNIUtil::initLogFile(cLevel, jpath);
+  JNIUtil::initLogFile(EnumMapper::toLogLevel(jlogLevel), jpath);
 
 }
 

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=926179&r1=926178&r2=926179&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
Mon Mar 22 16:49:38 2010
@@ -557,15 +557,25 @@ public class SVNClient implements ISVNCl
      *                      ClientLogLevel)
      * @param logFilePath   path of the log file
      */
-    public static native void enableLogging(int logLevel, String logFilePath);
+    public static native void enableLogging(ClientLogLevel logLevel,
+                                            String logFilePath);
 
     /**
-     * class for the constants of the logging levels.
-     * The constants are defined in ClientLogLevel because of building
-     * reasons
+     * enum for the constants of the logging levels.
      */
-    public static final class LogLevel implements ClientLogLevel
+    public enum ClientLogLevel
     {
+        /** Log nothing */
+        NoLog,
+
+        /** Log fatal error */
+        ErrorLog,
+
+        /** Log exceptions thrown */
+        ExceptionLog,
+
+        /** Log the entry and exits of the JNI code */
+        EntryLog;
     }
 
     /**

Modified: subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java?rev=926179&r1=926178&r2=926179&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
Mon Mar 22 16:49:38 2010
@@ -2357,8 +2357,10 @@ public class SVNClient implements SVNCli
      */
     public static void enableLogging(int logLevel, String logFilePath)
     {
-        org.apache.subversion.javahl.SVNClient.enableLogging(logLevel,
-                                                             logFilePath);
+        org.apache.subversion.javahl.SVNClient.enableLogging(
+            org.apache.subversion.javahl.SVNClient.ClientLogLevel.values()[
+                                                                logLevel],
+            logFilePath);
     }
 
     /**



Mime
View raw message