You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by vm...@apache.org on 2012/06/21 08:03:21 UTC

svn commit: r1352419 - in /subversion/branches/javahl-ra: ./ subversion/bindings/javahl/native/ subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/

Author: vmpn
Date: Thu Jun 21 06:03:20 2012
New Revision: 1352419

URL: http://svn.apache.org/viewvc?rev=1352419&view=rev
Log:
On the javahl-ra branch:

JavaHL: Implement getLatestRevision function using the factory based approach
to the SVN remote access layer implementation

* build.conf
  (options): Don't try to find new jni header files before they are generated
  (javahl-java): compile classes in the src/org/apache/subversion/javahl/ra
   directory
  (javahl-ra-javah): new section for generating jni header files for the Ra
   classes
  (libsvnjavahl): make the javahl library depend on the ra jni files

[ in subversion/bindings/javahl/native ]

* org_apache_subversion_javahl_ra_SVNRaFactory.cpp
   (Java_org_apache_subversion_javahl_ra_SVNRaFactory_createRaSession): New JNI
     method to create SVNRa session

* org_apache_subversion_javahl_ra_SVNRa.cpp
   (Java_org_apache_subversion_javahl_ra_SVNRa_finalize, 
    Java_org_apache_subversion_javahl_ra_SVNRa_dispose): Implement lifecycle
     JNI methods for the SVNRa session
   (Java_org_apache_subversion_javahl_ra_SVNRa_getLatestRevision): Implement
     the JNI wrapper around SVNRa::getLatestRevision function

* SVNRa.h,
  SVNRa.cpp 
  (SVNRa, ~SVNRa, dispose): Implement lifecycle methods for the SVNRa session
  (getLatestRevision): Implement the wrapper around svn_ra_get_latest_revnum

* RaContext.h,
  RaContext.cpp
  (RaContext, getCallbackBaton, getCallbacks): Implement JNI wrapper around
    svn_ra_create_callbacks function

[ in subversion/bindings/javahl/src/org/tigris/subversion/javahl/ra ]
   
* SVNRaFactory.java
  (<static>): Implement library initialization and version check
  (createRaSession): New method to obtain ISVNRa ra session implementation

* SVNRa.java,
  ISVNRa.java
  (SVNRa, finalize, dispose): Implement lifecycle methods
  (getLatestRevision): Implement the java wrapper around JNI getLatestRevision
    function

* RaContext.java: Marker class for Ra context

* ISVNRaConfig.java,
  SVNRaConfigDefault.java
  (getUsername, getPassword, getPrompt, getConfigDirectory): New functions to
    specify setting to be used in creating of RA session

Added:
    subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.cpp
    subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.h
    subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.cpp
    subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.h
    subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRa.cpp
    subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRaFactory.cpp
    subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/
    subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/ISVNRa.java
    subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/ISVNRaConfig.java
    subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/RaContext.java
    subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRa.java
    subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRaConfigDefault.java
    subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRaFactory.java
Modified:
    subversion/branches/javahl-ra/build.conf

Modified: subversion/branches/javahl-ra/build.conf
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/build.conf?rev=1352419&r1=1352418&r2=1352419&view=diff
==============================================================================
--- subversion/branches/javahl-ra/build.conf (original)
+++ subversion/branches/javahl-ra/build.conf Thu Jun 21 06:03:20 2012
@@ -57,7 +57,8 @@ private-built-includes =
         subversion/bindings/javahl/include/org_apache_subversion_javahl_types_Version.h
         subversion/bindings/javahl/include/org_apache_subversion_javahl_types_Revision.h
         subversion/bindings/javahl/include/org_apache_subversion_javahl_callback_UserPasswordCallback.h
