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/08/31 03:47:23 UTC
svn commit: r1519127 - in /subversion/branches/javahl-1.7-extensions: ./
subversion/bindings/javahl/ subversion/bindings/javahl/native/
subversion/bindings/javahl/src/org/apache/subversion/javahl/
subversion/bindings/javahl/src/org/apache/subversion/ja...
Author: brane
Date: Sat Aug 31 01:47:22 2013
New Revision: 1519127
URL: http://svn.apache.org/r1519127
Log:
On the javahl-1.7-extensions branch: Synced JavaHL with trunk up to r1519126.
Added:
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/GlobalConfig.h
- copied unchanged from r1519126, subversion/trunk/subversion/bindings/javahl/native/GlobalConfig.h
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.cpp
- copied, changed from r1519126, subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp
- copied unchanged from r1519126, subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigImpl.java
- copied unchanged from r1519126, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigImpl.java
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java
- copied unchanged from r1519126, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java
Removed:
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_ConfigImpl_Category.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ConfigImpl.java
Modified:
subversion/branches/javahl-1.7-extensions/build.conf
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/ (props changed)
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.h
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.h
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/SVNClient.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
Modified: subversion/branches/javahl-1.7-extensions/build.conf
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/build.conf?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/build.conf (original)
+++ subversion/branches/javahl-1.7-extensions/build.conf Sat Aug 31 01:47:22 2013
@@ -60,7 +60,8 @@ private-built-includes =
subversion/bindings/javahl/include/org_apache_subversion_javahl_callback_UserPasswordCallback.h
subversion/bindings/javahl/include/org_apache_subversion_javahl_remote_RemoteSession.h
subversion/bindings/javahl/include/org_apache_subversion_javahl_remote_RemoteFactory.h
- subversion/bindings/javahl/include/org_apache_subversion_javahl_ConfigImpl_Category.h
+ subversion/bindings/javahl/include/org_apache_subversion_javahl_util_ConfigImpl_Category.h
+ subversion/bindings/javahl/include/org_apache_subversion_javahl_util_ConfigLib.h
subversion/bindings/javahl/include/org_apache_subversion_javahl_util_DiffLib.h
test-scripts =
Propchange: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/
------------------------------------------------------------------------------
Merged /subversion/trunk/subversion/bindings/javahl:r1518879-1519126
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.cpp Sat Aug 31 01:47:22 2013
@@ -35,6 +35,7 @@
#include <apr_tables.h>
#include <apr_general.h>
#include <apr_lib.h>
+#include <apr_file_info.h>
#include "svn_pools.h"
#include "svn_fs.h"
@@ -44,7 +45,7 @@
#include "svn_dso.h"
#include "svn_path.h"
#include "svn_cache_config.h"
-#include <apr_file_info.h>
+#include "private/svn_atomic.h"
#include "svn_private_config.h"
#ifdef WIN32
/* FIXME: We're using an internal APR header here, which means we
@@ -68,6 +69,7 @@ apr_pool_t *JNIUtil::g_pool = NULL;
std::list<SVNBase*> JNIUtil::g_finalizedObjects;
JNIMutex *JNIUtil::g_finalizedObjectsMutex = NULL;
JNIMutex *JNIUtil::g_logMutex = NULL;
+JNIMutex *JNIUtil::g_configMutex = NULL;
bool JNIUtil::g_initException;
bool JNIUtil::g_inInit;
JNIEnv *JNIUtil::g_initEnv;
@@ -111,13 +113,11 @@ bool JNIUtil::JNIInit(JNIEnv *env)
bool JNIUtil::JNIGlobalInit(JNIEnv *env)
{
// This method has to be run only once during the run a program.
- static bool run = false;
- svn_error_t *err;
- if (run) // already run
+ static volatile svn_atomic_t once = 0;
+ svn_atomic_t done = svn_atomic_cas(&once, 1, 0);
+ if (done)
return true;
- run = true;
-
// Do not run this part more than one time. This leaves a small
// time window when two threads create their first SVNClient and
// SVNAdmin at the same time, but I do not see a better option
@@ -128,10 +128,10 @@ bool JNIUtil::JNIGlobalInit(JNIEnv *env)
g_inInit = true;
g_initEnv = env;
+ svn_error_t *err;
apr_status_t status;
-
/* Initialize the APR subsystem, and register an atexit() function
* to Uninitialize that subsystem at program exit. */
status = apr_initialize();
@@ -268,6 +268,10 @@ bool JNIUtil::JNIGlobalInit(JNIEnv *env)
if (isExceptionThrown())
return false;
+ g_configMutex = new JNIMutex(g_pool);
+ if (isExceptionThrown())
+ return false;
+
// initialized the thread local storage
if (!JNIThreadData::initThreadData())
return false;
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.h?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.h (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/JNIUtil.h Sat Aug 31 01:47:22 2013
@@ -164,6 +164,11 @@ class JNIUtil
};
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,
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.cpp?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.cpp Sat Aug 31 01:47:22 2013
@@ -28,6 +28,7 @@
#include "private/svn_wc_private.h"
#include "svn_private_config.h"
+#include "GlobalConfig.h"
#include "OperationContext.h"
#include "JNIUtil.h"
#include "JNICriticalSection.h"
@@ -77,6 +78,10 @@ OperationContext::attachJavaObject(
return;
env->DeleteLocalRef(jctx);
+
+ m_jcfgcb = env->NewGlobalRef(GlobalConfig::getConfigCallback());
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
}
OperationContext::~OperationContext()
@@ -123,65 +128,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_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_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;
+ }
+ 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 +272,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
{
@@ -411,7 +407,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;
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.h?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.h (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/OperationContext.h Sat Aug 31 01:47:22 2013
@@ -79,7 +79,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 +91,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
*/
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.cpp Sat Aug 31 01:47:22 2013
@@ -35,6 +35,7 @@
#include "svn_ra.h"
#include "svn_string.h"
#include "svn_dirent_uri.h"
+#include "svn_delta.h"
#include "CreateJ.h"
#include "EnumMapper.h"
@@ -63,7 +64,6 @@ jobject
RemoteSession::open(jint jretryAttempts,
jstring jurl, jstring juuid,
jstring jconfigDirectory,
- jobject jconfigHandler,
jstring jusername, jstring jpassword,
jobject jprompter, jobject jprogress)
{
@@ -108,7 +108,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);
if (JNIUtil::isExceptionThrown() || !jremoteSession)
{
delete prompter;
@@ -120,7 +120,7 @@ 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)
{
@@ -137,7 +137,7 @@ RemoteSession::open(jint jretryAttempts,
jobject jthis_out = NULL;
RemoteSession* session = new RemoteSession(
&jthis_out, jretryAttempts, url, uuid,
- configDirectory, jconfigHandler,
+ configDirectory,
usernameStr, passwordStr, prompter, jprogress);
if (JNIUtil::isJavaExceptionThrown() || !session)
{
@@ -163,7 +163,6 @@ namespace{
RemoteSession::RemoteSession(jobject* jthis_out, int retryAttempts,
const char* url, const char* uuid,
const char* configDirectory,
- jobject jconfigHandler,
const char* username, const char* password,
Prompter*& prompter, jobject jprogress)
: m_session(NULL), m_context(NULL)
@@ -190,7 +189,7 @@ RemoteSession::RemoteSession(jobject* jt
return;
m_context = new RemoteSessionContext(
- jremoteSession, pool, configDirectory, jconfigHandler,
+ jremoteSession, pool, configDirectory,
username, password, prompter, jprogress);
if (JNIUtil::isJavaExceptionThrown())
return;
@@ -1069,10 +1068,14 @@ 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)
{
+ *delta_handler = svn_delta_noop_window_handler;
+ *delta_handler_baton = NULL;
+
FileRevisionHandler* const self =
static_cast<FileRevisionHandler*>(baton);
SVN_ERR_ASSERT(self->m_jcallback != NULL);
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSession.h Sat Aug 31 01:47:22 2013
@@ -47,13 +47,11 @@ 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);
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);
~RemoteSession();
@@ -118,7 +116,6 @@ class RemoteSession : public SVNBase
RemoteSession(jobject*, int retryAttempts,
const char* url, const char* uuid,
const char* configDirectory,
- jobject jconfigHandler,
const char* username, const char* password,
Prompter*& prompter, jobject jprogress);
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.cpp Sat Aug 31 01:47:22 2013
@@ -33,13 +33,12 @@
RemoteSessionContext::RemoteSessionContext(
jobject contextHolder, SVN::Pool &pool,
- const char* configDirectory, jobject jconfigHandler,
+ const char* configDirectory,
const char* usernameStr, const char* passwordStr,
Prompter* prompter, jobject jprogress)
: OperationContext(pool), m_raCallbacks(NULL)
{
setConfigDirectory(configDirectory);
- setConfigCallback(jconfigHandler);
if (usernameStr != NULL)
username(usernameStr);
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/RemoteSessionContext.h Sat Aug 31 01:47:22 2013
@@ -36,7 +36,6 @@ class RemoteSessionContext : public Oper
public:
RemoteSessionContext(jobject contextHolder, SVN::Pool &pool,
const char* jconfigDirectory,
- jobject jconfigHandler,
const char* jusername, const char* jpassword,
Prompter* prompter, jobject jprogress);
virtual ~RemoteSessionContext();
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/SVNClient.cpp?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/SVNClient.cpp Sat Aug 31 01:47:22 2013
@@ -1502,7 +1502,6 @@ 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);
if (JNIUtil::isJavaExceptionThrown())
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Sat Aug 31 01:47:22 2013
@@ -1548,21 +1548,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)
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_remote_RemoteFactory.cpp Sat Aug 31 01:47:22 2013
@@ -38,7 +38,7 @@ JNIEXPORT jobject JNICALL
Java_org_apache_subversion_javahl_remote_RemoteFactory_open(
JNIEnv *env, jclass jclass, jint jretryAttempts,
jstring jurl, jstring juuid,
- jstring jconfigDirectory, jobject jconfigHandler,
+ jstring jconfigDirectory,
jstring jusername, jstring jpassword,
jobject jprompter, jobject jprogress)
{
@@ -51,8 +51,7 @@ Java_org_apache_subversion_javahl_remote
*/
jobject jremoteSession = RemoteSession::open(
jretryAttempts, jurl, juuid,
- jconfigDirectory, jconfigHandler,
- jusername, jpassword, jprompter, jprogress);
+ jconfigDirectory, jusername, jpassword, jprompter, jprogress);
if (JNIUtil::isJavaExceptionThrown())
return NULL;
Copied: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.cpp (from r1519126, subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.cpp)
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.cpp?p2=subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.cpp&p1=subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.cpp&r1=1519126&r2=1519127&rev=1519127&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.cpp (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigImpl_Category.cpp Sat Aug 31 01:47:22 2013
@@ -40,6 +40,8 @@
#include <string>
#include <vector>
+#define svn_hash_gets(ht, key) apr_hash_get(ht, key, strlen(key))
+
namespace {
struct ImplContext
{
@@ -126,45 +128,6 @@ Java_org_apache_subversion_javahl_util_C
return jboolean(value);
}
-JNIEXPORT jlong JNICALL
-Java_org_apache_subversion_javahl_util_ConfigImpl_00024Category_get_1long(
- JNIEnv* env, jobject jthis, jstring jcategory, jlong jcontext,
- jstring jsection, jstring joption, jlong jdefault_value)
-{
- JNIEntry(ConfigImpl$Category, get_long);
- const ImplContext ctx(env, jthis, jcategory, jcontext, jsection, joption);
-
- apr_int64_t value;
- SVN_JNI_ERR(svn_config_get_int64(ctx.m_config, &value,
- ctx.m_section.c_str(), ctx.m_option.c_str(),
- apr_int64_t(jdefault_value)),
- jdefault_value);
- return jlong(value);
-}
-
-JNIEXPORT jobject JNICALL
-Java_org_apache_subversion_javahl_util_ConfigImpl_00024Category_get_1tri(
- JNIEnv* env, jobject jthis, jstring jcategory, jlong jcontext,
- jstring jsection, jstring joption,
- jstring junknown, jobject jdefault_value)
-{
- JNIEntry(ConfigImpl$Category, get_tri);
- const ImplContext ctx(env, jthis, jcategory, jcontext, jsection, joption);
-
- JNIStringHolder unknown(junknown);
- if (JNIUtil::isJavaExceptionThrown())
- return NULL;
-
- svn_tristate_t value;
- SVN_JNI_ERR(svn_config_get_tristate(ctx.m_config, &value,
- ctx.m_section.c_str(),
- ctx.m_option.c_str(),
- unknown.c_str(),
- EnumMapper::toTristate(jdefault_value)),
- NULL);
- return EnumMapper::mapTristate(value);
-}
-
JNIEXPORT jstring JNICALL
Java_org_apache_subversion_javahl_util_ConfigImpl_00024Category_get_1yna(
JNIEnv* env, jobject jthis, jstring jcategory, jlong jcontext,
@@ -216,19 +179,6 @@ Java_org_apache_subversion_javahl_util_C
bool(jvalue));
}
-JNIEXPORT void JNICALL
-Java_org_apache_subversion_javahl_util_ConfigImpl_00024Category_set_1long(
- JNIEnv* env, jobject jthis, jstring jcategory, jlong jcontext,
- jstring jsection, jstring joption, jlong jvalue)
-{
- JNIEntry(ConfigImpl$Category, set_long);
- const ImplContext ctx(env, jthis, jcategory, jcontext, jsection, joption);
-
- svn_config_set_int64(ctx.m_config,
- ctx.m_section.c_str(), ctx.m_option.c_str(),
- apr_int64_t(jvalue));
-}
-
JNIEXPORT jobject JNICALL
Java_org_apache_subversion_javahl_util_ConfigImpl_00024Category_sections(
JNIEnv* env, jobject jthis, jstring jcategory, jlong jcontext)
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNClient.java Sat Aug 31 01:47:22 2013
@@ -803,12 +803,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
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNClient.java Sat Aug 31 01:47:22 2013
@@ -370,8 +370,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;
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java Sat Aug 31 01:47:22 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.
*/
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/src/org/apache/subversion/javahl/remote/RemoteFactory.java Sat Aug 31 01:47:22 2013
@@ -57,13 +57,11 @@ 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)
{
setConfigDirectory(configDirectory);
- setConfigEventHandler(configHandler);
setUsername(username);
setPassword(password);
setPrompt(prompt);
@@ -127,16 +125,6 @@ public class RemoteFactory
}
/**
- * Set an event handler that will be called every time the
- * configuration is loaded.
- */
- public void setConfigEventHandler(ConfigEvent configHandler)
- {
- this.configHandler = configHandler;
- }
-
-
- /**
* Open a persistent session to a repository.
* <p>
* <b>Note:</b> The URL can point to a subtree of the repository.
@@ -152,8 +140,7 @@ public class RemoteFactory
public ISVNRemote openRemoteSession(String url)
throws ClientException, SubversionException
{
- return open(1, url, null,
- configDirectory, configHandler,
+ return open(1, url, null, configDirectory,
username, password, prompt, progress);
}
@@ -180,8 +167,7 @@ public class RemoteFactory
if (retryAttempts <= 0)
throw new IllegalArgumentException(
"retryAttempts must be positive");
- return open(retryAttempts, url, null,
- configDirectory, configHandler,
+ return open(retryAttempts, url, null, configDirectory,
username, password, prompt, progress);
}
@@ -208,8 +194,7 @@ public class RemoteFactory
{
if (reposUUID == null)
throw new IllegalArgumentException("reposUUID may not be null");
- return open(1, url, reposUUID,
- configDirectory, configHandler,
+ return open(1, url, reposUUID, configDirectory,
username, password, prompt, progress);
}
@@ -243,13 +228,11 @@ public class RemoteFactory
if (retryAttempts <= 0)
throw new IllegalArgumentException(
"retryAttempts must be positive");
- return open(retryAttempts, url, reposUUID,
- configDirectory, configHandler,
+ return open(retryAttempts, url, reposUUID, configDirectory,
username, password, prompt, progress);
}
private String configDirectory;
- private ConfigEvent configHandler;
private String username;
private String password;
private UserPasswordCallback prompt;
@@ -259,7 +242,6 @@ public class RemoteFactory
private static native ISVNRemote open(int retryAttempts,
String url, String reposUUID,
String configDirectory,
- ConfigEvent configHandler,
String username, String password,
UserPasswordCallback prompt,
ProgressCallback progress)
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRemoteTests.java Sat Aug 31 01:47:22 2013
@@ -68,14 +68,12 @@ public class SVNRemoteTests extends SVNT
thisTest = new OneTest();
}
- public static ISVNRemote getSession(String url, String configDirectory,
- ConfigEvent configHandler)
+ public static ISVNRemote getSession(String url, String configDirectory)
{
try
{
RemoteFactory factory = new RemoteFactory();
factory.setConfigDirectory(configDirectory);
- factory.setConfigEventHandler(configHandler);
factory.setUsername(USERNAME);
factory.setPassword(PASSWORD);
factory.setPrompt(new DefaultPromptUserPassword());
@@ -92,7 +90,7 @@ public class SVNRemoteTests extends SVNT
private ISVNRemote getSession()
{
- return getSession(getTestRepoUrl(), super.conf.getAbsolutePath(), null);
+ return getSession(getTestRepoUrl(), super.conf.getAbsolutePath());
}
/**
@@ -111,7 +109,7 @@ public class SVNRemoteTests extends SVNT
try
{
session = new RemoteFactory(
- super.conf.getAbsolutePath(), null,
+ super.conf.getAbsolutePath(),
USERNAME, PASSWORD,
new DefaultPromptUserPassword(), null)
.openRemoteSession(getTestRepoUrl());
@@ -525,10 +523,13 @@ public class SVNRemoteTests extends SVNT
}
};
- ISVNRemote session = getSession(getTestRepoUrl(),
- super.conf.getAbsolutePath(),
- handler);
- session.getLatestRevision(); // Make sure the configuration gets loaded
+ try {
+ SVNUtil.setConfigEventHandler(handler);
+ ISVNRemote session = getSession();
+ session.getLatestRevision();
+ } finally {
+ SVNUtil.setConfigEventHandler(null);
+ }
}
public void testTrivialMergeinfo() throws Exception
Modified: subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java?rev=1519127&r1=1519126&r2=1519127&view=diff
==============================================================================
--- subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java (original)
+++ subversion/branches/javahl-1.7-extensions/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java Sat Aug 31 01:47:22 2013
@@ -173,6 +173,17 @@ class SVNTests extends TestCase
private void init()
{
+ String disableCredStore = System.getProperty("test.disablecredstore");
+ if (disableCredStore != null)
+ {
+ try {
+ SVNUtil.disableNativeCredentialsStore();
+ } catch(Throwable ex) {
+ System.err.println("*** ERROR: Could not disable" +
+ " the native credentials store");
+ }
+ }
+
// if not already set, get a usefull value for rootDir
if (rootDirectoryName == null)
rootDirectoryName = System.getProperty("test.rootdir");