[sword-svn] r3507 - in trunk/bindings/java-jni: . jni src/org/crosswire/android/sword
scribe at crosswire.org
scribe at crosswire.org
Wed Nov 1 03:36:40 MST 2017
Author: scribe
Date: 2017-11-01 03:36:39 -0700 (Wed, 01 Nov 2017)
New Revision: 3507
Removed:
trunk/bindings/java-jni/jni/org_crosswire_android_sword_InstallMgr.h
trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr.h
trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_ModInfo.h
trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_SearchHit.h
trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h
trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchHit.h
trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchProgressReporter.h
Modified:
trunk/bindings/java-jni/Makefile
trunk/bindings/java-jni/README
trunk/bindings/java-jni/jni/swordstub.cpp
trunk/bindings/java-jni/jni/webmgr.hpp
trunk/bindings/java-jni/src/org/crosswire/android/sword/InstallMgr.java
trunk/bindings/java-jni/src/org/crosswire/android/sword/SWMgr.java
trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java
Log:
Updated java-jni bindings. More generic. Removed uneccessary files
Modified: trunk/bindings/java-jni/Makefile
===================================================================
--- trunk/bindings/java-jni/Makefile 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/Makefile 2017-11-01 10:36:39 UTC (rev 3507)
@@ -10,6 +10,8 @@
javap -s -classpath classes/ org.crosswire.android.sword.SWModule.SearchHit > SearchHit.txt
javap -s -classpath classes/ org.crosswire.android.sword.SWModule.SearchProgressReporter > SearchProgressReporter.txt
javap -s -classpath classes/ org.crosswire.android.sword.InstallMgr > InstallMgr.txt
- cp src/org/crosswire/android/sword/*.java /home/scribe/src/bishop/src/org/crosswire/android/sword/
+ cp src/org/crosswire/android/sword/*.java ../Android/SWORD/app/src/main/java/org/crosswire/android/sword/
+clean:
+ rm -rf classes jni/org_crosswire_android_sword_*.h *.txt
Modified: trunk/bindings/java-jni/README
===================================================================
--- trunk/bindings/java-jni/README 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/README 2017-11-01 10:36:39 UTC (rev 3507)
@@ -1,27 +1,28 @@
-Android Build Instructions
+This folder contains java-jni bindings. They are 99% generic but have
+some Android-specific code which should eventually be removed. This
+includes setting a SWLog::setSystemLog(new AndroidLogger()) and an
+org.crosswire.android.sword.* package. This was not changed to
+org.crosswire.sword.* because there are conflicting SWMgr, et. al.
+classes from the crosswire-java project and the CORBA bindings.
+org.crosswire.jni.sword.* is an option but exposing the impl in the
+package name is bad practice. More thought needed.
-You'll need the Android NDK.
+A make in here should produce the JNI wrappers.
+jni/swordstub.cpp is the jni implementation
-Then link the sword/bindings/java-jni folder to your project's /jni folder.
-I have a symlink:
+This make also copies the java src/ files to the ../Android binding folder.
+The ../Android binding folder symlinks to the jni cpp file generated here.
-~/src/bishop/jni -> ~/src/sword/bindings/java-jni/jni/
+There is an Android Studio project there to build the native libs
-~/src/sword is simply a checkout of the current sword svn repository.
-(svn co https://crosswire.org/svn/sword/trunk ~/src/sword)
+The steps to build all of this are usually:
+1) make in this folder
+2) build all in ../Android/SWORD Android Studio project
+3) a make in the ../Android/ folder, which finally copies the binary libs
+ to the ../cordova/ bindings folder to produce a working cordova
+ plugin
+Android java bindings can be used after step 2
+cordova javascript bindings can be used after step 3
-So, since my $HOME directly is /home/scribe, my configuration looks like this:
-
-/home/scribe/src/sword/
-/home/scribe/src/bishop/
-/home/scribe/android-ndk-r8e/
-
-with:
-
-APP_PROJECT_PATH := $(call my-dir)/../../../src/bishop
-APP_MODULES := sword swordcore
-APP_PLATFORM := android-3
-
-
Hope this helps get you started. Let me know your progress!
Deleted: trunk/bindings/java-jni/jni/org_crosswire_android_sword_InstallMgr.h
===================================================================
--- trunk/bindings/java-jni/jni/org_crosswire_android_sword_InstallMgr.h 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/jni/org_crosswire_android_sword_InstallMgr.h 2017-11-01 10:36:39 UTC (rev 3507)
@@ -1,85 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_crosswire_android_sword_InstallMgr */
-
-#ifndef _Included_org_crosswire_android_sword_InstallMgr
-#define _Included_org_crosswire_android_sword_InstallMgr
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: reInit
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_InstallMgr_reInit
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: setUserDisclaimerConfirmed
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_InstallMgr_setUserDisclaimerConfirmed
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: syncConfig
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_syncConfig
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: uninstallModule
- * Signature: (Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_uninstallModule
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: getRemoteSources
- * Signature: ()[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_InstallMgr_getRemoteSources
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: refreshRemoteSource
- * Signature: (Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_refreshRemoteSource
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: getRemoteModInfoList
- * Signature: (Ljava/lang/String;)[Lorg/crosswire/android/sword/SWMgr/ModInfo;
- */
-JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_InstallMgr_getRemoteModInfoList
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: remoteInstallModule
- * Signature: (Ljava/lang/String;Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_remoteInstallModule
- (JNIEnv *, jobject, jstring, jstring, jobject);
-
-/*
- * Class: org_crosswire_android_sword_InstallMgr
- * Method: getRemoteModuleByName
- * Signature: (Ljava/lang/String;Ljava/lang/String;)Lorg/crosswire/android/sword/SWModule;
- */
-JNIEXPORT jobject JNICALL Java_org_crosswire_android_sword_InstallMgr_getRemoteModuleByName
- (JNIEnv *, jobject, jstring, jstring);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
Deleted: trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr.h
===================================================================
--- trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr.h 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr.h 2017-11-01 10:36:39 UTC (rev 3507)
@@ -1,158 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_crosswire_android_sword_SWMgr */
-
-#ifndef _Included_org_crosswire_android_sword_SWMgr
-#define _Included_org_crosswire_android_sword_SWMgr
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: version
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_version
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: reInit
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_reInit
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: getModInfoList
- * Signature: ()[Lorg/crosswire/android/sword/SWMgr/ModInfo;
- */
-JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getModInfoList
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: getModuleByName
- * Signature: (Ljava/lang/String;)Lorg/crosswire/android/sword/SWModule;
- */
-JNIEXPORT jobject JNICALL Java_org_crosswire_android_sword_SWMgr_getModuleByName
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: getPrefixPath
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getPrefixPath
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: getConfigPath
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getConfigPath
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: setGlobalOption
- * Signature: (Ljava/lang/String;Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setGlobalOption
- (JNIEnv *, jobject, jstring, jstring);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: getGlobalOption
- * Signature: (Ljava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOption
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: getGlobalOptionTip
- * Signature: (Ljava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptionTip
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: filterText
- * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_filterText
- (JNIEnv *, jobject, jstring, jstring);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: getGlobalOptions
- * Signature: ()[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptions
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: getGlobalOptionValues
- * Signature: (Ljava/lang/String;)[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptionValues
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: setCipherKey
- * Signature: (Ljava/lang/String;Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setCipherKey
- (JNIEnv *, jobject, jstring, jstring);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: setJavascript
- * Signature: (Z)V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setJavascript
- (JNIEnv *, jobject, jboolean);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: getAvailableLocales
- * Signature: ()[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getAvailableLocales
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: setDefaultLocale
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setDefaultLocale
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: sendBibleSyncMessage
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_sendBibleSyncMessage
- (JNIEnv *, jobject, jstring);
-
-
-/*
- * Class: org_crosswire_android_sword_SWMgr
- * Method: registerBibleSyncListener
- * Signature: (Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_registerBibleSyncListener
- (JNIEnv *, jobject, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
Deleted: trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_ModInfo.h
===================================================================
--- trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_ModInfo.h 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_ModInfo.h 2017-11-01 10:36:39 UTC (rev 3507)
@@ -1,13 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_crosswire_android_sword_SWMgr_ModInfo */
-
-#ifndef _Included_org_crosswire_android_sword_SWMgr_ModInfo
-#define _Included_org_crosswire_android_sword_SWMgr_ModInfo
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
Deleted: trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_SearchHit.h
===================================================================
--- trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_SearchHit.h 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWMgr_SearchHit.h 2017-11-01 10:36:39 UTC (rev 3507)
@@ -1,13 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_crosswire_android_sword_SWMgr_SearchHit */
-
-#ifndef _Included_org_crosswire_android_sword_SWMgr_SearchHit
-#define _Included_org_crosswire_android_sword_SWMgr_SearchHit
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
Deleted: trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h
===================================================================
--- trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule.h 2017-11-01 10:36:39 UTC (rev 3507)
@@ -1,199 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_crosswire_android_sword_SWModule */
-
-#ifndef _Included_org_crosswire_android_sword_SWModule
-#define _Included_org_crosswire_android_sword_SWModule
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef org_crosswire_android_sword_SWModule_SEARCHTYPE_REGEX
-#define org_crosswire_android_sword_SWModule_SEARCHTYPE_REGEX 1L
-#undef org_crosswire_android_sword_SWModule_SEARCHTYPE_PHRASE
-#define org_crosswire_android_sword_SWModule_SEARCHTYPE_PHRASE -1L
-#undef org_crosswire_android_sword_SWModule_SEARCHTYPE_MULTIWORD
-#define org_crosswire_android_sword_SWModule_SEARCHTYPE_MULTIWORD -2L
-#undef org_crosswire_android_sword_SWModule_SEARCHTYPE_ENTRYATTR
-#define org_crosswire_android_sword_SWModule_SEARCHTYPE_ENTRYATTR -3L
-#undef org_crosswire_android_sword_SWModule_SEARCHTYPE_LUCENE
-#define org_crosswire_android_sword_SWModule_SEARCHTYPE_LUCENE -4L
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: terminateSearch
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_terminateSearch
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: search
- * Signature: (Ljava/lang/String;IJLjava/lang/String;Lorg/crosswire/android/sword/SWModule/SearchProgressReporter;)[Lorg/crosswire/android/sword/SWModule/SearchHit;
- */
-JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_search
- (JNIEnv *, jobject, jstring, jint, jlong, jstring, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: error
- * Signature: ()C
- */
-JNIEXPORT jchar JNICALL Java_org_crosswire_android_sword_SWModule_error
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: getEntrySize
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_org_crosswire_android_sword_SWModule_getEntrySize
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: getEntryAttribute
- * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getEntryAttribute
- (JNIEnv *, jobject, jstring, jstring, jstring, jboolean);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: parseKeyList
- * Signature: (Ljava/lang/String;)[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_parseKeyList
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: setKeyText
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_setKeyText
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: getKeyText
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyText
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: hasKeyChildren
- * Signature: ()Z
- */
-JNIEXPORT jboolean JNICALL Java_org_crosswire_android_sword_SWModule_hasKeyChildren
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: getKeyChildren
- * Signature: ()[Ljava/lang/String;
- */
-JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getKeyChildren
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: getKeyParent
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyParent
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: previous
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_previous
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: next
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_next
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: begin
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_begin
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: getStripText
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getStripText
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: getRenderHeader
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderHeader
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: getRenderText
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderText
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: getRawEntry
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRawEntry
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: setRawEntry
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_setRawEntry
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: getConfigEntry
- * Signature: (Ljava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getConfigEntry
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: deleteSearchFramework
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_deleteSearchFramework
- (JNIEnv *, jobject);
-
-/*
- * Class: org_crosswire_android_sword_SWModule
- * Method: hasSearchFramework
- * Signature: ()Z
- */
-JNIEXPORT jboolean JNICALL Java_org_crosswire_android_sword_SWModule_hasSearchFramework
- (JNIEnv *, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
Deleted: trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchHit.h
===================================================================
--- trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchHit.h 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchHit.h 2017-11-01 10:36:39 UTC (rev 3507)
@@ -1,13 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_crosswire_android_sword_SWModule_SearchHit */
-
-#ifndef _Included_org_crosswire_android_sword_SWModule_SearchHit
-#define _Included_org_crosswire_android_sword_SWModule_SearchHit
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
Deleted: trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchProgressReporter.h
===================================================================
--- trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchProgressReporter.h 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/jni/org_crosswire_android_sword_SWModule_SearchProgressReporter.h 2017-11-01 10:36:39 UTC (rev 3507)
@@ -1,13 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_crosswire_android_sword_SWModule_SearchProgressReporter */
-
-#ifndef _Included_org_crosswire_android_sword_SWModule_SearchProgressReporter
-#define _Included_org_crosswire_android_sword_SWModule_SearchProgressReporter
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
Modified: trunk/bindings/java-jni/jni/swordstub.cpp
===================================================================
--- trunk/bindings/java-jni/jni/swordstub.cpp 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/jni/swordstub.cpp 2017-11-01 10:36:39 UTC (rev 3507)
@@ -38,8 +38,8 @@
#include <treekeyidx.h>
#include <installmgr.h>
#include <remotetrans.h>
+//#include <android/native_activity.h>
-#define BIBLESYNC
#ifdef BIBLESYNC
#include <biblesync.hh>
@@ -63,9 +63,14 @@
#ifdef BIBLESYNC
BibleSync *bibleSync = 0;
-#endif
+using std::string;
jobject bibleSyncListener = 0;
JNIEnv *bibleSyncListenerEnv = 0;
+#endif
+static SWBuf STORAGE_BASE;
+static char *SWORD_PATH = "/sdcard/sword";
+static char *AND_BIBLE_MODULES_PATH = "/sdcard/Android/data/net.bible.android.activity/files";
+//ANativeActivity *_activity;
class InstallStatusReporter : public StatusReporter {
public:
@@ -154,29 +159,49 @@
};
-static void init() {
+static void init(JNIEnv *env) {
if (!mgr) {
SWLog::setSystemLog(new AndroidLogger());
SWLog::getSystemLog()->setLogLevel(SWLog::LOG_DEBUG);
- SWBuf baseDir = "/sdcard/sword";
+SWLog::getSystemLog()->logDebug("libsword: init() begin");
+ SWBuf baseDir = SWORD_PATH;
SWBuf confPath = baseDir + "/mods.d/globals.conf";
// be sure we have at least some config file already out there
if (!FileMgr::existsFile(confPath.c_str())) {
+ SWLog::getSystemLog()->logDebug("libsword: init() sword config not found, attempting to create parent of: %s", confPath.c_str());
FileMgr::createParent(confPath.c_str());
remove(confPath.c_str());
+ SWLog::getSystemLog()->logDebug("libsword: init() saving basic: %s", confPath.c_str());
SWConfig config(confPath.c_str());
config["Globals"]["HiAndroid"] = "weeee";
- config.Save();
+ config.save();
}
- mgr = new WebMgr("/sdcard/sword");
+ if (!FileMgr::existsFile(confPath.c_str())) {
+ baseDir = STORAGE_BASE;
+ confPath = baseDir + "/mods.d/globals.conf";
+SWLog::getSystemLog()->logDebug("libsword: init() sword config STILL not found, attempting to create parent of: %s", confPath.c_str());
+ FileMgr::createParent(confPath.c_str());
+ remove(confPath.c_str());
+SWLog::getSystemLog()->logDebug("libsword: init() saving basic: %s", confPath.c_str());
+ SWConfig config(confPath.c_str());
+ config["Globals"]["HiAndroid"] = "weeee";
+ config.save();
+ }
+ confPath = STORAGE_BASE + "/extraConfig.conf";
+ bool exists = FileMgr::existsFile(confPath.c_str());
+SWLog::getSystemLog()->logDebug("libsword: extraConfig %s at path: %s", exists?"Exists":"Absent", confPath.c_str());
+
+SWLog::getSystemLog()->logDebug("libsword: init() creating WebMgr using path: %s", baseDir.c_str());
+ mgr = new WebMgr(baseDir, exists?confPath.c_str():0);
+
+SWLog::getSystemLog()->logDebug("libsword: init() augmenting modules from: %s", AND_BIBLE_MODULES_PATH);
// for And Bible modules
- mgr->augmentModules("/sdcard/Android/data/net.bible.android.activity/files", true);
+ mgr->augmentModules(AND_BIBLE_MODULES_PATH, true);
}
}
-
static void initInstall() {
if (!installStatusReporter) {
@@ -184,17 +209,27 @@
}
if (!installMgr) {
SWLog::getSystemLog()->logDebug("initInstall: installMgr is null");
- SWBuf baseDir = "/sdcard/sword/InstallMgr";
+ SWBuf baseDir = SWORD_PATH;
+ baseDir += "/InstallMgr";
SWBuf confPath = baseDir + "/InstallMgr.conf";
// be sure we have at least some config file already out there
SWLog::getSystemLog()->logDebug("initInstall: confPath: %s", confPath.c_str());
if (!FileMgr::existsFile(confPath.c_str())) {
-SWLog::getSystemLog()->logDebug("initInstall: file doesn't exist: %s", confPath.c_str());
+ SWLog::getSystemLog()->logDebug("initInstall: file doesn't exist: %s", confPath.c_str());
FileMgr::createParent(confPath.c_str());
SWConfig config(confPath.c_str());
config["General"]["PassiveFTP"] = "true";
- config.Save();
+ config.save();
}
+ if (!FileMgr::existsFile(confPath.c_str())) {
+ baseDir = STORAGE_BASE;
+ confPath = baseDir + "/InstallMgr.conf";
+ SWLog::getSystemLog()->logDebug("initInstall: file STILL doesn't exist, attempting to create parent of: %s", confPath.c_str());
+ FileMgr::createParent(confPath.c_str());
+ SWConfig config(confPath.c_str());
+ config["General"]["PassiveFTP"] = "true";
+ config.save();
+ }
installMgr = new InstallMgr(baseDir, installStatusReporter);
if (disclaimerConfirmed) installMgr->setUserDisclaimerConfirmed(true);
SWLog::getSystemLog()->logDebug("initInstall: instantiated InstallMgr with baseDir: %s", baseDir.c_str());
@@ -238,6 +273,7 @@
}
#endif
+
static void initBibleSync() {
#ifdef BIBLESYNC
if (!bibleSync) {
@@ -255,7 +291,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_version
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWVersion v;
return env->NewStringUTF(v.currentVersion);
@@ -268,8 +304,16 @@
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_reInit
- (JNIEnv *, jobject) {
+ (JNIEnv *env, jobject me) {
+ jclass swmgrClass = env->GetObjectClass(me);
+ jmethodID getStorageBasePath = env->GetMethodID(swmgrClass, "getStorageBasePath", "()Ljava/lang/String;");
+ jstring basePathJS = (jstring)env->CallObjectMethod(me, getStorageBasePath, NULL);
+
+ const char *basePath = (basePathJS?env->GetStringUTFChars(basePathJS, NULL):0);
+ STORAGE_BASE = basePath;
+ SWLog::getSystemLog()->logDebug("setting STORAGE_BASE to: %s", STORAGE_BASE.c_str());
+
delete mgr;
mgr = 0;
}
@@ -278,7 +322,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getPrefixPath
(JNIEnv *env, jobject me) {
- init();
+ init(env);
return env->NewStringUTF(mgr->prefixPath);
}
@@ -286,7 +330,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getConfigPath
(JNIEnv *env, jobject me) {
- init();
+ init(env);
return env->NewStringUTF(mgr->configPath);
}
@@ -295,7 +339,7 @@
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getModInfoList
(JNIEnv *env, jobject) {
- init();
+ init(env);
int size = 0;
for (sword::ModMap::iterator it = mgr->Modules.begin(); it != mgr->Modules.end(); ++it) {
@@ -352,7 +396,7 @@
JNIEXPORT jobject JNICALL Java_org_crosswire_android_sword_SWMgr_getModuleByName
(JNIEnv *env, jobject me, jstring modNameJS) {
- init();
+ init(env);
jobject retVal = 0;
@@ -383,7 +427,7 @@
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setGlobalOption
(JNIEnv *env, jobject me, jstring optionJS, jstring valueJS) {
- init();
+ init(env);
const char *option = env->GetStringUTFChars(optionJS, NULL);
const char *value = env->GetStringUTFChars(valueJS, NULL);
@@ -403,7 +447,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOption
(JNIEnv *env, jobject me, jstring optionJS) {
- init();
+ init(env);
const char *option = env->GetStringUTFChars(optionJS, NULL);
@@ -423,7 +467,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptionTip
(JNIEnv *env, jobject me, jstring optionJS) {
- init();
+ init(env);
const char *option = env->GetStringUTFChars(optionJS, NULL);
@@ -443,7 +487,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_filterText
(JNIEnv *env, jobject me, jstring filterNameJS, jstring textJS) {
- init();
+ init(env);
const char *filterName = env->GetStringUTFChars(filterNameJS, NULL);
const char *text = env->GetStringUTFChars(textJS, NULL);
@@ -466,9 +510,9 @@
* Signature: ()[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptions
- (JNIEnv *env, jobject me) {
+ (JNIEnv *env, jobject me) {
- init();
+ init(env);
sword::StringList options = mgr->getGlobalOptions();
int count = 0;
@@ -490,13 +534,233 @@
/*
* Class: org_crosswire_android_sword_SWMgr
+ * Method: getExtraConfigSections
+ * Signature: ()[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getExtraConfigSections
+ (JNIEnv *env, jobject me) {
+
+ init(env);
+
+ SWBuf baseDir = STORAGE_BASE;
+ SWBuf confPath = baseDir + "/extraConfig.conf";
+ int count = 0;
+ bool exists = FileMgr::existsFile(confPath.c_str());
+ jclass clazzString = env->FindClass("java/lang/String");
+ jobjectArray ret;
+ SWLog::getSystemLog()->logDebug("libsword: extraConfig %s at path: %s", exists?"Exists":"Absent", confPath.c_str());
+ if (exists) {
+ SWConfig config(confPath.c_str());
+ SectionMap::const_iterator sit;
+ for (sit = config.getSections().begin(); sit != config.getSections().end(); ++sit) {
+ count++;
+ }
+ SWLog::getSystemLog()->logDebug("libsword: %d sections found in extraConfig", count);
+ ret = (jobjectArray) env->NewObjectArray(count, clazzString, NULL);
+ count = 0;
+ for (sit = config.getSections().begin(); sit != config.getSections().end(); ++sit) {
+ env->SetObjectArrayElement(ret, count++, env->NewStringUTF(assureValidUTF8(sit->first.c_str())));
+ }
+ }
+ else {
+ ret = (jobjectArray) env->NewObjectArray(0, clazzString, NULL);
+ }
+
+ return ret;
+}
+
+
+/*
+ * Class: org_crosswire_android_sword_SWMgr
+ * Method: getExtraConfigKeys
+ * Signature: (Ljava/lang/String;)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getExtraConfigKeys
+ (JNIEnv *env, jobject me, jstring section) {
+
+ init(env);
+
+ const char *s = env->GetStringUTFChars(section, NULL);
+
+ SWBuf mySection = s;
+
+ env->ReleaseStringUTFChars(section, s);
+
+ SWBuf baseDir = STORAGE_BASE;
+ SWBuf confPath = baseDir + "/extraConfig.conf";
+ int count = 0;
+ bool exists = FileMgr::existsFile(confPath.c_str());
+ jclass clazzString = env->FindClass("java/lang/String");
+ jobjectArray ret;
+ if (exists) {
+ SWConfig config(confPath.c_str());
+ SectionMap::const_iterator sit = config.getSections().find(mySection.c_str());
+ if (sit != config.getSections().end()) {
+ ConfigEntMap::const_iterator it;
+ for (it = sit->second.begin(); it != sit->second.end(); ++it) {
+ count++;
+ }
+ ret = (jobjectArray) env->NewObjectArray(count, clazzString, NULL);
+ count = 0;
+ for (it = sit->second.begin(); it != sit->second.end(); ++it) {
+ env->SetObjectArrayElement(ret, count++,
+ env->NewStringUTF(assureValidUTF8(it->first.c_str())));
+ }
+ }
+ else {
+ ret = (jobjectArray) env->NewObjectArray(0, clazzString, NULL);
+ }
+ }
+ else {
+ ret = (jobjectArray) env->NewObjectArray(0, clazzString, NULL);
+ }
+
+ return ret;
+}
+
+
+/*
+ * Class: org_crosswire_android_sword_SWMgr
+ * Method: getExtraConfigValue
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWMgr_getExtraConfigValue
+ (JNIEnv *env, jobject me, jstring section, jstring key) {
+
+ init(env);
+
+ const char *s = env->GetStringUTFChars(section, NULL);
+
+ SWBuf mySection = s;
+
+ env->ReleaseStringUTFChars(section, s);
+
+ const char *k = env->GetStringUTFChars(key, NULL);
+
+ SWBuf myKey = k;
+
+ env->ReleaseStringUTFChars(key, k);
+
+ jstring ret = 0;
+
+ SWBuf baseDir = STORAGE_BASE;
+ SWBuf confPath = baseDir + "/extraConfig.conf";
+ bool exists = FileMgr::existsFile(confPath.c_str());
+ if (exists) {
+ SWConfig config(confPath.c_str());
+ SectionMap::const_iterator sit = config.getSections().find(mySection.c_str());
+ if (sit != config.getSections().end()) {
+ ConfigEntMap::const_iterator it = sit->second.find(myKey.c_str());
+ if (it != sit->second.end()) {
+ ret = env->NewStringUTF(assureValidUTF8(it->second.c_str()));
+ }
+ }
+ }
+
+ return ret;
+}
+
+
+/*
+ * Class: org_crosswire_android_sword_SWMgr
+ * Method: setExtraConfigValue
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setExtraConfigValue
+ (JNIEnv *env, jobject me, jstring section, jstring key, jstring value) {
+
+ init(env);
+
+ const char *s = env->GetStringUTFChars(section, NULL);
+
+ SWBuf mySection = s;
+
+ env->ReleaseStringUTFChars(section, s);
+
+ const char *k = env->GetStringUTFChars(key, NULL);
+
+ SWBuf myKey = k;
+
+ env->ReleaseStringUTFChars(key, k);
+
+ const char *v = env->GetStringUTFChars(value, NULL);
+
+ SWBuf myValue = v;
+
+ env->ReleaseStringUTFChars(value, v);
+
+ SWBuf baseDir = STORAGE_BASE;
+ SWBuf confPath = baseDir + "/extraConfig.conf";
+ SWConfig config(confPath.c_str());
+ config[mySection][myKey] = myValue;
+ config.save();
+
+ Java_org_crosswire_android_sword_SWMgr_reInit(env, me);
+
+}
+
+
+/*
+ * Class: org_crosswire_android_sword_SWMgr
+ * Method: addExtraConfig
+ * Signature: (Ljava/lang/String;)[Ljava/lang/String;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_addExtraConfig
+ (JNIEnv *env, jobject me, jstring blob) {
+
+ init(env);
+
+ const char *b = env->GetStringUTFChars(blob, NULL);
+
+ SWBuf myBlob = b;
+
+ env->ReleaseStringUTFChars(blob, b);
+
+ jobjectArray ret;
+
+ int count = 0;
+ jclass clazzString = env->FindClass("java/lang/String");
+
+ SWBuf baseDir = STORAGE_BASE;
+ SWBuf tmpConfPath = baseDir + "/tmpConfig.conf";
+ FileMgr::removeFile(tmpConfPath.c_str());
+ FileDesc *fd = FileMgr::getSystemFileMgr()->open(tmpConfPath.c_str(), FileMgr::CREAT|FileMgr::WRONLY, FileMgr::IREAD|FileMgr::IWRITE);
+ fd->getFd();
+ fd->write(myBlob.c_str(), myBlob.size());
+ FileMgr::getSystemFileMgr()->close(fd);
+
+ SWConfig newConfig(tmpConfPath.c_str());
+ FileMgr::removeFile(tmpConfPath.c_str());
+ SectionMap::const_iterator sit;
+ for (sit = newConfig.getSections().begin(); sit != newConfig.getSections().end(); ++sit) {
+ count++;
+ }
+ ret = (jobjectArray) env->NewObjectArray(count, clazzString, NULL);
+ count = 0;
+ for (sit = newConfig.getSections().begin(); sit != newConfig.getSections().end(); ++sit) {
+ env->SetObjectArrayElement(ret, count++, env->NewStringUTF(assureValidUTF8(sit->first.c_str())));
+ }
+
+ SWBuf confPath = baseDir + "/extraConfig.conf";
+ SWConfig config(confPath.c_str());
+ config.augment(newConfig);
+ config.save();
+
+ Java_org_crosswire_android_sword_SWMgr_reInit(env, me);
+
+ return ret;
+}
+
+
+/*
+ * Class: org_crosswire_android_sword_SWMgr
* Method: getGlobalOptionValues
* Signature: (Ljava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getGlobalOptionValues
(JNIEnv *env, jobject me, jstring optionJS) {
- init();
+ init(env);
const char *option = env->GetStringUTFChars(optionJS, NULL);
@@ -528,7 +792,7 @@
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setCipherKey
(JNIEnv *env, jobject me , jstring modNameJS, jstring keyJS) {
- init();
+ init(env);
const char *modName = env->GetStringUTFChars(modNameJS, NULL);
const char *key = env->GetStringUTFChars(keyJS, NULL);
@@ -548,7 +812,7 @@
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setJavascript
(JNIEnv *env, jobject me, jboolean val) {
- init();
+ init(env);
mgr->setJavascript(val == JNI_TRUE);
}
@@ -562,7 +826,7 @@
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getAvailableLocales
(JNIEnv *env, jobject me) {
- init();
+ init(env);
sword::StringList localeNames = LocaleMgr::getSystemLocaleMgr()->getAvailableLocales();
int count = 0;
@@ -589,7 +853,7 @@
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_setDefaultLocale
(JNIEnv *env, jobject me, jstring localeNameJS) {
- init();
+ init(env);
const char *localeName = env->GetStringUTFChars(localeNameJS, NULL);
@@ -605,7 +869,7 @@
SWModule *getModule(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = 0;
jclass clazzSWModule = env->FindClass("org/crosswire/android/sword/SWModule");
@@ -637,7 +901,7 @@
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_setKeyText
(JNIEnv *env, jobject me, jstring keyTextJS) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -675,7 +939,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyText
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -695,7 +959,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderText
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -715,7 +979,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderHeader
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -735,7 +999,7 @@
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_terminateSearch
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -753,7 +1017,7 @@
JNIEXPORT jchar JNICALL Java_org_crosswire_android_sword_SWModule_error
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -770,7 +1034,7 @@
JNIEXPORT jlong JNICALL Java_org_crosswire_android_sword_SWModule_getEntrySize
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -786,7 +1050,7 @@
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getEntryAttribute
(JNIEnv *env, jobject me, jstring level1JS, jstring level2JS, jstring level3JS, jboolean filteredJS) {
- init();
+ init(env);
const char *level1 = env->GetStringUTFChars(level1JS, NULL);
const char *level2 = env->GetStringUTFChars(level2JS, NULL);
@@ -895,7 +1159,7 @@
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_parseKeyList
(JNIEnv *env, jobject me, jstring keyListTextJS) {
- init();
+ init(env);
const char *keyListText = env->GetStringUTFChars(keyListTextJS, NULL);
@@ -940,7 +1204,7 @@
JNIEXPORT jboolean JNICALL Java_org_crosswire_android_sword_SWModule_hasKeyChildren
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -965,7 +1229,7 @@
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_getKeyChildren
(JNIEnv *env, jobject me) {
- init();
+ init(env);
jclass clazzString = env->FindClass("java/lang/String");
@@ -1024,8 +1288,8 @@
}
}
}
- return ret;
}
+ return ret;
}
@@ -1037,7 +1301,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getKeyParent
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWBuf retVal = "";
@@ -1067,7 +1331,7 @@
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_previous
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -1086,7 +1350,7 @@
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_next
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -1105,7 +1369,7 @@
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_begin
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -1124,7 +1388,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getStripText
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWBuf retVal = "";
@@ -1147,7 +1411,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRawEntry
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWBuf retVal = "";
@@ -1170,7 +1434,7 @@
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_setRawEntry
(JNIEnv *env, jobject me, jstring newEntryTextJS) {
- init();
+ init(env);
const char *newEntryText = env->GetStringUTFChars(newEntryTextJS, NULL);
@@ -1212,7 +1476,7 @@
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getConfigEntry
(JNIEnv *env, jobject me, jstring configKeyJS) {
- init();
+ init(env);
jstring retVal = 0;
@@ -1242,7 +1506,7 @@
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_deleteSearchFramework
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -1261,7 +1525,7 @@
JNIEXPORT jboolean JNICALL Java_org_crosswire_android_sword_SWModule_hasSearchFramework
(JNIEnv *env, jobject me) {
- init();
+ init(env);
SWModule *module = getModule(env, me);
@@ -1304,7 +1568,7 @@
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWModule_search
(JNIEnv *env, jobject me, jstring expressionJS, jint srchType, jlong flags, jstring scopeJS, jobject progressReporter) {
- init();
+ init(env);
const int MAX_RETURN_COUNT = 999999;
@@ -1417,7 +1681,7 @@
JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_uninstallModule
(JNIEnv *env, jobject me, jstring modNameJS) {
- init();
+ init(env);
initInstall();
const char *modName = env->GetStringUTFChars(modNameJS, NULL);
@@ -1498,7 +1762,7 @@
(JNIEnv *env, jobject me, jstring sourceNameJS) {
SWLog::getSystemLog()->logDebug("getRemoteModInfoList\n");
- init();
+ init(env);
initInstall();
const char *sourceName = env->GetStringUTFChars(sourceNameJS, NULL);
@@ -1571,7 +1835,7 @@
JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_remoteInstallModule
(JNIEnv *env, jobject me, jstring sourceNameJS, jstring modNameJS, jobject progressReporter) {
- init();
+ init(env);
initInstall();
installStatusReporter->init(env, progressReporter);
@@ -1704,12 +1968,13 @@
*/
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWMgr_registerBibleSyncListener
(JNIEnv *env, jobject me, jobject bibleSyncListener) {
+
+#ifdef BIBLESYNC
SWLog::getSystemLog()->logDebug("registerBibleSyncListener");
::bibleSyncListener = bibleSyncListener;
::bibleSyncListenerEnv = env;
SWLog::getSystemLog()->logDebug("registerBibleSyncListener - calling init");
initBibleSync();
-#ifdef BIBLESYNC
SWLog::getSystemLog()->logDebug("registerBibleSyncListener - starting while listener");
while(::bibleSyncListener) {
SWLog::getSystemLog()->logDebug("bibleSyncListener - while loop iteration");
Modified: trunk/bindings/java-jni/jni/webmgr.hpp
===================================================================
--- trunk/bindings/java-jni/jni/webmgr.hpp 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/jni/webmgr.hpp 2017-11-01 10:36:39 UTC (rev 3507)
@@ -41,15 +41,18 @@
SWModule *defaultHebLex;
SWModule *defaultGreekParse;
SWModule *defaultHebParse;
+ char *extraConf;
public:
// WebMgr(SWConfig *sysConf) : SWMgr(0, sysConf, false, new MarkupFilterMgr(FMT_WEBIF)) {
- WebMgr(const char *path) : SWMgr(path, false, new MarkupFilterMgr(FMT_WEBIF)) {
+ WebMgr(const char *path, const char *extraConfPath) : extraConf(0), SWMgr(path, false, new MarkupFilterMgr(FMT_XHTML)) {
defaultGreekLex = 0;
defaultHebLex = 0;
defaultGreekParse = 0;
defaultHebParse = 0;
+ stdstr(&extraConf, extraConfPath);
+
osisWordJS = new OSISWordJS();
thmlWordJS = new ThMLWordJS();
gbfWordJS = new GBFWordJS();
@@ -67,9 +70,21 @@
delete osisWordJS;
delete thmlWordJS;
delete gbfWordJS;
+ delete extraConf;
}
+ void createAllModules(bool multiMod) {
+ if (extraConf) {
+ bool exists = FileMgr::existsFile(extraConf);
+ if (exists) {
+ SWConfig addConfig(extraConf);
+ this->config->augment(addConfig);
+ }
+ }
+ SWMgr::createAllModules(multiMod);
+ }
+
void AddGlobalOptions(SWModule *module, ConfigEntMap §ion, ConfigEntMap::iterator start, ConfigEntMap::iterator end) {
// ThML word stuff needs to process before strongs strip
Modified: trunk/bindings/java-jni/src/org/crosswire/android/sword/InstallMgr.java
===================================================================
--- trunk/bindings/java-jni/src/org/crosswire/android/sword/InstallMgr.java 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/src/org/crosswire/android/sword/InstallMgr.java 2017-11-01 10:36:39 UTC (rev 3507)
@@ -2,7 +2,7 @@
*
* InstallMgr.java -
*
- * $Id$
+ * $Id: InstallMgr.java 3229 2014-05-09 09:32:36Z scribe $
*
* Copyright 2009-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
Modified: trunk/bindings/java-jni/src/org/crosswire/android/sword/SWMgr.java
===================================================================
--- trunk/bindings/java-jni/src/org/crosswire/android/sword/SWMgr.java 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/src/org/crosswire/android/sword/SWMgr.java 2017-11-01 10:36:39 UTC (rev 3507)
@@ -2,7 +2,7 @@
*
* SWMgr.java -
*
- * $Id$
+ * $Id: SWMgr.java 2833 2013-06-29 06:40:28Z chrislit $
*
* Copyright 2009-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -37,6 +37,12 @@
public String delta;
}
+ public SWMgr() {
+ reInit();
+ }
+ public SWMgr(boolean init) {
+ if (init) reInit();
+ }
public native String version();
public native void reInit();
@@ -55,6 +61,31 @@
public native void setJavascript(boolean val);
public native String[] getAvailableLocales();
public native void setDefaultLocale(String name);
+
+ /**
+ * add a conf snippet to extraConfig. This is useful for adding a config section
+ * sent from a module unlock key app.
+ * @param blob
+ * @return an array of section names which were contained in the blob
+ */
+ public native String[] addExtraConfig(String blob);
+ public native void setExtraConfigValue(String section, String key, String value);
+ public native String[] getExtraConfigSections();
+ public native String[] getExtraConfigKeys(String section);
+ public native String getExtraConfigValue(String section, String key);
+
+ public static interface BibleSyncListener {
+ public void messageReceived(String osisRef);
+ }
+ public native void sendBibleSyncMessage(String osisRef);
+ public native void registerBibleSyncListener(BibleSyncListener listener);
+ public String getStorageBasePath() {
+ return ".";
+/*
+ Context context = app.getApplicationContext();
+ return context.getFilesDir().getAbsolutePath();
+*/
+ }
}
Modified: trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java
===================================================================
--- trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java 2017-11-01 10:36:29 UTC (rev 3506)
+++ trunk/bindings/java-jni/src/org/crosswire/android/sword/SWModule.java 2017-11-01 10:36:39 UTC (rev 3507)
@@ -2,7 +2,7 @@
*
* SWModule.java -
*
- * $Id$
+ * $Id: SWModule.java 3237 2014-05-22 08:02:06Z scribe $
*
* Copyright 2009-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
More information about the sword-cvs
mailing list