-
+        subversion/bindings/javahl/include/org_apache_subversion_javahl_ra_SVNRa.h
+        subversion/bindings/javahl/include/org_apache_subversion_javahl_ra_SVNRaFactory.h
 
 test-scripts =
         subversion/tests/cmdline/*_tests.py
@@ -507,6 +508,7 @@ type = java
 path = subversion/bindings/javahl/src/org/apache/subversion/javahl
   subversion/bindings/javahl/src/org/apache/subversion/javahl/callback
   subversion/bindings/javahl/src/org/apache/subversion/javahl/types
+  subversion/bindings/javahl/src/org/apache/subversion/javahl/ra
 src-root = subversion/bindings/javahl/src
 sources = *.java
 install = javahl-java
@@ -561,6 +563,17 @@ add-deps = $(javahl_java_DEPS)
 install = javahl-javah
 link-cmd = $(COMPILE_JAVAHL_JAVAH) -force
 
+[javahl-ra-javah]
+type = javah 
+path = subversion/bindings/javahl/src/org/apache/subversion/javahl/ra
+classes = subversion/bindings/javahl/classes
+headers = subversion/bindings/javahl/include
+package = org.apache.subversion.javahl.ra
+sources = *.java
+add-deps = $(javahl_java_DEPS)
+install = javahl-javah
+link-cmd = $(COMPILE_JAVAHL_JAVAH) -force
+
 [javahl-callback-javah]
 type = javah 
 path = subversion/bindings/javahl/src/org/apache/subversion/javahl/callback
@@ -590,7 +603,7 @@ path = subversion/bindings/javahl/native
 libs = libsvn_repos libsvn_client libsvn_wc libsvn_ra libsvn_delta libsvn_diff 
        libsvn_subr libsvn_fs aprutil apriconv apr
 sources = *.cpp *.c
-add-deps = $(javahl_javah_DEPS) $(javahl_java_DEPS) $(javahl_callback_javah_DEPS) $(javahl_types_javah_DEPS)
+add-deps = $(javahl_javah_DEPS) $(javahl_java_DEPS) $(javahl_callback_javah_DEPS) $(javahl_types_javah_DEPS) $(javahl_ra_javah_DEPS)
 install = javahl-lib
 # need special build rule to include -I$(JDK)/include/jni.h
 compile-cmd = $(COMPILE_JAVAHL_CXX)

Added: subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.cpp?rev=1352419&view=auto
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.cpp (added)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.cpp Thu Jun 21 06:03:20 2012
@@ -0,0 +1,159 @@
+#include "RaContext.h"
+#include "JNIUtil.h"
+#include "Prompter.h"
+
+#define STRING_RETURN_SIGNATURE "()Ljava/lang/String;"
+
+RaContext::RaContext(jobject contextHolder, SVN::Pool &pool, jobject jconfig)
+  :RaSharedContext(pool), m_raCallbacks(NULL)
+{
+  /*
+   * Extract config properties
+   */
+  JNIEnv *env = JNIUtil::getEnv();
+
+  static jmethodID midUsername = 0;
+  static jmethodID midPassword = 0;
+  static jmethodID midConfigDirectory = 0;
+  static jmethodID midPrompt = 0;
+
+  if (midUsername == 0 || midPassword == 0 || midConfigDirectory == 0
+      || midPrompt == 0)
+  {
+    jclass clazz = env->FindClass(JAVA_PACKAGE"/ra/ISVNRaConfig");
+    if (JNIUtil::isJavaExceptionThrown())
+      return;
+
+    midUsername = env->GetMethodID(clazz, "getUsername",
+        STRING_RETURN_SIGNATURE);
+    if (JNIUtil::isJavaExceptionThrown() || midUsername == 0)
+      return;
+
+    midPassword = env->GetMethodID(clazz, "getPassword",
+        STRING_RETURN_SIGNATURE);
+    if (JNIUtil::isJavaExceptionThrown() || midPassword == 0)
+      return;
+
+    midConfigDirectory = env->GetMethodID(clazz, "getConfigDirectory",
+        STRING_RETURN_SIGNATURE);
+    if (JNIUtil::isJavaExceptionThrown() || midConfigDirectory == 0)
+      return;
+
+    midPrompt = env->GetMethodID(clazz, "getPrompt",
+        "()Lorg/apache/subversion/javahl/callback/UserPasswordCallback;");
+    if (JNIUtil::isJavaExceptionThrown() || midPrompt == 0)
+      return;
+
+    env->DeleteLocalRef(clazz);
+  }
+
+  jstring jusername = (jstring) env->CallObjectMethod(jconfig, midUsername);
+  if (JNIUtil::isExceptionThrown())
+    return;
+
+  if (jusername != NULL)
+  {
+    JNIStringHolder usernameStr(jusername);
+    if (JNIUtil::isExceptionThrown())
+    {
+      return;
+    }
+
+    username(usernameStr);
+
+    JNIUtil::getEnv()->DeleteLocalRef(jusername);
+  }
+
+  jstring jpassword = (jstring) env->CallObjectMethod(jconfig, midPassword);
+  if (JNIUtil::isExceptionThrown())
+    return;
+
+  if (jpassword != NULL)
+  {
+    JNIStringHolder passwordStr(jpassword);
+    if (JNIUtil::isExceptionThrown())
+    {
+      return;
+    }
+
+    password(passwordStr);
+
+    JNIUtil::getEnv()->DeleteLocalRef(jpassword);
+  }
+
+  jstring jconfigDirectory = (jstring) env->CallObjectMethod(jconfig,
+      midConfigDirectory);
+  if (JNIUtil::isExceptionThrown())
+    return;
+
+  JNIStringHolder configDirectory(jconfigDirectory);
+  if (JNIUtil::isExceptionThrown())
+  {
+    return;
+  }
+
+  setConfigDirectory (configDirectory);
+
+  JNIUtil::getEnv()->DeleteLocalRef(jconfigDirectory);
+
+  jobject jprompter = env->CallObjectMethod(jconfig, midPrompt);
+  if (JNIUtil::isExceptionThrown())
+    return;
+
+  if (jprompter != NULL)
+  {
+    Prompter *prompter = Prompter::makeCPrompter(jprompter);
+    if (JNIUtil::isExceptionThrown())
+      return;
+
+    setPrompt(prompter);
+    JNIUtil::getEnv()->DeleteLocalRef(jprompter);
+  }
+
+  /*
+   * Attach session context java object
+   */
+  static jfieldID ctxFieldID = 0;
+  attachJavaObject(contextHolder, "L"JAVA_PACKAGE"/ra/RaContext;",
+      "sessionContext", &ctxFieldID);
+
+  /*
+   * Setup callbacks
+   */
+  SVN_JNI_ERR(svn_ra_create_callbacks(&m_raCallbacks, m_pool->getPool()), );
+
+  m_raCallbacks->auth_baton = getAuthBaton(pool);
+  m_raCallbacks->cancel_func = checkCancel;
+  m_raCallbacks->get_client_string = clientName;
+  m_raCallbacks->progress_baton = m_jctx;
+  m_raCallbacks->progress_func = progress;
+
+  /*
+   * JNI RA layer does not work with WC so all WC callbacks are set to NULL
+   */
+  m_raCallbacks->get_wc_prop = NULL;
+  m_raCallbacks->invalidate_wc_props = NULL;
+  m_raCallbacks->push_wc_prop = NULL;
+  m_raCallbacks->set_wc_prop = NULL;
+
+  /*
+   * Don't set deprecated callback
+   */
+  m_raCallbacks->open_tmp_file = NULL;
+}
+
+RaContext::~RaContext()
+{
+}
+
+void *
+RaContext::getCallbackBaton()
+{
+  return this;
+}
+
+svn_ra_callbacks2_t *
+RaContext::getCallbacks()
+{
+  return m_raCallbacks;
+}

