subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r905689 - in /subversion/trunk/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/ src/org/tigris/subversion/javahl/
Date Tue, 02 Feb 2010 16:17:46 GMT
Author: hwright
Date: Tue Feb  2 16:17:28 2010
New Revision: 905689

URL: http://svn.apache.org/viewvc?rev=905689&view=rev
Log:
JavaHL: Migrate the NativeResources and Version class native implementations
to the new org.apache package, and implement the old versions as simple
wrappers.

[ in subversion/bindings/javahl/ ]
* native/org_tigris_subversion_javahl_Version.cpp:
  Removed, copied to ...

* native/org_apache_subversion_javahl_Version.cpp:
  ... this.

* native/org_tigris_subversion_javahl_NativeResources.cpp:
  Removed, copied to ...

* native/org_apache_subversion_javahl_NativeResources.cpp:
  ... this.

* src/org/tigris/subversion/javahl/Version.java:
  Make this class wrap the version in org.apache.

* src/org/tigris/subversion/javahl/NativeResources.java:
  Same.

* src/org/apache/subversion/javahl/NativeResources.java:
  Make the class public so the old package can use it.

Added:
    subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_NativeResources.cpp
      - copied, changed from r905641, subversion/trunk/subversion/bindings/javahl/native/org_tigris_subversion_javahl_NativeResources.cpp
    subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_Version.cpp
      - copied, changed from r905641, subversion/trunk/subversion/bindings/javahl/native/org_tigris_subversion_javahl_Version.cpp
Removed:
    subversion/trunk/subversion/bindings/javahl/native/org_tigris_subversion_javahl_NativeResources.cpp
    subversion/trunk/subversion/bindings/javahl/native/org_tigris_subversion_javahl_Version.cpp
Modified:
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java
    subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/NativeResources.java
    subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Version.java

Copied: subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_NativeResources.cpp
(from r905641, subversion/trunk/subversion/bindings/javahl/native/org_tigris_subversion_javahl_NativeResources.cpp)
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_NativeResources.cpp?p2=subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_NativeResources.cpp&p1=subversion/trunk/subversion/bindings/javahl/native/org_tigris_subversion_javahl_NativeResources.cpp&r1=905641&r2=905689&rev=905689&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/org_tigris_subversion_javahl_NativeResources.cpp
(original)
+++ subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_NativeResources.cpp
Tue Feb  2 16:17:28 2010
@@ -20,16 +20,16 @@
  * ====================================================================
  * @endcopyright
  *
- * @file org_tigris_subversion_javahl_NativeResources.cpp
+ * @file org_apache_subversion_javahl_NativeResources.cpp
  * @brief Implementation of the native methods in the Java class
  * NativeResources.
  */
 
 #include "JNIUtil.h"
-#include "../include/org_tigris_subversion_javahl_NativeResources.h"
+#include "../include/org_apache_subversion_javahl_NativeResources.h"
 
 JNIEXPORT void JNICALL
