* Makefile.in
(RUN_SWIG_JAVA): Change paths to make build more sane. Now works for build outside of main dir.
* Notifier.java
(notifyWC): Add new signature for notifyWC. The old signature should probably go away at some point.
* swigutil_java_cache.h
(*): Add new class and method defs for the cache. Also, fix some declarations for some of the cache items (ArrayList, List, Map, etc.)
* swigutil_java.c
(JCALL*): Add new JCALL* macros for calling with 8 and 9 params.
(make_pointer): Fix compiler warning. Pointers in java are jint size, not jlong.
(*): Use values from swigutil_java_cache.h.
(svn_swig_java_add_to_list): Rudimentary implementation.
(svn_swig_java_array_to_list): Fix method signature.
(svn_swig_java_make_editor): Make it a hand-rolled JNI function. SWIG will create the Java wrapper, but emit no C code.
(svn_swig_java_notify_func): Rudimentary implementation.
(snv_swig_java_cancel_func): Rudimentary implementation.
* swigutil_java.h
(svn_swig_java_make_editor): Make it a hand-rolled JNI function. SWIG will create the Java wrapper, but emit no C code.
* svn_delta.i
(svn_swig_java_make_editor): Add definition, and make it native, so SWIG doesn't create any C code for it.
Index: Makefile.in
===================================================================
--- Makefile.in (revision 5740)
+++ Makefile.in (working copy)
@@ -135,7 +135,7 @@
# these commands run SWIG to generate wrapper source files (*.c)
### should we protect against swig not being available?
RUN_SWIG_PY = $(SWIG) -c -python -noproxy $(SWIG_INCLUDES) $(SWIG_PY_INCLUDES) -o $@
-RUN_SWIG_JAVA = cd ${SWIG_SRC_DIR}/java/org/tigris/subversion/swig && $(SWIG) -c -java -noproxy -package 'org.tigris.subversion.swig' $(SWIG_INCLUDES) -o ${abs_builddir}/$@
+RUN_SWIG_JAVA = cd ${abs_builddir}/subversion/bindings/swig/java/org/tigris/subversion/swig && $(SWIG) -c -java -noproxy -package 'org.tigris.subversion.swig' $(SWIG_INCLUDES) -o ${abs_builddir}/$@
# Compilation of SWIG-generated C source code
COMPILE_PY_WRAPPER = $(LIBTOOL) $(LTFLAGS) --mode=compile $(SWIG_PY_COMPILE) $(SWIG_INCLUDES) $(SWIG_PY_INCLUDES) -prefer-pic -c -o $@
Index: subversion/bindings/java/org/tigris/subversion/wc/Notifier.java
===================================================================
--- subversion/bindings/java/org/tigris/subversion/wc/Notifier.java (revision 5740)
+++ subversion/bindings/java/org/tigris/subversion/wc/Notifier.java (working copy)
@@ -30,4 +30,6 @@
*/
void notifyWC(int action, NodeKind kind, String mimeType, int notifyState,
int propState, Revision revision);
+
+ void notifyWC( String path, int action, int kind, String mimeType, int notifyState, int propState, long revision );
}
Index: subversion/bindings/swig/swigutil_java_cache.h
===================================================================
--- subversion/bindings/swig/swigutil_java_cache.h (revision 5740)
+++ subversion/bindings/swig/swigutil_java_cache.h (working copy)
@@ -97,17 +97,22 @@
SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_outofmemoryerror,"java/lang/OutOfMemoryError")
SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_outputstream,"java/io/OutputStream")
SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_inputstream,"java/io/InputStream")
-SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_list,"java/util/ArrayList")
+SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_arraylist,"java/util/ArrayList")
SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_list,"java/util/List")
-SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_list,"java/util/Map")
+SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_map,"java/util/Map")
+SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_hashmap,"java/util/HashMap")
+SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_illegalargumentexception,"java/lang/IllegalArgumentException")
SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_subversionexception,"org/tigris/subversion/SubversionException")
SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_clientprompt,"org/tigris/subversion/client/ClientPrompt")
-
+SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_notifier,"org/tigris/subversion/wc/Notifier")
+SVN_SWIG_JAVA_CACHE_CLASS_DEF(jenv,svn_swig_java_cls_canceller,"org/tigris/subversion/Canceller")
SVN_SWIG_JAVA_CACHE_METHOD_DEF(jenv,svn_swig_java_mid_long_longvalue,svn_swig_java_cls_long,"longValue","()J")
SVN_SWIG_JAVA_CACHE_METHOD_DEF(jenv,svn_swig_java_mid_outputstream_write,svn_swig_java_cls_outputstream,"write","([B)V")
SVN_SWIG_JAVA_CACHE_METHOD_DEF(jenv,svn_swig_java_mid_inputstream_read,svn_swig_java_cls_inputstream,"read","([B)I")
SVN_SWIG_JAVA_CACHE_METHOD_DEF(jenv,svn_swig_java_mid_subversionexception_init,svn_swig_java_cls_subversionexception,"<init>","(Ljava/lang/String;Ljava/lang/Throwable;JLjava/lang/String;J)V")
SVN_SWIG_JAVA_CACHE_METHOD_DEF(jenv,svn_swig_java_mid_clientprompt_prompt,svn_swig_java_cls_clientprompt,"prompt","(Ljava/lang/String;Z)Ljava/lang/String;")
+SVN_SWIG_JAVA_CACHE_METHOD_DEF(jenv,svn_swig_java_mid_notifier_notifywc,svn_swig_java_cls_notifier,"notifyWC","(Ljava/lang/String;IILjava/lang/String;III)V")
+SVN_SWIG_JAVA_CACHE_METHOD_DEF(jenv,svn_swig_java_mid_canceller_cancel,svn_swig_java_cls_canceller,"cancel","()V")
SVN_SWIG_JAVA_CACHE_END
Index: subversion/bindings/swig/swigutil_java.c
===================================================================
--- subversion/bindings/swig/swigutil_java.c (revision 5740)
+++ subversion/bindings/swig/swigutil_java.c (working copy)
@@ -41,6 +41,8 @@
# define JCALL3(func, jenv, ar1, ar2, ar3) jenv->func(ar1, ar2, ar3)
# define JCALL4(func, jenv, ar1, ar2, ar3, ar4) jenv->func(ar1, ar2, ar3, ar4)
# define JCALL7(func, jenv, ar1, ar2, ar3, ar4, ar5, ar6, ar7) jenv->func(ar1, ar2, ar3, ar4, ar5, ar6, ar7)
+# define JCALL8(func, jenv, ar1, ar2, ar3, ar4, ar5, ar6, ar7, ar8) jenv->func(ar1, ar2, ar3, ar4, ar5, ar6, ar7, ar8)
+# define JCALL9(func, jenv, ar1, ar2, ar3, ar4, ar5, ar6, ar7, ar8, ar9) jenv->func(ar1, ar2, ar3, ar4, ar5, ar6, ar7, ar8, ar9)
#else
# define JCALL0(func, jenv) (*jenv)->func(jenv)
# define JCALL1(func, jenv, ar1) (*jenv)->func(jenv, ar1)
@@ -48,6 +50,8 @@
# define JCALL3(func, jenv, ar1, ar2, ar3) (*jenv)->func(jenv, ar1, ar2, ar3)
# define JCALL4(func, jenv, ar1, ar2, ar3, ar4) (*jenv)->func(jenv, ar1, ar2, ar3, ar4)
# define JCALL7(func, jenv, ar1, ar2, ar3, ar4, ar5, ar6, ar7) (*jenv)->func(jenv, ar1, ar2, ar3, ar4, ar5, ar6, ar7)
+# define JCALL8(func, jenv, ar1, ar2, ar3, ar4, ar5, ar6, ar7, ar8) (*jenv)->func(jenv, ar1, ar2, ar3, ar4, ar5, ar6, ar7, ar8)
+# define JCALL9(func, jenv, ar1, ar2, ar3, ar4, ar5, ar6, ar7, ar8, ar9) (*jenv)->func(jenv, ar1, ar2, ar3, ar4, ar5, ar6, ar7, ar8, ar9)
#endif
#endif
@@ -104,8 +108,10 @@
/* Return a Long object contining the C pointer to the object
(SWIG/Java knows nothing of SWIG_NewPointerObj) */
jclass cls = JCALL1(FindClass, env, "java/lang/Long");
+
+ /* Java jint's are pointers. Longs are 64-bit */
return JCALL3(NewObject, env, cls,
- JCALL3(GetMethodID, env, cls, "<init>", "(J)V"), (jlong) ptr);
+ JCALL3(GetMethodID, env, cls, "<init>", "(J)V"), (jint) ptr);
}
static jobject convert_hash(JNIEnv* jenv, apr_hash_t *hash,
@@ -115,7 +121,7 @@
void *ctx)
{
apr_hash_index_t *hi;
- jclass cls = JCALL1(FindClass, jenv, "java/util/HashMap");
+ jclass cls = svn_swig_java_cls_hashmap;
jobject dict = JCALL3(NewObject, jenv, cls,
JCALL3(GetMethodID, jenv, cls, "<init>", "(I)V"),
(jint) apr_hash_count(hash));
@@ -145,13 +151,34 @@
void svn_swig_java_add_to_list(JNIEnv* jenv, apr_array_header_t *array,
jobject list)
{
- /* TODO: This impl will be much like svn_swig_java_add_to_map */
+ int x;
+ jobject obj;
+
+ jclass cls = svn_swig_java_cls_list;
+ jmethodID add;
+
+ if (array->nelts > 0)
+ add = JCALL3(GetMethodID, jenv, cls, "add", "(Ljava/lang/Object;)Z");
+
+ for ( x = 0; x < array->nelts; ++x )
+ {
+ const char *s;
+
+ s = APR_ARRAY_IDX(array, x, const char *);
+ obj = JCALL1(NewStringUTF, jenv, s);
+
+ JCALL3(CallObjectMethod, jenv, list, add, obj);
+ JCALL1(DeleteLocalRef, jenv, obj);
+
+ if (JCALL0(ExceptionOccurred, jenv))
+ return;
+ }
}
void svn_swig_java_add_to_map(JNIEnv* jenv, apr_hash_t *hash, jobject map)
{
apr_hash_index_t *hi;
- jclass cls = JCALL1(FindClass, jenv, "java/util/Map");
+ jclass cls = svn_swig_java_cls_map;
jmethodID put = JCALL3(GetMethodID, jenv, cls, "put",
"(Ljava/lang/Object;Ljava/lang/Object;)"
"Ljava/lang/Object;");
@@ -202,7 +229,7 @@
jobject svn_swig_java_c_strings_to_list(JNIEnv *jenv, char **strings)
{
- jclass cls = JCALL1(FindClass, jenv, "java/util/ArrayList");
+ jclass cls = svn_swig_java_cls_arraylist;
jobject list = JCALL2(NewObject, jenv, cls,
JCALL3(GetMethodID, jenv, cls, "<init>", "()V"));
jmethodID add = JCALL3(GetMethodID, jenv, cls, "add", "(Ljava/lang/Object;)Z");
@@ -230,7 +257,7 @@
jobject svn_swig_java_array_to_list(JNIEnv *jenv,
const apr_array_header_t *strings)
{
- jclass cls = JCALL1(FindClass, jenv, "java/util/ArrayList");
+ jclass cls = svn_swig_java_cls_arraylist;
jobject list = JCALL3(NewObject, jenv, cls,
JCALL3(GetMethodID, jenv, cls, "<init>", "(I)V"),
strings->nelts);
@@ -239,7 +266,7 @@
jmethodID add;
if (strings->nelts > 0)
- add = JCALL3(GetMethodID, jenv, cls, "add", "(i, Ljava/lang/Object;)Z");
+ add = JCALL3(GetMethodID, jenv, cls, "add", "(ILjava/lang/Object;)Z");
for (i = 0; i < strings->nelts; ++i)
{
@@ -249,7 +276,6 @@
obj = JCALL1(NewStringUTF, jenv, s);
if (obj == NULL)
goto error;
- /* ### HELP: The format specifier might be 'I' instead of 'i' */
JCALL4(CallObjectMethod, jenv, list, add, i, obj);
JCALL1(DeleteLocalRef, jenv, obj);
}
@@ -268,13 +294,12 @@
int targlen;
apr_array_header_t *temp;
- jclass cls = JCALL1(FindClass, jenv, "java/util/List");
+ jclass cls = svn_swig_java_cls_list;
jmethodID size = JCALL3(GetMethodID, jenv, cls, "size", "()I");
jmethodID get = JCALL3(GetMethodID, jenv, cls, "get",
"(I)Ljava/lang/Object;");
- jclass illegalArgCls = JCALL1(FindClass, jenv,
- "java/lang/IllegalArgumentException");
+ jclass illegalArgCls = svn_swig_java_cls_illegalargumentexception;
if (!JCALL2(IsInstanceOf, jenv, source, cls))
{
@@ -735,7 +760,8 @@
return close_baton(edit_baton, "abort_edit");
}
-void svn_swig_java_make_editor(JNIEnv *jenv,
+/* This is hand-wrapped. We don't want SWIG creating a JNIEnv wrapper. */
+JNIEXPORT void JNICALL svn_swig_java_make_editor(JNIEnv *jenv,
const svn_delta_editor_t **editor,
void **edit_baton,
jobject java_editor,
@@ -816,15 +842,76 @@
svn_wc_notify_state_t prop_state,
svn_revnum_t revision)
{
- /* TODO: svn_swig_java_notify_func is not implemented yet */
+ callback_baton_t *callback_baton;
+ JNIEnv *jenv;
+ jobject callback;
+ jstring jpath;
+ jint jaction;
+ jint jkind;
+ jstring jmime_type;
+ jint jcontent_state;
+ jint jprop_state;
+ jint jrevision;
+ svn_error_t *result;
+
+ callback_baton = (callback_baton_t *) baton;
+ jenv = callback_baton->jenv;
+ callback = callback_baton->callback;
+
+ /* Create a new local reference frame. Exit immediately
+ if functions fails. */
+ if (JCALL1(PushLocalFrame, jenv, 2) < 0)
+ {
+ return;
+ }
+
+ jpath = JCALL1(NewStringUTF, jenv, path);
+ if (!jpath)
+ {
+ goto error;
+ }
+
+ jaction = action;
+ jkind = kind;
+
+ jmime_type = JCALL1(NewStringUTF, jenv, mime_type);
+ if (!jmime_type)
+ {
+ goto error;
+ }
+
+ jcontent_state = content_state;
+ jprop_state = prop_state;
+ jrevision = revision;
+
+ JCALL9(CallObjectMethod, jenv, callback,
+ svn_swig_java_mid_notifier_notifywc, jpath, jaction, jkind, jmime_type,
+ jcontent_state, jprop_state, jrevision );
+
+ /* Fall through for cleanup */
+
+error:
+ JCALL1(PopLocalFrame, jenv, NULL);
+ return;
}
/* a cancel function that executes a Java method on an object which is
passed in via the cancel_baton argument */
svn_error_t *svn_swig_java_cancel_func(void *cancel_baton)
{
- /* TODO: svn_swig_java_cancel_func is not implemented yet */
- return SVN_NO_ERROR;
+ callback_baton_t *callback_baton;
+ JNIEnv *jenv;
+ jobject callback;
+ svn_error_t *result;
+
+ callback_baton = (callback_baton_t *) cancel_baton;
+ jenv = callback_baton->jenv;
+ callback = callback_baton->callback;
+
+ /* FIXME: Does more need to be done here? */
+ JCALL2(CallObjectMethod, jenv, callback, svn_swig_java_mid_canceller_cancel);
+
+ return SVN_NO_ERROR;
}
/* thunked commit log fetcher */
Index: subversion/bindings/swig/swigutil_java.h
===================================================================
--- subversion/bindings/swig/swigutil_java.h (revision 5740)
+++ subversion/bindings/swig/swigutil_java.h (working copy)
@@ -76,7 +76,9 @@
apr_pool_t *pool);
/* make a editor that "thunks" from C callbacks up to Java */
-void svn_swig_java_make_editor(JNIEnv *jenv,
+/* This probably needs to be hand-wrapped JNI. */
+JNIEXPORT void JNICALL Java_org_tigris_subversion_swig_svn_swig_java_make_editor(
+ JNIEnv *jenv,
const svn_delta_editor_t **editor,
void **edit_baton,
jobject java_editor,
Index: subversion/bindings/swig/svn_delta.i
===================================================================
--- subversion/bindings/swig/svn_delta.i (revision 5740)
+++ subversion/bindings/swig/svn_delta.i (working copy)
@@ -55,6 +55,14 @@
apr_pool_t *pool);
#endif
+#ifdef SWIGJAVA
+%native(svn_swig_java_make_editor) void svn_swig_java_make_editor(
+ const svn_delta_editor_t **editor,
+ void **edit_baton,
+ jobject java_editor,
+ apr_pool_t *pool);
+#endif
+
/* ----------------------------------------------------------------------- */
%include svn_delta.h
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Apr 28 06:32:26 2003