Added: subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.h?rev=1352419&view=auto
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.h (added)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.h Thu Jun 21 06:03:20 2012
@@ -0,0 +1,20 @@
+#ifndef RACONTEXT_H_
+#define RACONTEXT_H_
+
+#include "svn_ra.h"
+
+#include "RaSharedContext.h"
+
+class RaContext : public RaSharedContext
+{
+  public:
+    RaContext(jobject contextHolder, SVN::Pool &pool, jobject jconfig);
+    virtual ~RaContext();
+    void * getCallbackBaton();
+    svn_ra_callbacks2_t * getCallbacks();
+
+  private:
+    svn_ra_callbacks2_t * m_raCallbacks;
+};
+
+#endif /* RACONTEXT_H_ */

Added: subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.cpp?rev=1352419&view=auto
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.cpp (added)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.cpp Thu Jun 21 06:03:20 2012
@@ -0,0 +1,95 @@
+#include "JNIStringHolder.h"
+#include "JNIUtil.h"
+
+#include "svn_ra.h"
+
+#include "SVNRa.h"
+
+#include "svn_private_config.h"
+
+#define JAVA_CLASS_SVN_RA JAVA_PACKAGE "/ra/SVNRa"
+
+SVNRa *
+SVNRa::getCppObject(jobject jthis)
+{
+  static jfieldID fid = 0;
+  jlong cppAddr = SVNBase::findCppAddrForJObject(jthis, &fid,
+      JAVA_CLASS_SVN_RA);
+  return (cppAddr == 0 ? NULL : reinterpret_cast<SVNRa *>(cppAddr));
+}
+
+SVNRa::SVNRa(jobject *jthis_out, jstring jurl, jstring juuid, jobject jconfig)
+{
+  JNIEnv *env = JNIUtil::getEnv();
+
+  JNIStringHolder url(jurl);
+  if (JNIUtil::isExceptionThrown())
+  {
+    return;
+  }
+
+  JNIStringHolder uuid(juuid);
+  if (JNIUtil::isExceptionThrown())
+  {
+    return;
+  }
+
+  // Create java session object
+  jclass clazz = env->FindClass(JAVA_CLASS_SVN_RA);
+  if (JNIUtil::isJavaExceptionThrown())
+    return;
+
+  static jmethodID ctor = 0;
+  if (ctor == 0)
+  {
+    ctor = env->GetMethodID(clazz, "<init>", "(J)V");
+    if (JNIUtil::isJavaExceptionThrown())
+      return;
+  }
+
+  jlong cppAddr = this->getCppAddr();
+
+  jobject jSVNRa = env->NewObject(clazz, ctor, cppAddr);
+  if (JNIUtil::isJavaExceptionThrown())
+    return;
+
+  *jthis_out = jSVNRa;
+
+  m_context = new RaContext(jSVNRa, pool, jconfig);
+  if (JNIUtil::isJavaExceptionThrown())
+    return;
+
+  //TODO: add corrected URL support
+  SVN_JNI_ERR(
+      svn_ra_open4(&m_session, NULL, url, uuid, m_context->getCallbacks(),
+          m_context->getCallbackBaton(), m_context->getConfigData(),
+          pool.getPool()),
+      );
+}
+
+SVNRa::~SVNRa()
+{
+  if (m_context)
+  {
+    delete m_context;
+  }
+}
+
+jlong
+SVNRa::getLatestRevision()
+{
+  SVN::Pool subPool(pool);
+  svn_revnum_t rev;
+
+  SVN_JNI_ERR(svn_ra_get_latest_revnum(m_session, &rev, subPool.getPool()),
+      SVN_INVALID_REVNUM);
+
+  return rev;
+}
+
+void
+SVNRa::dispose(jobject jthis)
+{
+  static jfieldID fid = 0;
+  SVNBase::dispose(jthis, &fid, JAVA_CLASS_SVN_RA);
+}