-Java_org_tigris_subversion_javahl_NativeResources_initNativeLibrary
+Java_org_apache_subversion_javahl_NativeResources_initNativeLibrary
 (JNIEnv *env, jclass jclazz)
 {
   // No usual JNIEntry here, as the prerequisite native library

Copied: subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_Version.cpp
(from r905641, subversion/trunk/subversion/bindings/javahl/native/org_tigris_subversion_javahl_Version.cpp)
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_Version.cpp?p2=subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_Version.cpp&p1=subversion/trunk/subversion/bindings/javahl/native/org_tigris_subversion_javahl_Version.cpp&r1=905641&r2=905689&rev=905689&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/org_tigris_subversion_javahl_Version.cpp
(original)
+++ subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_Version.cpp
Tue Feb  2 16:17:28 2010
@@ -20,37 +20,37 @@
  * ====================================================================
  * @endcopyright
  *
- * @file org_tigris_subversion_javahl_Version.cpp
+ * @file org_apache_subversion_javahl_Version.cpp
  * @brief Implementation of the native methods in the Java class Version.
  */
 
-#include "../include/org_tigris_subversion_javahl_Version.h"
+#include "../include/org_apache_subversion_javahl_Version.h"
 #include "JNIStackElement.h"
 #include "svn_version.h"
 
 JNIEXPORT jint JNICALL
-Java_org_tigris_subversion_javahl_Version_getMajor(JNIEnv *env, jobject jthis)
+Java_org_apache_subversion_javahl_Version_getMajor(JNIEnv *env, jobject jthis)
 {
   JNIEntry(Version, getMajor);
   return SVN_VER_MAJOR;
 }
 
 JNIEXPORT jint JNICALL
-Java_org_tigris_subversion_javahl_Version_getMinor(JNIEnv *env, jobject jthis)
+Java_org_apache_subversion_javahl_Version_getMinor(JNIEnv *env, jobject jthis)
 {
   JNIEntry(Version, getMinor);
   return SVN_VER_MINOR;
 }
 
 JNIEXPORT jint JNICALL
-Java_org_tigris_subversion_javahl_Version_getPatch(JNIEnv *env, jobject jthis)
+Java_org_apache_subversion_javahl_Version_getPatch(JNIEnv *env, jobject jthis)
 {
   JNIEntry(Version, getPatch);
   return SVN_VER_PATCH;
 }
 
 JNIEXPORT jstring JNICALL
-Java_org_tigris_subversion_javahl_Version_getTag(JNIEnv *env, jobject jthis)
+Java_org_apache_subversion_javahl_Version_getTag(JNIEnv *env, jobject jthis)
 {
   JNIEntry(Version, getTag);
   jstring tag = JNIUtil::makeJString(SVN_VER_TAG);
@@ -61,7 +61,7 @@
 }
 
 JNIEXPORT jstring JNICALL
-Java_org_tigris_subversion_javahl_Version_getNumberTag(JNIEnv *env,
+Java_org_apache_subversion_javahl_Version_getNumberTag(JNIEnv *env,
                                                        jobject jthis)
 {
   JNIEntry(Version, getNumberTag);

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java?rev=905689&r1=905688&r2=905689&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java
Tue Feb  2 16:17:28 2010
@@ -27,7 +27,7 @@
  * Handles activities related to management of native resouces
  * (e.g. loading of native libraries).
  */
-class NativeResources
+public class NativeResources
 {
     /**
      * Version information about the underlying native libraries.

Modified: subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/NativeResources.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/NativeResources.java?rev=905689&r1=905688&r2=905689&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/NativeResources.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/NativeResources.java
Tue Feb  2 16:17:28 2010
@@ -23,110 +23,13 @@
 
 package org.tigris.subversion.javahl;
 
+import org.apache.subversion.javahl.*;
+
 /**
  * Handles activities related to management of native resouces
  * (e.g. loading of native libraries).
  */
-class NativeResources
+class NativeResources extends org.apache.subversion.javahl.NativeResources
 {
-    /**
-     * Version information about the underlying native libraries.
-     */
-    static Version version;
-
-    /**
-     * Load the required native library whose path is specified by the
-     * system property <code>subversion.native.library</code> (which
-     * can be passed to the JVM on start-up using an argument like
-     * <code>-Dsubversion.native.library=/usr/local/lib/libsvnjavahl-1.so</code>).
-     * If the system property is not specified or cannot be loaded,
-     * attempt to load the library using its expected name, and the
-     * platform-dependent loading mechanism.
-     *
-     * @throws UnsatisfiedLinkError If the native library cannot be
-     * loaded.
-     * @throws LinkageError If the version of the loaded native
-     * library is not compatible with this version of JavaHL's Java
-     * APIs.
-     * @since 1.3.0
-     */
-    public static synchronized void loadNativeLibrary()
-    {
-        UnsatisfiedLinkError loadException = null;
-
-        // If the user specified the fully qualified path to the
-        // native library, try loading that first.
-        try
-        {
-            String specifiedLibraryName =
-                System.getProperty("subversion.native.library");
-            if (specifiedLibraryName != null)
-            {
-                System.load(specifiedLibraryName);
-                init();
-                return;
-            }
-        }
-        catch (UnsatisfiedLinkError ex)
-        {
-            // Since the user explicitly specified this path, this is
-            // the best error to return if no other method succeeds.
-            loadException = ex;
-        }
-
-        // Try to load the library by its name.  Failing that, try to
-        // load it by its old name.
-        String[] libraryNames = {"svnjavahl-1", "libsvnjavahl-1", "svnjavahl"};
-        for (int i = 0; i < libraryNames.length; i++)
-        {
-            try
-            {
-                System.loadLibrary(libraryNames[i]);
-                init();
-                return;
-            }
-            catch (UnsatisfiedLinkError ex)
-            {
-                if (loadException == null)
-                {
-                    loadException = ex;
-                }
-            }
-        }
-
-        // Re-throw the most relevant exception.
-        if (loadException == null)
-        {
-            // This could only happen as the result of a programming error.
-            loadException = new UnsatisfiedLinkError("Unable to load JavaHL " +
-                                                     "native library");
-        }
-        throw loadException;
-    }
-
-    /**
-     * Initializer for native resources to be invoked <em>after</em>
-     * the native library has been loaded.  Sets library version
-     * information, and initializes the re-entrance hack for native
-     * code.
-     * @throws LinkageError If the version of the loaded native
-     * library is not compatible with this version of JavaHL's Java
-     * APIs.
-     */
-    private static final void init()
-    {
-        initNativeLibrary();
-        version = new Version();
-        if (!version.isAtLeast(1, 5, 0))
-        {
-            throw new LinkageError("Native library version must be at least " +
-                                   "1.5.0, but is only " + version);
-        }
-    }
-
-    /**
-     * Initialize the native library layer.
-     * @since 1.5.0
-     */
-    private static native void initNativeLibrary();
+  static Version version = new Version();
 }

Modified: subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Version.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Version.java?rev=905689&r1=905688&r2=905689&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Version.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/Version.java
Tue Feb  2 16:17:28 2010
@@ -23,6 +23,8 @@
 
 package org.tigris.subversion.javahl;
 
+import org.apache.subversion.javahl.*;
+
 /**
  * Encapsulates version information about the underlying native
  * libraries.  Basically a wrapper for <a
@@ -30,68 +32,4 @@
  */
 public class Version
 {
-    /**
-     * @return The full version string for the loaded JavaHL library,
-     * as defined by <code>MAJOR.MINOR.PATCH INFO</code>.
-     * @since 1.4.0
-     */
-    public String toString()
-    {
-        StringBuffer version = new StringBuffer();
-        version.append(getMajor())
-            .append('.').append(getMinor())
-            .append('.').append(getPatch())
-            .append(getNumberTag())
-            .append(getTag());
-        return version.toString();
-    }
-
-    /**
-     * @return The major version number for the loaded JavaHL library.
-     * @since 1.4.0
-     */
-    public native int getMajor();
-
-    /**
-     * @return The minor version number for the loaded JavaHL library.
-     * @since 1.4.0
-     */
-    public native int getMinor();
-
-    /**
-     * @return The patch-level version number for the loaded JavaHL
-     * library.
-     * @since 1.4.0
-     */
-    public native int getPatch();
-
-    /**
-     * @return Whether the JavaHL native library version is at least
-     * of <code>major.minor.patch</code> level.
-     * @since 1.5.0
-     */
-    public boolean isAtLeast(int major, int minor, int patch)
-    {
-        int actualMajor = getMajor();
-        int actualMinor = getMinor();
-        return ((major < actualMajor)
-                || (major == actualMajor && minor < actualMinor)
-                || (major == actualMajor && minor == actualMinor &&
-                    patch <= getPatch()));
-    }
-
-    /**
-     * @return Some text further describing the library version
-     * (e.g. <code>" (r1234)"</code>, <code>" (Alpha 1)"</code>,
-     * <code>" (dev build)"</code>, etc.).
-     * @since 1.4.0
-     */
-    private native String getTag();
-
-    /**
-     * @return Some text further describing the library version
-     * (e.g. "r1234", "Alpha 1", "dev build", etc.).
-     * @since 1.4.0
-     */
-    private native String getNumberTag();
 }



Mime
View raw message