You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/10/16 01:44:46 UTC
svn commit: r1532597 [2/10] - in /subversion/branches/log-addressing: ./
build/ac-macros/ build/generator/ build/generator/templates/ build/win32/
contrib/client-side/emacs/ notes/ subversion/bindings/javahl/native/
subversion/bindings/javahl/src/org/a...
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/JNIUtil.h
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/JNIUtil.h?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/JNIUtil.h (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/JNIUtil.h Tue Oct 15 23:44:41 2013
@@ -122,7 +122,9 @@ class JNIUtil
*/
static void handleSVNError(svn_error_t *err);
- static jstring makeSVNErrorMessage(svn_error_t *err);
+ static std::string makeSVNErrorMessage(svn_error_t *err,
+ jstring *jerror_message,
+ jobject *jmessage_stack);
/**
* Create and throw a java.lang.Throwable instance.
@@ -150,26 +152,13 @@ class JNIUtil
enum { formatBufferSize = 2048 };
enum { noLog, errorLog, exceptionLog, entryLog } LogLevel;
- struct message_stack_item
- {
- apr_status_t m_code;
- std::string m_message;
- bool m_generic;
-
- message_stack_item(apr_status_t code, const char* message,
- bool generic = false)
- : m_code(code),
- m_message(message),
- m_generic(generic)
- {}
- };
- typedef std::vector<message_stack_item> error_message_stack_t;
+ /**
+ * Mutex that secures the global configuration object.
+ */
+ static JNIMutex *g_configMutex;
private:
- static void assembleErrorMessage(svn_error_t *err, int depth,
- apr_status_t parent_apr_err,
- std::string &buffer,
- error_message_stack_t* message_stack = NULL);
+ static void wrappedHandleSVNError(svn_error_t *err);
static void putErrorsInTrace(svn_error_t *err,
std::vector<jobject> &stackTrace);
/**
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/LockTokenTable.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/LockTokenTable.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/OperationContext.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/OperationContext.cpp?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/OperationContext.cpp (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/OperationContext.cpp Tue Oct 15 23:44:41 2013
@@ -24,10 +24,14 @@
* @brief Implementation of the class OperationContext
*/
+#include <apr_file_io.h>
+
#include "svn_client.h"
#include "private/svn_wc_private.h"
+#include "private/svn_dep_compat.h"
#include "svn_private_config.h"
+#include "GlobalConfig.h"
#include "OperationContext.h"
#include "JNIUtil.h"
#include "JNICriticalSection.h"
@@ -43,7 +47,8 @@ OperationContext::OperationContext(SVN::
m_cancelOperation(0),
m_pool(&pool),
m_jctx(NULL),
- m_jcfgcb(NULL)
+ m_jcfgcb(NULL),
+ m_jtunnelcb(NULL)
{}
void
@@ -77,6 +82,10 @@ OperationContext::attachJavaObject(
return;
env->DeleteLocalRef(jctx);
+
+ m_jcfgcb = env->NewGlobalRef(GlobalConfig::getConfigCallback());
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
}
OperationContext::~OperationContext()
@@ -87,6 +96,8 @@ OperationContext::~OperationContext()
env->DeleteGlobalRef(m_jctx);
if (m_jcfgcb)
env->DeleteGlobalRef(m_jcfgcb);
+ if (m_jtunnelcb)
+ env->DeleteGlobalRef(m_jtunnelcb);
}
apr_hash_t *
@@ -123,65 +134,78 @@ OperationContext::getAuthBaton(SVN::Pool
return NULL;
}
- svn_config_t *config = reinterpret_cast<svn_config_t *>(apr_hash_get(configData,
+ svn_config_t *config = static_cast<svn_config_t *>(apr_hash_get(configData,
SVN_CONFIG_CATEGORY_CONFIG, APR_HASH_KEY_STRING));
+ const bool use_native_store = GlobalConfig::useNativeCredentialsStore();
+
/* The whole list of registered providers */
apr_array_header_t *providers;
+ svn_auth_provider_object_t *provider;
- /* Populate the registered providers with the platform-specific providers */
- SVN_JNI_ERR(
- svn_auth_get_platform_specific_client_providers(&providers, config, pool),
- NULL);
-
- /* Use the prompter (if available) to prompt for password and cert
- * caching. */
- svn_auth_plaintext_prompt_func_t plaintext_prompt_func = NULL;
- void *plaintext_prompt_baton = NULL;
- svn_auth_plaintext_passphrase_prompt_func_t plaintext_passphrase_prompt_func;
- void *plaintext_passphrase_prompt_baton = NULL;
-
- if (m_prompter != NULL)
+ if (use_native_store)
{
- plaintext_prompt_func = Prompter::plaintext_prompt;
- plaintext_prompt_baton = m_prompter;
- plaintext_passphrase_prompt_func = Prompter::plaintext_passphrase_prompt;
- plaintext_passphrase_prompt_baton = m_prompter;
- }
+ /* Populate the registered providers with the platform-specific providers */
+ SVN_JNI_ERR(
+ svn_auth_get_platform_specific_client_providers(
+ &providers, config, pool),
+ NULL);
+
+ /* Use the prompter (if available) to prompt for password and cert
+ * caching. */
+ svn_auth_plaintext_prompt_func_t plaintext_prompt_func = NULL;
+ void *plaintext_prompt_baton = NULL;
+ svn_auth_plaintext_passphrase_prompt_func_t plaintext_passphrase_prompt_func;
+ void *plaintext_passphrase_prompt_baton = NULL;
+
+ if (m_prompter != NULL)
+ {
+ plaintext_prompt_func = Prompter::plaintext_prompt;
+ plaintext_prompt_baton = m_prompter;
+ plaintext_passphrase_prompt_func = Prompter::plaintext_passphrase_prompt;
+ plaintext_passphrase_prompt_baton = m_prompter;
+ }
- /* The main disk-caching auth providers, for both
- * 'username/password' creds and 'username' creds. */
- svn_auth_provider_object_t *provider;
+ /* The main disk-caching auth providers, for both
+ * 'username/password' creds and 'username' creds. */
+
+ svn_auth_get_simple_provider2(&provider, plaintext_prompt_func,
+ plaintext_prompt_baton, pool);
+ APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+
+ svn_auth_get_username_provider(&provider, pool);
+ APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+
+ /* The server-cert, client-cert, and client-cert-password providers. */
+ SVN_JNI_ERR(
+ svn_auth_get_platform_specific_provider(
+ &provider, "windows", "ssl_server_trust", pool),
+ NULL);
+
+ if (provider)
+ APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
- svn_auth_get_simple_provider2(&provider, plaintext_prompt_func,
- plaintext_prompt_baton, pool);
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
-
- svn_auth_get_username_provider(&provider, pool);
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
-
- /* The server-cert, client-cert, and client-cert-password providers. */
- SVN_JNI_ERR(
- svn_auth_get_platform_specific_provider(&provider, "windows", "ssl_server_trust", pool),
- NULL);
-
- if (provider)
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
-
- svn_auth_get_ssl_server_trust_file_provider(&provider, pool);
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
- svn_auth_get_ssl_client_cert_file_provider(&provider, pool);
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
- svn_auth_get_ssl_client_cert_pw_file_provider2(&provider,
- plaintext_passphrase_prompt_func, plaintext_passphrase_prompt_baton,
- pool);
- APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+ svn_auth_get_ssl_server_trust_file_provider(&provider, pool);
+ APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+ svn_auth_get_ssl_client_cert_file_provider(&provider, pool);
+ APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+ svn_auth_get_ssl_client_cert_pw_file_provider2(
+ &provider,
+ plaintext_passphrase_prompt_func, plaintext_passphrase_prompt_baton,
+ pool);
+ APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
+ }
+ else
+ {
+ // Not using hte native credentials store, start with an empty
+ // providers array.
+ providers = apr_array_make(pool, 0, sizeof(svn_auth_provider_object_t *));
+ }
if (m_prompter != NULL)
{
/* Two basic prompt providers: username/password, and just username.*/
provider = m_prompter->getProviderSimple(in_pool);
-
APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
provider = m_prompter->getProviderUsername(in_pool);
@@ -254,34 +278,12 @@ OperationContext::setConfigDirectory(con
m_config = NULL;
}
-void
-OperationContext::setConfigCallback(jobject configCallback)
-{
- JNIEnv* env = JNIUtil::getEnv();
-
- if (m_jcfgcb)
- {
- env->DeleteGlobalRef(m_jcfgcb);
- m_jcfgcb = NULL;
- }
- if (configCallback)
- {
- m_jcfgcb = env->NewGlobalRef(configCallback);
- env->DeleteLocalRef(configCallback);
- }
-}
-
const char *
OperationContext::getConfigDirectory() const
{
return (m_configDir.empty() ? NULL : m_configDir.c_str());
}
-jobject OperationContext::getConfigCallback() const
-{
- return m_jcfgcb;
-}
-
const char *
OperationContext::getUsername() const
{
@@ -299,6 +301,26 @@ const Prompter& OperationContext::getPro
return *m_prompter;
}
+void OperationContext::setTunnelCallback(jobject jtunnelcb)
+{
+ JNIEnv *env = JNIUtil::getEnv();
+ if (jtunnelcb)
+ {
+ jtunnelcb = env->NewGlobalRef(jtunnelcb);
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+ }
+
+ if (m_jtunnelcb)
+ env->DeleteGlobalRef(m_jtunnelcb);
+ m_jtunnelcb = jtunnelcb;
+}
+
+jobject OperationContext::getTunnelCallback() const
+{
+ return m_jtunnelcb;
+}
+
void
OperationContext::cancelOperation()
{
@@ -332,6 +354,9 @@ OperationContext::progress(apr_off_t pro
apr_pool_t *pool)
{
jobject jctx = (jobject) baton;
+ if (!jctx)
+ return;
+
JNIEnv *env = JNIUtil::getEnv();
// Create a local frame for our references
@@ -411,7 +436,7 @@ OperationContext::notifyConfigLoad()
return;
}
- jclass cfg_cls = env->FindClass(JAVA_PACKAGE"/ConfigImpl");
+ jclass cfg_cls = env->FindClass(JAVA_PACKAGE"/util/ConfigImpl");
if (JNIUtil::isJavaExceptionThrown())
return;
@@ -441,3 +466,187 @@ OperationContext::notifyConfigLoad()
env->CallVoidMethod(jcbimpl, dispose_mid);
env->DeleteLocalRef(jcbimpl);
}
+
+namespace {
+class TunnelContext
+{
+public:
+ explicit TunnelContext(apr_pool_t *pool)
+ : request_in(NULL),
+ request_out(NULL),
+ response_in(NULL),
+ response_out(NULL)
+ {
+#if APR_VERSION_AT_LEAST(1, 3, 0)
+ status = apr_file_pipe_create_ex(&request_in, &request_out,
+ APR_FULL_BLOCK, pool);
+ if (!status)
+ status = apr_file_pipe_create_ex(&response_in, &response_out,
+ APR_FULL_BLOCK, pool);
+#else
+ // XXX APR compatibility note:
+ // Versions of APR before 1.3 do not have the extended pipe
+ // API. Just create a default pipe and just hope that it returns
+ // a blocking handle.
+ status = apr_file_pipe_create(&request_in, &request_out, pool);
+ if (!status)
+ status = apr_file_pipe_create(&response_in, &response_out, pool);
+#endif
+ }
+
+ apr_file_t *request_in;
+ apr_file_t *request_out;
+ apr_file_t *response_in;
+ apr_file_t *response_out;
+ apr_status_t status;
+};
+
+jobject create_Channel(const char *class_name, JNIEnv *env, apr_file_t *fd)
+{
+ jclass cls = env->FindClass(class_name);
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+ jmethodID ctor = env->GetMethodID(cls, "<init>", "(J)V");
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+ return env->NewObject(cls, ctor, reinterpret_cast<jlong>(fd));
+}
+
+jobject create_RequestChannel(JNIEnv *env, apr_file_t *fd)
+{
+ return create_Channel(JAVA_PACKAGE"/util/RequestChannel", env, fd);
+}
+jobject create_ResponseChannel(JNIEnv *env, apr_file_t *fd)
+{
+ return create_Channel(JAVA_PACKAGE"/util/ResponseChannel", env, fd);
+}
+} // anonymous namespace
+
+svn_boolean_t
+OperationContext::checkTunnel(void *tunnel_baton, const char *tunnel_name)
+{
+ JNIEnv *env = JNIUtil::getEnv();
+
+ jstring jtunnel_name = JNIUtil::makeJString(tunnel_name);
+ if (JNIUtil::isJavaExceptionThrown())
+ return false;
+
+ static jmethodID mid = 0;
+ if (0 == mid)
+ {
+ jclass cls = env->FindClass(JAVA_PACKAGE"/callback/TunnelAgent");
+ if (JNIUtil::isJavaExceptionThrown())
+ return false;
+ mid = env->GetMethodID(cls, "checkTunnel",
+ "(Ljava/lang/String;)Z");
+ if (JNIUtil::isJavaExceptionThrown())
+ return false;
+ }
+
+ jobject jtunnelcb = jobject(tunnel_baton);
+ jboolean check = env->CallBooleanMethod(jtunnelcb, mid, jtunnel_name);
+ if (JNIUtil::isJavaExceptionThrown())
+ return false;
+
+ return svn_boolean_t(check);
+}
+
+svn_error_t *
+OperationContext::openTunnel(apr_file_t **request, apr_file_t **response,
+ void **tunnel_context, void *tunnel_baton,
+ const char *tunnel_name, const char *user,
+ const char *hostname, int port,
+ apr_pool_t *pool)
+{
+ TunnelContext *tc = new TunnelContext(pool);
+ if (tc->status)
+ {
+ delete tc;
+ return svn_error_trace(
+ svn_error_wrap_apr(tc->status, _("Could not open tunnel streams")));
+ }
+
+ *request = tc->request_out;
+ *response = tc->response_in;
+
+ JNIEnv *env = JNIUtil::getEnv();
+
+ jobject jrequest = create_RequestChannel(env, tc->request_in);
+ SVN_JNI_CATCH(, SVN_ERR_BASE);
+
+ jobject jresponse = create_ResponseChannel(env, tc->response_out);
+ SVN_JNI_CATCH(, SVN_ERR_BASE);
+
+ jstring jtunnel_name = JNIUtil::makeJString(tunnel_name);
+ SVN_JNI_CATCH(, SVN_ERR_BASE);
+
+ jstring juser = JNIUtil::makeJString(user);
+ SVN_JNI_CATCH(, SVN_ERR_BASE);
+
+ jstring jhostname = JNIUtil::makeJString(hostname);
+ SVN_JNI_CATCH(, SVN_ERR_BASE);
+
+ static jmethodID mid = 0;
+ if (0 == mid)
+ {
+ jclass cls = env->FindClass(JAVA_PACKAGE"/callback/TunnelAgent");
+ SVN_JNI_CATCH(, SVN_ERR_BASE);
+ SVN_JNI_CATCH(
+ mid = env->GetMethodID(cls, "openTunnel",
+ "(Ljava/nio/channels/ReadableByteChannel;"
+ "Ljava/nio/channels/WritableByteChannel;"
+ "Ljava/lang/String;"
+ "Ljava/lang/String;"
+ "Ljava/lang/String;I)V"),
+ SVN_ERR_BASE);
+ }
+
+ jobject jtunnelcb = jobject(tunnel_baton);
+ SVN_JNI_CATCH(
+ env->CallVoidMethod(jtunnelcb, mid, jrequest, jresponse,
+ jtunnel_name, juser, jhostname, jint(port)),
+ SVN_ERR_BASE);
+
+ *tunnel_context = NULL;
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+OperationContext::closeTunnel(void *tunnel_context, void *tunnel_baton,
+ const char *tunnel_name, const char *user,
+ const char *hostname, int port)
+{
+ delete static_cast<TunnelContext*>(tunnel_context);
+
+ jstring jtunnel_name = JNIUtil::makeJString(tunnel_name);
+ SVN_JNI_CATCH(, SVN_ERR_BASE);
+
+ jstring juser = JNIUtil::makeJString(user);
+ SVN_JNI_CATCH(, SVN_ERR_BASE);
+
+ jstring jhostname = JNIUtil::makeJString(hostname);
+ SVN_JNI_CATCH(, SVN_ERR_BASE);
+
+ JNIEnv *env = JNIUtil::getEnv();
+
+ static jmethodID mid = 0;
+ if (0 == mid)
+ {
+ jclass cls = env->FindClass(JAVA_PACKAGE"/callback/TunnelAgent");
+ SVN_JNI_CATCH(, SVN_ERR_BASE);
+ SVN_JNI_CATCH(
+ mid = env->GetMethodID(cls, "closeTunnel",
+ "(Ljava/lang/String;"
+ "Ljava/lang/String;"
+ "Ljava/lang/String;I)V"),
+ SVN_ERR_BASE);
+ }
+
+ jobject jtunnelcb = jobject(tunnel_baton);
+ SVN_JNI_CATCH(
+ env->CallVoidMethod(jtunnelcb, mid,
+ jtunnel_name, juser, jhostname, jint(port)),
+ SVN_ERR_BASE);
+
+ return SVN_NO_ERROR;
+}
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/OperationContext.h
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/OperationContext.h?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/OperationContext.h (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/OperationContext.h Tue Oct 15 23:44:41 2013
@@ -59,9 +59,27 @@ class OperationContext
jobject m_jctx;
jobject m_jcfgcb;
+ jobject m_jtunnelcb;
+
static void progress(apr_off_t progressVal, apr_off_t total,
void *baton, apr_pool_t *pool);
void notifyConfigLoad();
+
+ static svn_boolean_t checkTunnel(
+ void *tunnel_baton, const char *tunnel_name);
+
+ static svn_error_t *openTunnel(
+ apr_file_t **request, apr_file_t **response,
+ void **tunnel_context, void *tunnel_baton,
+ const char *tunnel_name, const char *user,
+ const char *hostname, int port,
+ apr_pool_t *pool);
+
+ static svn_error_t *closeTunnel(
+ void *tunnel_context, void *tunnel_baton,
+ const char *tunnel_name, const char *user,
+ const char *hostname, int port);
+
public:
OperationContext(SVN::Pool &pool);
void attachJavaObject(jobject contextHolder, const char *contextClassType, const char *contextFieldName, jfieldID * ctxFieldID);
@@ -79,7 +97,6 @@ class OperationContext
virtual bool isCancelledOperation();
jobject getSelf() const;
const char *getConfigDirectory() const;
- jobject getConfigCallback() const;
const char *getUsername() const;
const char *getPassword() const;
const Prompter& getPrompter() const;
@@ -92,12 +109,6 @@ class OperationContext
void setConfigDirectory(const char *configDir);
/**
- * Set the config ConfigCallback instance to call when configuration
- * is loaded..
- */
- void setConfigCallback(jobject configCallback);
-
- /**
* Return configuration data for the context.
* Read it from config directory if necessary
*/
@@ -105,6 +116,9 @@ class OperationContext
static svn_error_t * clientName(void *baton, const char **name, apr_pool_t *pool);
virtual const char * getClientName() const;
+
+ virtual void setTunnelCallback(jobject jtunnelcb);
+ jobject getTunnelCallback() const;
};
#endif // JAVAHL_OPERATION_CONTEXT_H
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/PatchCallback.h
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/PatchCallback.h?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/PatchCallback.h (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/PatchCallback.h Tue Oct 15 23:44:41 2013
@@ -30,8 +30,6 @@
#include <jni.h>
#include "svn_client.h"
-struct info_entry;
-
/**
* This class holds a Java callback object, which will receive every line of
* the file for which the callback information is requested.
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSession.cpp?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSession.cpp (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSession.cpp Tue Oct 15 23:44:41 2013
@@ -36,6 +36,7 @@
#include "svn_ra.h"
#include "svn_string.h"
#include "svn_dirent_uri.h"
+#include "svn_delta.h"
#include "CreateJ.h"
#include "EnumMapper.h"
@@ -66,9 +67,8 @@ jobject
RemoteSession::open(jint jretryAttempts,
jstring jurl, jstring juuid,
jstring jconfigDirectory,
- jobject jconfigHandler,
jstring jusername, jstring jpassword,
- jobject jprompter, jobject jprogress)
+ jobject jprompter, jobject jprogress, jobject jtunnelcb)
{
JNIEnv *env = JNIUtil::getEnv();
@@ -111,7 +111,7 @@ RemoteSession::open(jint jretryAttempts,
jobject jremoteSession = open(
jretryAttempts, url.c_str(), uuid,
(jconfigDirectory ? configDirectory.c_str() : NULL),
- jconfigHandler, usernameStr, passwordStr, prompter, jprogress);
+ usernameStr, passwordStr, prompter, jprogress, jtunnelcb);
if (JNIUtil::isExceptionThrown() || !jremoteSession)
{
delete prompter;
@@ -123,9 +123,9 @@ RemoteSession::open(jint jretryAttempts,
jobject
RemoteSession::open(jint jretryAttempts,
const char* url, const char* uuid,
- const char* configDirectory, jobject jconfigHandler,
+ const char* configDirectory,
const char* usernameStr, const char* passwordStr,
- Prompter*& prompter, jobject jprogress)
+ Prompter*& prompter, jobject jprogress, jobject jtunnelcb)
{
/*
* Initialize ra layer if we have not done so yet
@@ -137,17 +137,51 @@ RemoteSession::open(jint jretryAttempts,
initialized = true;
}
- jobject jthis_out = NULL;
RemoteSession* session = new RemoteSession(
- &jthis_out, jretryAttempts, url, uuid,
- configDirectory, jconfigHandler,
- usernameStr, passwordStr, prompter, jprogress);
+ jretryAttempts, url, uuid, configDirectory,
+ usernameStr, passwordStr, prompter, jtunnelcb);
if (JNIUtil::isJavaExceptionThrown() || !session)
{
delete session;
- jthis_out = NULL;
+ return NULL;
}
- return jthis_out;
+
+ // Create java session object
+ JNIEnv *env = JNIUtil::getEnv();
+
+ jclass clazz = env->FindClass(JAVA_CLASS_REMOTE_SESSION);
+ if (JNIUtil::isJavaExceptionThrown())
+ {
+ delete session;
+ return NULL;
+ }
+
+ static jmethodID ctor = 0;
+ if (ctor == 0)
+ {
+ ctor = env->GetMethodID(clazz, "<init>", "(J)V");
+ if (JNIUtil::isJavaExceptionThrown())
+ {
+ delete session;
+ return NULL;
+ }
+ }
+
+ jobject jremoteSession = env->NewObject(clazz, ctor, session->getCppAddr());
+ if (JNIUtil::isJavaExceptionThrown())
+ {
+ delete session;
+ return NULL;
+ }
+
+ session->m_context->activate(jremoteSession, jprogress);
+ if (JNIUtil::isJavaExceptionThrown())
+ {
+ delete session;
+ jremoteSession = NULL;
+ }
+
+ return jremoteSession;
}
@@ -163,38 +197,15 @@ namespace{
typedef std::pair<attempt_set::iterator, bool> attempt_insert;
} // anonymous namespace
-RemoteSession::RemoteSession(jobject* jthis_out, int retryAttempts,
+RemoteSession::RemoteSession(int retryAttempts,
const char* url, const char* uuid,
const char* configDirectory,
- jobject jconfigHandler,
const char* username, const char* password,
- Prompter*& prompter, jobject jprogress)
+ Prompter*& prompter, jobject jtunnelcb)
: m_session(NULL), m_context(NULL)
{
- // Create java session object
- JNIEnv *env = JNIUtil::getEnv();
-
- jclass clazz = env->FindClass(JAVA_CLASS_REMOTE_SESSION);
- 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 jremoteSession = env->NewObject(clazz, ctor, cppAddr);
- if (JNIUtil::isJavaExceptionThrown())
- return;
-
m_context = new RemoteSessionContext(
- jremoteSession, pool, configDirectory, jconfigHandler,
- username, password, prompter, jprogress);
+ pool, configDirectory, username, password, prompter, jtunnelcb);
if (JNIUtil::isJavaExceptionThrown())
return;
@@ -233,6 +244,8 @@ RemoteSession::RemoteSession(jobject* jt
if (cycle_detected)
{
+ JNIEnv *env = JNIUtil::getEnv();
+
jstring exmsg = JNIUtil::makeJString(
apr_psprintf(pool.getPool(),
_("Redirect cycle detected for URL '%s'"),
@@ -258,6 +271,8 @@ RemoteSession::RemoteSession(jobject* jt
if (corrected_url)
{
+ JNIEnv *env = JNIUtil::getEnv();
+
jstring exmsg = JNIUtil::makeJString(_("Too many redirects"));
if (JNIUtil::isJavaExceptionThrown())
return;
@@ -283,8 +298,6 @@ RemoteSession::RemoteSession(jobject* jt
env->Throw(static_cast<jthrowable>(ex));
return;
}
-
- *jthis_out = jremoteSession;
}
RemoteSession::~RemoteSession()
@@ -1173,10 +1186,16 @@ public:
// We ignore the deltas as they're not
// exposed in the JavaHL API.
svn_boolean_t result_of_merge,
- svn_txdelta_window_handler_t*, void**,
+ svn_txdelta_window_handler_t* delta_handler,
+ void** delta_handler_baton,
apr_array_header_t* prop_diffs,
apr_pool_t* scratch_pool)
{
+ if (delta_handler)
+ *delta_handler = svn_delta_noop_window_handler;
+ if (delta_handler_baton)
+ *delta_handler_baton = NULL;
+
FileRevisionHandler* const self =
static_cast<FileRevisionHandler*>(baton);
SVN_ERR_ASSERT(self->m_jcallback != NULL);
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSession.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSession.h
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSession.h?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSession.h (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSession.h Tue Oct 15 23:44:41 2013
@@ -47,15 +47,15 @@ class RemoteSession : public SVNBase
static jobject open(jint jretryAttempts,
jstring jurl, jstring juuid,
jstring jconfigDirectory,
- jobject jconfigHandler,
jstring jusername, jstring jpassword,
- jobject jprompter, jobject jprogress);
+ jobject jprompter, jobject jprogress,
+ jobject jtunnelcb);
static jobject open(jint jretryAttempts,
const char* url, const char* uuid,
const char* configDirectory,
- jobject jconfigHandler,
const char* username, const char* password,
- Prompter*& prompter, jobject jprogress);
+ Prompter*& prompter, jobject jprogress,
+ jobject jtunnelcb);
~RemoteSession();
void cancelOperation() const { m_context->cancelOperation(); }
@@ -115,12 +115,11 @@ class RemoteSession : public SVNBase
private:
friend class CommitEditor;
- RemoteSession(jobject*, int retryAttempts,
+ RemoteSession(int retryAttempts,
const char* url, const char* uuid,
const char* configDirectory,
- jobject jconfigHandler,
const char* username, const char* password,
- Prompter*& prompter, jobject jprogress);
+ Prompter*& prompter, jobject jtunnelcb);
svn_ra_session_t* m_session;
RemoteSessionContext* m_context;
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSession.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSessionContext.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSessionContext.cpp?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSessionContext.cpp (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSessionContext.cpp Tue Oct 15 23:44:41 2013
@@ -29,17 +29,14 @@
#include "JNIUtil.h"
#include "Prompter.h"
-#define STRING_RETURN_SIGNATURE "()Ljava/lang/String;"
RemoteSessionContext::RemoteSessionContext(
- jobject contextHolder, SVN::Pool &pool,
- const char* configDirectory, jobject jconfigHandler,
- const char* usernameStr, const char* passwordStr,
- Prompter* prompter, jobject jprogress)
+ SVN::Pool &pool, const char* configDirectory,
+ const char* usernameStr, const char* passwordStr,
+ Prompter* prompter, jobject jtunnelcb)
: OperationContext(pool), m_raCallbacks(NULL)
{
setConfigDirectory(configDirectory);
- setConfigCallback(jconfigHandler);
if (usernameStr != NULL)
username(usernameStr);
@@ -47,32 +44,7 @@ RemoteSessionContext::RemoteSessionConte
password(passwordStr);
setPrompt(prompter);
-
- /*
- * Attach session context java object
- */
- static jfieldID ctxFieldID = 0;
- attachJavaObject(contextHolder,
- "L"JAVA_PACKAGE"/remote/RemoteSession$RemoteSessionContext;",
- "sessionContext", &ctxFieldID);
-
- /*
- * Set the progress callback
- */
- JNIEnv *env = JNIUtil::getEnv();
-
- 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);
+ setTunnelCallback(jtunnelcb);
/*
* Setup callbacks
@@ -82,7 +54,7 @@ RemoteSessionContext::RemoteSessionConte
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_baton = NULL;
m_raCallbacks->progress_func = progress;
/*
@@ -97,12 +69,50 @@ RemoteSessionContext::RemoteSessionConte
* Don't set deprecated callback
*/
m_raCallbacks->open_tmp_file = NULL;
+
+ if (m_jtunnelcb)
+ {
+ m_raCallbacks->check_tunnel_func = checkTunnel;
+ m_raCallbacks->open_tunnel_func = openTunnel;
+ m_raCallbacks->close_tunnel_func = closeTunnel;
+ m_raCallbacks->tunnel_baton = m_jtunnelcb;
+ }
}
RemoteSessionContext::~RemoteSessionContext()
{
}
+void RemoteSessionContext::activate(jobject jremoteSession, jobject jprogress)
+{
+ /*
+ * Attach session context java object
+ */
+ static jfieldID ctxFieldID = 0;
+ attachJavaObject(jremoteSession,
+ "L"JAVA_PACKAGE"/remote/RemoteSession$RemoteSessionContext;",
+ "sessionContext", &ctxFieldID);
+
+ /*
+ * Set the progress callback
+ */
+ JNIEnv *env = JNIUtil::getEnv();
+
+ 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);
+ m_raCallbacks->progress_baton = m_jctx;
+}
+
void *
RemoteSessionContext::getCallbackBaton()
{
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSessionContext.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSessionContext.h
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSessionContext.h?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSessionContext.h (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSessionContext.h Tue Oct 15 23:44:41 2013
@@ -34,12 +34,12 @@
class RemoteSessionContext : public OperationContext
{
public:
- RemoteSessionContext(jobject contextHolder, SVN::Pool &pool,
+ RemoteSessionContext(SVN::Pool &pool,
const char* jconfigDirectory,
- jobject jconfigHandler,
const char* jusername, const char* jpassword,
- Prompter* prompter, jobject jprogress);
+ Prompter* prompter, jobject jtunnelcb);
virtual ~RemoteSessionContext();
+ void activate(jobject jremoteSession, jobject jprogress);
void * getCallbackBaton();
svn_ra_callbacks2_t* getCallbacks();
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/RemoteSessionContext.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/RevisionRangeList.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/RevisionRangeList.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/SVNClient.cpp?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/SVNClient.cpp Tue Oct 15 23:44:41 2013
@@ -1120,7 +1120,7 @@ void SVNClient::streamFileContent(const
return;
SVN_JNI_ERR(svn_client_cat2(outputStream.getStream(subPool),
- path, pegRevision.revision(),
+ intPath.c_str(), pegRevision.revision(),
revision.revision(), ctx, subPool.getPool()),
);
}
@@ -1419,16 +1419,11 @@ jobject SVNClient::revProperties(const c
return CreateJ::PropertyMap(props, subPool.getPool());
}
-struct info_baton
-{
- std::vector<info_entry> infoVect;
- apr_pool_t *pool;
-};
-
void
-SVNClient::info2(const char *path, Revision &revision, Revision &pegRevision,
- svn_depth_t depth, StringArray &changelists,
- InfoCallback *callback)
+SVNClient::info2(const char *path,
+ Revision &revision, Revision &pegRevision, svn_depth_t depth,
+ svn_boolean_t fetchExcluded, svn_boolean_t fetchActualOnly,
+ StringArray &changelists, InfoCallback *callback)
{
SVN_JNI_NULL_PTR_EX(path, "path", );
@@ -1443,7 +1438,7 @@ SVNClient::info2(const char *path, Revis
SVN_JNI_ERR(svn_client_info3(checkedPath.c_str(),
pegRevision.revision(),
revision.revision(),
- depth, FALSE, TRUE,
+ depth, fetchExcluded, fetchActualOnly,
changelists.array(subPool),
InfoCallback::callback, callback,
ctx, subPool.getPool()), );
@@ -1516,10 +1511,6 @@ SVNClient::openRemoteSession(const char*
ctx, subPool.getPool()),
NULL);
- jobject jctx = context.getSelf();
- if (JNIUtil::isJavaExceptionThrown())
- return NULL;
-
/* Decouple the RemoteSession's context from SVNClient's context
by creating a copy of the prompter here. */
Prompter* prompter = new Prompter(context.getPrompter());
@@ -1529,9 +1520,8 @@ SVNClient::openRemoteSession(const char*
jobject jremoteSession = RemoteSession::open(
retryAttempts, path_info.url.c_str(), path_info.uuid.c_str(),
context.getConfigDirectory(),
- context.getConfigCallback(),
context.getUsername(), context.getPassword(),
- prompter, jctx);
+ prompter, context.getSelf(), context.getTunnelCallback());
if (JNIUtil::isJavaExceptionThrown())
delete prompter;
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/SVNClient.h
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/SVNClient.h?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/SVNClient.h (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/SVNClient.h Tue Oct 15 23:44:41 2013
@@ -66,9 +66,10 @@ class SVNClient :public SVNBase
void patch(const char *patchPath, const char *targetPath, bool dryRun,
int stripCount, bool reverse, bool ignoreWhitespace,
bool removeTempfiles, PatchCallback *callback);
- void info2(const char *path, Revision &revision, Revision &pegRevision,
- svn_depth_t depth, StringArray &changelists,
- InfoCallback *callback);
+ void info2(const char *path,
+ Revision &revision, Revision &pegRevision, svn_depth_t depth,
+ svn_boolean_t fetchExcluded, svn_boolean_t fetchActualOnly,
+ StringArray &changelists, InfoCallback *callback);
void unlock(Targets &targets, bool force);
void lock(Targets &targets, const char *comment, bool force);
jobject revProperties(const char *path, Revision &revision);
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/StateReporter.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/StateReporter.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_NativeResources.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_NativeResources.cpp?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_NativeResources.cpp (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_NativeResources.cpp Tue Oct 15 23:44:41 2013
@@ -28,11 +28,11 @@
#include "JNIUtil.h"
#include "../include/org_apache_subversion_javahl_NativeResources.h"
-JNIEXPORT void JNICALL
+JNIEXPORT jboolean JNICALL
Java_org_apache_subversion_javahl_NativeResources_initNativeLibrary
(JNIEnv *env, jclass jclazz)
{
// No usual JNIEntry here, as the prerequisite native library
// initialization is performed here.
- JNIUtil::JNIGlobalInit(env);
+ return jboolean(JNIUtil::JNIGlobalInit(env));
}
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Tue Oct 15 23:44:41 2013
@@ -275,6 +275,21 @@ Java_org_apache_subversion_javahl_SVNCli
}
JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_SVNClient_setTunnelAgent
+(JNIEnv *env, jobject jthis, jobject jtunnelcb)
+{
+ JNIEntry(SVNClient, setPrompt);
+ SVNClient *cl = SVNClient::getCppObject(jthis);
+ if (cl == NULL)
+ {
+ JNIUtil::throwError(_("bad C++ this"));
+ return;
+ }
+
+ cl->getClientContext().setTunnelCallback(jtunnelcb);
+}
+
+JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_logMessages
(JNIEnv *env, jobject jthis, jstring jpath, jobject jpegRevision,
jobject jranges, jboolean jstopOnCopy, jboolean jdisoverPaths,
@@ -1634,21 +1649,6 @@ Java_org_apache_subversion_javahl_SVNCli
cl->getClientContext().setConfigDirectory(configDir);
}
-JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_SVNClient_setConfigEventHandler
-(JNIEnv *env, jobject jthis, jobject jconfigHandler)
-{
- JNIEntry(SVNClient, setConfigDirectory);
- SVNClient *cl = SVNClient::getCppObject(jthis);
- if (cl == NULL)
- {
- JNIUtil::throwError(_("bad C++ this"));
- return;
- }
-
- cl->getClientContext().setConfigCallback(jconfigHandler);
-}
-
JNIEXPORT jstring JNICALL
Java_org_apache_subversion_javahl_SVNClient_getConfigDirectory
(JNIEnv *env, jobject jthis)
@@ -1810,8 +1810,9 @@ Java_org_apache_subversion_javahl_SVNCli
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNClient_info2
(JNIEnv *env, jobject jthis, jstring jpath, jobject jrevision,
- jobject jpegRevision, jobject jdepth, jobject jchangelists,
- jobject jinfoCallback)
+ jobject jpegRevision, jobject jdepth,
+ jboolean jfetchExcluded, jboolean jfetchActualOnly,
+ jobject jchangelists, jobject jinfoCallback)
{
JNIEntry(SVNClient, info2);
SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -1838,6 +1839,7 @@ Java_org_apache_subversion_javahl_SVNCli
InfoCallback callback(jinfoCallback);
cl->info2(path, revision, pegRevision, EnumMapper::toDepth(jdepth),
+ svn_boolean_t(jfetchExcluded), svn_boolean_t(jfetchActualOnly),
changelists, &callback);
}
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp Tue Oct 15 23:44:41 2013
@@ -182,16 +182,6 @@ Java_org_apache_subversion_javahl_remote
editor->move(jsrc_relpath, jsrc_revision, jdst_relpath, jreplaces_revision);
}
-//JNIEXPORT void JNICALL
-//Java_org_apache_subversion_javahl_remote_CommitEditor_rotate(
-// JNIEnv* env, jobject jthis, jobject jelements)
-//{
-// JNIEntry(CommitEditor, rotate);
-// CommitEditor *editor = CommitEditor::getCppObject(jthis);
-// CPPADDR_NULL_PTR(editor,);
-// editor->rotate(jelements);
-//}
-
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_remote_CommitEditor_complete(
JNIEnv* env, jobject jthis)
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_CommitEditor.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp Tue Oct 15 23:44:41 2013
@@ -36,23 +36,22 @@
JNIEXPORT jobject JNICALL
Java_org_apache_subversion_javahl_remote_RemoteFactory_open(
- JNIEnv *env, jclass jclass, jint jretryAttempts,
+ JNIEnv *env, jclass jclazz, jint jretryAttempts,
jstring jurl, jstring juuid,
- jstring jconfigDirectory, jobject jconfigHandler,
+ jstring jconfigDirectory,
jstring jusername, jstring jpassword,
- jobject jprompter, jobject jprogress)
+ jobject jprompter, jobject jprogress,
+ jobject jtunnelcb)
{
//JNI macros need jthis but this is a static call
- jobject jthis = NULL;
- JNIEntry(Remotefactory, open);
+ JNIEntryStatic(RemoteFactory, open);
/*
* Create RemoteSession C++ object and return its java wrapper to the caller
*/
jobject jremoteSession = RemoteSession::open(
jretryAttempts, jurl, juuid,
- jconfigDirectory, jconfigHandler,
- jusername, jpassword, jprompter, jprogress);
+ jconfigDirectory, jusername, jpassword, jprompter, jprogress, jtunnelcb);
if (JNIUtil::isJavaExceptionThrown())
return NULL;
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteSession.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_StateReporter.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_types_RevisionRangeList.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_DiffLib.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_DiffLib.cpp?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_DiffLib.cpp (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_DiffLib.cpp Tue Oct 15 23:44:41 2013
@@ -35,7 +35,7 @@
#include "svn_diff.h"
-JNIEXPORT void JNICALL
+JNIEXPORT jboolean JNICALL
Java_org_apache_subversion_javahl_util_DiffLib_nativeFileDiff(
JNIEnv* env, jobject jthis,
jstring joriginal_file,
@@ -60,13 +60,13 @@ Java_org_apache_subversion_javahl_util_D
Path original(joriginal_file, pool);
if (JNIUtil::isJavaExceptionThrown())
- return;
- SVN_JNI_ERR(original.error_occurred(),);
+ return false;
+ SVN_JNI_ERR(original.error_occurred(), false);
Path modified(jmodified_file, pool);
if (JNIUtil::isJavaExceptionThrown())
- return;
- SVN_JNI_ERR(modified.error_occurred(),);
+ return false;
+ SVN_JNI_ERR(modified.error_occurred(), false);
svn_diff_t* diff;
svn_diff_file_options_t* diff_options =
@@ -79,24 +79,27 @@ Java_org_apache_subversion_javahl_util_D
original.c_str(),
modified.c_str(),
diff_options,
- pool.getPool()),);
+ pool.getPool()),
+ false);
+
+ const jboolean diffs = svn_diff_contains_diffs(diff);
JNIStringHolder original_header(joriginal_header);
if (JNIUtil::isJavaExceptionThrown())
- return;
+ return false;
JNIStringHolder modified_header(jmodified_header);
if (JNIUtil::isJavaExceptionThrown())
- return;
+ return false;
JNIStringHolder header_encoding(jheader_encoding);
if (JNIUtil::isJavaExceptionThrown())
- return;
+ return false;
JNIStringHolder relative_to_dir(jrelative_to_dir);
if (JNIUtil::isJavaExceptionThrown())
- return;
-
+ return false;
+
OutputStream result_stream(jresult_stream);
SVN_JNI_ERR(svn_diff_file_output_unified3(
@@ -105,10 +108,13 @@ Java_org_apache_subversion_javahl_util_D
original_header.c_str(), modified_header.c_str(),
header_encoding.c_str(), relative_to_dir.c_str(),
diff_options->show_c_function,
- pool.getPool()),);
+ pool.getPool()),
+ false);
+
+ return diffs;
}
-JNIEXPORT void JNICALL
+JNIEXPORT jboolean JNICALL
Java_org_apache_subversion_javahl_util_DiffLib_nativeFileMerge(
JNIEnv* env, jobject jthis,
jstring joriginal_file,
@@ -135,18 +141,18 @@ Java_org_apache_subversion_javahl_util_D
Path original(joriginal_file, pool);
if (JNIUtil::isJavaExceptionThrown())
- return;
- SVN_JNI_ERR(original.error_occurred(),);
+ return false;
+ SVN_JNI_ERR(original.error_occurred(), false);
Path modified(jmodified_file, pool);
if (JNIUtil::isJavaExceptionThrown())
- return;
- SVN_JNI_ERR(modified.error_occurred(),);
+ return false;
+ SVN_JNI_ERR(modified.error_occurred(), false);
Path latest(jlatest_file, pool);
if (JNIUtil::isJavaExceptionThrown())
- return;
- SVN_JNI_ERR(latest.error_occurred(),);
+ return false;
+ SVN_JNI_ERR(latest.error_occurred(), false);
svn_diff_t* diff;
svn_diff_file_options_t* diff_options =
@@ -160,24 +166,27 @@ Java_org_apache_subversion_javahl_util_D
modified.c_str(),
latest.c_str(),
diff_options,
- pool.getPool()),);
+ pool.getPool()),
+ false);
+
+ const jboolean conflicts = svn_diff_contains_conflicts(diff);
JNIStringHolder conflict_original(jconflict_original);
if (JNIUtil::isJavaExceptionThrown())
- return;
+ return false;
JNIStringHolder conflict_modified(jconflict_modified);
if (JNIUtil::isJavaExceptionThrown())
- return;
+ return false;
JNIStringHolder conflict_latest(jconflict_latest);
if (JNIUtil::isJavaExceptionThrown())
- return;
+ return false;
JNIStringHolder conflict_separator(jconflict_separator);
if (JNIUtil::isJavaExceptionThrown())
- return;
-
+ return false;
+
OutputStream result_stream(jresult_stream);
SVN_JNI_ERR(svn_diff_file_output_merge2(
@@ -188,5 +197,8 @@ Java_org_apache_subversion_javahl_util_D
conflict_latest.c_str(),
conflict_separator.c_str(),
svn_diff_conflict_display_style_t(jconflict_style_ordinal),
- pool.getPool()),);
+ pool.getPool()),
+ false);
+
+ return conflicts;
}
Propchange: subversion/branches/log-addressing/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_DiffLib.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ClientNotifyInformation.java Tue Oct 15 23:44:41 2013
@@ -23,10 +23,12 @@
package org.apache.subversion.javahl;
+import org.apache.subversion.javahl.types.*;
+import org.apache.subversion.javahl.callback.ClientNotifyCallback;
+
+import java.util.List;
import java.util.Map;
import java.util.EventObject;
-import org.apache.subversion.javahl.callback.ClientNotifyCallback;
-import org.apache.subversion.javahl.types.*;
/**
* The event passed to the {@link ClientNotifyCallback#onNotify}
@@ -41,7 +43,7 @@ public class ClientNotifyInformation ext
// http://java.sun.com/j2se/1.4/pdf/serial-spec.pdf
// http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/version.html#6678
// http://java.sun.com/javase/6/docs/platform/serialization/spec/version.html#6678
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
/**
* The {@link Action} which triggered this event.
@@ -69,6 +71,12 @@ public class ClientNotifyInformation ext
private String errMsg;
/**
+ * A detailed stack of error messages for the item.
+ * @see ClientException
+ */
+ private List<ClientException.ErrorMessage> errMsgStack;
+
+ /**
* The {@link Status} of the content of the item.
*/
private Status contentState;
@@ -157,6 +165,7 @@ public class ClientNotifyInformation ext
this.mimeType = mimeType;
this.lock = lock;
this.errMsg = errMsg;
+ this.errMsgStack = null;
this.contentState = contentState;
this.propState = propState;
this.lockState = lockState;
@@ -176,6 +185,34 @@ public class ClientNotifyInformation ext
}
/**
+ * This constructor will be called only by the native code.
+ *
+ * In addition to all the other parameters, sets the detailed
+ * message stack.
+ */
+ protected ClientNotifyInformation(String path, Action action, NodeKind kind,
+ String mimeType, Lock lock, String errMsg,
+ List<ClientException.ErrorMessage> errMsgStack,
+ Status contentState, Status propState,
+ LockStatus lockState, long revision,
+ String changelistName, RevisionRange mergeRange,
+ String pathPrefix, String propName,
+ Map<String, String> revProps, long oldRevision,
+ long hunkOriginalStart, long hunkOriginalLength,
+ long hunkModifiedStart, long hunkModifiedLength,
+ long hunkMatchedLine, int hunkFuzz)
+ {
+ this(path, action, kind, mimeType, lock, errMsg,
+ contentState, propState, lockState, revision,
+ changelistName, mergeRange, pathPrefix, propName,
+ revProps, oldRevision,
+ hunkOriginalStart, hunkOriginalLength,
+ hunkModifiedStart, hunkModifiedLength,
+ hunkMatchedLine, hunkFuzz);
+ this.errMsgStack = errMsgStack;
+ }
+
+ /**
* @return The path of the item, which is the source of the event.
*/
public String getPath()
@@ -224,6 +261,14 @@ public class ClientNotifyInformation ext
}
/**
+ * @return Details about the error message for the item.
+ */
+ public List<ClientException.ErrorMessage> getErrMsgDetails()
+ {
+ return errMsgStack;
+ }
+
+ /**
* @return The {@link Status} of the content of the item.
*/
public Status getContentState()
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java Tue Oct 15 23:44:41 2013
@@ -134,6 +134,12 @@ public interface ISVNClient
void setPrompt(UserPasswordCallback prompt);
/**
+ * Set callbacks for ra_svn tunnel handling.
+ * @since 1.9
+ */
+ void setTunnelAgent(TunnelAgent tunnelAgent);
+
+ /**
* Retrieve the log messages for an item.
* @param path path or url to get the log message for.
* @param pegRevision revision to interpret path
@@ -1069,12 +1075,6 @@ public interface ISVNClient
void setConfigDirectory(String configDir) throws ClientException;
/**
- * Set an event handler that will be called every time the
- * configuration is loaded.
- */
- void setConfigEventHandler(ConfigEvent configHandler);
-
- /**
* Get the configuration directory
* @return the directory
* @throws ClientException
@@ -1139,7 +1139,56 @@ public interface ISVNClient
throws ClientException;
/**
+ * Invoke <code>callback</code> to return information
+ * <code>pathOrUrl</code> in <code>revision</code>. The
+ * information returned is system-generated metadata, not the sort
+ * of "property" metadata created by users.
+ * <p>
+ * If both revision arguments are either <code>null</code> or
+ * {@link Revision#START}, then information will be pulled solely
+ * from the working copy; no network connections will be made.
+ * <p>
+ * Otherwise, information will be pulled from a repository. The
+ * actual node revision selected is determined by the
+ * <code>pathOrUrl</code> as it exists in
+ * <code>pegRevision</code>. If <code>pegRevision</code> is
+ * {@link Revision#START}, then it defaults to {@link
+ * Revision#HEAD} for URLs or {@link Revision#WORKING} for WC
+ * targets.
+ * <p>
+ * If <code>pathOrUrl</code> is not a local path, then if
+ * <code>revision</code> is {@link Revision#PREVIOUS} (or some
+ * other kind that requires a local path), an error will be
+ * returned, because the desired revision cannot be determined.
+ * <p>
+ * If <code>pathOrUrl</code> is a file, just invoke the callback on it. If it
+ * is a directory, then descend according to <code>depth</code>.
+ * <p>
+ * @param pathOrUrl the path or the url of the item
+ * @param revision the revision of the item to return
+ * @param pegRevision the revision to interpret pathOrUrl
+ * @param depth the depth to recurse
+ * @param fetchExcluded when <code>true</code>, retreive
+ * information about nodes that are excluded from the working copy
+ * @param fetchActualOnly when <code>true</code>, retreive
+ * information about node that are not versioned, but are still
+ * tree conflicted.
+ * @param changelists if non-null, filter paths using changelists
+ * @param callback a callback to receive the infos retrieved
+ * @since 1.9
+ */
+ void info2(String pathOrUrl,
+ Revision revision, Revision pegRevision, Depth depth,
+ boolean fertchExcluded, boolean fetchActualOnly,
+ Collection<String> changelists, InfoCallback callback)
+ throws ClientException;
+
+ /**
* Retrieve information about repository or working copy items.
+ * <p>
+ * Behaves like the 1.9 version, with <code>fetchExcluded</code>
+ * set to <code>false</code> and <code>fetchActualOnly</code> set
+ * to <code>true</code>.
* @param pathOrUrl the path or the url of the item
* @param revision the revision of the item to return
* @param pegRevision the revision to interpret pathOrUrl
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNConfig.java
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNConfig.java?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNConfig.java (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNConfig.java Tue Oct 15 23:44:41 2013
@@ -112,19 +112,19 @@ public interface ISVNConfig
public static final String HTTP_CHUNKED_REQUESTS = "http-chunked-requests";
/**
- * "true" value in configuraition. One of the values returned by
+ * "true" value in configuration. One of the values returned by
* {@link Category#getYesNoAsk}.
*/
public static final String TRUE = "TRUE";
/**
- * "false" value in configuraition. One of the values returned by
+ * "false" value in configuration. One of the values returned by
* {@link Category#getYesNoAsk}.
*/
public static final String FALSE = "FALSE";
/**
- * "ask" value in configuraition. One of the values returned by
+ * "ask" value in configuration. One of the values returned by
* {@link Category#getYesNoAsk}.
*/
public static final String ASK = "ASK";
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNEditor.java Tue Oct 15 23:44:41 2013
@@ -261,8 +261,7 @@ public interface ISVNEditor
* <code>sourceRelativePath</code> at the start of the whole edit
* and<code>sourceRelativePath</code> at
* <code>sourceRevision</code> must lie within the same node-rev
- * (aka history-segment). This is just like the #delete() and
- * #rotate().
+ * (aka history-segment). This is just like the #delete().
* <p>
* For a description of <code>replacesRevision</code>, see #addFile().
*
@@ -274,42 +273,6 @@ public interface ISVNEditor
long replacesRevision)
throws ClientException;
-// Not implemented in the native API
-// /**
-// * Perform a rotation among multiple nodes in the target tree.
-// * <p>
-// * The <code>elements</code> list specifies the nodes in the tree
-// * which are located at a path and expected to be at a specific
-// * revision. These nodes are simultaneously moved in a rotation
-// * pattern. For example, the node at index 0
-// * <code>elements</code> will be moved to the relative path
-// * specified at index 1 of <code>elements</code>. The node at
-// * index 1 will be moved to the location at index 2. The node at
-// * index N-1 will be moved to the relative path specified at index 0.
-// * <p>
-// * The simplest form of this operation is to swap nodes A and
-// * B. One may think to move A to a temporary location T, then move
-// * B to A, then move T to B. However, this last move violations
-// * the Once Rule by moving T (which had already by edited by the
-// * move from A). In order to keep the restrictions against
-// * multiple moves of a single node, the rotation operation is
-// * needed for certain types of tree edits.
-// *
-// * @throws ClientException
-// */
-// void rotate(Iterable<RotatePair> elements) throws ClientException;
-//
-// public static final class RotatePair
-// {
-// public RotatePair(String relativePath, long revision)
-// {
-// this.relativePath = relativePath;
-// this.revision = revision;
-// }
-// public final String relativePath;
-// public final long revision;
-// }
-
/**
* Signal that the edit has been completed successfully.
* After this method is called, the editor is considered closed.
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/NativeResources.java Tue Oct 15 23:44:41 2013
@@ -129,7 +129,9 @@ public class NativeResources
*/
private static final void init()
{
- initNativeLibrary();
+ if (!initNativeLibrary())
+ throw new LinkageError("Native library initialization failed");
+
version = new Version();
if (!version.isAtLeast(1, 9, 0))
{
@@ -141,5 +143,5 @@ public class NativeResources
/**
* Initialize the native library layer.
*/
- private static native void initNativeLibrary();
+ private static native boolean initNativeLibrary();
}
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java Tue Oct 15 23:44:41 2013
@@ -132,6 +132,8 @@ public class SVNClient implements ISVNCl
public native void setPrompt(UserPasswordCallback prompt);
+ public native void setTunnelAgent(TunnelAgent tunnelAgent);
+
public native void logMessages(String path, Revision pegRevision,
List<RevisionRange> revisionRanges,
boolean stopOnCopy, boolean discoverPath,
@@ -573,8 +575,6 @@ public class SVNClient implements ISVNCl
public native void setConfigDirectory(String configDir)
throws ClientException;
- public native void setConfigEventHandler(ConfigEvent configHandler);
-
public native String getConfigDirectory()
throws ClientException;
@@ -664,10 +664,21 @@ public class SVNClient implements ISVNCl
public native void info2(String pathOrUrl, Revision revision,
Revision pegRevision, Depth depth,
+ boolean fetchExcluded, boolean fetchActualOnly,
Collection<String> changelists,
InfoCallback callback)
throws ClientException;
+ public void info2(String pathOrUrl, Revision revision,
+ Revision pegRevision, Depth depth,
+ Collection<String> changelists,
+ InfoCallback callback)
+ throws ClientException
+ {
+ info2(pathOrUrl, revision, pegRevision, depth,
+ false, true, changelists, callback);
+ }
+
public native void patch(String patchPath, String targetPath,
boolean dryRun, int stripCount, boolean reverse,
boolean ignoreWhitespace, boolean removeTempfiles,
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java Tue Oct 15 23:44:41 2013
@@ -23,12 +23,97 @@
package org.apache.subversion.javahl;
+import org.apache.subversion.javahl.callback.*;
import org.apache.subversion.javahl.util.*;
import java.io.OutputStream;
public class SVNUtil
{
+ //
+ // Global configuration
+ //
+
+ /**
+ * Enable storing authentication credentials in Subversion's
+ * standard credentials store in the configuration directory and
+ * system-specific secure locations.
+ * <p>
+ * The standard credentials store is enabled by default.
+ * <p>
+ * This setting will be inherited by all ISVNClient and ISVNRemote
+ * objects. Changing the setting will not affect existing such
+ * objects.
+ * @throws ClientException
+ */
+ public static void enableNativeCredentialsStore()
+ throws ClientException
+ {
+ new ConfigLib().enableNativeCredentialsStore();
+ }
+
+ /**
+ * Disable storing authentication credentials in Subversion's
+ * standard credentials store in the configuration directory and
+ * system-specific secure locations. In this mode, the
+ * authentication (see {@link ISVNClient#setPrompt} and {@link
+ * remote.RemoteFactory#setPrompt}) will be called every time the
+ * underlying library needs access to the credentials.
+ * <p>
+ * This mode is intented to support client implementations that
+ * use their own credentials store.
+ * <p>
+ * The standard credentials store is enabled by default.
+ * <p>
+ * This setting will be inherited by all ISVNClient and ISVNRemote
+ * objects. Changing the setting will not affect existing such
+ * objects.
+ * @throws ClientException
+ */
+ public static void disableNativeCredentialsStore()
+ throws ClientException
+ {
+ new ConfigLib().disableNativeCredentialsStore();
+ }
+
+ /**
+ * Find out if the standard credentials store is enabled.
+ */
+ public static boolean isNativeCredentialsStoreEnabled()
+ throws ClientException
+ {
+ return new ConfigLib().isNativeCredentialsStoreEnabled();
+ }
+
+ /**
+ * Set an event handler that will be called every time the
+ * configuration is loaded.
+ * <p>
+ * This setting will be inherited by all ISVNClient and ISVNRemote
+ * objects. Changing the setting will not affect existing such
+ * objects.
+ * @throws ClientException
+ */
+ public static void setConfigEventHandler(ConfigEvent configHandler)
+ throws ClientException
+ {
+ new ConfigLib().setConfigEventHandler(configHandler);
+ }
+
+ /**
+ * Return a reference to the installed configuration event
+ * handler. The returned value may be <code>null</code>.
+ */
+ public static ConfigEvent getConfigEventHandler()
+ throws ClientException
+ {
+ return new ConfigLib().getConfigEventHandler();
+ }
+
+ //
+ // Diff and Merge
+ //
+
/**
* Options to control the behaviour of the file diff routines.
*/
@@ -131,23 +216,25 @@ public class SVNUtil
* This path will be stripped from the beginning of those
* file names if they are used in the unidiff index header.
* @param resultStream The stream that receives the merged output.
+ * @return <code>true</code> if there were differences between the files.
* @throws ClientException
*/
- public static void FileDiff(String originalFile,
- String modifiedFile,
- SVNUtil.DiffOptions diffOptions,
-
- String originalHeader,
- String modifiedHeader,
- String headerEncoding,
- String relativeToDir,
+ public static boolean fileDiff(String originalFile,
+ String modifiedFile,
+ SVNUtil.DiffOptions diffOptions,
+
+ String originalHeader,
+ String modifiedHeader,
+ String headerEncoding,
+ String relativeToDir,
- OutputStream resultStream)
+ OutputStream resultStream)
throws ClientException
{
- new DiffLib().FileDiff(originalFile, modifiedFile, diffOptions,
- originalHeader, modifiedHeader, headerEncoding,
- relativeToDir, resultStream);
+ return new DiffLib().fileDiff(originalFile, modifiedFile, diffOptions,
+ originalHeader, modifiedHeader,
+ headerEncoding,
+ relativeToDir, resultStream);
}
@@ -171,26 +258,27 @@ public class SVNUtil
* @param conflictSeparator Optional custom conflict separator.
* @param conflictStyle Determines how conflicts are displayed.
* @param resultStream The stream that receives the merged output.
+ * @return <code>true</code> if there were any conflicts.
* @throws ClientException
*/
- public static void FileMerge(String originalFile,
- String modifiedFile,
- String latestFile,
- DiffOptions diffOptions,
-
- String conflictOriginal,
- String conflictModified,
- String conflictLatest,
- String conflictSeparator,
- ConflictDisplayStyle conflictStyle,
+ public static boolean fileMerge(String originalFile,
+ String modifiedFile,
+ String latestFile,
+ DiffOptions diffOptions,
+
+ String conflictOriginal,
+ String conflictModified,
+ String conflictLatest,
+ String conflictSeparator,
+ ConflictDisplayStyle conflictStyle,
- OutputStream resultStream)
+ OutputStream resultStream)
throws ClientException
{
- new DiffLib().FileMerge(originalFile, modifiedFile, latestFile,
- diffOptions,
- conflictOriginal, conflictModified,
- conflictLatest, conflictSeparator,
- conflictStyle, resultStream);
+ return new DiffLib().fileMerge(originalFile, modifiedFile, latestFile,
+ diffOptions,
+ conflictOriginal, conflictModified,
+ conflictLatest, conflictSeparator,
+ conflictStyle, resultStream);
}
-}
\ No newline at end of file
+}
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/CommitEditor.java Tue Oct 15 23:44:41 2013
@@ -29,6 +29,7 @@ import org.apache.subversion.javahl.call
import org.apache.subversion.javahl.ISVNEditor;
import org.apache.subversion.javahl.JNIObject;
import org.apache.subversion.javahl.ClientException;
+import org.apache.subversion.javahl.NativeResources;
import java.io.InputStream;
import java.util.Map;
@@ -40,6 +41,14 @@ import java.util.Set;
*/
public class CommitEditor extends JNIObject implements ISVNEditor
{
+ /**
+ * Load the required native library.
+ */
+ static
+ {
+ NativeResources.loadNativeLibrary();
+ }
+
public void dispose()
{
session.disposeEditor(this);
@@ -111,9 +120,6 @@ public class CommitEditor extends JNIObj
long replacesRevision)
throws ClientException;
-// public native void rotate(Iterable<RotatePair> elements)
-// throws ClientException;
-
public native void complete() throws ClientException;
public native void abort() throws ClientException;
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java Tue Oct 15 23:44:41 2013
@@ -57,17 +57,17 @@ public class RemoteFactory
* Initializing constructor. Any or all of its arguments may be null.
*/
public RemoteFactory(String configDirectory,
- ConfigEvent configHandler,
String username, String password,
UserPasswordCallback prompt,
- ProgressCallback progress)
+ ProgressCallback progress,
+ TunnelAgent tunnelAgent)
{
setConfigDirectory(configDirectory);
- setConfigEventHandler(configHandler);
setUsername(username);
setPassword(password);
setPrompt(prompt);
setProgressCallback(progress);
+ setTunnelAgent(tunnelAgent);
}
/**
@@ -127,15 +127,13 @@ public class RemoteFactory
}
/**
- * Set an event handler that will be called every time the
- * configuration is loaded.
+ * Set callbacks for ra_svn tunnel handling.
*/
- public void setConfigEventHandler(ConfigEvent configHandler)
+ public void setTunnelAgent(TunnelAgent tunnelAgent)
{
- this.configHandler = configHandler;
+ this.tunnelAgent = tunnelAgent;
}
-
/**
* Open a persistent session to a repository.
* <p>
@@ -152,9 +150,8 @@ public class RemoteFactory
public ISVNRemote openRemoteSession(String url)
throws ClientException, SubversionException
{
- return open(1, url, null,
- configDirectory, configHandler,
- username, password, prompt, progress);
+ return open(1, url, null, configDirectory,
+ username, password, prompt, progress, tunnelAgent);
}
/**
@@ -180,9 +177,8 @@ public class RemoteFactory
if (retryAttempts <= 0)
throw new IllegalArgumentException(
"retryAttempts must be positive");
- return open(retryAttempts, url, null,
- configDirectory, configHandler,
- username, password, prompt, progress);
+ return open(retryAttempts, url, null, configDirectory,
+ username, password, prompt, progress, tunnelAgent);
}
/**
@@ -208,9 +204,8 @@ public class RemoteFactory
{
if (reposUUID == null)
throw new IllegalArgumentException("reposUUID may not be null");
- return open(1, url, reposUUID,
- configDirectory, configHandler,
- username, password, prompt, progress);
+ return open(1, url, reposUUID, configDirectory,
+ username, password, prompt, progress, tunnelAgent);
}
/**
@@ -243,25 +238,24 @@ public class RemoteFactory
if (retryAttempts <= 0)
throw new IllegalArgumentException(
"retryAttempts must be positive");
- return open(retryAttempts, url, reposUUID,
- configDirectory, configHandler,
- username, password, prompt, progress);
+ return open(retryAttempts, url, reposUUID, configDirectory,
+ username, password, prompt, progress, tunnelAgent);
}
private String configDirectory;
- private ConfigEvent configHandler;
private String username;
private String password;
private UserPasswordCallback prompt;
private ProgressCallback progress;
+ private TunnelAgent tunnelAgent;
/* Native factory implementation. */
private static native ISVNRemote open(int retryAttempts,
String url, String reposUUID,
String configDirectory,
- ConfigEvent configHandler,
String username, String password,
UserPasswordCallback prompt,
- ProgressCallback progress)
+ ProgressCallback progress,
+ TunnelAgent tunnelAgent)
throws ClientException, SubversionException;
}
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteSession.java Tue Oct 15 23:44:41 2013
@@ -32,6 +32,7 @@ import org.apache.subversion.javahl.ISVN
import org.apache.subversion.javahl.JNIObject;
import org.apache.subversion.javahl.OperationContext;
import org.apache.subversion.javahl.ClientException;
+import org.apache.subversion.javahl.NativeResources;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -46,6 +47,14 @@ import static java.util.concurrent.TimeU
public class RemoteSession extends JNIObject implements ISVNRemote
{
+ /**
+ * Load the required native library.
+ */
+ static
+ {
+ NativeResources.loadNativeLibrary();
+ }
+
public void dispose()
{
if (editorReference != null)
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/StateReporter.java Tue Oct 15 23:44:41 2013
@@ -29,6 +29,7 @@ import org.apache.subversion.javahl.call
import org.apache.subversion.javahl.JNIObject;
import org.apache.subversion.javahl.ISVNReporter;
import org.apache.subversion.javahl.ClientException;
+import org.apache.subversion.javahl.NativeResources;
/**
* Implementation of ISVNReporter.
@@ -36,6 +37,14 @@ import org.apache.subversion.javahl.Clie
*/
public class StateReporter extends JNIObject implements ISVNReporter
{
+ /**
+ * Load the required native library.
+ */
+ static
+ {
+ NativeResources.loadNativeLibrary();
+ }
+
public void dispose()
{
session.disposeReporter(this);
Modified: subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/RevisionRangeList.java
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/RevisionRangeList.java?rev=1532597&r1=1532596&r2=1532597&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/RevisionRangeList.java (original)
+++ subversion/branches/log-addressing/subversion/bindings/javahl/src/org/apache/subversion/javahl/types/RevisionRangeList.java Tue Oct 15 23:44:41 2013
@@ -24,6 +24,7 @@
package org.apache.subversion.javahl.types;
import org.apache.subversion.javahl.ClientException;
+import org.apache.subversion.javahl.NativeResources;
import java.util.List;
@@ -39,6 +40,14 @@ public class RevisionRangeList implement
// the Java release.
private static final long serialVersionUID = 1L;
+ /**
+ * Load the required native library.
+ */
+ static
+ {
+ NativeResources.loadNativeLibrary();
+ }
+
private List<RevisionRange> ranges;
/**