Added: subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.h?rev=1352419&view=auto
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.h (added)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.h Thu Jun 21 06:03:20 2012
@@ -0,0 +1,35 @@
+#ifndef SVNRa_H
+#define SVNRa_H
+
+#include <jni.h>
+
+#include "svn_ra.h"
+
+#include "SVNBase.h"
+#include "RaContext.h"
+
+#include <set>
+
+class SVNEditor;
+
+/*
+ * This class wraps Ra based operations from svn_ra.h
+ */
+class SVNRa : public SVNBase
+{
+  public:
+    static SVNRa *getCppObject(jobject jthis);
+    SVNRa(jobject *, jstring jurl, jstring juuid, jobject jconfig);
+    ~SVNRa();
+
+    jlong getLatestRevision();
+
+    virtual void dispose(jobject jthis);
+
+  private:
+    svn_ra_session_t * m_session;
+
+    RaContext * m_context;
+};
+
+#endif //SVNRa_H

Added: subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRa.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRa.cpp?rev=1352419&view=auto
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRa.cpp (added)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRa.cpp Thu Jun 21 06:03:20 2012
@@ -0,0 +1,38 @@
+#include "../include/org_apache_subversion_javahl_ra_SVNRa.h"
+
+#include "JNIStackElement.h"
+#include "JNIUtil.h"
+#include "Prompter.h"
+#include "SVNRa.h"
+
+#include "svn_private_config.h"
+
+
+JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_ra_SVNRa_finalize
+(JNIEnv *env, jobject jthis)
+{
+  JNIEntry(SVNRa, finalize);
+  SVNRa *ras = SVNRa::getCppObject(jthis);
+  if (ras != NULL)
+    ras->finalize();
+}
+
+JNIEXPORT void JNICALL Java_org_apache_subversion_javahl_ra_SVNRa_dispose
+(JNIEnv *env, jobject jthis)
+{
+  JNIEntry(SVNRa, dispose);
+  SVNRa *ras = SVNRa::getCppObject(jthis);
+  if (ras != NULL)
+    ras->dispose(jthis);
+}
+
+JNIEXPORT jlong JNICALL Java_org_apache_subversion_javahl_ra_SVNRa_getLatestRevision
+(JNIEnv *env, jobject jthis)
+{
+  JNIEntry(SVNRa, getLatestRevision);
+  SVNRa *ras = SVNRa::getCppObject(jthis);
+  CPPADDR_NULL_PTR(ras, SVN_INVALID_REVNUM);
+
+  return ras->getLatestRevision();
+}

