You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/06/13 11:17:03 UTC
svn commit: r1492590 - in /subversion/branches/javahl-ra: ./
subversion/bindings/javahl/native/
subversion/bindings/javahl/src/org/apache/subversion/javahl/
subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/
subversion/bindings/javahl/src/...
Author: brane
Date: Thu Jun 13 09:17:02 2013
New Revision: 1492590
URL: http://svn.apache.org/r1492590
Log:
On the javahl-ra branch:
Changed how the remote-access initialization works, putting the session
configuration defaults into the factory class instead of having to
juggle with a separate configuration object.
Also moved and renamed packages and classes, so that the common bits
don't have RA-specific names, and use 'Remote instead of 'Ra' as the
package and class base name.
Renamed classes and interfaces (within org.apache.subversion.javahl):
RaSharedContext -> OperationContext
ra.ISVNRa -> ISVNRemote
ra.SVNRa -> remote.RemoteSession
ra.SVNRaFactory -> remote.RemoteFactory
ra.RaContext -> remote.RemoteSession$RemoteSessionContext
SVNRATests -> SVNRemoteTests
Removedclasses and interfaces (within org.apache.subversion.javahl):
ra.ISVNRaConfig
ra.SVNRaConfigDefault
This change also affects:
* SVNClient.java: Base class of ClientContext renamed.
* RunTests.java: Name of remote-access test class changed.
Added:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/OperationContext.cpp
- copied, changed from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaSharedContext.cpp
subversion/branches/javahl-ra/subversion/bindings/javahl/native/OperationContext.h
- copied, changed from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaSharedContext.h
subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.cpp
- copied, changed from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.cpp
subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.h
- copied, changed from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.h
subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSessionContext.cpp
- copied, changed from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.cpp
subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSessionContext.h
- copied, changed from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.h
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp
- copied, changed from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRaFactory.cpp
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
- copied, changed from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRa.cpp
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java
- copied, changed from r1492216, 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/OperationContext.java
- copied, changed from r1492216, subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/RaSharedContext.java
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/
- copied from r1492216, 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/remote/RemoteFactory.java
- copied, changed from r1492216, subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRaFactory.java
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java
- copied, changed from r1492216, subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRa.java
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
- copied, changed from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java
Removed:
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/RaSharedContext.cpp
subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaSharedContext.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/RaSharedContext.java
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/remote/ISVNRa.java
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/ISVNRaConfig.java
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RaContext.java
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/SVNRa.java
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/SVNRaConfigDefault.java
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/SVNRaFactory.java
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java
Modified:
subversion/branches/javahl-ra/build.conf
subversion/branches/javahl-ra/subversion/bindings/javahl/native/ClientContext.cpp
subversion/branches/javahl-ra/subversion/bindings/javahl/native/ClientContext.h
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/RunTests.java
Modified: subversion/branches/javahl-ra/build.conf
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/build.conf?rev=1492590&r1=1492589&r2=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/build.conf (original)
+++ subversion/branches/javahl-ra/build.conf Thu Jun 13 09:17:02 2013
@@ -67,8 +67,8 @@ private-built-includes =
subversion/bindings/javahl/include/org_apache_subversion_javahl_types_VersionExtended_LoadedLibIterator.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
+ subversion/bindings/javahl/include/org_apache_subversion_javahl_remote_RemoteSession.h
+ subversion/bindings/javahl/include/org_apache_subversion_javahl_remote_RemoteFactory.h
subversion/svn/svn-help.inc
subversion/svn/svn-help.man
@@ -545,7 +545,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
+ subversion/bindings/javahl/src/org/apache/subversion/javahl/remote
src-root = subversion/bindings/javahl/src
sources = *.java
install = javahl-java
@@ -600,12 +600,12 @@ add-deps = $(javahl_java_DEPS)
install = javahl-javah
link-cmd = $(COMPILE_JAVAHL_JAVAH) -force
-[javahl-ra-javah]
+[javahl-remote-javah]
type = javah
-path = subversion/bindings/javahl/src/org/apache/subversion/javahl/ra
+path = subversion/bindings/javahl/src/org/apache/subversion/javahl/remote
classes = subversion/bindings/javahl/classes
headers = subversion/bindings/javahl/include
-package = org.apache.subversion.javahl.ra
+package = org.apache.subversion.javahl.remote
sources = *.java
add-deps = $(javahl_java_DEPS)
install = javahl-javah
@@ -640,7 +640,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) $(javahl_ra_javah_DEPS)
+add-deps = $(javahl_javah_DEPS) $(javahl_java_DEPS) $(javahl_callback_javah_DEPS) $(javahl_types_javah_DEPS) $(javahl_remote_javah_DEPS)
install = javahl-lib
# need special build rule to include -I$(JDK)/include/jni.h
compile-cmd = $(COMPILE_JAVAHL_CXX)
Modified: subversion/branches/javahl-ra/subversion/bindings/javahl/native/ClientContext.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/ClientContext.cpp?rev=1492590&r1=1492589&r2=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/ClientContext.cpp (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/ClientContext.cpp Thu Jun 13 09:17:02 2013
@@ -39,7 +39,7 @@
ClientContext::ClientContext(jobject jsvnclient, SVN::Pool &pool)
- : RaSharedContext(pool)
+ : OperationContext(pool)
{
static jfieldID ctxFieldID = 0;
attachJavaObject(jsvnclient, "L"JAVA_PACKAGE"/SVNClient$ClientContext;", "clientContext", &ctxFieldID);
Modified: subversion/branches/javahl-ra/subversion/bindings/javahl/native/ClientContext.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/ClientContext.h?rev=1492590&r1=1492589&r2=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/ClientContext.h (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/ClientContext.h Thu Jun 13 09:17:02 2013
@@ -29,7 +29,7 @@
#include <string>
-#include "RaSharedContext.h"
+#include "OperationContext.h"
#include "svn_types.h"
#include "svn_client.h"
@@ -45,7 +45,7 @@ class CommitMessage;
* and implements the functions read & close of svn_stream_t.
*
*/
-class ClientContext : public RaSharedContext
+class ClientContext : public OperationContext
{
private:
svn_client_ctx_t *m_context;
Copied: subversion/branches/javahl-ra/subversion/bindings/javahl/native/OperationContext.cpp (from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaSharedContext.cpp)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/OperationContext.cpp?p2=subversion/branches/javahl-ra/subversion/bindings/javahl/native/OperationContext.cpp&p1=subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaSharedContext.cpp&r1=1492029&r2=1492590&rev=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaSharedContext.cpp (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/OperationContext.cpp Thu Jun 13 09:17:02 2013
@@ -20,15 +20,15 @@
* ====================================================================
* @endcopyright
*
- * @file RaSharedContext.cpp
- * @brief Implementation of the class RaSharedContext
+ * @file OperationContext.cpp
+ * @brief Implementation of the class OperationContext
*/
#include "svn_client.h"
#include "private/svn_wc_private.h"
#include "svn_private_config.h"
-#include "RaSharedContext.h"
+#include "OperationContext.h"
#include "JNIUtil.h"
#include "JNICriticalSection.h"
@@ -37,19 +37,23 @@
#include "EnumMapper.h"
#include "CommitMessage.h"
-RaSharedContext::RaSharedContext(SVN::Pool &pool)
- :m_prompter(NULL), m_cancelOperation(false), m_pool(&pool), m_config(NULL), m_jctx(NULL)
-{
-}
+OperationContext::OperationContext(SVN::Pool &pool)
+ : m_config(NULL),
+ m_prompter(NULL),
+ m_cancelOperation(false),
+ m_pool(&pool),
+ m_jctx(NULL)
+{}
void
-RaSharedContext::attachJavaObject(jobject contextHolder, const char *contextClassType,
+OperationContext::attachJavaObject(
+ jobject contextHolder, const char *contextClassType,
const char *contextFieldName, jfieldID * ctxFieldID)
{
JNIEnv *env = JNIUtil::getEnv();
- /* Grab a global reference to the Java object embedded in the parent Java
- object. */
+ /* Grab a global reference to the Java object embedded in the parent
+ Java object. */
if ((*ctxFieldID) == 0)
{
jclass clazz = env->GetObjectClass(contextHolder);
@@ -74,7 +78,7 @@ RaSharedContext::attachJavaObject(jobjec
env->DeleteLocalRef(jctx);
}
-RaSharedContext::~RaSharedContext()
+OperationContext::~OperationContext()
{
delete m_prompter;
@@ -83,7 +87,7 @@ RaSharedContext::~RaSharedContext()
}
apr_hash_t *
-RaSharedContext::getConfigData()
+OperationContext::getConfigData()
{
if(m_pool->getPool() == NULL)
{
@@ -103,7 +107,7 @@ RaSharedContext::getConfigData()
}
svn_auth_baton_t *
-RaSharedContext::getAuthBaton(SVN::Pool &in_pool)
+OperationContext::getAuthBaton(SVN::Pool &in_pool)
{
svn_auth_baton_t *ab;
apr_pool_t *pool = in_pool.getPool();
@@ -210,26 +214,26 @@ RaSharedContext::getAuthBaton(SVN::Pool
}
void
-RaSharedContext::username(const char *pi_username)
+OperationContext::username(const char *pi_username)
{
m_userName = (pi_username == NULL ? "" : pi_username);
}
void
-RaSharedContext::password(const char *pi_password)
+OperationContext::password(const char *pi_password)
{
m_passWord = (pi_password == NULL ? "" : pi_password);
}
void
-RaSharedContext::setPrompt(Prompter *prompter)
+OperationContext::setPrompt(Prompter *prompter)
{
delete m_prompter;
m_prompter = prompter;
}
void
-RaSharedContext::setConfigDirectory(const char *configDir)
+OperationContext::setConfigDirectory(const char *configDir)
{
// A change to the config directory may necessitate creation of
// the config templates.
@@ -242,33 +246,33 @@ RaSharedContext::setConfigDirectory(cons
}
const char *
-RaSharedContext::getConfigDirectory() const
+OperationContext::getConfigDirectory() const
{
return m_configDir.c_str();
}
void
-RaSharedContext::cancelOperation()
+OperationContext::cancelOperation()
{
m_cancelOperation = true;
}
void
-RaSharedContext::resetCancelRequest()
+OperationContext::resetCancelRequest()
{
m_cancelOperation = false;
}
bool
-RaSharedContext::isCancelledOperation()
+OperationContext::isCancelledOperation()
{
return m_cancelOperation;
}
svn_error_t *
-RaSharedContext::checkCancel(void *cancelBaton)
+OperationContext::checkCancel(void *cancelBaton)
{
- RaSharedContext *that = static_cast<RaSharedContext *>(cancelBaton);
+ OperationContext *that = static_cast<OperationContext *>(cancelBaton);
if (that->isCancelledOperation())
return svn_error_create(SVN_ERR_CANCELLED, NULL, _("Operation cancelled"));
else
@@ -276,7 +280,7 @@ RaSharedContext::checkCancel(void *cance
}
void
-RaSharedContext::progress(apr_off_t progressVal, apr_off_t total, void *baton,
+OperationContext::progress(apr_off_t progressVal, apr_off_t total, void *baton,
apr_pool_t *pool)
{
jobject jctx = (jobject) baton;
@@ -324,15 +328,15 @@ RaSharedContext::progress(apr_off_t prog
}
const char *
-RaSharedContext::getClientName() const
+OperationContext::getClientName() const
{
return "javahl";
}
svn_error_t *
-RaSharedContext::clientName(void *baton, const char **name, apr_pool_t *pool)
+OperationContext::clientName(void *baton, const char **name, apr_pool_t *pool)
{
- RaSharedContext *that = (RaSharedContext *) baton;
+ OperationContext *that = (OperationContext *) baton;
*name = that->getClientName();
Copied: subversion/branches/javahl-ra/subversion/bindings/javahl/native/OperationContext.h (from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaSharedContext.h)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/OperationContext.h?p2=subversion/branches/javahl-ra/subversion/bindings/javahl/native/OperationContext.h&p1=subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaSharedContext.h&r1=1492029&r2=1492590&rev=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaSharedContext.h (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/OperationContext.h Thu Jun 13 09:17:02 2013
@@ -20,12 +20,12 @@
* ====================================================================
* @endcopyright
*
- * @file RaSharedContext.h
- * @brief Interface of the class RaSharedContext
+ * @file OperationContext.h
+ * @brief Interface of the class OperationContext
*/
-#ifndef RASHAREDCONTEXT_H
-#define RASHAREDCONTEXT_H
+#ifndef JAVAHL_OPERATION_CONTEXT_H
+#define JAVAHL_OPERATION_CONTEXT_H
#include <string>
@@ -41,7 +41,7 @@ class Prompter;
/**
* This class contains a Java objects implementing the interface RaSharedContext
*/
-class RaSharedContext
+class OperationContext
{
private:
std::string m_userName;
@@ -60,9 +60,9 @@ class RaSharedContext
static void progress(apr_off_t progressVal, apr_off_t total,
void *baton, apr_pool_t *pool);
public:
- RaSharedContext(SVN::Pool &pool);
+ OperationContext(SVN::Pool &pool);
void attachJavaObject(jobject contextHolder, const char *contextClassType, const char *contextFieldName, jfieldID * ctxFieldID);
- virtual ~RaSharedContext();
+ virtual ~OperationContext();
static svn_error_t *checkCancel(void *cancelBaton);
@@ -93,4 +93,4 @@ class RaSharedContext
virtual const char * getClientName() const;
};
-#endif // RASHAREDCONTEXT_H
+#endif // JAVAHL_OPERATION_CONTEXT_H
Copied: subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.cpp (from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.cpp)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.cpp?p2=subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.cpp&p1=subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.cpp&r1=1492029&r2=1492590&rev=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.cpp (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.cpp Thu Jun 13 09:17:02 2013
@@ -1,3 +1,29 @@
+/**
+ * @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
+ *
+ * @file RemoteSession.cpp
+ * @brief Implementation of the class RemoteSession
+ */
+
#include "JNIStringHolder.h"
#include "JNIUtil.h"
@@ -5,22 +31,25 @@
#include "CreateJ.h"
#include "EnumMapper.h"
-#include "SVNRa.h"
+#include "RemoteSession.h"
#include "svn_private_config.h"
-#define JAVA_CLASS_SVN_RA JAVA_PACKAGE "/ra/SVNRa"
+#define JAVA_CLASS_REMOTE_SESSION JAVA_PACKAGE "/remote/RemoteSession"
-SVNRa *
-SVNRa::getCppObject(jobject jthis)
+RemoteSession *
+RemoteSession::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));
+ JAVA_CLASS_REMOTE_SESSION);
+ return (cppAddr == 0 ? NULL : reinterpret_cast<RemoteSession *>(cppAddr));
}
-SVNRa::SVNRa(jobject *jthis_out, jstring jurl, jstring juuid, jobject jconfig)
+RemoteSession::RemoteSession(jobject *jthis_out, jstring jurl, jstring juuid,
+ jstring jconfigDirectory,
+ jstring jusername, jstring jpassword,
+ jobject jprompter, jobject jprogress)
{
JNIEnv *env = JNIUtil::getEnv();
@@ -37,7 +66,7 @@ SVNRa::SVNRa(jobject *jthis_out, jstring
}
// Create java session object
- jclass clazz = env->FindClass(JAVA_CLASS_SVN_RA);
+ jclass clazz = env->FindClass(JAVA_CLASS_REMOTE_SESSION);
if (JNIUtil::isJavaExceptionThrown())
return;
@@ -51,13 +80,15 @@ SVNRa::SVNRa(jobject *jthis_out, jstring
jlong cppAddr = this->getCppAddr();
- jobject jSVNRa = env->NewObject(clazz, ctor, cppAddr);
+ jobject jremoteSession = env->NewObject(clazz, ctor, cppAddr);
if (JNIUtil::isJavaExceptionThrown())
return;
- *jthis_out = jSVNRa;
+ *jthis_out = jremoteSession;
- m_context = new RaContext(jSVNRa, pool, jconfig);
+ m_context = new RemoteSessionContext(
+ jremoteSession, pool, jconfigDirectory,
+ jusername, jpassword, jprompter, jprogress);
if (JNIUtil::isJavaExceptionThrown())
return;
@@ -69,7 +100,7 @@ SVNRa::SVNRa(jobject *jthis_out, jstring
);
}
-SVNRa::~SVNRa()
+RemoteSession::~RemoteSession()
{
if (m_context)
{
@@ -78,7 +109,7 @@ SVNRa::~SVNRa()
}
jlong
-SVNRa::getLatestRevision()
+RemoteSession::getLatestRevision()
{
SVN::Pool subPool(pool);
svn_revnum_t rev;
@@ -90,7 +121,7 @@ SVNRa::getLatestRevision()
}
jstring
-SVNRa::getUUID()
+RemoteSession::getUUID()
{
SVN::Pool subPool(pool);
const char * uuid;
@@ -105,7 +136,7 @@ SVNRa::getUUID()
}
jstring
-SVNRa::getUrl()
+RemoteSession::getUrl()
{
SVN::Pool subPool(pool);
const char * url;
@@ -120,14 +151,14 @@ SVNRa::getUrl()
}
void
-SVNRa::dispose(jobject jthis)
+RemoteSession::dispose(jobject jthis)
{
static jfieldID fid = 0;
- SVNBase::dispose(jthis, &fid, JAVA_CLASS_SVN_RA);
+ SVNBase::dispose(jthis, &fid, JAVA_CLASS_REMOTE_SESSION);
}
svn_revnum_t
-SVNRa::getDatedRev(jlong timestamp)
+RemoteSession::getDatedRev(jlong timestamp)
{
SVN::Pool requestPool;
svn_revnum_t rev;
@@ -142,7 +173,7 @@ SVNRa::getDatedRev(jlong timestamp)
}
jobject
-SVNRa::getLocks(jstring jpath, jobject jdepth)
+RemoteSession::getLocks(jstring jpath, jobject jdepth)
{
SVN::Pool requestPool;
apr_hash_t *locks;
@@ -163,7 +194,7 @@ SVNRa::getLocks(jstring jpath, jobject j
}
jobject
-SVNRa::checkPath(jstring jpath, jobject jrevision)
+RemoteSession::checkPath(jstring jpath, jobject jrevision)
{
SVN::Pool requestPool;
svn_node_kind_t kind;
Copied: subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.h (from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.h)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.h?p2=subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.h&p1=subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.h&r1=1492029&r2=1492590&rev=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRa.h (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSession.h Thu Jun 13 09:17:02 2013
@@ -1,12 +1,38 @@
-#ifndef SVNRa_H
-#define SVNRa_H
+/**
+ * @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
+ *
+ * @file RemoteSession.h
+ * @brief Interface of the class RemoteSession
+ */
+
+#ifndef JAVAHL_REMOTE_SESSION_H
+#define JAVAHL_REMOTE_SESSION_H
#include <jni.h>
#include "svn_ra.h"
#include "SVNBase.h"
-#include "RaContext.h"
+#include "RemoteSessionContext.h"
#include "Revision.h"
#include <set>
@@ -16,12 +42,15 @@ class SVNEditor;
/*
* This class wraps Ra based operations from svn_ra.h
*/
-class SVNRa: public SVNBase
+class RemoteSession : public SVNBase
{
public:
- static SVNRa *getCppObject(jobject jthis);
- SVNRa(jobject *, jstring jurl, jstring juuid, jobject jconfig);
- ~SVNRa();
+ static RemoteSession* getCppObject(jobject jthis);
+ RemoteSession(jobject*, jstring jurl, jstring juuid,
+ jstring jconfigDirectory,
+ jstring jusername, jstring jpassword,
+ jobject jprompter, jobject jprogress);
+ ~RemoteSession();
jlong getLatestRevision();
jstring getUUID();
@@ -34,9 +63,8 @@ class SVNRa: public SVNBase
virtual void dispose(jobject jthis);
private:
- svn_ra_session_t * m_session;
-
- RaContext * m_context;
+ svn_ra_session_t* m_session;
+ RemoteSessionContext* m_context;
};
-#endif //SVNRa_H
+#endif // JAVAHL_REMOTE_SESSION_H
Copied: subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSessionContext.cpp (from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.cpp)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSessionContext.cpp?p2=subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSessionContext.cpp&p1=subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.cpp&r1=1492029&r2=1492590&rev=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.cpp (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSessionContext.cpp Thu Jun 13 09:17:02 2013
@@ -1,105 +1,73 @@
-#include "RaContext.h"
+/**
+ * @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
+ *
+ * @file RemoteSessionContext.cpp
+ * @brief Implementation of the class RemoteSessionContext
+ */
+
+
+#include "RemoteSessionContext.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)
+RemoteSessionContext::RemoteSessionContext(
+ jobject contextHolder, SVN::Pool &pool, jstring jconfigDirectory,
+ jstring jusername, jstring jpassword, jobject jprompter, jobject jprogress)
+ : OperationContext(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);
+ JNIStringHolder configDirectory(jconfigDirectory);
if (JNIUtil::isExceptionThrown())
- return;
+ return;
+
+ setConfigDirectory(configDirectory);
+ env->DeleteLocalRef(jconfigDirectory);
if (jusername != NULL)
{
JNIStringHolder usernameStr(jusername);
if (JNIUtil::isExceptionThrown())
- {
return;
- }
username(usernameStr);
-
- JNIUtil::getEnv()->DeleteLocalRef(jusername);
+ env->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;
+ env->DeleteLocalRef(jpassword);
}
- setConfigDirectory(configDirectory);
-
- JNIUtil::getEnv()->DeleteLocalRef(jconfigDirectory);
-
- jobject jprompter = env->CallObjectMethod(jconfig, midPrompt);
- if (JNIUtil::isExceptionThrown())
- return;
-
if (jprompter != NULL)
{
Prompter *prompter = Prompter::makeCPrompter(jprompter);
@@ -107,17 +75,34 @@ RaContext::RaContext(jobject contextHold
return;
setPrompt(prompter);
- JNIUtil::getEnv()->DeleteLocalRef(jprompter);
+ env->DeleteLocalRef(jprompter);
}
/*
* Attach session context java object
*/
static jfieldID ctxFieldID = 0;
- attachJavaObject(contextHolder, "L"JAVA_PACKAGE"/ra/RaContext;",
+ attachJavaObject(contextHolder,
+ "L"JAVA_PACKAGE"/remote/RemoteSession$RemoteSessionContext;",
"sessionContext", &ctxFieldID);
/*
+ * Set the progress callback
+ */
+ jclass clazz = env->GetObjectClass(m_jctx);
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+
+ jmethodID mid = env->GetMethodID(
+ clazz, "setProgressCallback",
+ "(L"JAVA_PACKAGE"/callback/ProgressCallback;)V");
+ if (JNIUtil::isJavaExceptionThrown() || mid == 0)
+ return;
+
+ env->CallVoidMethod(m_jctx, mid, jprogress);
+ env->DeleteLocalRef(jprogress);
+
+ /*
* Setup callbacks
*/
SVN_JNI_ERR(svn_ra_create_callbacks(&m_raCallbacks, m_pool->getPool()), );
@@ -142,18 +127,18 @@ RaContext::RaContext(jobject contextHold
m_raCallbacks->open_tmp_file = NULL;
}
-RaContext::~RaContext()
+RemoteSessionContext::~RemoteSessionContext()
{
}
void *
-RaContext::getCallbackBaton()
+RemoteSessionContext::getCallbackBaton()
{
return this;
}
svn_ra_callbacks2_t *
-RaContext::getCallbacks()
+RemoteSessionContext::getCallbacks()
{
return m_raCallbacks;
}
Copied: subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSessionContext.h (from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.h)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSessionContext.h?p2=subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSessionContext.h&p1=subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.h&r1=1492029&r2=1492590&rev=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/RaContext.h (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/RemoteSessionContext.h Thu Jun 13 09:17:02 2013
@@ -1,15 +1,44 @@
-#ifndef RACONTEXT_H_
-#define RACONTEXT_H_
+/**
+ * @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
+ *
+ * @file RemoteSessionContext.h
+ * @brief Interface of the class RemoteSessionContext
+ */
+
+#ifndef JAVAHL_REMOTE_SESSION_CONTEXT_H
+#define JAVAHL_REMOTE_SESSION_CONTEXT_H
#include "svn_ra.h"
-#include "RaSharedContext.h"
+#include "OperationContext.h"
-class RaContext: public RaSharedContext
+class RemoteSessionContext : public OperationContext
{
public:
- RaContext(jobject contextHolder, SVN::Pool &pool, jobject jconfig);
- virtual ~RaContext();
+ RemoteSessionContext(jobject contextHolder, SVN::Pool &pool,
+ jstring jconfigDirectory,
+ jstring jusername, jstring jpassword,
+ jobject jprompter, jobject jprogress);
+ virtual ~RemoteSessionContext();
void * getCallbackBaton();
svn_ra_callbacks2_t * getCallbacks();
@@ -17,4 +46,4 @@ class RaContext: public RaSharedContext
svn_ra_callbacks2_t * m_raCallbacks;
};
-#endif /* RACONTEXT_H_ */
+#endif /* JAVAHL_REMOTE_SESSION_CONTEXT_H */
Copied: subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp (from r1492029, 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_remote_RemoteFactory.cpp?p2=subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp&p1=subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRaFactory.cpp&r1=1492029&r2=1492590&rev=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRaFactory.cpp (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp Thu Jun 13 09:17:02 2013
@@ -1,20 +1,48 @@
-#include "../include/org_apache_subversion_javahl_ra_SVNRaFactory.h"
+/**
+ * @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
+ *
+ * @file org_apache_subversion_javahl_remote_RemoteFactory.cpp
+ * @brief Implementation of the native methods in the Java class RemoteFactory
+ */
+
+#include "../include/org_apache_subversion_javahl_remote_RemoteFactory.h"
#include "JNIStackElement.h"
#include "JNIUtil.h"
#include "JNIStringHolder.h"
-#include "SVNRa.h"
+#include "RemoteSession.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)
+Java_org_apache_subversion_javahl_remote_RemoteFactory_open(
+ JNIEnv *env, jclass jclass, jstring jurl, jstring juuid,
+ jstring jconfigDirectory, jstring jusername, jstring jpassword,
+ jobject jprompter, jobject jprogress)
{
//JNI macros need jthis but this is a static call
jobject jthis = NULL;
- JNIEntry(SVNRaFactory, createRaSession);
+ JNIEntry(Remotefactory, open);
/*
* Initialize ra layer if we have not done so yet
@@ -27,13 +55,18 @@ Java_org_apache_subversion_javahl_ra_SVN
}
/*
- * Create Ra C++ object and return its java wrapper to the caller
+ * Create RemoteSession C++ object and return its java wrapper to the caller
*/
- jobject jSVNRa = NULL;
+ jobject jremoteSession = NULL;
- SVNRa * raSesson = new SVNRa(&jSVNRa, jurl, juuid, jconfig);
+ RemoteSession* session = new RemoteSession(
+ &jremoteSession, jurl, juuid, jconfigDirectory,
+ jusername, jpassword, jprompter, jprogress);
if (JNIUtil::isJavaExceptionThrown())
- return NULL;
+ {
+ delete session;
+ return NULL;
+ }
- return jSVNRa;
+ return jremoteSession;
}
Copied: subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp (from r1492029, 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_remote_RemoteSession.cpp?p2=subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp&p1=subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRa.cpp&r1=1492029&r2=1492590&rev=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_ra_SVNRa.cpp (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp Thu Jun 13 09:17:02 2013
@@ -1,93 +1,119 @@
-#include "../include/org_apache_subversion_javahl_ra_SVNRa.h"
+/**
+ * @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
+ *
+ * @file org_apache_subversion_javahl_remote_RemoteSession.cpp
+ * @brief Implementation of the native methods in the Java class RemoteSession
+ */
+
+#include "../include/org_apache_subversion_javahl_remote_RemoteSession.h"
#include "JNIStackElement.h"
#include "JNIUtil.h"
#include "Prompter.h"
-#include "SVNRa.h"
+#include "RemoteSession.h"
#include "Revision.h"
#include "EnumMapper.h"
#include "svn_private_config.h"
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_ra_SVNRa_finalize(JNIEnv *env, jobject jthis)
+Java_org_apache_subversion_javahl_remote_RemoteSession_finalize(JNIEnv *env, jobject jthis)
{
- JNIEntry(SVNRa, finalize);
- SVNRa *ras = SVNRa::getCppObject(jthis);
+ JNIEntry(RemoteSession, finalize);
+ RemoteSession *ras = RemoteSession::getCppObject(jthis);
if (ras != NULL)
ras->finalize();
}
JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_ra_SVNRa_dispose(JNIEnv *env, jobject jthis)
+Java_org_apache_subversion_javahl_remote_RemoteSession_dispose(JNIEnv *env, jobject jthis)
{
- JNIEntry(SVNRa, dispose);
- SVNRa *ras = SVNRa::getCppObject(jthis);
+ JNIEntry(RemoteSession, dispose);
+ RemoteSession *ras = RemoteSession::getCppObject(jthis);
if (ras != NULL)
ras->dispose(jthis);
}
JNIEXPORT jlong JNICALL
-Java_org_apache_subversion_javahl_ra_SVNRa_getLatestRevision(JNIEnv *env,
+Java_org_apache_subversion_javahl_remote_RemoteSession_getLatestRevision(JNIEnv *env,
jobject jthis)
{
- JNIEntry(SVNRa, getLatestRevision);
- SVNRa *ras = SVNRa::getCppObject(jthis);
+ JNIEntry(RemoteSession, getLatestRevision);
+ RemoteSession *ras = RemoteSession::getCppObject(jthis);
CPPADDR_NULL_PTR(ras, SVN_INVALID_REVNUM);
return ras->getLatestRevision();
}
JNIEXPORT jstring JNICALL
-Java_org_apache_subversion_javahl_ra_SVNRa_getUUID
+Java_org_apache_subversion_javahl_remote_RemoteSession_getUUID
(JNIEnv *env, jobject jthis)
{
- JNIEntry(SVNRa, getUUID);
- SVNRa *ras = SVNRa::getCppObject(jthis);
+ JNIEntry(RemoteSession, getUUID);
+ RemoteSession *ras = RemoteSession::getCppObject(jthis);
CPPADDR_NULL_PTR(ras, NULL);
return ras->getUUID();
}
JNIEXPORT jstring JNICALL
-Java_org_apache_subversion_javahl_ra_SVNRa_getUrl
+Java_org_apache_subversion_javahl_remote_RemoteSession_getUrl
(JNIEnv *env, jobject jthis)
{
- JNIEntry(SVNRa, getUrl);
- SVNRa *ras = SVNRa::getCppObject(jthis);
+ JNIEntry(RemoteSession, getUrl);
+ RemoteSession *ras = RemoteSession::getCppObject(jthis);
CPPADDR_NULL_PTR(ras, NULL);
return ras->getUrl();
}
JNIEXPORT jlong JNICALL
-Java_org_apache_subversion_javahl_ra_SVNRa_getDatedRevision
+Java_org_apache_subversion_javahl_remote_RemoteSession_getDatedRevision
(JNIEnv *env, jobject jthis, jlong timestamp)
{
- JNIEntry(SVNRa, getDatedRevision);
- SVNRa *ras = SVNRa::getCppObject(jthis);
+ JNIEntry(RemoteSession, getDatedRevision);
+ RemoteSession *ras = RemoteSession::getCppObject(jthis);
CPPADDR_NULL_PTR(ras, SVN_INVALID_REVNUM);
return ras->getDatedRev(timestamp);
}
JNIEXPORT jobject JNICALL
-Java_org_apache_subversion_javahl_ra_SVNRa_getLocks
+Java_org_apache_subversion_javahl_remote_RemoteSession_getLocks
(JNIEnv *env, jobject jthis, jstring jpath, jobject jdepth)
{
- JNIEntry(SVNRa, getLocks);
- SVNRa *ras = SVNRa::getCppObject(jthis);
+ JNIEntry(RemoteSession, getLocks);
+ RemoteSession *ras = RemoteSession::getCppObject(jthis);
CPPADDR_NULL_PTR(ras, NULL);
return ras->getLocks(jpath, jdepth);
}
JNIEXPORT jobject JNICALL
-Java_org_apache_subversion_javahl_ra_SVNRa_checkPath
+Java_org_apache_subversion_javahl_remote_RemoteSession_checkPath
(JNIEnv *env, jobject jthis, jstring jpath, jobject jrevision)
{
JNIEntry(SVNReposAccess, checkPath);
- SVNRa *ras = SVNRa::getCppObject(jthis);
+ RemoteSession *ras = RemoteSession::getCppObject(jthis);
CPPADDR_NULL_PTR(ras, NULL);
return ras->checkPath(jpath, jrevision);
Copied: subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java (from r1492216, 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/ISVNRemote.java?p2=subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java&p1=subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/ISVNRa.java&r1=1492216&r2=1492590&rev=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/ISVNRa.java (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRemote.java Thu Jun 13 09:17:02 2013
@@ -21,25 +21,24 @@
* @endcopyright
*/
-package org.apache.subversion.javahl.ra;
+package org.apache.subversion.javahl;
+
+import org.apache.subversion.javahl.types.*;
+import org.apache.subversion.javahl.callback.*;
import java.util.Date;
import java.util.Map;
-import org.apache.subversion.javahl.SubversionException;
-import org.apache.subversion.javahl.types.Depth;
-import org.apache.subversion.javahl.types.Lock;
-import org.apache.subversion.javahl.types.NodeKind;
-import org.apache.subversion.javahl.types.Revision;
-
/**
- * Represent an instance of RA session
+ * Encapsulates an RA session object and related operations.
+ * @see subversion/include/svn_ra.h#svn_ra_open
+ * @since 1.9
*/
-public interface ISVNRa
+public interface ISVNRemote
{
/**
- * Release native resources use by this Ra session. Once called this object
- * is no longer usable
+ * Release the native peer (should not depend on finalize).
+ * Also invalidates any existing editors related to this session.
*/
public void dispose();
Copied: subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/OperationContext.java (from r1492216, subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/RaSharedContext.java)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/OperationContext.java?p2=subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/OperationContext.java&p1=subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/RaSharedContext.java&r1=1492216&r2=1492590&rev=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/RaSharedContext.java (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/OperationContext.java Thu Jun 13 09:17:02 2013
@@ -29,24 +29,18 @@ import org.apache.subversion.javahl.call
* A private class to hold the contextual information required to
* persist in this object, such as notification handlers.
*/
-public class RaSharedContext
- implements ProgressCallback
+public class OperationContext implements ProgressCallback
{
- private ProgressCallback listener = null;
+ private ProgressCallback progress = null;
public void onProgress(ProgressEvent event)
{
- if (listener != null)
- listener.onProgress(event);
+ if (progress != null)
+ progress.onProgress(event);
}
- public ProgressCallback getListener()
+ public void setProgressCallback(ProgressCallback progress)
{
- return listener;
- }
-
- public void setListener(ProgressCallback listener)
- {
- this.listener = listener;
+ this.progress = progress;
}
}
Modified: subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=1492590&r1=1492589&r2=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java Thu Jun 13 09:17:02 2013
@@ -151,14 +151,14 @@ public class SVNClient implements ISVNCl
clientContext.notify = notify;
}
- public void setConflictResolver(ConflictResolverCallback listener)
+ public void setConflictResolver(ConflictResolverCallback resolver)
{
- clientContext.resolver = listener;
+ clientContext.resolver = resolver;
}
- public void setProgressCallback(ProgressCallback listener)
+ public void setProgressCallback(ProgressCallback progress)
{
- clientContext.setListener(listener);
+ clientContext.setProgressCallback(progress);
}
public native void remove(Set<String> paths, boolean force,
@@ -665,9 +665,8 @@ public class SVNClient implements ISVNCl
* A private class to hold the contextual information required to
* persist in this object, such as notification handlers.
*/
- private class ClientContext extends RaSharedContext
- implements ClientNotifyCallback, ProgressCallback,
- ConflictResolverCallback
+ private class ClientContext extends OperationContext
+ implements ClientNotifyCallback, ConflictResolverCallback
{
public ClientNotifyCallback notify = null;
public ConflictResolverCallback resolver = null;
Copied: subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java (from r1492216, 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/remote/RemoteFactory.java?p2=subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java&p1=subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRaFactory.java&r1=1492216&r2=1492590&rev=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRaFactory.java (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java Thu Jun 13 09:17:02 2013
@@ -21,42 +21,146 @@
* @endcopyright
*/
-package org.apache.subversion.javahl.ra;
+package org.apache.subversion.javahl.remote;
+import org.apache.subversion.javahl.callback.*;
+import org.apache.subversion.javahl.types.*;
+
+import org.apache.subversion.javahl.ISVNRemote;
+import org.apache.subversion.javahl.ClientException;
import org.apache.subversion.javahl.NativeResources;
-import org.apache.subversion.javahl.types.Version;
-public class SVNRaFactory
+
+/**
+ * Factory class for creating ISVNRemote instances.
+ * @since 1.9
+ */
+public class RemoteFactory
{
/**
- * Load the required native library.
+ * Default constructor.
+ */
+ public RemoteFactory() {}
+
+ /**
+ * Initializing constructor. Any or all of its arguments may be null.
*/
- static
+ public RemoteFactory(String configDirectory,
+ String username, String password,
+ UserPasswordCallback prompt,
+ ProgressCallback progress)
{
- NativeResources.loadNativeLibrary();
+ setConfigDirectory(configDirectory);
+ setUsername(username);
+ setPassword(password);
+ setPrompt(prompt);
+ setProgressCallback(progress);
+ }
- // 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);
- }
+ /**
+ * Sets the username used for authentication.
+ * @param username The username; Set to the <code>null</code> to clear it.
+ * @throws IllegalArgumentException If <code>username</code> is empty.
+ * @see #password(String)
+ */
+ public void setUsername(String username)
+ {
+ if (username != null && username.isEmpty())
+ throw new IllegalArgumentException("username must not be empty");
+ this.username = username;
}
/**
- * 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
+ * Sets the password used for authentication.
+ * @param password The passwordp Set <code>null</code> to clear it.
+ * @throws IllegalArgumentException If <code>password</code> is empty.
+ * @see #username(String)
*/
- public static native ISVNRa createRaSession(String url, String uuid,
- ISVNRaConfig config);
+ public void setPassword(String password)
+ {
+ if (password != null && password.isEmpty())
+ throw new IllegalArgumentException("password must not be empty");
+ this.password = password;
+ }
+
+ /**
+ * Register callback interface to supply username and password on demand.
+ * This callback can also be used to provide theequivalent of the
+ * <code>--no-auth-cache</code> and <code>--non-interactive</code>
+ * arguments accepted by the command-line client.
+ * @param prompt the callback interface
+ */
+ public void setPrompt(UserPasswordCallback prompt)
+ {
+ this.prompt = prompt;
+ }
+
+ /**
+ * Set the progress callback for new sessions.
+ *
+ * @param progress The progress callback.
+ */
+ public void setProgressCallback(ProgressCallback progress)
+ {
+ this.progress = progress;
+ }
+
+ /**
+ * Set directory for the configuration information.
+ */
+ public void setConfigDirectory(String configDirectory)
+ {
+ this.configDirectory = configDirectory;
+ }
+
+
+ /**
+ * Open a persistent session to a repository.
+ * @param url The initial session root URL.
+ * @throws ClientException
+ * @note The URL can point to a subtree of the repository.
+ * @note The session object inherits the progress callback,
+ * configuration directory and authentication info.
+ */
+ public ISVNRemote openRemoteSession(String url)
+ throws ClientException
+ {
+ return open(url, null,
+ configDirectory, username, password, prompt, progress);
+ }
+
+ /**
+ * Open a persistent session to a repository.
+ * @param url The initial session root URL.
+ * @param reposUUID The expected repository UUID; may not be null..
+ * @throws IllegalArgumentException If <code>reposUUID</code> is null.
+ * @throws ClientException
+ * @note The URL can point to a subtree of the repository.
+ * @note If the UUID does not match the repository, this function fails.
+ * @note The session object inherits the progress callback,
+ * configuration directory and authentication info.
+ */
+ public ISVNRemote openRemoteSession(String url, String reposUUID)
+ throws ClientException
+ {
+ if (reposUUID == null)
+ throw new IllegalArgumentException("reposUUID may not be null");
+ return open(url, reposUUID,
+ configDirectory, username, password, prompt, progress);
+ }
+
+
+ private String configDirectory;
+ private String username;
+ private String password;
+ private UserPasswordCallback prompt;
+ private ProgressCallback progress;
+
+ /** Native factory implementation. */
+ private static native ISVNRemote open(String url, String reposUUID,
+ String configDirectory,
+ String username, String password,
+ UserPasswordCallback prompt,
+ ProgressCallback progress)
+ throws ClientException;
}
Copied: subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java (from r1492216, 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/remote/RemoteSession.java?p2=subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java&p1=subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRa.java&r1=1492216&r2=1492590&rev=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ra/SVNRa.java (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java Thu Jun 13 09:17:02 2013
@@ -21,32 +21,33 @@
* @endcopyright
*/
-package org.apache.subversion.javahl.ra;
+package org.apache.subversion.javahl.remote;
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static java.util.concurrent.TimeUnit.NANOSECONDS;
+import org.apache.subversion.javahl.types.*;
+import org.apache.subversion.javahl.callback.*;
+
+import org.apache.subversion.javahl.ISVNRemote;
+import org.apache.subversion.javahl.JNIObject;
+import org.apache.subversion.javahl.OperationContext;
+import org.apache.subversion.javahl.SubversionException;
import java.util.Date;
import java.util.Map;
-import org.apache.subversion.javahl.JNIObject;
-import org.apache.subversion.javahl.SubversionException;
-import org.apache.subversion.javahl.types.Depth;
-import org.apache.subversion.javahl.types.Lock;
-import org.apache.subversion.javahl.types.NodeKind;
-import org.apache.subversion.javahl.types.Revision;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
-public class SVNRa extends JNIObject implements ISVNRa
+public class RemoteSession extends JNIObject implements ISVNRemote
{
@Override
public native long getLatestRevision();
-
+
@Override
public native String getUUID();
@Override
public native String getUrl();
-
+
public native long getDatedRevision(long timestamp) throws SubversionException;
public long getDatedRevision(Date date) throws SubversionException
@@ -67,19 +68,18 @@ public class SVNRa extends JNIObject imp
@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
+ * This constructor is called from JNI to get an instance call
+ * getRaSession method of ISVNClient
*/
- protected SVNRa(long cppAddr)
+ protected RemoteSession(long cppAddr)
{
super(cppAddr);
}
+
+ /*
+ * NOTE: This field is accessed from native code for callbacks.
+ */
+ private RemoteSessionContext sessionContext = new RemoteSessionContext();
+ private class RemoteSessionContext extends OperationContext {}
}
Modified: subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/RunTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/RunTests.java?rev=1492590&r1=1492589&r2=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/RunTests.java (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/RunTests.java Thu Jun 13 09:17:02 2013
@@ -92,7 +92,7 @@ public class RunTests
{
// Add default test suites.
suite.addTestSuite(SVNReposTests.class);
- suite.addTestSuite(SVNRATests.class);
+ suite.addTestSuite(SVNRemoteTests.class);
suite.addTestSuite(BasicTests.class);
}
else
Copied: subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java (from r1492029, subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java?p2=subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java&p1=subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java&r1=1492029&r2=1492590&rev=1492590&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java (original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java Thu Jun 13 09:17:02 2013
@@ -22,34 +22,30 @@
*/
package org.apache.subversion.javahl;
+import org.apache.subversion.javahl.*;
+import org.apache.subversion.javahl.remote.*;
+import org.apache.subversion.javahl.types.*;
+
import java.util.Date;
import java.util.Set;
import java.util.Map;
import java.util.HashSet;
import java.io.IOException;
-import org.apache.subversion.javahl.ra.ISVNRa;
-import org.apache.subversion.javahl.ra.SVNRaConfigDefault;
-import org.apache.subversion.javahl.ra.SVNRaFactory;
-import org.apache.subversion.javahl.types.Depth;
-import org.apache.subversion.javahl.types.Lock;
-import org.apache.subversion.javahl.types.NodeKind;
-import org.apache.subversion.javahl.types.Revision;
-
/**
* This class is used for testing the SVNReposAccess class
*
* More methodes for testing are still needed
*/
-public class SVNRATests extends SVNTests
+public class SVNRemoteTests extends SVNTests
{
protected OneTest thisTest;
- public SVNRATests()
+ public SVNRemoteTests()
{
}
- public SVNRATests(String name)
+ public SVNRemoteTests(String name)
{
super(name);
}
@@ -74,7 +70,7 @@ public class SVNRATests extends SVNTests
public void testDatedRev()
throws SubversionException, IOException
{
- ISVNRa session = getSession();
+ ISVNRemote session = getSession();
long revision = session.getDatedRevision(new Date());
assertEquals(revision, 1);
@@ -83,7 +79,7 @@ public class SVNRATests extends SVNTests
public void testGetLocks()
throws SubversionException, IOException
{
- ISVNRa session = getSession();
+ ISVNRemote session = getSession();
Set<String> iotaPathSet = new HashSet<String>(1);
String iotaPath = thisTest.getWCPath() + "/iota";
@@ -102,7 +98,7 @@ public class SVNRATests extends SVNTests
public void testCheckPath()
throws SubversionException, IOException
{
- ISVNRa session = getSession();
+ ISVNRemote session = getSession();
NodeKind kind = session.checkPath("iota", Revision.getInstance(1));
assertEquals(NodeKind.file, kind);
@@ -114,22 +110,27 @@ public class SVNRATests extends SVNTests
assertEquals(NodeKind.dir, kind);
}
- public static ISVNRa getSession(String url, String configDirectory)
+ public static ISVNRemote getSession(String url, String configDirectory)
{
- SVNRaConfigDefault config = new SVNRaConfigDefault();
- config.setUsername(USERNAME);
- config.setPassword(PASSWORD);
- config.setPrompt(new DefaultPromptUserPassword());
- config.setConfigDirectory(configDirectory);
-
- ISVNRa raSession = SVNRaFactory.createRaSession(url, null, config);
-
- assertNotNull("Null session was returned by factory", raSession);
-
- return raSession;
+ try
+ {
+ RemoteFactory factory = new RemoteFactory();
+ factory.setConfigDirectory(configDirectory);
+ factory.setUsername(USERNAME);
+ factory.setPassword(PASSWORD);
+ factory.setPrompt(new DefaultPromptUserPassword());
+
+ ISVNRemote raSession = factory.openRemoteSession(url);
+ assertNotNull("Null session was returned by factory", raSession);
+ return raSession;
+ }
+ catch (ClientException ex)
+ {
+ throw new RuntimeException(ex);
+ }
}
- private ISVNRa getSession()
+ private ISVNRemote getSession()
{
return getSession(getTestRepoUrl(), super.conf.getAbsolutePath());
}
@@ -141,14 +142,14 @@ public class SVNRATests extends SVNTests
public void testGetLatestRevision() throws Exception
{
- ISVNRa session = getSession();
+ ISVNRemote session = getSession();
assertEquals(1, session.getLatestRevision());
}
public void testGetUUID() throws Exception
{
- ISVNRa session = getSession();
+ ISVNRemote session = getSession();
/*
* Test UUID
@@ -160,7 +161,7 @@ public class SVNRATests extends SVNTests
public void testGetUrl() throws Exception
{
- ISVNRa session = getSession();
+ ISVNRemote session = getSession();
assertEquals(getTestRepoUrl(), session.getUrl());
}