Author: hwright
Date: Sat Jun 12 13:31:30 2010
New Revision: 954003
URL: http://svn.apache.org/viewvc?rev=954003&view=rev
Log:
JavaHL: Propogate the repository notification system through to JavaHL. This
change only introduces the system for verify(), and only adds the notify
actions and values that are needed by verify(). Further improvements are
forthcoming.
[ in subversion/bindings/javahl/ ]
* tests/org/apache/subversion/javahl/SVNAdminTests.java
(testVerify): New.
* native/ReposNotifyCallback.cpp,
native/ReposNotifyCallback.h:
New.
* native/CreateJ.h,
native/CreateJ.cpp
(ReposNotifyInformation): New.
* native/SVNAdmin.h,
native/SVNAdmin.cpp
(verify): Update to use the new callback, and the newest version of the repos
API.
* native/org_apache_subversion_javahl_SVNAdmin.cpp
(Java_org_apache_subversion_javahl_SVNAdmin_verify): Handle the new notifier.
* native/EnumMapper.h,
native/EnumMapper.cpp
(mapReposNotifyAction): New.
* src/org/apache/subversion/javahl/ISVNAdmin.java,
src/org/apache/subversion/javahl/SVNAdmin.java
(verify): Remove the need for an output stream, and use the notifier instead.
* src/org/apache/subversion/javahl/callback/ReposNotifyCallback.java:
New.
* src/org/apache/subversion/javahl/ReposNotifyInformation.java:
New.
Added:
subversion/trunk/subversion/bindings/javahl/native/ReposNotifyCallback.cpp
(with props)
subversion/trunk/subversion/bindings/javahl/native/ReposNotifyCallback.h
(with props)
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
(with props)
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposNotifyCallback.java
(with props)
Modified:
subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
subversion/trunk/subversion/bindings/javahl/native/CreateJ.h
subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp
subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h
subversion/trunk/subversion/bindings/javahl/native/SVNAdmin.cpp
subversion/trunk/subversion/bindings/javahl/native/SVNAdmin.h
subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNAdmin.cpp
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNAdmin.java
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNAdmin.java
subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNAdminTests.java
Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp?rev=954003&r1=954002&r2=954003&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp Sat Jun 12
13:31:30 2010
@@ -691,6 +691,50 @@ CreateJ::ClientNotifyInformation(const s
}
jobject
+CreateJ::ReposNotifyInformation(const svn_repos_notify_t *reposNotify,
+ apr_pool_t *pool)
+{
+ JNIEnv *env = JNIUtil::getEnv();
+
+ // Create a local frame for our references
+ env->PushLocalFrame(LOCAL_FRAME_SIZE);
+ if (JNIUtil::isJavaExceptionThrown())
+ return NULL;
+
+ static jmethodID midCT = 0;
+ jclass clazz = env->FindClass(JAVA_PACKAGE"/ReposNotifyInformation");
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ if (midCT == 0)
+ {
+ midCT = env->GetMethodID(clazz, "<init>",
+
"(L"JAVA_PACKAGE"/ReposNotifyInformation$Action;"
+ "JLjava/lang/String;)V");
+ if (JNIUtil::isJavaExceptionThrown() || midCT == 0)
+ POP_AND_RETURN_NULL;
+ }
+
+ // convert the parameters to their Java relatives
+ jobject jAction = EnumMapper::mapReposNotifyAction(reposNotify->action);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ jstring jWarning = JNIUtil::makeJString(reposNotify->warning);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ jlong jRevision = (jlong)reposNotify->revision;
+
+ // call the Java method
+ jobject jInfo = env->NewObject(clazz, midCT, jAction, jRevision, jWarning);
+ if (JNIUtil::isJavaExceptionThrown())
+ POP_AND_RETURN_NULL;
+
+ return env->PopLocalFrame(jInfo);
+}
+
+jobject
CreateJ::RevisionRangeList(apr_array_header_t *ranges)
{
JNIEnv *env = JNIUtil::getEnv();
Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.h?rev=954003&r1=954002&r2=954003&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.h Sat Jun 12
13:31:30 2010
@@ -29,6 +29,7 @@
#include <jni.h>
#include "svn_wc.h"
+#include "svn_repos.h"
#include "svn_client.h"
#include <vector>
@@ -58,6 +59,9 @@ class CreateJ
ClientNotifyInformation(const svn_wc_notify_t *notify, apr_pool_t *pool);
static jobject
+ ReposNotifyInformation(const svn_repos_notify_t *notify, apr_pool_t *pool);
+
+ static jobject
RevisionRangeList(apr_array_header_t *ranges);
static jobject
Modified: subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp?rev=954003&r1=954002&r2=954003&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/EnumMapper.cpp Sat Jun
12 13:31:30 2010
@@ -77,6 +77,15 @@ jobject EnumMapper::mapNotifyAction(svn_
}
/**
+ * Map a C repos notify action constant to the Java constant.
+ */
+jobject EnumMapper::mapReposNotifyAction(svn_repos_notify_action_t action)
+{
+ // We're assuming a valid value for the C enum above
+ return mapEnum(JAVA_PACKAGE"/ReposNotifyInformation$Action", (int) action);
+}
+
+/**
* Map a C node kind constant to the Java constant.
*/
jobject EnumMapper::mapNodeKind(svn_node_kind_t nodeKind)
Modified: subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h?rev=954003&r1=954002&r2=954003&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/EnumMapper.h Sat Jun 12
13:31:30 2010
@@ -30,6 +30,7 @@
#include <jni.h>
#include "svn_client.h"
#include "svn_wc.h"
+#include "svn_repos.h"
#include "svn_types.h"
class JNIStringHolder;
@@ -52,6 +53,7 @@ class EnumMapper
static jint mapCommitMessageStateFlags(apr_byte_t flags);
static jobject mapNotifyState(svn_wc_notify_state_t state);
static jobject mapNotifyAction(svn_wc_notify_action_t action);
+ static jobject mapReposNotifyAction(svn_repos_notify_action_t action);
static jobject mapNodeKind(svn_node_kind_t nodeKind);
static jobject mapNotifyLockState(svn_wc_notify_lock_state_t state);
static jobject mapStatusKind(svn_wc_status_kind svnKind);
Added:
subversion/trunk/subversion/bindings/javahl/native/ReposNotifyCallback.cpp
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/ReposNotifyCallback.cpp?rev=954003&view=auto
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/ReposNotifyCallback.cpp
(added)
+++ subversion/trunk/subversion/bindings/javahl/native/ReposNotifyCallback.cpp
Sat Jun 12 13:31:30 2010
@@ -0,0 +1,93 @@
+/**
+ * @copyright
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ * @endcopyright
+ *
+ * @file ReposNotifyCallback.cpp
+ * @brief Implementation of the class ReposNotifyCallback
+ */
+
+#include "ReposNotifyCallback.h"
+#include "JNIUtil.h"
+#include "CreateJ.h"
+#include "EnumMapper.h"
+#include "RevisionRange.h"
+
+/**
+ * Create a new object and store the Java object.
+ * @param notify global reference to the Java object
+ */
+ReposNotifyCallback::ReposNotifyCallback(jobject p_notify)
+{
+ m_notify = p_notify;
+}
+
+ReposNotifyCallback::~ReposNotifyCallback()
+{
+ // Don't need to destroy the reference, since it was given us by Java
+}
+
+void
+ReposNotifyCallback::notify(void *baton, const svn_repos_notify_t *notify,
+ apr_pool_t *pool)
+{
+ if (baton)
+ ((ReposNotifyCallback *)baton)->onNotify(notify, pool);
+}
+
+/**
+ * Handler for Subversion notifications.
+ *
+ * @param notify all the information about the event
+ * @param pool an apr pool to allocated memory
+ */
+void
+ReposNotifyCallback::onNotify(const svn_repos_notify_t *wcNotify,
+ apr_pool_t *pool)
+{
+ JNIEnv *env = JNIUtil::getEnv();
+
+ // Java method id will not change during the time this library is
+ // loaded, so it can be cached.
+ static jmethodID mid = 0;
+ if (mid == 0)
+ {
+ jclass clazz =
env->FindClass(JAVA_PACKAGE"/callback/ReposNotifyCallback");
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+
+ mid = env->GetMethodID(clazz, "onNotify",
+ "(L"JAVA_PACKAGE"/ReposNotifyInformation;)V");
+ if (JNIUtil::isJavaExceptionThrown() || mid == 0)
+ return;
+
+ env->DeleteLocalRef(clazz);
+ }
+
+ jobject jInfo = CreateJ::ReposNotifyInformation(wcNotify, pool);
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+
+ env->CallVoidMethod(m_notify, mid, jInfo);
+ if (JNIUtil::isJavaExceptionThrown())
+ return;
+
+ env->DeleteLocalRef(jInfo);
+}
Propchange:
subversion/trunk/subversion/bindings/javahl/native/ReposNotifyCallback.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added: subversion/trunk/subversion/bindings/javahl/native/ReposNotifyCallback.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/ReposNotifyCallback.h?rev=954003&view=auto
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/ReposNotifyCallback.h
(added)
+++ subversion/trunk/subversion/bindings/javahl/native/ReposNotifyCallback.h
Sat Jun 12 13:31:30 2010
@@ -0,0 +1,70 @@
+/**
+ * @copyright
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ * @endcopyright
+ *
+ * @file ReposNotifyCallback.h
+ * @brief Interface of the class ReposNotifyCallback
+ */
+
+#ifndef REPOSNOTIFYCALLBACK_H
+#define REPOSNOTIFYCALLBACK_H
+
+#include <jni.h>
+#include "svn_repos.h"
+
+/**
+ * This class passes notification from subversion to a Java object
+ * (1.2 version).
+ */
+class ReposNotifyCallback
+{
+ private:
+ /**
+ * The local reference to the Java object.
+ */
+ jobject m_notify;
+
+ public:
+ ReposNotifyCallback(jobject p_notify);
+ ~ReposNotifyCallback();
+
+ /**
+ * Implementation of the svn_repos_notify_func_t API.
+ *
+ * @param baton notification instance is passed using this parameter
+ * @param notify all the information about the event
+ * @param pool An APR pool from which to allocate memory.
+ */
+ static void notify(void *baton,
+ const svn_repos_notify_t *notify,
+ apr_pool_t *pool);
+
+ /**
+ * Handler for Subversion notifications.
+ *
+ * @param notify all the information about the event
+ * @param pool An APR pool from which to allocate memory.
+ */
+ void onNotify(const svn_repos_notify_t *notify,
+ apr_pool_t *pool);
+};
+
+#endif // REPOSNOTIFYCALLBACK_H
Propchange:
subversion/trunk/subversion/bindings/javahl/native/ReposNotifyCallback.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/trunk/subversion/bindings/javahl/native/SVNAdmin.cpp
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNAdmin.cpp?rev=954003&r1=954002&r2=954003&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNAdmin.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNAdmin.cpp Sat Jun 12
13:31:30 2010
@@ -26,6 +26,7 @@
#include "SVNAdmin.h"
#include "CreateJ.h"
+#include "ReposNotifyCallback.h"
#include "JNIUtil.h"
#include "svn_error_codes.h"
#include "svn_repos.h"
@@ -505,8 +506,9 @@ SVNAdmin::getRevnum(svn_revnum_t *revnum
return SVN_NO_ERROR;
}
-void SVNAdmin::verify(File &path, OutputStream &messageOut,
- Revision &revisionStart, Revision &revisionEnd)
+void
+SVNAdmin::verify(File &path, Revision &revisionStart, Revision &revisionEnd,
+ ReposNotifyCallback *notifyCallback)
{
SVN::Pool requestPool;
svn_repos_t *repos;
@@ -548,10 +550,13 @@ void SVNAdmin::verify(File &path, Output
(SVN_ERR_INCORRECT_PARAMS, NULL,
_("Start revision cannot be higher than end revision")), );
- SVN_JNI_ERR(svn_repos_verify_fs(repos, messageOut.getStream(requestPool),
- lower, upper,
- NULL, NULL /* cancel callback/baton */,
- requestPool.pool()), );
+ SVN_JNI_ERR(svn_repos_verify_fs2(repos, lower, upper,
+ notifyCallback != NULL
+ ? ReposNotifyCallback::notify
+ : NULL,
+ notifyCallback,
+ NULL, NULL /* cancel callback/baton */,
+ requestPool.pool()), );
}
jobject SVNAdmin::lslocks(File &path)
Modified: subversion/trunk/subversion/bindings/javahl/native/SVNAdmin.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNAdmin.h?rev=954003&r1=954002&r2=954003&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNAdmin.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNAdmin.h Sat Jun 12
13:31:30 2010
@@ -34,6 +34,7 @@
#include "OutputStream.h"
#include "InputStream.h"
#include "MessageReceiver.h"
+#include "ReposNotifyCallback.h"
#include "StringArray.h"
#include "File.h"
@@ -42,8 +43,8 @@ class SVNAdmin : public SVNBase
public:
void rmlocks(File &path, StringArray &locks);
jobject lslocks(File &path);
- void verify(File &path, OutputStream &messageOut,
- Revision &revisionStart, Revision &revisionEnd);
+ void verify(File &path, Revision &revisionStart, Revision &revisionEnd,
+ ReposNotifyCallback *notifyCallback);
void setRevProp(File &path, Revision &revision,
const char *propName, const char *propValue,
bool usePreRevPropChangeHook,
Modified:
subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNAdmin.cpp
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNAdmin.cpp?rev=954003&r1=954002&r2=954003&view=diff
==============================================================================
---
subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNAdmin.cpp
(original)
+++
subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNAdmin.cpp
Sat Jun 12 13:31:30 2010
@@ -35,6 +35,7 @@
#include "OutputStream.h"
#include "MessageReceiver.h"
#include "File.h"
+#include "ReposNotifyCallback.h"
#include "svn_props.h"
#include "svn_private_config.h"
@@ -374,8 +375,8 @@ Java_org_apache_subversion_javahl_SVNAdm
JNIEXPORT void JNICALL
Java_org_apache_subversion_javahl_SVNAdmin_verify
-(JNIEnv *env, jobject jthis, jobject jpath, jobject jmessageout,
- jobject jrevisionStart, jobject jrevisionEnd)
+(JNIEnv *env, jobject jthis, jobject jpath, jobject jrevisionStart,
+ jobject jrevisionEnd, jobject jcallback)
{
JNIEntry(SVNAdmin, verify);
SVNAdmin *cl = SVNAdmin::getCppObject(jthis);
@@ -389,19 +390,20 @@ Java_org_apache_subversion_javahl_SVNAdm
if (JNIUtil::isExceptionThrown())
return;
- OutputStream messageOut(jmessageout);
+ Revision revisionStart(jrevisionStart);
if (JNIUtil::isExceptionThrown())
return;
- Revision revisionStart(jrevisionStart);
+ Revision revisionEnd(jrevisionEnd);
if (JNIUtil::isExceptionThrown())
return;
- Revision revisionEnd(jrevisionEnd);
+ ReposNotifyCallback callback(jcallback);
if (JNIUtil::isExceptionThrown())
return;
- cl->verify(path, messageOut, revisionStart, revisionEnd);
+ cl->verify(path, revisionStart, revisionEnd,
+ jcallback != NULL ? &callback : NULL);
}
JNIEXPORT jobject JNICALL
Modified:
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNAdmin.java
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNAdmin.java?rev=954003&r1=954002&r2=954003&view=diff
==============================================================================
---
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNAdmin.java
(original)
+++
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNAdmin.java
Sat Jun 12 13:31:30 2010
@@ -29,6 +29,7 @@ import java.io.InputStream;
import java.io.File;
import org.apache.subversion.javahl.SVNAdmin.MessageReceiver;
+import org.apache.subversion.javahl.callback.ReposNotifyCallback;
public interface ISVNAdmin {
@@ -191,13 +192,14 @@ public interface ISVNAdmin {
* <code>start</code> and <code>end</code>.
*
* @param path the path to the repository
- * @param messageOut the receiver of all messages
* @param start the first revision
* @param end the last revision
+ * @param callback the callback to recieve notifications
* @throws ClientException If an error occurred.
*/
- public abstract void verify(File path, OutputStream messageOut,
- Revision start, Revision end) throws ClientException;
+ public abstract void verify(File path, Revision start, Revision end,
+ ReposNotifyCallback callback)
+ throws ClientException;
/**
* list all locks in the repository
Added:
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java?rev=954003&view=auto
==============================================================================
---
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
(added)
+++
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
Sat Jun 12 13:31:30 2010
@@ -0,0 +1,105 @@
+/**
+ * @copyright
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ * @endcopyright
+ */
+
+package org.apache.subversion.javahl;
+
+import java.util.Map;
+import java.util.EventObject;
+
+/**
+ * The event passed to the {...@link Notify2#onNotify(NotifyInformation)}
+ * API to notify {...@link SVNClientInterface} of relevant events.
+ *
+ * @since 1.2
+ */
+public class ReposNotifyInformation extends EventObject
+{
+ // Update the serialVersionUID when there is a incompatible change
+ // made to this class. See any of the following, depending upon
+ // the Java release.
+ //
http://java.sun.com/j2se/1.3/docs/guide/serialization/spec/version.doc7.html
+ // 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;
+
+ /**
+ * The {...@link NotifyAction} which triggered this event.
+ */
+ private Action action;
+
+ /**
+ * The revision of the item.
+ */
+ private long revision;
+
+ /**
+ * The warning text.
+ */
+ private String warning;
+
+ /**
+ * This constructor is to be used by the native code.
+ *
+ * @param action The {...@link NotifyAction} which triggered this event.
+ * @param revision potentially the revision.
+ */
+ public ReposNotifyInformation(Action action, long revision, String warning)
+ {
+ super(action);
+ this.action = action;
+ this.revision = revision;
+ this.warning = warning;
+ }
+
+ /**
+ * @return The {...@link NotifyAction} which triggered this event.
+ */
+ public Action getAction()
+ {
+ return action;
+ }
+
+ /**
+ * @return The revision for the item.
+ */
+ public long getRevision()
+ {
+ return revision;
+ }
+
+ /**
+ * The type of action triggering the notification
+ */
+ public enum Action
+ {
+ /** A warning message is waiting. */
+ warning,
+
+ /** A revision has finished being dumped. */
+ dump_rev_end,
+
+ /** A revision has finished being verified. */
+ verify_rev_end;
+ }
+}
Propchange:
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNAdmin.java
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNAdmin.java?rev=954003&r1=954002&r2=954003&view=diff
==============================================================================
---
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNAdmin.java
(original)
+++
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNAdmin.java
Sat Jun 12 13:31:30 2010
@@ -28,6 +28,8 @@ import java.io.OutputStream;
import java.io.InputStream;
import java.io.File;
+import org.apache.subversion.javahl.callback.ReposNotifyCallback;
+
/**
* This class offers the same commands as the svnadmin commandline
* client.
@@ -240,18 +242,8 @@ public class SVNAdmin implements ISVNAdm
boolean usePostRevPropChangeHook)
throws SubversionException;
- /**
- * Verify the repository at <code>path</code> between revisions
- * <code>start</code> and <code>end</code>.
- *
- * @param path the path to the repository
- * @param messageOut the receiver of all messages
- * @param start the first revision
- * @param end the last revision
- * @throws ClientException If an error occurred.
- */
- public native void verify(File path, OutputStream messageOut,
- Revision start, Revision end)
+ public native void verify(File path, Revision start, Revision end,
+ ReposNotifyCallback callback)
throws ClientException;
/**
Added:
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposNotifyCallback.java
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposNotifyCallback.java?rev=954003&view=auto
==============================================================================
---
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposNotifyCallback.java
(added)
+++
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposNotifyCallback.java
Sat Jun 12 13:31:30 2010
@@ -0,0 +1,49 @@
+/**
+ * @copyright
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ * @endcopyright
+ */
+
+package org.apache.subversion.javahl.callback;
+
+import org.apache.subversion.javahl.ReposNotifyInformation;
+
+import java.util.EventListener;
+
+/**
+ * Subversion notification interface.
+ *
+ * Implement this interface to provide a custom notification handler
+ * to the SVNClient class. If you need to pass extra information to
+ * the notification handler add it to your implementing class.
+ *
+ * @since 1.2
+ */
+public interface ReposNotifyCallback extends EventListener
+{
+ /**
+ * Handler for Subversion notifications.
+ *
+ * Override this function to allow Subversion to
+ * send notifications
+ * @param info everything to know about this event
+ */
+ public void onNotify(ReposNotifyInformation info);
+}
Propchange:
subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposNotifyCallback.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNAdminTests.java
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNAdminTests.java?rev=954003&r1=954002&r2=954003&view=diff
==============================================================================
---
subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNAdminTests.java
(original)
+++
subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNAdminTests.java
Sat Jun 12 13:31:30 2010
@@ -72,6 +72,16 @@ public class SVNAdminTests extends SVNTe
String logMessage = new String(pdata.get("svn:log"));
assertEquals("expect rev prop change to take effect", MSG, logMessage);
}
+
+ /* This test only tests the call down to the C++ layer. */
+ public void testVerify()
+ throws SubversionException, IOException
+ {
+ OneTest thisTest = new OneTest(false);
+ admin.verify(thisTest.getRepository(), Revision.getInstance(0),
+ Revision.HEAD, null);
+ }
+
public void testLoadRepo()
throws SubversionException, IOException
{