Added: subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRaFactory.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRaFactory.cpp?rev=1352419&view=auto
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRaFactory.cpp (added)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRaFactory.cpp Thu Jun 21 06:03:20 2012
@@ -0,0 +1,38 @@
+#include "../include/org_apache_subversion_javahl_ra_SVNRaFactory.h"
+
+#include "JNIStackElement.h"
+#include "JNIUtil.h"
+#include "JNIStringHolder.h"
+
+#include "SVNRa.h"
+
+#include "svn_private_config.h"
+
+JNIEXPORT jobject JNICALL Java_org_apache_subversion_javahl_ra_SVNRaFactory_createRaSession
+(JNIEnv *env, jclass jclass, jstring jurl, jstring juuid, jobject jconfig)
+{
+  //JNI macros need jthis but this is a static call
+  jobject jthis = NULL;
+  JNIEntry(SVNRaFactory, createRaSession);
+
+  /*
+   * Initialize ra layer if we have not done so yet
+   */
+  static bool initialized = false;
+  if(!initialized)
+    {
+      SVN_JNI_ERR(svn_ra_initialize(JNIUtil::getPool()), NULL);
+      initialized = true;
+    }
+
+  /*
+   * Create Ra C++ object and return its java wrapper to the caller
+   */
+  jobject jSVNRa = NULL;
+
+  SVNRa * raSesson = new SVNRa(&jSVNRa, jurl, juuid, jconfig);
+  if (JNIUtil::isJavaExceptionThrown())
+    return NULL;
+
+  return jSVNRa;
+}

Added: subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/ISVNRa.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/ISVNRa.java?rev=1352419&view=auto
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/ISVNRa.java (added)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/ISVNRa.java Thu Jun 21 06:03:20 2012
@@ -0,0 +1,41 @@
+/**
+ * @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.ra;
+
+/**
+ * Represent an instance of RA session
+ */
+public interface ISVNRa
+{
+    /**
+     * Release native resources use by this Ra session. Once called this object
+     * is no longer usable
+     */
+    public void dispose();
+
+    /**
+     * @return latest revision
+     */
+    public long getLatestRevision();
+}

Added: subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/ISVNRaConfig.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/ISVNRaConfig.java?rev=1352419&view=auto
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/ISVNRaConfig.java (added)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/ISVNRaConfig.java Thu Jun 21 06:03:20 2012
@@ -0,0 +1,41 @@
+/**
+ * @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.ra;
+
+import org.apache.subversion.javahl.callback.UserPasswordCallback;
+
+/**
+ * Interface providing necessary configuration details for creation of ISVNRa
+ * instance
+ */
+public interface ISVNRaConfig
+{
+    public String getUsername();
+
+    public String getPassword();
+
+    public UserPasswordCallback getPrompt();
+
+    public String getConfigDirectory();
+}

