rhoconnect-client 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +9 -0
- data/CREDITS +0 -0
- data/LICENSE +9 -0
- data/README.md +47 -0
- data/ext/rhoconnect-client/RhoConnectClient.rb +190 -0
- data/ext/rhoconnect-client/ext/RhoConnectClient.xml +726 -0
- data/ext/rhoconnect-client/ext/build +26 -0
- data/ext/rhoconnect-client/ext/build.bat +30 -0
- data/ext/rhoconnect-client/ext/platform/android/ext_java.files +1 -0
- data/ext/rhoconnect-client/ext/platform/android/ext_native.files +14 -0
- data/ext/rhoconnect-client/ext/platform/android/src/com/rhoconnectclient/RhoconnectClient.java +1 -0
- data/ext/rhoconnect-client/ext/platform/iphone/.gitignore +1 -0
- data/ext/rhoconnect-client/ext/platform/iphone/Rakefile +74 -0
- data/ext/rhoconnect-client/ext/platform/iphone/RhoconnectClient.xcodeproj/project.pbxproj +390 -0
- data/ext/rhoconnect-client/ext/platform/iphone/RhoconnectClient_Prefix.pch +7 -0
- data/ext/rhoconnect-client/ext/platform/iphone/impl/readme.txt +7 -0
- data/ext/rhoconnect-client/ext/platform/qt/Rakefile +35 -0
- data/ext/rhoconnect-client/ext/platform/qt/rhoconnect-client.pro +88 -0
- data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.sln +36 -0
- data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.vcproj +774 -0
- data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.vsprops +15 -0
- data/ext/rhoconnect-client/ext/platform/wm/src/rhoconnectclient_wm.cpp +40 -0
- data/ext/rhoconnect-client/ext/platform/wm/src/rhoconnectclient_wm.h +2 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.props +22 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.sln +32 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.vcxproj +220 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.vcxproj.filters +103 -0
- data/ext/rhoconnect-client/ext/shared/RhoConnectClientImpl.cpp +273 -0
- data/ext/rhoconnect-client/ext/shared/RhoConnectClientImpl.h +60 -0
- data/ext/rhoconnect-client/ext/shared/RhoConnectClientSingletonImpl.h +53 -0
- data/ext/rhoconnect-client/ext/shared/initRhoconnectClient.cpp +207 -0
- data/ext/rhoconnect-client/ext/shared/rhoconnectclient.c +18 -0
- data/ext/rhoconnect-client/ext/shared/sync/ClientRegister.cpp +398 -0
- data/ext/rhoconnect-client/ext/shared/sync/ClientRegister.h +147 -0
- data/ext/rhoconnect-client/ext/shared/sync/ISyncProtocol.h +91 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncEngine.cpp +1245 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncEngine.h +213 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncNotify.cpp +737 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncNotify.h +209 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncProtocol_3.h +220 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncProtocol_4.h +259 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncSource.cpp +1694 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncSource.h +212 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncThread.cpp +583 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncThread.h +250 -0
- data/ext/rhoconnect-client/ext.yml +12 -0
- data/lib/build/run_rhoconnect_spec.rb +135 -0
- data/lib/rhoconnect-client.rb +3 -0
- data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1673 -0
- data/platform/shared/RhoConnectClient/RhoConnectClient.h +181 -0
- data/platform/shared/RhoConnectClient/RhoError.h +77 -0
- data/rhoconnect-client/C++/Tests/RhoConnectClientTest.cpp +830 -0
- data/rhoconnect-client/C++/Tests/win32/.gitignore +3 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClient.sln +65 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClient.vcproj +634 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClientTest/RhoConnectClientTest.vcproj +222 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClientTest/stdafx.h +65 -0
- data/rhoconnect-client/C++/Tests/win32/stdafx.h +65 -0
- data/rhoconnect-client/CHANGELOG +18 -0
- data/rhoconnect-client/Java/Android/build/android.rake +387 -0
- data/rhoconnect-client/Java/Android/build/android_sdk.rb +582 -0
- data/rhoconnect-client/Java/Android/build/libcurl_build.files +73 -0
- data/rhoconnect-client/Java/Android/build/libjson_build.files +9 -0
- data/rhoconnect-client/Java/Android/build/librhocommon_build.files +14 -0
- data/rhoconnect-client/Java/Android/build/librhodb_build.files +5 -0
- data/rhoconnect-client/Java/Android/build/librhoimpl_build.files +13 -0
- data/rhoconnect-client/Java/Android/build/librholog_build.files +4 -0
- data/rhoconnect-client/Java/Android/build/libsqlite_build.files +1 -0
- data/rhoconnect-client/Java/Android/build/libsync_build.files +7 -0
- data/rhoconnect-client/Java/Android/build/libunzip_build.files +1 -0
- data/rhoconnect-client/Java/Android/build/rhoconnectclient_build.files +3 -0
- data/rhoconnect-client/Java/Android/build/rhoimpljava_build.files +21 -0
- data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/Capabilities.java +63 -0
- data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/MemoryInfoCollector.java +79 -0
- data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/util/ContextFactory.java +63 -0
- data/rhoconnect-client/Java/Android/test/.classpath +9 -0
- data/rhoconnect-client/Java/Android/test/.project +33 -0
- data/rhoconnect-client/Java/Android/test/AndroidManifest.xml +14 -0
- data/rhoconnect-client/Java/Android/test/assets/apps/androidtest.png +0 -0
- data/rhoconnect-client/Java/Android/test/assets/apps/rhoconfig.txt +19 -0
- data/rhoconnect-client/Java/Android/test/assets/apps/rhoconfig.txt.timestamp +1 -0
- data/rhoconnect-client/Java/Android/test/assets/db/syncdb.schema +44 -0
- data/rhoconnect-client/Java/Android/test/assets/db/syncdb.triggers +10 -0
- data/rhoconnect-client/Java/Android/test/assets/db/syncdb_java.triggers +21 -0
- data/rhoconnect-client/Java/Android/test/assets/rho.dat +9 -0
- data/rhoconnect-client/Java/Android/test/proguard.cfg +36 -0
- data/rhoconnect-client/Java/Android/test/project.properties +11 -0
- data/rhoconnect-client/Java/Android/test/res/drawable-hdpi/icon.png +0 -0
- data/rhoconnect-client/Java/Android/test/res/drawable-ldpi/icon.png +0 -0
- data/rhoconnect-client/Java/Android/test/res/drawable-mdpi/icon.png +0 -0
- data/rhoconnect-client/Java/Android/test/res/layout/main.xml +12 -0
- data/rhoconnect-client/Java/Android/test/res/values/strings.xml +5 -0
- data/rhoconnect-client/Java/Android/test/rhoimpl.jar +0 -0
- data/rhoconnect-client/Java/Android/test/src/com/rhomobile/rhoconnect_client_test/TestRhoConnectClient.java +343 -0
- data/rhoconnect-client/Java/Android/test/src/com/rhomobile/rhoconnect_client_test/TestRhoConnectClientBlobs.java +219 -0
- data/rhoconnect-client/Java/RhoConnect/.classpath +6 -0
- data/rhoconnect-client/Java/RhoConnect/.project +93 -0
- data/rhoconnect-client/Java/RhoConnect/assets/apps/rhoconfig.txt +19 -0
- data/rhoconnect-client/Java/RhoConnect/assets/apps/rhoconfig.txt.timestamp +1 -0
- data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb.schema +44 -0
- data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb.triggers +10 -0
- data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb_java.triggers +21 -0
- data/rhoconnect-client/Java/RhoConnect/assets/rho.dat +8 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/RhoConnectJniNotify.h +61 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectClient.h +181 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectNotify.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectNotify_IDelegate.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectObjectNotify.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectObjectNotify_IDelegate.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhomModel.h +103 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/rhojava.inc +76 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniClient.cpp +401 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniModel.cpp +332 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniNotify.cpp +223 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectUtil.cpp +82 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhodesApp.cpp +114 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectClient.java +108 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectNotify.java +78 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectObjectNotify.java +71 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhomModel.java +195 -0
- data/rhoconnect-client/JavaScript/.classpath +10 -0
- data/rhoconnect-client/JavaScript/.gitignore +4 -0
- data/rhoconnect-client/JavaScript/.project +17 -0
- data/rhoconnect-client/JavaScript/README.textile +1 -0
- data/rhoconnect-client/JavaScript/build.xml +185 -0
- data/rhoconnect-client/JavaScript/doc/fsm-sample.js +44 -0
- data/rhoconnect-client/JavaScript/doc/fsm-sample.png +0 -0
- data/rhoconnect-client/JavaScript/src/RhoSyncJS.gwt.xml +21 -0
- data/rhoconnect-client/JavaScript/stubs/RhoSyncStubsJS.gwt.xml +21 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/Capabilities.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/IRhoRubyHelper.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/Mutex.java +5 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoAppAdapter.java +39 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoClassFactory.java +29 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoConf.java +100 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoEmptyLogger.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoEmptyProfiler.java +5 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoLogger.java +32 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoProfiler.java +27 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhodesApp.java +25 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/TimeInterval.java +22 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/Tokenizer.java +23 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBAdapter.java +174 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBAttrManager.java +15 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBException.java +5 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/IDBResult.java +27 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/file/IFileAccess.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/file/SimpleFile.java +15 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/IHttpConnection.java +22 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/NetRequest.java +324 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/NetResponse.java +51 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/URI.java +64 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/ClientRegister.java +15 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONArrayIterator.java +37 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONEntry.java +48 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONStructIterator.java +41 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/SyncNotify.java +98 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/SyncThread.java +92 -0
- data/rhoconnect-client/JavaScript/war/WEB-INF/lib/gwt-servlet-deps.jar +0 -0
- data/rhoconnect-client/JavaScript/war/WEB-INF/lib/gwt-servlet.jar +0 -0
- data/rhoconnect-client/JavaScript/war/js/fsm-sample.js +54 -0
- data/rhoconnect-client/JavaScript/war/js/rhosync-api.js +237 -0
- data/rhoconnect-client/JavaScript/war/js/rhosync-fsm.js +307 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/4C71D69C9BBC9E6F05C6BA49B01BCBC1.cache.html +3122 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/5146F4FFF34511C8BB2661E920B49E3A.cache.html +3254 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/5248C67481D9D27AD0703D15CDBD2A1C.cache.html +3147 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/EE1DC2692C9C32367B53A39E2358AF23.cache.html +3195 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/clear.cache.gif +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/corner.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/corner_ie6.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/hborder.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/hborder_ie6.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/corner_dialog_topleft.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/corner_dialog_topright.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/hborder_blue_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/hborder_gray_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/vborder_blue_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/vborder_gray_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/splitPanelThumb.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/vborder.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/vborder_ie6.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/standard.css +1144 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/standard_rtl.css +1145 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/hosted.html +350 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/rhosyncjs.nocache.js +314 -0
- data/rhoconnect-client/JavaScript/war/test/SpecRunner.html +35 -0
- data/rhoconnect-client/JavaScript/war/test/dbtest.html +38 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/MIT.LICENSE +20 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine-html.js +188 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine.css +166 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine.js +2421 -0
- data/rhoconnect-client/JavaScript/war/test/spec/SpecHelper.js +7 -0
- data/rhoconnect-client/JavaScript/war/test/spec/SyncApiSpec.js +573 -0
- data/rhoconnect-client/JavaScript/war/test/spec/samples/PlayerSpec.js +58 -0
- data/rhoconnect-client/JavaScript/war/test/worker-test.js +17 -0
- data/rhoconnect-client/LICENSE +41 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectClient.h +118 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectClient.m +641 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectClient.xcodeproj/project.pbxproj +1434 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectNotify.h +83 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectNotify.m +181 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectObjectNotify.h +65 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectObjectNotify.m +73 -0
- data/rhoconnect-client/ObjectiveC/RhomModel.h +101 -0
- data/rhoconnect-client/ObjectiveC/RhomModel.m +320 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/MainWindow.xib +198 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest-Info.plist +30 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest.xcodeproj/project.pbxproj +373 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTestAppDelegate.h +58 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTestAppDelegate.m +84 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest_Prefix.pch +8 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/invalid_import_db.zip +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/main.m +1096 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/test.png +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/test2.png +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/valid_import_db.zip +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsAppDelegate.h +62 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsAppDelegate.m +35 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsViewController.h +78 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsViewController.m +549 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/MainWindow.xib +227 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/main.m +17 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests-Info.plist +30 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests.xcodeproj/project.pbxproj +363 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptestsViewController.xib +641 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests_Prefix.pch +8 -0
- data/rhoconnect-client/README.textile +23 -0
- data/rhoconnect-client/Rakefile +20 -0
- data/rhoconnect-client/Samples/Java/android_store/.classpath +8 -0
- data/rhoconnect-client/Samples/Java/android_store/.project +33 -0
- data/rhoconnect-client/Samples/Java/android_store/AndroidManifest.xml +24 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/apps/rhoconfig.txt +19 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/apps/rhoconfig.txt.timestamp +1 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb.schema +44 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb.triggers +10 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb_java.triggers +21 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/rho.dat +8 -0
- data/rhoconnect-client/Samples/Java/android_store/default.properties +11 -0
- data/rhoconnect-client/Samples/Java/android_store/project.properties +14 -0
- data/rhoconnect-client/Samples/Java/android_store/res/drawable-hdpi/icon.png +0 -0
- data/rhoconnect-client/Samples/Java/android_store/res/drawable-ldpi/icon.png +0 -0
- data/rhoconnect-client/Samples/Java/android_store/res/drawable-mdpi/icon.png +0 -0
- data/rhoconnect-client/Samples/Java/android_store/res/layout/main.xml +12 -0
- data/rhoconnect-client/Samples/Java/android_store/res/values/strings.xml +5 -0
- data/rhoconnect-client/Samples/Java/android_store/rhoimpl.jar +0 -0
- data/rhoconnect-client/Samples/Java/android_store/src/com/rhomobile/android_store/StoreActivity.java +68 -0
- data/rhoconnect-client/Samples/Java/android_store/src/com/rhomobile/android_store/StoreApplication.java +15 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/LoginViewController.h +70 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/LoginViewController.m +94 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RhoConnectEngine.h +82 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RhoConnectEngine.m +119 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RootViewController.h +63 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RootViewController.m +314 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/WaitLoginController.h +65 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/WaitLoginController.m +110 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/storeAppDelegate.h +61 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/storeAppDelegate.m +171 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/LoginViewController.xib +779 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/MainWindow.xib +580 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/RootViewController.xib +384 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/WaitLoginController.xib +557 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/icon.png +0 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/main.m +22 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/store-Info.plist +30 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/store.xcodeproj/project.pbxproj +367 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/store_Prefix.pch +14 -0
- data/rhoconnect-client/build.yml +3 -0
- data/rhoconnect-client/version +1 -0
- metadata +314 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/*------------------------------------------------------------------------
|
|
2
|
+
* (The MIT License)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2008-2011 Rhomobile, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*
|
|
24
|
+
* http://rhomobile.com
|
|
25
|
+
|
|
26
|
+
* Copyright (c) 2011-2016 Symbol Technologies, Inc.
|
|
27
|
+
*
|
|
28
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
29
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
30
|
+
* in the Software without restriction, including without limitation the rights
|
|
31
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
32
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
33
|
+
* furnished to do so, subject to the following conditions:
|
|
34
|
+
*
|
|
35
|
+
* The above copyright notice and this permission notice shall be included in
|
|
36
|
+
* all copies or substantial portions of the Software.
|
|
37
|
+
*
|
|
38
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
39
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
40
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
41
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
42
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
43
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
44
|
+
* THE SOFTWARE.
|
|
45
|
+
*
|
|
46
|
+
* http://symbol.com
|
|
47
|
+
*------------------------------------------------------------------------*/
|
|
48
|
+
|
|
49
|
+
#include "rhodes/JNIRhodes.h"
|
|
50
|
+
#include "sync/SyncThread.h"
|
|
51
|
+
#include "RhoConnectClient/RhoConnectClient.h"
|
|
52
|
+
#include "logging/RhoLog.h"
|
|
53
|
+
|
|
54
|
+
#include "com_rhomobile_rhoconnect_RhomModel.h"
|
|
55
|
+
|
|
56
|
+
#include "RhoConnectJniNotify.h"
|
|
57
|
+
|
|
58
|
+
#undef DEFAULT_LOGCATEGORY
|
|
59
|
+
#define DEFAULT_LOGCATEGORY "RhomModelJNI"
|
|
60
|
+
|
|
61
|
+
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhoconnect_RhomModel_init
|
|
62
|
+
(JNIEnv * env, jobject jmodel)
|
|
63
|
+
{
|
|
64
|
+
static jclass clsmodel = getJNIClass(RHOCONNECT_JAVA_CLASS_RHOMMODEL);
|
|
65
|
+
if (!clsmodel) return;
|
|
66
|
+
|
|
67
|
+
static jmethodID midmodeltype = getJNIClassMethod(env, clsmodel, "setModelType", "(I)V");
|
|
68
|
+
if (!midmodeltype) return;
|
|
69
|
+
static jmethodID midsynctype = getJNIClassMethod(env, clsmodel, "setSyncType", "(I)V");
|
|
70
|
+
if (!midsynctype) return;
|
|
71
|
+
static jmethodID midsyncpri = getJNIClassMethod(env, clsmodel, "setSyncPriority", "(I)V");
|
|
72
|
+
if (!midsyncpri) return;
|
|
73
|
+
static jmethodID midpart = getJNIClassMethod(env, clsmodel, "setPartition", "(Ljava/lang/String;)V");
|
|
74
|
+
if (!midpart) return;
|
|
75
|
+
|
|
76
|
+
RHOM_MODEL model;
|
|
77
|
+
rho_connectclient_initmodel(&model);
|
|
78
|
+
|
|
79
|
+
env->CallVoidMethod(jmodel, midmodeltype, model.type);
|
|
80
|
+
env->CallVoidMethod(jmodel, midsynctype, model.sync_type);
|
|
81
|
+
env->CallVoidMethod(jmodel, midsyncpri, model.sync_priority);
|
|
82
|
+
env->CallVoidMethod(jmodel, midpart, rho_cast<jhstring>(env, model.partition).get());
|
|
83
|
+
}
|
|
84
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
85
|
+
|
|
86
|
+
RHO_GLOBAL jobject JNICALL Java_com_rhomobile_rhoconnect_RhomModel_syncByName
|
|
87
|
+
(JNIEnv * env, jclass, jstring jname)
|
|
88
|
+
{
|
|
89
|
+
std::string name = rho_cast<std::string>(env, jname);
|
|
90
|
+
|
|
91
|
+
LOG(INFO) + "Syncing model: " + name;
|
|
92
|
+
|
|
93
|
+
char* res = reinterpret_cast<char*>(rho_sync_doSyncSourceByName(name.c_str()));
|
|
94
|
+
jhobject jhNotify = rho::connect_jni::rhoconnect_jni_parsenotify(env, res);
|
|
95
|
+
rho_sync_free_string(res);
|
|
96
|
+
return jhNotify.release();
|
|
97
|
+
}
|
|
98
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
int java_map_inserter(const char* key, const char* val, void* pThis)
|
|
101
|
+
{
|
|
102
|
+
JNIEnv * env = jnienv();
|
|
103
|
+
jobject jMap = reinterpret_cast<jobject>(pThis);
|
|
104
|
+
|
|
105
|
+
jclass& jMapClass = getJNIClass(RHODES_JAVA_CLASS_MAP);
|
|
106
|
+
if (!jMapClass) return 0;
|
|
107
|
+
|
|
108
|
+
static jmethodID midPut = getJNIClassMethod(env, jMapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
|
|
109
|
+
if (!midPut) return 0;
|
|
110
|
+
|
|
111
|
+
jhstring jhKey = rho_cast<jhstring>(env, key);
|
|
112
|
+
jhstring jhVal = rho_cast<jhstring>(env, val);
|
|
113
|
+
env->CallObjectMethod(jMap, midPut, jhKey.get(), jhVal.get());
|
|
114
|
+
|
|
115
|
+
return 1;
|
|
116
|
+
}
|
|
117
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
118
|
+
|
|
119
|
+
unsigned long rhoconnect_jni_make_object_hash(JNIEnv * env, jobjectArray jKeys, jobjectArray jVals)
|
|
120
|
+
{
|
|
121
|
+
unsigned long item = rho_connectclient_hash_create();
|
|
122
|
+
|
|
123
|
+
unsigned n = env->GetArrayLength(jKeys);
|
|
124
|
+
for(unsigned i = 0; i < n; ++i)
|
|
125
|
+
{
|
|
126
|
+
jhstring jkey = static_cast<jstring>(env->GetObjectArrayElement(jKeys, i));
|
|
127
|
+
jhstring jval = static_cast<jstring>(env->GetObjectArrayElement(jVals, i));
|
|
128
|
+
|
|
129
|
+
std::string key = rho_cast<std::string>(env, jkey);
|
|
130
|
+
std::string val = rho_cast<std::string>(env, jval);
|
|
131
|
+
|
|
132
|
+
rho_connectclient_hash_put(item, key.c_str(), val.c_str());
|
|
133
|
+
}
|
|
134
|
+
return item;
|
|
135
|
+
}
|
|
136
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
137
|
+
|
|
138
|
+
RHO_GLOBAL jobject JNICALL Java_com_rhomobile_rhoconnect_RhomModel_createByName
|
|
139
|
+
(JNIEnv * env, jclass, jstring jModelName, jobjectArray jKeys, jobjectArray jVals)
|
|
140
|
+
{
|
|
141
|
+
std::string name = rho_cast<std::string>(env, jModelName);
|
|
142
|
+
LOG(TRACE) + "createByName: " + name;
|
|
143
|
+
|
|
144
|
+
unsigned long item = rhoconnect_jni_make_object_hash(env, jKeys, jVals);
|
|
145
|
+
|
|
146
|
+
rho_connectclient_create_object(name.c_str(), item);
|
|
147
|
+
|
|
148
|
+
static jclass jMapClass = getJNIClass(RHODES_JAVA_CLASS_HASHMAP);
|
|
149
|
+
if (!jMapClass) return 0;
|
|
150
|
+
|
|
151
|
+
static jmethodID midHashMap = getJNIClassMethod(env, jMapClass, "<init>", "()V");
|
|
152
|
+
if (!midHashMap) return 0;
|
|
153
|
+
|
|
154
|
+
jobject jMap = env->NewObject(jMapClass, midHashMap);
|
|
155
|
+
rho_connectclient_hash_enumerate(item, java_map_inserter, jMap);
|
|
156
|
+
rho_connectclient_hash_delete(item);
|
|
157
|
+
return jMap;
|
|
158
|
+
}
|
|
159
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
160
|
+
|
|
161
|
+
RHO_GLOBAL jobject JNICALL Java_com_rhomobile_rhoconnect_RhomModel_findByName
|
|
162
|
+
(JNIEnv * env, jclass, jstring jModelName, jstring jItemId)
|
|
163
|
+
{
|
|
164
|
+
std::string modelName = rho_cast<std::string>(env, jModelName);
|
|
165
|
+
std::string itemId = rho_cast<std::string>(env, jItemId);
|
|
166
|
+
|
|
167
|
+
unsigned long item = rho_connectclient_find(modelName.c_str(), itemId.c_str());
|
|
168
|
+
if (item == 0) return NULL;
|
|
169
|
+
|
|
170
|
+
static jclass jMapClass = getJNIClass(RHODES_JAVA_CLASS_HASHMAP);
|
|
171
|
+
if (!jMapClass) return 0;
|
|
172
|
+
|
|
173
|
+
static jmethodID midHashMap = getJNIClassMethod(env, jMapClass, "<init>", "()V");
|
|
174
|
+
if (!midHashMap) return 0;
|
|
175
|
+
|
|
176
|
+
jobject jMap = env->NewObject(jMapClass, midHashMap);
|
|
177
|
+
rho_connectclient_hash_enumerate(item, java_map_inserter, jMap);
|
|
178
|
+
return jMap;
|
|
179
|
+
}
|
|
180
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
181
|
+
|
|
182
|
+
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhoconnect_RhomModel_saveByName
|
|
183
|
+
(JNIEnv * env, jclass, jstring jModelName, jobjectArray jKeys, jobjectArray jVals)
|
|
184
|
+
{
|
|
185
|
+
std::string name = rho_cast<std::string>(env, jModelName);
|
|
186
|
+
|
|
187
|
+
LOG(TRACE) + "saveByName: " + name;
|
|
188
|
+
|
|
189
|
+
unsigned long item = rhoconnect_jni_make_object_hash(env, jKeys, jVals);
|
|
190
|
+
|
|
191
|
+
rho_connectclient_save(name.c_str(), item);
|
|
192
|
+
rho_connectclient_hash_delete(item);
|
|
193
|
+
}
|
|
194
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
195
|
+
|
|
196
|
+
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhoconnect_RhomModel_destroyByName
|
|
197
|
+
(JNIEnv * env, jclass, jstring jModelName, jobjectArray jKeys, jobjectArray jVals)
|
|
198
|
+
{
|
|
199
|
+
std::string name = rho_cast<std::string>(env, jModelName);
|
|
200
|
+
LOG(TRACE) + "destroyByName: " + name;
|
|
201
|
+
|
|
202
|
+
unsigned long item = rhoconnect_jni_make_object_hash(env, jKeys, jVals);
|
|
203
|
+
|
|
204
|
+
rho_connectclient_itemdestroy(name.c_str(), item);
|
|
205
|
+
rho_connectclient_hash_delete(item);
|
|
206
|
+
}
|
|
207
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
208
|
+
|
|
209
|
+
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhoconnect_RhomModel_startBulkUpdateByName
|
|
210
|
+
(JNIEnv * env, jclass, jstring jModelName)
|
|
211
|
+
{
|
|
212
|
+
std::string modelName = rho_cast<std::string>(env, jModelName);
|
|
213
|
+
rho_connectclient_start_bulkupdate(modelName.c_str());
|
|
214
|
+
}
|
|
215
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
216
|
+
|
|
217
|
+
RHO_GLOBAL void JNICALL Java_com_rhomobile_rhoconnect_RhomModel_stopBulkUpdateByName
|
|
218
|
+
(JNIEnv * env, jclass, jstring jModelName)
|
|
219
|
+
{
|
|
220
|
+
std::string modelName = rho_cast<std::string>(env, jModelName);
|
|
221
|
+
rho_connectclient_stop_bulkupdate(modelName.c_str());
|
|
222
|
+
}
|
|
223
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
224
|
+
|
|
225
|
+
RHO_GLOBAL jobject JNICALL Java_com_rhomobile_rhoconnect_RhomModel_findFirstByName
|
|
226
|
+
(JNIEnv * env, jclass, jstring jModelName, jobjectArray jKeys, jobjectArray jVals)
|
|
227
|
+
{
|
|
228
|
+
std::string name = rho_cast<std::string>(env, jModelName);
|
|
229
|
+
LOG(TRACE) + "findFirstByName: " + name;
|
|
230
|
+
|
|
231
|
+
unsigned long cond = rhoconnect_jni_make_object_hash(env, jKeys, jVals);
|
|
232
|
+
|
|
233
|
+
unsigned long item = rho_connectclient_find_first(name.c_str(), cond);
|
|
234
|
+
rho_connectclient_hash_delete(cond);
|
|
235
|
+
|
|
236
|
+
LOG(TRACE) + "Item found: " + item;
|
|
237
|
+
if (item == 0) return 0;
|
|
238
|
+
|
|
239
|
+
static jclass jMapClass = getJNIClass(RHODES_JAVA_CLASS_HASHMAP);
|
|
240
|
+
if (!jMapClass) return 0;
|
|
241
|
+
|
|
242
|
+
static jmethodID midHashMap = getJNIClassMethod(env, jMapClass, "<init>", "()V");
|
|
243
|
+
if (!midHashMap) return 0;
|
|
244
|
+
|
|
245
|
+
jobject jMap = env->NewObject(jMapClass, midHashMap);
|
|
246
|
+
|
|
247
|
+
LOG(TRACE) + "Enumerating item: " + item;
|
|
248
|
+
|
|
249
|
+
rho_connectclient_hash_enumerate(item, java_map_inserter, jMap);
|
|
250
|
+
return jMap;
|
|
251
|
+
}
|
|
252
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
253
|
+
|
|
254
|
+
RHO_GLOBAL jobject JNICALL Java_com_rhomobile_rhoconnect_RhomModel_findAllByName
|
|
255
|
+
(JNIEnv * env, jclass, jstring jModelName, jobjectArray jKeys, jobjectArray jVals)
|
|
256
|
+
{
|
|
257
|
+
std::string name = rho_cast<std::string>(env, jModelName);
|
|
258
|
+
|
|
259
|
+
LOG(TRACE) + "findFirstByName: " + name;
|
|
260
|
+
|
|
261
|
+
unsigned long cond = rhoconnect_jni_make_object_hash(env, jKeys, jVals);
|
|
262
|
+
|
|
263
|
+
unsigned long items = rho_connectclient_find_all(name.c_str(), cond);
|
|
264
|
+
rho_connectclient_hash_delete(cond);
|
|
265
|
+
|
|
266
|
+
static jclass jListClass = getJNIClass(RHODES_JAVA_CLASS_ARRAYLIST);
|
|
267
|
+
if (!jListClass) return 0;
|
|
268
|
+
static jmethodID midList = getJNIClassMethod(env, jListClass, "<init>", "()V");
|
|
269
|
+
if (!midList) return 0;
|
|
270
|
+
static jmethodID midListAdd = getJNIClassMethod(env, jListClass, "add", "(Ljava/lang/Object;)Z");
|
|
271
|
+
if (!midList) return 0;
|
|
272
|
+
|
|
273
|
+
static jclass jMapClass = getJNIClass(RHODES_JAVA_CLASS_HASHMAP);
|
|
274
|
+
if (!jMapClass) return 0;
|
|
275
|
+
static jmethodID midHashMap = getJNIClassMethod(env, jMapClass, "<init>", "()V");
|
|
276
|
+
if (!midHashMap) return 0;
|
|
277
|
+
|
|
278
|
+
jobject jList = env->NewObject(jListClass, midList);
|
|
279
|
+
|
|
280
|
+
int cnt = rho_connectclient_strhasharray_size(items);
|
|
281
|
+
for(int i = 0; i < cnt; ++i)
|
|
282
|
+
{
|
|
283
|
+
jobject jMap = env->NewObject(jMapClass, midHashMap);
|
|
284
|
+
rho_connectclient_hash_enumerate(rho_connectclient_strhasharray_get(items, i), java_map_inserter, jMap);
|
|
285
|
+
env->CallBooleanMethod(jList, midListAdd, jMap);
|
|
286
|
+
env->DeleteLocalRef(jMap);
|
|
287
|
+
}
|
|
288
|
+
return jList;
|
|
289
|
+
}
|
|
290
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
291
|
+
|
|
292
|
+
RHO_GLOBAL jobject JNICALL Java_com_rhomobile_rhoconnect_RhomModel_findBySqlByName
|
|
293
|
+
(JNIEnv * env, jclass, jstring jModelName, jstring jQuery, jobjectArray jParams)
|
|
294
|
+
{
|
|
295
|
+
std::string name = rho_cast<std::string>(env, jModelName);
|
|
296
|
+
|
|
297
|
+
LOG(TRACE) + "findBySqlByName: " + name;
|
|
298
|
+
|
|
299
|
+
std::string query = rho_cast<std::string>(env, jQuery);
|
|
300
|
+
std::auto_ptr<rho::Vector<std::string> > params = (jParams != NULL)
|
|
301
|
+
? rho_cast<std::auto_ptr<rho::Vector<std::string> > >(env, jParams)
|
|
302
|
+
: std::auto_ptr<rho::Vector<std::string> >(0);
|
|
303
|
+
|
|
304
|
+
unsigned long items = rho_connectclient_findbysql(name.c_str(), query.c_str(), reinterpret_cast<unsigned long>(params.get()));
|
|
305
|
+
|
|
306
|
+
jclass& jListClass = getJNIClass(RHODES_JAVA_CLASS_ARRAYLIST);
|
|
307
|
+
if (!jListClass) return 0;
|
|
308
|
+
static jmethodID midList = getJNIClassMethod(env, jListClass, "<init>", "()V");
|
|
309
|
+
if (!midList) return 0;
|
|
310
|
+
static jmethodID midListAdd = getJNIClassMethod(env, jListClass, "add", "(Ljava/lang/Object;)Z");
|
|
311
|
+
if (!midList) return 0;
|
|
312
|
+
|
|
313
|
+
jclass& jMapClass = getJNIClass(RHODES_JAVA_CLASS_HASHMAP);
|
|
314
|
+
if (!jMapClass) return 0;
|
|
315
|
+
static jmethodID midHashMap = getJNIClassMethod(env, jMapClass, "<init>", "()V");
|
|
316
|
+
if (!midHashMap) return 0;
|
|
317
|
+
|
|
318
|
+
jobject jList = env->NewObject(jListClass, midList);
|
|
319
|
+
|
|
320
|
+
int cnt = rho_connectclient_strhasharray_size(items);
|
|
321
|
+
for(int i = 0; i < cnt; ++i)
|
|
322
|
+
{
|
|
323
|
+
jobject jMap = env->NewObject(jMapClass, midHashMap);
|
|
324
|
+
rho_connectclient_hash_enumerate(rho_connectclient_strhasharray_get(items, i), java_map_inserter, jMap);
|
|
325
|
+
env->CallBooleanMethod(jList, midListAdd, jMap);
|
|
326
|
+
env->DeleteLocalRef(jMap);
|
|
327
|
+
}
|
|
328
|
+
return jList;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
332
|
+
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/*------------------------------------------------------------------------
|
|
2
|
+
* (The MIT License)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2008-2011 Rhomobile, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
* THE SOFTWARE.
|
|
23
|
+
*
|
|
24
|
+
* http://rhomobile.com
|
|
25
|
+
|
|
26
|
+
* Copyright (c) 2011-2016 Symbol Technologies, Inc.
|
|
27
|
+
*
|
|
28
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
29
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
30
|
+
* in the Software without restriction, including without limitation the rights
|
|
31
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
32
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
33
|
+
* furnished to do so, subject to the following conditions:
|
|
34
|
+
*
|
|
35
|
+
* The above copyright notice and this permission notice shall be included in
|
|
36
|
+
* all copies or substantial portions of the Software.
|
|
37
|
+
*
|
|
38
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
39
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
40
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
41
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
42
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
43
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
44
|
+
* THE SOFTWARE.
|
|
45
|
+
*
|
|
46
|
+
* http://symbol.com
|
|
47
|
+
*------------------------------------------------------------------------*/
|
|
48
|
+
|
|
49
|
+
#include "rhodes/JNIRhodes.h"
|
|
50
|
+
#include "sync/SyncThread.h"
|
|
51
|
+
#include "RhoConnectClient/RhoConnectClient.h"
|
|
52
|
+
#include "logging/RhoLog.h"
|
|
53
|
+
|
|
54
|
+
#include "RhoConnectJniNotify.h"
|
|
55
|
+
|
|
56
|
+
namespace rho { namespace connect_jni {
|
|
57
|
+
|
|
58
|
+
jobject rhoconnect_jni_parsenotify(JNIEnv * env, const char* res)
|
|
59
|
+
{
|
|
60
|
+
LOG(TRACE) + "rhoconnect_jni_parsenotify: " + res;
|
|
61
|
+
|
|
62
|
+
RHO_CONNECT_NOTIFY notify;
|
|
63
|
+
memset(¬ify, 0, sizeof(notify));
|
|
64
|
+
|
|
65
|
+
rho_connectclient_parsenotify(res, ¬ify);
|
|
66
|
+
|
|
67
|
+
static jclass clsNotify = getJNIClass(RHOCONNECT_JAVA_CLASS_NOTIFY);
|
|
68
|
+
if (!clsNotify) return NULL;
|
|
69
|
+
|
|
70
|
+
static jmethodID midNotify = getJNIClassMethod(env, clsNotify, "<init>", "()V");
|
|
71
|
+
if (!midNotify) return NULL;
|
|
72
|
+
static jfieldID fidTotalCount = getJNIClassField(env, clsNotify, "mTotalCount", "I");
|
|
73
|
+
if (!fidTotalCount) return NULL;
|
|
74
|
+
static jfieldID fidProcCount = getJNIClassField(env, clsNotify, "mProcessedCount", "I");
|
|
75
|
+
if (!fidProcCount) return NULL;
|
|
76
|
+
static jfieldID fidCumulativeCount = getJNIClassField(env, clsNotify, "mCumulativeCount", "I");
|
|
77
|
+
if (!fidCumulativeCount) return NULL;
|
|
78
|
+
static jfieldID fidSrcId = getJNIClassField(env, clsNotify, "mSourceId", "I");
|
|
79
|
+
if (!fidSrcId) return NULL;
|
|
80
|
+
static jfieldID fidErrorCode = getJNIClassField(env, clsNotify, "mErrorCode", "I");
|
|
81
|
+
if (!fidErrorCode) return NULL;
|
|
82
|
+
static jfieldID fidSrcName = getJNIClassField(env, clsNotify, "mSourceName", "Ljava/lang/String;");
|
|
83
|
+
if (!fidSrcName) return NULL;
|
|
84
|
+
static jfieldID fidStatus = getJNIClassField(env, clsNotify, "mStatus", "Ljava/lang/String;");
|
|
85
|
+
if (!fidStatus) return NULL;
|
|
86
|
+
static jfieldID fidSyncType = getJNIClassField(env, clsNotify, "mSyncType", "Ljava/lang/String;");
|
|
87
|
+
if (!fidSyncType) return NULL;
|
|
88
|
+
static jfieldID fidErrMsg = getJNIClassField(env, clsNotify, "mErrorMessage", "Ljava/lang/String;");
|
|
89
|
+
if (!fidErrMsg) return NULL;
|
|
90
|
+
static jfieldID fidParams = getJNIClassField(env, clsNotify, "mParams", "Ljava/lang/String;");
|
|
91
|
+
if (!fidParams) return NULL;
|
|
92
|
+
|
|
93
|
+
jobject jNotify = env->NewObject(clsNotify, midNotify);
|
|
94
|
+
if (!jNotify) return NULL;
|
|
95
|
+
|
|
96
|
+
env->SetIntField(jNotify, fidTotalCount, notify.total_count);
|
|
97
|
+
env->SetIntField(jNotify, fidProcCount, notify.processed_count);
|
|
98
|
+
env->SetIntField(jNotify, fidCumulativeCount, notify.cumulative_count);
|
|
99
|
+
env->SetIntField(jNotify, fidSrcId, notify.source_id);
|
|
100
|
+
env->SetIntField(jNotify, fidErrorCode, notify.error_code);
|
|
101
|
+
|
|
102
|
+
jhstring jhSrcName = rho_cast<jhstring>(env, notify.source_name);
|
|
103
|
+
jhstring jhStatus = rho_cast<jhstring>(env, notify.status);
|
|
104
|
+
jhstring jhSyncType = rho_cast<jhstring>(env, notify.sync_type);
|
|
105
|
+
jhstring jhErrMsg = rho_cast<jhstring>(env, notify.error_message);
|
|
106
|
+
jhstring jhParams = rho_cast<jhstring>(env, notify.callback_params);
|
|
107
|
+
|
|
108
|
+
env->SetObjectField(jNotify, fidSrcName, jhSrcName.get());
|
|
109
|
+
env->SetObjectField(jNotify, fidStatus, jhStatus.get());
|
|
110
|
+
env->SetObjectField(jNotify, fidSyncType, jhSyncType.get());
|
|
111
|
+
env->SetObjectField(jNotify, fidErrMsg, jhErrMsg.get());
|
|
112
|
+
env->SetObjectField(jNotify, fidParams, jhParams.get());
|
|
113
|
+
|
|
114
|
+
rho_connectclient_free_syncnotify(¬ify);
|
|
115
|
+
|
|
116
|
+
return jNotify;
|
|
117
|
+
|
|
118
|
+
}
|
|
119
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
120
|
+
void rhoconnect_jni_fill_objectnotify(JNIEnv * env, jobject jNotify, int cnt, const char* const * objects, int* src_ids,
|
|
121
|
+
jfieldID fidObjects, jfieldID fidSrcIds)
|
|
122
|
+
{
|
|
123
|
+
static jclass clsString = getJNIClass(RHODES_JAVA_CLASS_STRING);
|
|
124
|
+
if (!clsString) return;
|
|
125
|
+
|
|
126
|
+
LOG(TRACE) + "rhoconnect_jni_fill_objectnotify: cnt: " + cnt + ", Java notify reference: " + (int)jNotify;
|
|
127
|
+
|
|
128
|
+
if(cnt > 0)
|
|
129
|
+
{
|
|
130
|
+
jobjectArray jObjects = env->NewObjectArray(cnt, clsString, NULL);
|
|
131
|
+
if (!jObjects) return;
|
|
132
|
+
jintArray jSrcIds = env->NewIntArray(cnt);
|
|
133
|
+
if (!jSrcIds) return;
|
|
134
|
+
|
|
135
|
+
for(int i = 0; i < cnt; ++i)
|
|
136
|
+
{
|
|
137
|
+
jhstring jhObject = rho_cast<jhstring>(env, objects[i]);
|
|
138
|
+
env->SetObjectArrayElement(jObjects, i, jhObject.release());
|
|
139
|
+
}
|
|
140
|
+
env->SetIntArrayRegion(jSrcIds, 0, cnt, src_ids);
|
|
141
|
+
|
|
142
|
+
env->SetObjectField(jNotify, fidObjects, jObjects);
|
|
143
|
+
env->SetObjectField(jNotify, fidSrcIds, jSrcIds);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
148
|
+
|
|
149
|
+
jobject rhoconnect_jni_parseobjectnotify(JNIEnv * env, const char* res)
|
|
150
|
+
{
|
|
151
|
+
LOG(TRACE) + "rhoconnect_jni_parseobjectnotify: " + res;
|
|
152
|
+
|
|
153
|
+
RHO_CONNECT_OBJECT_NOTIFY notify;
|
|
154
|
+
memset(¬ify, 0, sizeof(notify));
|
|
155
|
+
|
|
156
|
+
rho_connectclient_parse_objectnotify(res, ¬ify);
|
|
157
|
+
|
|
158
|
+
static jclass clsNotify = getJNIClass(RHOCONNECT_JAVA_CLASS_OBJECTNOTIFY);
|
|
159
|
+
if (!clsNotify) {
|
|
160
|
+
LOG(ERROR) + "Cannot get RhoConnectObjectNotify class";
|
|
161
|
+
return NULL;
|
|
162
|
+
}
|
|
163
|
+
static jmethodID midNotify = getJNIClassMethod(env, clsNotify, "<init>", "()V");
|
|
164
|
+
if (!midNotify) {
|
|
165
|
+
LOG(ERROR) + "Cannot get RhoConnectObjectNotify constructor method id";
|
|
166
|
+
return NULL;
|
|
167
|
+
}
|
|
168
|
+
static jfieldID fidDeletedObjects = getJNIClassField(env, clsNotify, "mDeletedObjects", "[Ljava/lang/String;");
|
|
169
|
+
if (!fidDeletedObjects) {
|
|
170
|
+
LOG(ERROR) + "Cannot get RhoConnectObjectNotify.mDeletedObjects field id";
|
|
171
|
+
return NULL;
|
|
172
|
+
}
|
|
173
|
+
static jfieldID fidUpdatedObjects = getJNIClassField(env, clsNotify, "mUpdatedObjects", "[Ljava/lang/String;");
|
|
174
|
+
if (!fidUpdatedObjects) {
|
|
175
|
+
LOG(ERROR) + "Cannot get RhoConnectObjectNotify.mUpdatedObjects field id";
|
|
176
|
+
return NULL;
|
|
177
|
+
}
|
|
178
|
+
static jfieldID fidCreatedObjects = getJNIClassField(env, clsNotify, "mCreatedObjects", "[Ljava/lang/String;");
|
|
179
|
+
if (!fidCreatedObjects) {
|
|
180
|
+
LOG(ERROR) + "Cannot get RhoConnectObjectNotify.mCreatedObjects field id";
|
|
181
|
+
return NULL;
|
|
182
|
+
}
|
|
183
|
+
static jfieldID fidDeletedIds = getJNIClassField(env, clsNotify, "mDeletedSrcIds", "[I");
|
|
184
|
+
if (!fidDeletedIds) {
|
|
185
|
+
LOG(ERROR) + "Cannot get RhoConnectObjectNotify.mDeletedSrcIds field id";
|
|
186
|
+
return NULL;
|
|
187
|
+
}
|
|
188
|
+
static jfieldID fidUpdatedIds = getJNIClassField(env, clsNotify, "mUpdatedSrcIds", "[I");
|
|
189
|
+
if (!fidUpdatedIds) {
|
|
190
|
+
LOG(ERROR) + "Cannot get RhoConnectObjectNotify.mUpdatedSrcIds field id";
|
|
191
|
+
return NULL;
|
|
192
|
+
}
|
|
193
|
+
static jfieldID fidCreatedIds = getJNIClassField(env, clsNotify, "mCreatedSrcIds", "[I");
|
|
194
|
+
if (!fidCreatedIds) {
|
|
195
|
+
LOG(ERROR) + "Cannot get RhoConnectObjectNotify.mCreatedSrcIds field id";
|
|
196
|
+
return NULL;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
jobject jNotify = env->NewObject(clsNotify, midNotify);
|
|
200
|
+
if (!jNotify) {
|
|
201
|
+
LOG(ERROR) + "Cannot create RhoConnectObjectNotify instance";
|
|
202
|
+
return NULL;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
rhoconnect_jni_fill_objectnotify(env, jNotify, notify.deleted_count,
|
|
206
|
+
notify.deleted_objects, notify.deleted_source_ids,
|
|
207
|
+
fidDeletedObjects, fidDeletedIds);
|
|
208
|
+
|
|
209
|
+
rhoconnect_jni_fill_objectnotify(env, jNotify, notify.updated_count,
|
|
210
|
+
notify.updated_objects, notify.updated_source_ids,
|
|
211
|
+
fidUpdatedObjects, fidUpdatedIds);
|
|
212
|
+
|
|
213
|
+
rhoconnect_jni_fill_objectnotify(env, jNotify, notify.created_count,
|
|
214
|
+
notify.created_objects, notify.created_source_ids,
|
|
215
|
+
fidCreatedObjects, fidCreatedIds);
|
|
216
|
+
|
|
217
|
+
rho_connectclient_free_sync_objectnotify(¬ify);
|
|
218
|
+
|
|
219
|
+
LOG(TRACE) + "Returning Java RhoConnectObjectNotify reference: " + (int)jNotify;
|
|
220
|
+
return jNotify;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
}}
|