Added: subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/RaContext.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/RaContext.java?rev=1352419&view=auto
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/RaContext.java (added)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/RaContext.java Thu Jun 21 06:03:20 2012
@@ -0,0 +1,35 @@
+/**
+ * @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.ra;
+
+import org.apache.subversion.javahl.RaSharedContext;
+
+/**
+ *  This class is used internally by the JavaHL implementation and not
+ *  considered part part of the public API. 
+ */
+public class RaContext extends RaSharedContext
+{
+
+}

Added: subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRa.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRa.java?rev=1352419&view=auto
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRa.java (added)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRa.java Thu Jun 21 06:03:20 2012
@@ -0,0 +1,54 @@
+/**
+ * @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.ra;
+
+import org.apache.subversion.javahl.JNIObject;
+
+public class SVNRa extends JNIObject implements ISVNRa
+{
+    @Override
+    public native long getLatestRevision();
+
+    @Override
+    public native void finalize() throws Throwable;
+
+    @Override
+    public native void dispose();
+
+    /*
+     * NOTE: This field is accessed from native code for callbacks.
+     */
+    private RaContext sessionContext = new RaContext();
+
+    /**
+     * This constructor is called from JNI to get an instance call getRaSession
+     * method of ISVNClient
+     * 
+     * @param cppAddr
+     */
+    protected SVNRa(long cppAddr)
+    {
+        super(cppAddr);
+    }
+}

Added: subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRaConfigDefault.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRaConfigDefault.java?rev=1352419&view=auto
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRaConfigDefault.java (added)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRaConfigDefault.java Thu Jun 21 06:03:20 2012
@@ -0,0 +1,78 @@
+/**
+ * @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.ra;
+
+import org.apache.subversion.javahl.callback.UserPasswordCallback;
+
+public class SVNRaConfigDefault implements ISVNRaConfig
+{
+    private String username;
+    private String password;
+    private UserPasswordCallback prompt;
+    private String configDirectory;
+
+    @Override
+    public String getUsername()
+    {
+        return username;
+    }
+
+    public void setUsername(String username)
+    {
+        this.username = username;
+    }
+
+    @Override
+    public String getPassword()
+    {
+        return password;
+    }
+
+    public void setPassword(String password)
+    {
+        this.password = password;
+    }
+
+    @Override
+    public UserPasswordCallback getPrompt()
+    {
+        return prompt;
+    }
+
+    public void setPrompt(UserPasswordCallback prompt)
+    {
+        this.prompt = prompt;
+    }
+
+    @Override
+    public String getConfigDirectory()
+    {
+        return configDirectory;
+    }
+
+    public void setConfigDirectory(String configDirectory)
+    {
+        this.configDirectory = configDirectory;
+    }
+}

Added: subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRaFactory.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRaFactory.java?rev=1352419&view=auto
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRaFactory.java (added)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRaFactory.java Thu Jun 21 06:03:20 2012
@@ -0,0 +1,62 @@
+/**
+ * @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.ra;
+
+import org.apache.subversion.javahl.NativeResources;
+import org.apache.subversion.javahl.types.Version;
+
+public class SVNRaFactory
+{
+    /**
+     * Load the required native library.
+     */
+    static
+    {
+        NativeResources.loadNativeLibrary();
+
+        // TODO: Remove below, once NativeResources version check catches up to
+        // Ra check
+        Version version = NativeResources.getVersion();
+        if (!version.isAtLeast(1, 7, 6))
+        {
+            throw new LinkageError("Native library version must be at least "
+                    + "1.7.6, but is only " + version);
+        }
+    }
+
+    /**
+     * Crates RA session for a given url with provided context
+     * 
+     * @param url 
+     *            to connect to
+     * @param uuid
+     *            of the remote repository, can be null if uuid check is not
+     *            desired
+     * @param config
+     *            configuration to use for the session.
+     * @return RA session
+     */
+    public static native ISVNRa createRaSession(String url, String uuid,
+            ISVNRaConfig config);
+}