rhoconnect-client 5.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (270) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +9 -0
  3. data/CREDITS +0 -0
  4. data/LICENSE +9 -0
  5. data/README.md +47 -0
  6. data/ext/rhoconnect-client/RhoConnectClient.rb +190 -0
  7. data/ext/rhoconnect-client/ext/RhoConnectClient.xml +726 -0
  8. data/ext/rhoconnect-client/ext/build +26 -0
  9. data/ext/rhoconnect-client/ext/build.bat +30 -0
  10. data/ext/rhoconnect-client/ext/platform/android/ext_java.files +1 -0
  11. data/ext/rhoconnect-client/ext/platform/android/ext_native.files +14 -0
  12. data/ext/rhoconnect-client/ext/platform/android/src/com/rhoconnectclient/RhoconnectClient.java +1 -0
  13. data/ext/rhoconnect-client/ext/platform/iphone/.gitignore +1 -0
  14. data/ext/rhoconnect-client/ext/platform/iphone/Rakefile +74 -0
  15. data/ext/rhoconnect-client/ext/platform/iphone/RhoconnectClient.xcodeproj/project.pbxproj +390 -0
  16. data/ext/rhoconnect-client/ext/platform/iphone/RhoconnectClient_Prefix.pch +7 -0
  17. data/ext/rhoconnect-client/ext/platform/iphone/impl/readme.txt +7 -0
  18. data/ext/rhoconnect-client/ext/platform/qt/Rakefile +35 -0
  19. data/ext/rhoconnect-client/ext/platform/qt/rhoconnect-client.pro +88 -0
  20. data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.sln +36 -0
  21. data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.vcproj +774 -0
  22. data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.vsprops +15 -0
  23. data/ext/rhoconnect-client/ext/platform/wm/src/rhoconnectclient_wm.cpp +40 -0
  24. data/ext/rhoconnect-client/ext/platform/wm/src/rhoconnectclient_wm.h +2 -0
  25. data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.props +22 -0
  26. data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.sln +32 -0
  27. data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.vcxproj +220 -0
  28. data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.vcxproj.filters +103 -0
  29. data/ext/rhoconnect-client/ext/shared/RhoConnectClientImpl.cpp +273 -0
  30. data/ext/rhoconnect-client/ext/shared/RhoConnectClientImpl.h +60 -0
  31. data/ext/rhoconnect-client/ext/shared/RhoConnectClientSingletonImpl.h +53 -0
  32. data/ext/rhoconnect-client/ext/shared/initRhoconnectClient.cpp +207 -0
  33. data/ext/rhoconnect-client/ext/shared/rhoconnectclient.c +18 -0
  34. data/ext/rhoconnect-client/ext/shared/sync/ClientRegister.cpp +398 -0
  35. data/ext/rhoconnect-client/ext/shared/sync/ClientRegister.h +147 -0
  36. data/ext/rhoconnect-client/ext/shared/sync/ISyncProtocol.h +91 -0
  37. data/ext/rhoconnect-client/ext/shared/sync/SyncEngine.cpp +1245 -0
  38. data/ext/rhoconnect-client/ext/shared/sync/SyncEngine.h +213 -0
  39. data/ext/rhoconnect-client/ext/shared/sync/SyncNotify.cpp +737 -0
  40. data/ext/rhoconnect-client/ext/shared/sync/SyncNotify.h +209 -0
  41. data/ext/rhoconnect-client/ext/shared/sync/SyncProtocol_3.h +220 -0
  42. data/ext/rhoconnect-client/ext/shared/sync/SyncProtocol_4.h +259 -0
  43. data/ext/rhoconnect-client/ext/shared/sync/SyncSource.cpp +1694 -0
  44. data/ext/rhoconnect-client/ext/shared/sync/SyncSource.h +212 -0
  45. data/ext/rhoconnect-client/ext/shared/sync/SyncThread.cpp +583 -0
  46. data/ext/rhoconnect-client/ext/shared/sync/SyncThread.h +250 -0
  47. data/ext/rhoconnect-client/ext.yml +12 -0
  48. data/lib/build/run_rhoconnect_spec.rb +135 -0
  49. data/lib/rhoconnect-client.rb +3 -0
  50. data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1673 -0
  51. data/platform/shared/RhoConnectClient/RhoConnectClient.h +181 -0
  52. data/platform/shared/RhoConnectClient/RhoError.h +77 -0
  53. data/rhoconnect-client/C++/Tests/RhoConnectClientTest.cpp +830 -0
  54. data/rhoconnect-client/C++/Tests/win32/.gitignore +3 -0
  55. data/rhoconnect-client/C++/Tests/win32/RhoConnectClient.sln +65 -0
  56. data/rhoconnect-client/C++/Tests/win32/RhoConnectClient.vcproj +634 -0
  57. data/rhoconnect-client/C++/Tests/win32/RhoConnectClientTest/RhoConnectClientTest.vcproj +222 -0
  58. data/rhoconnect-client/C++/Tests/win32/RhoConnectClientTest/stdafx.h +65 -0
  59. data/rhoconnect-client/C++/Tests/win32/stdafx.h +65 -0
  60. data/rhoconnect-client/CHANGELOG +18 -0
  61. data/rhoconnect-client/Java/Android/build/android.rake +387 -0
  62. data/rhoconnect-client/Java/Android/build/android_sdk.rb +582 -0
  63. data/rhoconnect-client/Java/Android/build/libcurl_build.files +73 -0
  64. data/rhoconnect-client/Java/Android/build/libjson_build.files +9 -0
  65. data/rhoconnect-client/Java/Android/build/librhocommon_build.files +14 -0
  66. data/rhoconnect-client/Java/Android/build/librhodb_build.files +5 -0
  67. data/rhoconnect-client/Java/Android/build/librhoimpl_build.files +13 -0
  68. data/rhoconnect-client/Java/Android/build/librholog_build.files +4 -0
  69. data/rhoconnect-client/Java/Android/build/libsqlite_build.files +1 -0
  70. data/rhoconnect-client/Java/Android/build/libsync_build.files +7 -0
  71. data/rhoconnect-client/Java/Android/build/libunzip_build.files +1 -0
  72. data/rhoconnect-client/Java/Android/build/rhoconnectclient_build.files +3 -0
  73. data/rhoconnect-client/Java/Android/build/rhoimpljava_build.files +21 -0
  74. data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/Capabilities.java +63 -0
  75. data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/MemoryInfoCollector.java +79 -0
  76. data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/util/ContextFactory.java +63 -0
  77. data/rhoconnect-client/Java/Android/test/.classpath +9 -0
  78. data/rhoconnect-client/Java/Android/test/.project +33 -0
  79. data/rhoconnect-client/Java/Android/test/AndroidManifest.xml +14 -0
  80. data/rhoconnect-client/Java/Android/test/assets/apps/androidtest.png +0 -0
  81. data/rhoconnect-client/Java/Android/test/assets/apps/rhoconfig.txt +19 -0
  82. data/rhoconnect-client/Java/Android/test/assets/apps/rhoconfig.txt.timestamp +1 -0
  83. data/rhoconnect-client/Java/Android/test/assets/db/syncdb.schema +44 -0
  84. data/rhoconnect-client/Java/Android/test/assets/db/syncdb.triggers +10 -0
  85. data/rhoconnect-client/Java/Android/test/assets/db/syncdb_java.triggers +21 -0
  86. data/rhoconnect-client/Java/Android/test/assets/rho.dat +9 -0
  87. data/rhoconnect-client/Java/Android/test/proguard.cfg +36 -0
  88. data/rhoconnect-client/Java/Android/test/project.properties +11 -0
  89. data/rhoconnect-client/Java/Android/test/res/drawable-hdpi/icon.png +0 -0
  90. data/rhoconnect-client/Java/Android/test/res/drawable-ldpi/icon.png +0 -0
  91. data/rhoconnect-client/Java/Android/test/res/drawable-mdpi/icon.png +0 -0
  92. data/rhoconnect-client/Java/Android/test/res/layout/main.xml +12 -0
  93. data/rhoconnect-client/Java/Android/test/res/values/strings.xml +5 -0
  94. data/rhoconnect-client/Java/Android/test/rhoimpl.jar +0 -0
  95. data/rhoconnect-client/Java/Android/test/src/com/rhomobile/rhoconnect_client_test/TestRhoConnectClient.java +343 -0
  96. data/rhoconnect-client/Java/Android/test/src/com/rhomobile/rhoconnect_client_test/TestRhoConnectClientBlobs.java +219 -0
  97. data/rhoconnect-client/Java/RhoConnect/.classpath +6 -0
  98. data/rhoconnect-client/Java/RhoConnect/.project +93 -0
  99. data/rhoconnect-client/Java/RhoConnect/assets/apps/rhoconfig.txt +19 -0
  100. data/rhoconnect-client/Java/RhoConnect/assets/apps/rhoconfig.txt.timestamp +1 -0
  101. data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb.schema +44 -0
  102. data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb.triggers +10 -0
  103. data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb_java.triggers +21 -0
  104. data/rhoconnect-client/Java/RhoConnect/assets/rho.dat +8 -0
  105. data/rhoconnect-client/Java/RhoConnect/jni/include/RhoConnectJniNotify.h +61 -0
  106. data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectClient.h +181 -0
  107. data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectNotify.h +13 -0
  108. data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectNotify_IDelegate.h +13 -0
  109. data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectObjectNotify.h +13 -0
  110. data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectObjectNotify_IDelegate.h +13 -0
  111. data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhomModel.h +103 -0
  112. data/rhoconnect-client/Java/RhoConnect/jni/include/rhojava.inc +76 -0
  113. data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniClient.cpp +401 -0
  114. data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniModel.cpp +332 -0
  115. data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniNotify.cpp +223 -0
  116. data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectUtil.cpp +82 -0
  117. data/rhoconnect-client/Java/RhoConnect/jni/src/RhodesApp.cpp +114 -0
  118. data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectClient.java +108 -0
  119. data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectNotify.java +78 -0
  120. data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectObjectNotify.java +71 -0
  121. data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhomModel.java +195 -0
  122. data/rhoconnect-client/JavaScript/.classpath +10 -0
  123. data/rhoconnect-client/JavaScript/.gitignore +4 -0
  124. data/rhoconnect-client/JavaScript/.project +17 -0
  125. data/rhoconnect-client/JavaScript/README.textile +1 -0
  126. data/rhoconnect-client/JavaScript/build.xml +185 -0
  127. data/rhoconnect-client/JavaScript/doc/fsm-sample.js +44 -0
  128. data/rhoconnect-client/JavaScript/doc/fsm-sample.png +0 -0
  129. data/rhoconnect-client/JavaScript/src/RhoSyncJS.gwt.xml +21 -0
  130. data/rhoconnect-client/JavaScript/stubs/RhoSyncStubsJS.gwt.xml +21 -0
  131. data/rhoconnect-client/JavaScript/stubs/com/rho/Capabilities.java +7 -0
  132. data/rhoconnect-client/JavaScript/stubs/com/rho/IRhoRubyHelper.java +7 -0
  133. data/rhoconnect-client/JavaScript/stubs/com/rho/Mutex.java +5 -0
  134. data/rhoconnect-client/JavaScript/stubs/com/rho/RhoAppAdapter.java +39 -0
  135. data/rhoconnect-client/JavaScript/stubs/com/rho/RhoClassFactory.java +29 -0
  136. data/rhoconnect-client/JavaScript/stubs/com/rho/RhoConf.java +100 -0
  137. data/rhoconnect-client/JavaScript/stubs/com/rho/RhoEmptyLogger.java +7 -0
  138. data/rhoconnect-client/JavaScript/stubs/com/rho/RhoEmptyProfiler.java +5 -0
  139. data/rhoconnect-client/JavaScript/stubs/com/rho/RhoLogger.java +32 -0
  140. data/rhoconnect-client/JavaScript/stubs/com/rho/RhoProfiler.java +27 -0
  141. data/rhoconnect-client/JavaScript/stubs/com/rho/RhodesApp.java +25 -0
  142. data/rhoconnect-client/JavaScript/stubs/com/rho/TimeInterval.java +22 -0
  143. data/rhoconnect-client/JavaScript/stubs/com/rho/Tokenizer.java +23 -0
  144. data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBAdapter.java +174 -0
  145. data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBAttrManager.java +15 -0
  146. data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBException.java +5 -0
  147. data/rhoconnect-client/JavaScript/stubs/com/rho/db/IDBResult.java +27 -0
  148. data/rhoconnect-client/JavaScript/stubs/com/rho/file/IFileAccess.java +7 -0
  149. data/rhoconnect-client/JavaScript/stubs/com/rho/file/SimpleFile.java +15 -0
  150. data/rhoconnect-client/JavaScript/stubs/com/rho/net/IHttpConnection.java +22 -0
  151. data/rhoconnect-client/JavaScript/stubs/com/rho/net/NetRequest.java +324 -0
  152. data/rhoconnect-client/JavaScript/stubs/com/rho/net/NetResponse.java +51 -0
  153. data/rhoconnect-client/JavaScript/stubs/com/rho/net/URI.java +64 -0
  154. data/rhoconnect-client/JavaScript/stubs/com/rho/sync/ClientRegister.java +15 -0
  155. data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONArrayIterator.java +37 -0
  156. data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONEntry.java +48 -0
  157. data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONStructIterator.java +41 -0
  158. data/rhoconnect-client/JavaScript/stubs/com/rho/sync/SyncNotify.java +98 -0
  159. data/rhoconnect-client/JavaScript/stubs/com/rho/sync/SyncThread.java +92 -0
  160. data/rhoconnect-client/JavaScript/war/WEB-INF/lib/gwt-servlet-deps.jar +0 -0
  161. data/rhoconnect-client/JavaScript/war/WEB-INF/lib/gwt-servlet.jar +0 -0
  162. data/rhoconnect-client/JavaScript/war/js/fsm-sample.js +54 -0
  163. data/rhoconnect-client/JavaScript/war/js/rhosync-api.js +237 -0
  164. data/rhoconnect-client/JavaScript/war/js/rhosync-fsm.js +307 -0
  165. data/rhoconnect-client/JavaScript/war/rhosyncjs/4C71D69C9BBC9E6F05C6BA49B01BCBC1.cache.html +3122 -0
  166. data/rhoconnect-client/JavaScript/war/rhosyncjs/5146F4FFF34511C8BB2661E920B49E3A.cache.html +3254 -0
  167. data/rhoconnect-client/JavaScript/war/rhosyncjs/5248C67481D9D27AD0703D15CDBD2A1C.cache.html +3147 -0
  168. data/rhoconnect-client/JavaScript/war/rhosyncjs/EE1DC2692C9C32367B53A39E2358AF23.cache.html +3195 -0
  169. data/rhoconnect-client/JavaScript/war/rhosyncjs/clear.cache.gif +0 -0
  170. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/corner.png +0 -0
  171. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/corner_ie6.png +0 -0
  172. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/hborder.png +0 -0
  173. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/hborder_ie6.png +0 -0
  174. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/corner_dialog_topleft.png +0 -0
  175. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/corner_dialog_topright.png +0 -0
  176. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/hborder_blue_shadow.png +0 -0
  177. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/hborder_gray_shadow.png +0 -0
  178. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/vborder_blue_shadow.png +0 -0
  179. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/vborder_gray_shadow.png +0 -0
  180. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/splitPanelThumb.png +0 -0
  181. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/vborder.png +0 -0
  182. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/vborder_ie6.png +0 -0
  183. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/standard.css +1144 -0
  184. data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/standard_rtl.css +1145 -0
  185. data/rhoconnect-client/JavaScript/war/rhosyncjs/hosted.html +350 -0
  186. data/rhoconnect-client/JavaScript/war/rhosyncjs/rhosyncjs.nocache.js +314 -0
  187. data/rhoconnect-client/JavaScript/war/test/SpecRunner.html +35 -0
  188. data/rhoconnect-client/JavaScript/war/test/dbtest.html +38 -0
  189. data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/MIT.LICENSE +20 -0
  190. data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine-html.js +188 -0
  191. data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine.css +166 -0
  192. data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine.js +2421 -0
  193. data/rhoconnect-client/JavaScript/war/test/spec/SpecHelper.js +7 -0
  194. data/rhoconnect-client/JavaScript/war/test/spec/SyncApiSpec.js +573 -0
  195. data/rhoconnect-client/JavaScript/war/test/spec/samples/PlayerSpec.js +58 -0
  196. data/rhoconnect-client/JavaScript/war/test/worker-test.js +17 -0
  197. data/rhoconnect-client/LICENSE +41 -0
  198. data/rhoconnect-client/ObjectiveC/RhoConnectClient.h +118 -0
  199. data/rhoconnect-client/ObjectiveC/RhoConnectClient.m +641 -0
  200. data/rhoconnect-client/ObjectiveC/RhoConnectClient.xcodeproj/project.pbxproj +1434 -0
  201. data/rhoconnect-client/ObjectiveC/RhoConnectNotify.h +83 -0
  202. data/rhoconnect-client/ObjectiveC/RhoConnectNotify.m +181 -0
  203. data/rhoconnect-client/ObjectiveC/RhoConnectObjectNotify.h +65 -0
  204. data/rhoconnect-client/ObjectiveC/RhoConnectObjectNotify.m +73 -0
  205. data/rhoconnect-client/ObjectiveC/RhomModel.h +101 -0
  206. data/rhoconnect-client/ObjectiveC/RhomModel.m +320 -0
  207. data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/MainWindow.xib +198 -0
  208. data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest-Info.plist +30 -0
  209. data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest.xcodeproj/project.pbxproj +373 -0
  210. data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTestAppDelegate.h +58 -0
  211. data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTestAppDelegate.m +84 -0
  212. data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest_Prefix.pch +8 -0
  213. data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/invalid_import_db.zip +0 -0
  214. data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/main.m +1096 -0
  215. data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/test.png +0 -0
  216. data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/test2.png +0 -0
  217. data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/valid_import_db.zip +0 -0
  218. data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsAppDelegate.h +62 -0
  219. data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsAppDelegate.m +35 -0
  220. data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsViewController.h +78 -0
  221. data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsViewController.m +549 -0
  222. data/rhoconnect-client/ObjectiveC/Tests/ptests/MainWindow.xib +227 -0
  223. data/rhoconnect-client/ObjectiveC/Tests/ptests/main.m +17 -0
  224. data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests-Info.plist +30 -0
  225. data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests.xcodeproj/project.pbxproj +363 -0
  226. data/rhoconnect-client/ObjectiveC/Tests/ptests/ptestsViewController.xib +641 -0
  227. data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests_Prefix.pch +8 -0
  228. data/rhoconnect-client/README.textile +23 -0
  229. data/rhoconnect-client/Rakefile +20 -0
  230. data/rhoconnect-client/Samples/Java/android_store/.classpath +8 -0
  231. data/rhoconnect-client/Samples/Java/android_store/.project +33 -0
  232. data/rhoconnect-client/Samples/Java/android_store/AndroidManifest.xml +24 -0
  233. data/rhoconnect-client/Samples/Java/android_store/assets/apps/rhoconfig.txt +19 -0
  234. data/rhoconnect-client/Samples/Java/android_store/assets/apps/rhoconfig.txt.timestamp +1 -0
  235. data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb.schema +44 -0
  236. data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb.triggers +10 -0
  237. data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb_java.triggers +21 -0
  238. data/rhoconnect-client/Samples/Java/android_store/assets/rho.dat +8 -0
  239. data/rhoconnect-client/Samples/Java/android_store/default.properties +11 -0
  240. data/rhoconnect-client/Samples/Java/android_store/project.properties +14 -0
  241. data/rhoconnect-client/Samples/Java/android_store/res/drawable-hdpi/icon.png +0 -0
  242. data/rhoconnect-client/Samples/Java/android_store/res/drawable-ldpi/icon.png +0 -0
  243. data/rhoconnect-client/Samples/Java/android_store/res/drawable-mdpi/icon.png +0 -0
  244. data/rhoconnect-client/Samples/Java/android_store/res/layout/main.xml +12 -0
  245. data/rhoconnect-client/Samples/Java/android_store/res/values/strings.xml +5 -0
  246. data/rhoconnect-client/Samples/Java/android_store/rhoimpl.jar +0 -0
  247. data/rhoconnect-client/Samples/Java/android_store/src/com/rhomobile/android_store/StoreActivity.java +68 -0
  248. data/rhoconnect-client/Samples/Java/android_store/src/com/rhomobile/android_store/StoreApplication.java +15 -0
  249. data/rhoconnect-client/Samples/ObjectiveC/store/Classes/LoginViewController.h +70 -0
  250. data/rhoconnect-client/Samples/ObjectiveC/store/Classes/LoginViewController.m +94 -0
  251. data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RhoConnectEngine.h +82 -0
  252. data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RhoConnectEngine.m +119 -0
  253. data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RootViewController.h +63 -0
  254. data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RootViewController.m +314 -0
  255. data/rhoconnect-client/Samples/ObjectiveC/store/Classes/WaitLoginController.h +65 -0
  256. data/rhoconnect-client/Samples/ObjectiveC/store/Classes/WaitLoginController.m +110 -0
  257. data/rhoconnect-client/Samples/ObjectiveC/store/Classes/storeAppDelegate.h +61 -0
  258. data/rhoconnect-client/Samples/ObjectiveC/store/Classes/storeAppDelegate.m +171 -0
  259. data/rhoconnect-client/Samples/ObjectiveC/store/LoginViewController.xib +779 -0
  260. data/rhoconnect-client/Samples/ObjectiveC/store/MainWindow.xib +580 -0
  261. data/rhoconnect-client/Samples/ObjectiveC/store/RootViewController.xib +384 -0
  262. data/rhoconnect-client/Samples/ObjectiveC/store/WaitLoginController.xib +557 -0
  263. data/rhoconnect-client/Samples/ObjectiveC/store/icon.png +0 -0
  264. data/rhoconnect-client/Samples/ObjectiveC/store/main.m +22 -0
  265. data/rhoconnect-client/Samples/ObjectiveC/store/store-Info.plist +30 -0
  266. data/rhoconnect-client/Samples/ObjectiveC/store/store.xcodeproj/project.pbxproj +367 -0
  267. data/rhoconnect-client/Samples/ObjectiveC/store/store_Prefix.pch +14 -0
  268. data/rhoconnect-client/build.yml +3 -0
  269. data/rhoconnect-client/version +1 -0
  270. metadata +314 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 838632de1564e3e6a30b6336a52de80b5492a70a
4
+ data.tar.gz: d25322b15be0e7a31d2db56a4095487c2a6d93f2
5
+ SHA512:
6
+ metadata.gz: 8f11ecb7cad1484ae3087ac43979e7aac3aec8fb377da5dca144882b090ddb311b1727c0d33491354e4c9c213f7d09c19ba64e96ae944964c4afd922f7ac574b
7
+ data.tar.gz: b5fa10e33f586906ed98e3ce002d859e6ca2dd3793d373a966bf78d434427d4b8a137ec6a0223ff20d47cb9ff98980290ad0ae27742f40a3e206405d36541268
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ ## 4.1.0 (not released yet)
2
+ * #57824836 "Cannot consistently raise exception in JS adapter" - bug fix
3
+ * #58672208 Bug fix "Pass_through models aren't deleting previous records before syncing" (port from v4.0.0)
4
+
5
+ ## 4.0.0.beta.55 (2013-08-08)
6
+ * Recommended code for handling "Unknown Client" error is broken - remove URL encode
7
+
8
+ ## 4.0.0.beta.1 (2013-01-23)
9
+ * introduced 'rhoconnect-client' as separate part of RMS.
data/CREDITS ADDED
File without changes
data/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2008-2010 Rhomobile, Inc.
3
+ Copyright (c) 2011-2016 Symbol Technologies LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ rhoconnect-client
2
+ =================
3
+
4
+ This repo contains code for Rhodes 'rhoconnect-client' extension and any standalone Rhoconnect clients. For more info on Rhoconnect clients refer to:
5
+ http://docs.rhomobile.com/rhodes/synchronization
6
+ http://docs.rhomobile.com/rhoconnect/client
7
+
8
+ ##Building gem
9
+
10
+ To use latest code from github repo you will need to build and install rhoconnect-client gem.
11
+
12
+ First you will need to set up paths to the Rhodes and Rhoconnect folders. To do this, copy 'config.yml.sample' to 'config.yml' and edit it with the path to your rhodes and rhoconnect workspaces.
13
+
14
+ To build gem run `rake gem:make_gem` command from repo root. Gem file will be created in the same folder. Install it using `gem install ./rhoconnect-client-<version>.gem`
15
+
16
+ ##Creating Rhodes application that uses Rhoconnect client
17
+
18
+ Rhodes application needs to use 'rhoconnect-client' extension to utilize API for data synchronization. By default "rhoconnect-client" extension in included in newly generated Rhodes application. You can also specify it in "extensions" section of build.yml file for your application.
19
+
20
+ For documetation how to create Rhodes applications please refer to
21
+ http://docs.rhomobile.com/rhodes/generator
22
+
23
+ API is documented here:
24
+ http://docs.rhomobile.com/rhodes/synchronization
25
+
26
+ ##Creating native applications that uses Rhoconnect client.
27
+
28
+ This repo contains rhoconnect-client library that can be used by your native application for iOS or Android. For documentation on how to use clients for native applications please refer to
29
+ http://docs.rhomobile.com/rhoconnect/client
30
+
31
+ ##Running specs
32
+
33
+ Copy `config.yml.sample` to `config.yml` and edit it with the path to your rhodes and rhoconnect workspaces.
34
+ Use the following tasks to run specs on respective platform:
35
+
36
+ Ruby:
37
+ * `rake run:android:rhoconnect_spec`
38
+ * `rake run:iphone:rhoconnect_spec`
39
+ * `rake run:win32:rhoconnect_spec`
40
+
41
+ JavaScript
42
+ * `rake run:android:rhoconnect_spec_js`
43
+ * `rake run:iphone:rhoconnect_spec_js`
44
+ * `rake run:win32:rhoconnect_spec_js`
45
+
46
+
47
+ **NOTE: The test server, http://rhostore.herokuapp.com, that is used by these tests is reset every hour. Therefore you may see failures if you run tests exactly at the top of the hour.**
@@ -0,0 +1,190 @@
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
+ #require 'time'
50
+ =begin
51
+ require 'rho/render'
52
+ require 'rho/rhoapplication'
53
+ require 'rhom'
54
+ require 'rhofsconnector'
55
+ require 'rho/rhoerror'
56
+ require 'rhom/rhom_source'
57
+ =end
58
+
59
+
60
+ module Rho
61
+
62
+ class RhoConnectClient
63
+ =begin
64
+ def self.get_user_name
65
+ Rho::RhoConfig.rho_sync_user
66
+ end
67
+ =end
68
+ def self.on_sync_create_error( src_name, objects, action )
69
+ raise ArgumentError, 'on_sync_create_error src_name should be string' unless src_name.is_a?(String)
70
+
71
+ Object.const_get(src_name).on_sync_create_error(objects, action)
72
+ end
73
+
74
+ def self.push_changes( src_name )
75
+ raise ArgumentError, 'push_changes src_name should be string' unless src_name.is_a?(String)
76
+
77
+ Object.const_get(src_name).push_changes()
78
+ end
79
+
80
+ def self.on_sync_update_error( src_name, objects, action, rollback_data = nil )
81
+ raise ArgumentError, 'on_sync_update_error src_name should be string' unless src_name.is_a?(String)
82
+
83
+ Object.const_get(src_name).on_sync_update_error(objects, action, rollback_data)
84
+ end
85
+
86
+ def self.on_sync_delete_error( src_name, objects, action )
87
+ raise ArgumentError, 'on_sync_delete_error src_name should be string' unless src_name.is_a?(String)
88
+
89
+ Object.const_get(src_name).on_sync_delete_error(objects, action)
90
+ end
91
+
92
+ def self.getSourceNameById( sourceId )
93
+ if -1 == sourceId
94
+ return '*'
95
+ else
96
+ Rho::RhoConfig::sources.values.each do |src|
97
+ if src['source_id'] == sourceId
98
+ return src['name']
99
+ end
100
+ end
101
+ end
102
+
103
+ nil
104
+ end
105
+
106
+
107
+
108
+ # vvv DEPRECATED vvv
109
+
110
+
111
+ def self.set_threaded_mode( threaded )
112
+ RhoConnectClient.threadedMode = threaded
113
+ end
114
+
115
+ def self.set_ssl_verify_peer( verify )
116
+ RhoConnectClient.sslVerifyPeer = verify
117
+ end
118
+
119
+ def self.set_pollinterval( interval )
120
+ ret = RhoConnectClient.pollInterval
121
+ RhoConnectClient.pollInterval = interval
122
+ ret
123
+ end
124
+
125
+ def self.get_pollinterval()
126
+ RhoConnectClient.pollInterval
127
+ end
128
+
129
+ def self.set_syncserver(url)
130
+ RhoConnectClient.syncServer = url
131
+ end
132
+
133
+ def self.set_pagesize(size)
134
+ RhoConnectClient.pageSize = size
135
+ end
136
+
137
+ def self.get_pagesize
138
+ RhoConnectClient.pageSize
139
+ end
140
+
141
+ def self.enable_status_popup(enable)
142
+ RhoConnectClient.showStatusPopup = enable
143
+ end
144
+
145
+ def self.dosync_source(source,show_status_popup=0,query_params="")
146
+ src = source
147
+ if source.is_a?(Integer) then
148
+ src = RhoConnectClient.getSourceNameById(source)
149
+ end
150
+ RhoConnectClient.doSyncSource(src,show_status_popup!=0,query_params)
151
+ end
152
+
153
+ def self.set_notification(source,callback,callback_param)
154
+ RhoConnectClient.setNotification( RhoConnectClient.getSourceNameById(source), callback, callback_param )
155
+ end
156
+
157
+ def self.clear_notification(source)
158
+ RhoConnectClient.clearNotification( RhoConnectClient.getSourceNameById(source) )
159
+ end
160
+
161
+ def self.add_objectnotify(source,object)
162
+ RhoConnectClient.addObjectNotify( RhoConnectClient.getSourceNameById(source), object )
163
+ end
164
+
165
+ def self.get_lastsync_objectcount(source)
166
+ RhoConnectClient.getLastSyncObjectCount( RhoConnectClient.getSourceNameById( source ) )
167
+ end
168
+
169
+ def self.set_source_property(source,propertyName,propertyValue)
170
+ RhoConnectClient.setSourceProperty( RhoConnectClient.getSourceNameById(source), propertyName, propertyValue )
171
+ end
172
+
173
+ def self.get_source_property(source,propertyName)
174
+ RhoConnectClient.getSourceProperty( RhoConnectClient.getSourceNameById(source), propertyName )
175
+ end
176
+
177
+ def self.logged_in
178
+ RhoConnectClient.isLoggedIn()? 1 : 0
179
+ end
180
+
181
+ def self.is_syncing
182
+ RhoConnectClient.isSyncing()? 1 : 0
183
+ end
184
+
185
+ def self.set_objectnotify_url(url)
186
+ RhoConnectClient.setObjectNotification(url)
187
+ end
188
+ end
189
+
190
+ end
@@ -0,0 +1,726 @@
1
+ <?xml version = "1.0"?>
2
+ <?xml-stylesheet type="text/xsl" href="pb_help.xsl"?>
3
+ <API>
4
+ <MODULE name="RhoConnectClient" parent="Rho" generateUnderscoreRubyNames="true" productException="eb">
5
+ <HELP_OVERVIEW>RhoConnectClient is used for synchronization with RhoConnect applications.
6
+ ## Enabling the API
7
+ In order to use this API you must include the following extension in your `build.yml`
8
+ :::ruby
9
+ extensions: ["rhoconnect-client"]
10
+
11
+ ## JavaScript Usage
12
+ Be sure to review the [JavaScript API Usage](/guide/api_js) guide for important information about using this API in JavaScript
13
+
14
+ ## Ruby Usage
15
+ Be sure to review the [Ruby API Usage](/guide/api_ruby) guide for important information about using this API in Ruby
16
+ </HELP_OVERVIEW>
17
+
18
+ <ALIASES>
19
+ <ALIAS new="SyncEngine" existing="Rho.RhoConnectClient" deprecated="true"/>
20
+ </ALIASES>
21
+
22
+ <PROPERTIES access="STATIC">
23
+ <DESC>These properties are used to configure RhoConnectClient global behavior or retrieving current configuration parameters.</DESC>
24
+
25
+ <PROPERTY name="userName" type="STRING" readOnly="true">
26
+ <DESC>Current username of the RhoConnectClient session if isLoggedIn is true, otherwise returns the last logged in username.</DESC>
27
+ </PROPERTY>
28
+
29
+ <PROPERTY name="pollInterval" type="INTEGER" default="60">
30
+ <DESC>Sync poll interval in seconds. Setting this to 0 will disable polling-based sync. Sync process will be triggered automatically according to this setting.</DESC>
31
+ </PROPERTY>
32
+
33
+ <PROPERTY name="syncServer" type="STRING">
34
+ <DESC>Sync server URL.</DESC>
35
+ </PROPERTY>
36
+
37
+ <PROPERTY name="bulksyncState" type="INTEGER" default="1">
38
+ <DESC>Set 0 to force bulk sync on next synchronization cycle. After sync is complete, bulksyncState will be set to 1.</DESC>
39
+ <APPLIES rubyOnly="true">Not currently supported in JavaScript.</APPLIES>
40
+ </PROPERTY>
41
+
42
+ <PROPERTY name="pageSize" type="INTEGER">
43
+ <DESC>Page size for RhoConnectClient. Default size is 2000.</DESC>
44
+ </PROPERTY>
45
+
46
+ <PROPERTY name="threadedMode" type="BOOLEAN" default="true" generateDoc="false">
47
+ <DESC>Sets if RhoConnectClient will work in a separate thread. If true then calls to login, doSync, doSyncSource and search will perform asynchronously without delaying calling thread. Results should be handled in provided callbacks. If false, all calls are blocking and resuls are returned directly from method calls. Default is true.</DESC>
48
+ </PROPERTY>
49
+
50
+ <PROPERTY name="showStatusPopup" type="BOOLEAN" default="true">
51
+ <DESC>Enable or disable show status popup.</DESC>
52
+ </PROPERTY>
53
+
54
+ <PROPERTY name="sslVerifyPeer" type="BOOLEAN" default="true">
55
+ <DESC>Enable or disable verification of RhoConnect ssl certificates, true by default.</DESC>
56
+ </PROPERTY>
57
+ </PROPERTIES>
58
+
59
+ <METHODS access="STATIC">
60
+ <ALIASES>
61
+ <ALIAS new="dosync" existing="doSync" deprecated="true">
62
+ <DESC>Deprecated name of doSync method.</DESC>
63
+ </ALIAS>
64
+
65
+ <ALIAS new="set_objectnotify_url" existing="setObjectNotification" deprecated="true">
66
+ <DESC>Deprecated name of setObjectNotification method.</DESC>
67
+ </ALIAS>
68
+
69
+ <ALIAS new="add_objectnotify" existing="addObjectNotify" deprecated="true">
70
+ <DESC>Deprecated name of addObjectNotify method.</DESC>
71
+ </ALIAS>
72
+
73
+ <ALIAS new="clean_objectnotify" existing="cleanObjectNotify">
74
+ <DESC>Deprecated name of cleanObjectNotify method.</DESC>
75
+ </ALIAS>
76
+
77
+ <ALIAS new="stop_sync" existing="stopSync" deprecated="true">
78
+ <DESC>Deprecated name of stopSync method.</DESC>
79
+ </ALIAS>
80
+ </ALIASES>
81
+
82
+ <METHOD name="isLoggedIn">
83
+ <DESC>Returns true if the RhoConnectClient currently has a user session, false if not.</DESC>
84
+ <RETURN type="BOOLEAN">
85
+ <DESC>True if have logged in user session, false if not.</DESC>
86
+ </RETURN>
87
+ </METHOD>
88
+
89
+ <METHOD name="isSyncing">
90
+ <DESC>Returns true if sync is currently in progress.</DESC>
91
+ <RETURN type="BOOLEAN">
92
+ <DESC>True if sync has started but not finished yet, false otherwise.</DESC>
93
+ </RETURN>
94
+ </METHOD>
95
+
96
+ <METHOD name="search" hasCallback="optional" runInThread="none">
97
+ <DESC>If you have a large dataset in your backend service, you don't have to synchronize everything with the RhoConnectClient. Instead you can filter the synchronized dataset using the RhoConnectClient's search function. Provide callback, which will be executed after search is completed.</DESC>
98
+ <APPLIES rubyOnly="true">Not currently supported in JavaScript.</APPLIES>
99
+ <PARAMS>
100
+ <PARAM name="args" type="HASH" propertyHash="true">
101
+ <DESC>Hash of arguments passed to search.</DESC>
102
+ <PARAMS>
103
+ <PARAM name="sourceNames" type="ARRAY">
104
+ <DESC>Array of source names to be included in search result.</DESC>
105
+ </PARAM>
106
+
107
+ <PARAM name="from" type="STRING">
108
+ <DESC>Default is 'search'</DESC>
109
+ <CAN_BE_NIL/>
110
+ </PARAM>
111
+
112
+ <PARAM name="searchParams" type="HASH">
113
+ <DESC>Hash of key-value pairs to be included in search result.</DESC>
114
+ </PARAM>
115
+
116
+ <PARAM name="offset" type="INTEGER">
117
+ <CAN_BE_NIL/>
118
+ <DESC></DESC>
119
+ </PARAM>
120
+ <PARAM name="maxResults" type="INTEGER">
121
+ <CAN_BE_NIL/>
122
+ <DESC>Maximum number of results to be returned.</DESC>
123
+ </PARAM>
124
+
125
+ <PARAM name="progressStep" type="INTEGER">
126
+ <DESC></DESC>
127
+ <CAN_BE_NIL/>
128
+ </PARAM>
129
+
130
+ <PARAM name="syncChanges" type="BOOLEAN">
131
+ <DESC>If true and there are local changes, client sync will be triggered before search.</DESC>
132
+ <CAN_BE_NIL/>
133
+ </PARAM>
134
+ </PARAMS>
135
+ </PARAM>
136
+ </PARAMS>
137
+
138
+ <RETURN type="HASH">
139
+ <DESC>Will return value only if threadedMode set to false. Otherwise search results returned in callback.</DESC>
140
+ </RETURN>
141
+ <CALLBACK>
142
+ <PARAMS>
143
+ <PARAM name="status" type="STRING">
144
+ <DESC>Resulting status of search. 'ok' of completed successfully, 'error' otherwise.</DESC>
145
+ </PARAM>
146
+
147
+ <PARAM name="search_params" type="HASH">
148
+ <DESC>Search_params originally provided for the search call. Typically you want to forward the original search_params to your view that displays the results so you can perform the same query locally. Please see examples section.</DESC>
149
+ </PARAM>
150
+ </PARAMS>
151
+ </CALLBACK>
152
+ </METHOD>
153
+
154
+ <METHOD name="doSync">
155
+ <DESC>Start the RhoConnectClient sync process.</DESC>
156
+ <PARAMS>
157
+ <PARAM name="showStatusPopup" type="BOOLEAN">
158
+ <DESC>Set to true to show status popup.</DESC>
159
+ <CAN_BE_NIL/>
160
+ </PARAM>
161
+
162
+ <PARAM name="queryParams" type="STRING">
163
+ <DESC>Parameters to be passed to server.</DESC>
164
+ <CAN_BE_NIL/>
165
+ </PARAM>
166
+
167
+ <PARAM name="syncOnlyChangedSources" type="BOOLEAN">
168
+ <DESC>Sync only sources that have local changes.</DESC>
169
+ <CAN_BE_NIL/>
170
+ </PARAM>
171
+ </PARAMS>
172
+ <RETURN type="STRING"/>
173
+ </METHOD>
174
+
175
+ <METHOD name="doSyncSource">
176
+ <DESC>Start RhoConnectClient sync process for a given source name.</DESC>
177
+ <PARAMS>
178
+ <PARAM name="sourceName" type="STRING">
179
+ <DESC>Source name.</DESC>
180
+ </PARAM>
181
+
182
+ <PARAM name="showStatusPopup" type="BOOLEAN">
183
+ <CAN_BE_NIL/>
184
+ <DESC>Set to true to show status popup.</DESC>
185
+ </PARAM>
186
+
187
+ <PARAM name="queryParams" type="STRING">
188
+ <CAN_BE_NIL/>
189
+ <DESC>Parameters to be passed to server.</DESC>
190
+ </PARAM>
191
+ </PARAMS>
192
+ <RETURN type="STRING"/>
193
+ </METHOD>
194
+
195
+ <METHOD name="login" runInThread="none" hasCallback="mandatory">
196
+ <DESC>Authenticates the user with RhoConnect. The callback will be executed when it is finished.</DESC>
197
+ <PARAMS>
198
+ <PARAM name="login" type="STRING">
199
+ <DESC>Login name.</DESC>
200
+ </PARAM>
201
+
202
+ <PARAM name="password" type="STRING">
203
+ <DESC>Password.</DESC>
204
+ </PARAM>
205
+ </PARAMS>
206
+ <RETURN type="INTEGER"/>
207
+ </METHOD>
208
+
209
+ <METHOD name="logout">
210
+ <DESC>Logout the user from the RhoConnect server. This removes the local user session.</DESC>
211
+ </METHOD>
212
+
213
+ <METHOD name="stopSync">
214
+ <DESC>Stops any sync operations currently in progress.</DESC>
215
+ </METHOD>
216
+
217
+ <METHOD name="setNotification" hasCallback="mandatory" runInThread="none">
218
+ <DESC>The RhoConnectClient system uses notifications to provide information about the sync process to a Rhodes application. Notifications can be setup once for the duration of runtime or each time a sync is triggered. Once a sync is processing for a model, notifications are called with parameters containing sync process state. Your application can use this information to display different wait pages, progress bars, etc. setNotification will set notification for a model.</DESC>
219
+ <PARAMS>
220
+ <PARAM name="sourceName" type="STRING">
221
+ <DESC>Source name for which notification will be enabled. Use '*' to set notification for all models.</DESC>
222
+ </PARAM>
223
+ </PARAMS>
224
+ </METHOD>
225
+
226
+ <METHOD name="clearNotification">
227
+ <DESC>Clears the sync notification for a given source.</DESC>
228
+ <PARAMS>
229
+ <PARAM name="sourceName" type="STRING">
230
+ <DESC>Source name to clear notification. Use '*' to clear notification for all models.</DESC>
231
+ </PARAM>
232
+ </PARAMS>
233
+ </METHOD>
234
+
235
+ <METHOD name="setObjectNotification" hasCallback="mandatory" runInThread="none">
236
+ <DESC>The RhoConnectClient can send a notification when a specific object on the current page has been modified. This is useful if you have frequently-changing data like feeds or timelines in your application and want them to update without the user taking any action.</DESC>
237
+ <CALLBACK>
238
+ <PARAMS>
239
+ <PARAM name="created" type="ARRAY">
240
+ <DESC>Array of created objects.</DESC>
241
+ </PARAM>
242
+
243
+ <PARAM name="updated" type="ARRAY">
244
+ <DESC>Array of updated objects.</DESC>
245
+ </PARAM>
246
+
247
+ <PARAM name="deleted" type="ARRAY">
248
+ <DESC>Array of deleted objects.</DESC>
249
+ </PARAM>
250
+ </PARAMS>
251
+ </CALLBACK>
252
+ </METHOD>
253
+
254
+ <METHOD name="addObjectNotify">
255
+ <DESC>Add the object notification by passing in an object ID.</DESC>
256
+ <PARAMS>
257
+ <PARAM name="sourceName" type="STRING">
258
+ <DESC>Source name for object notification.</DESC>
259
+ </PARAM>
260
+ <PARAM name="object" type="STRING">
261
+ <DESC>Object ID to get notifications.</DESC>
262
+ </PARAM>
263
+ </PARAMS>
264
+ </METHOD>
265
+
266
+ <METHOD name="cleanObjectNotify">
267
+ <DESC>Removes callback for object notifications.</DESC>
268
+ </METHOD>
269
+
270
+ <METHOD name="getLastSyncObjectCount" generateDoc="false">
271
+ <DESC>Returns number of synced objects for a given source.</DESC>
272
+ <PARAMS>
273
+ <PARAM name="sourceName" type="STRING">
274
+ <DESC>Source name.</DESC>
275
+ </PARAM>
276
+ </PARAMS>
277
+ <RETURN type="INTEGER"/>
278
+ </METHOD>
279
+
280
+ <METHOD name="setSourceProperty" generateDoc="false">
281
+ <DESC>Sets property value for a given source.</DESC>
282
+ <PARAMS>
283
+ <PARAM name="sourceName" type="STRING">
284
+ <DESC>Source name.</DESC>
285
+ </PARAM>
286
+
287
+ <PARAM name="propertyName" type="STRING">
288
+ <DESC>Property name.</DESC>
289
+ </PARAM>
290
+
291
+ <PARAM name="propertyValue" type="STRING">
292
+ <DESC>Property value.</DESC>
293
+ </PARAM>
294
+ </PARAMS>
295
+ </METHOD>
296
+
297
+ <METHOD name="getSourceProperty" generateDoc="false">
298
+ <DESC>Gets property value for a given source.</DESC>
299
+ <PARAMS>
300
+ <PARAM name="sourceName" type="STRING">
301
+ <DESC>Source name.</DESC>
302
+ </PARAM>
303
+
304
+ <PARAM name="propertyName" type="STRING">
305
+ <DESC>Property name.</DESC>
306
+ </PARAM>
307
+ </PARAMS>
308
+ <RETURN type="STRING"/>
309
+ </METHOD>
310
+ </METHODS>
311
+
312
+ <VER_INTRODUCED>1.0.0</VER_INTRODUCED>
313
+ <PLATFORM>WM, Win32, Android, iOS, WP8</PLATFORM>
314
+ <PLATFORM_EB>WM, Win32, Android</PLATFORM_EB>
315
+ <EXAMPLES>
316
+ <EXAMPLE title="Sync Authentication">
317
+ <DESC>Call login method and then handle login result in provided callback.</DESC>
318
+ <SECTIONS>
319
+ <SECTION>
320
+ <DESC>In your controller call login.</DESC>
321
+ <CODE>
322
+ <RUBY>
323
+ <![CDATA[
324
+ RhoConnectClient.login(
325
+ @params['login'],
326
+ @params['password'],
327
+ url_for(:action => :login_callback)
328
+ )]]>
329
+ </RUBY>
330
+ <JAVASCRIPT>
331
+ <![CDATA[
332
+ Rho.RhoConnectClient.login('john','password',function(result){
333
+ loginCallback(result);
334
+ });]]>
335
+ </JAVASCRIPT>
336
+ </CODE>
337
+ </SECTION>
338
+ <SECTION>
339
+ <DESC>
340
+ When RhoConnectClient.login completes, the callback declared is executed and receives parameters including success or failure and error messages (if any).
341
+ </DESC>
342
+ <CODE>
343
+ <RUBY><![CDATA[
344
+ # Error codes:
345
+ # ERR_NONE = 0
346
+ # ERR_NETWORK = 1
347
+ # ERR_REMOTESERVER = 2
348
+ # ERR_RUNTIME = 3
349
+ # ERR_UNEXPECTEDSERVERRESPONSE = 4
350
+ # ERR_DIFFDOMAINSINSYNCSRC = 5
351
+ # ERR_NOSERVERRESPONSE = 6
352
+ # ERR_CLIENTISNOTLOGGEDIN = 7
353
+ # ERR_CUSTOMSYNCSERVER = 8
354
+ # ERR_UNATHORIZED = 9
355
+
356
+ def login_callback
357
+ error_code = @params['error_code'].to_i
358
+ if error_code == Rho::RhoError::ERR_NONE
359
+ # run sync if we were successful
360
+ WebView.navigate Rho::RhoConfig.options_path
361
+ RhoConnectClient.doSync
362
+ else
363
+ if error_code == Rho::RhoError::ERR_CUSTOMSYNCSERVER
364
+ @msg = @params['error_message']
365
+ end
366
+
367
+ if not @msg or @msg.length == 0
368
+ @msg = Rho::RhoError.new(error_code).message
369
+ end
370
+
371
+ WebView.navigate(
372
+ url_for(:action => :login, :query => {:msg => @msg})
373
+ )
374
+ end
375
+ end]]>
376
+ </RUBY>
377
+ <JAVASCRIPT><![CDATA[
378
+ // Error codes:
379
+ // ERR_NONE = 0
380
+ // ERR_NETWORK = 1
381
+ // ERR_REMOTESERVER = 2
382
+ // ERR_RUNTIME = 3
383
+ // ERR_UNEXPECTEDSERVERRESPONSE = 4
384
+ // ERR_DIFFDOMAINSINSYNCSRC = 5
385
+ // ERR_NOSERVERRESPONSE = 6
386
+ // ERR_CLIENTISNOTLOGGEDIN = 7
387
+ // ERR_CUSTOMSYNCSERVER = 8
388
+ // ERR_UNATHORIZED = 9
389
+
390
+ function loginCallback(result) {
391
+ var errorCode = parseInt(result.error_code);
392
+ var errorMessage = result.error_message;
393
+ if(errorCode === 0 {
394
+ // process success
395
+ } else {
396
+ // process error with errorMessage
397
+ }
398
+ }]]>
399
+ </JAVASCRIPT>
400
+ </CODE>
401
+ </SECTION>
402
+ </SECTIONS>
403
+ </EXAMPLE>
404
+ <EXAMPLE title="Notifications">
405
+ <DESC>In this example, once the sync process for the Account model is complete, a callback will be invoked (we define as `sync_notify` here) with the status and errors (if any).</DESC>
406
+ <SECTIONS>
407
+ <SECTION>
408
+ <DESC>First, assign a sync notification for the Account model:</DESC>
409
+ <CODE>
410
+ <RUBY><![CDATA[
411
+ RhoConnectClient.setNotification(
412
+ 'Account',
413
+ url_for(:action => :sync_notify),
414
+ "sync_complete=true"
415
+ )]]>
416
+ </RUBY>
417
+ <JAVASCRIPT><![CDATA[
418
+ function syncNotify(params) {
419
+ // handle notifications...
420
+ }
421
+ Rho.RhoConnectClient.setNotification('Account', syncNotify);
422
+ ]]>
423
+ </JAVASCRIPT>
424
+ </CODE>
425
+ </SECTION>
426
+ <SECTION>
427
+ <DESC>Which is the same as:</DESC>
428
+ <CODE>
429
+ <RUBY><![CDATA[
430
+ Account.setNotification(
431
+ url_for(:action => :sync_notify),
432
+ "sync_complete=true"
433
+ )]]>
434
+ </RUBY>
435
+ <JAVASCRIPT><![CDATA[
436
+ function syncNotify() {
437
+ // handle notifications...
438
+ }
439
+ Account.setNotification(syncNotify);
440
+ ]]>
441
+ </JAVASCRIPT>
442
+ </CODE>
443
+ </SECTION>
444
+ <SECTION>
445
+ <DESC>You can also set a notification for all models:</DESC>
446
+ <CODE>
447
+ <RUBY><![CDATA[
448
+ RhoConnectClient.setNotification(
449
+ '*',
450
+ url_for(:action => :sync_notify),
451
+ "sync_complete=true"
452
+ )]]>
453
+ </RUBY>
454
+ <JAVASCRIPT><![CDATA[
455
+ function syncNotify(params) {
456
+ // handle notifications...
457
+ }
458
+ Rho.RhoConnectClient.setNotification('*', syncNotify);
459
+ ]]>
460
+ </JAVASCRIPT>
461
+ </CODE>
462
+ </SECTION>
463
+ </SECTIONS>
464
+ </EXAMPLE>
465
+ <EXAMPLE title="Object notifications">
466
+ <DESC></DESC>
467
+ <SECTIONS>
468
+ <SECTION>
469
+ <DESC>To use object notifications, first set the notification callback in application.rb#initialize.</DESC>
470
+ <CODE>
471
+ <RUBY><![CDATA[
472
+ class AppApplication < Rho::RhoApplication
473
+ def initialize
474
+ super
475
+
476
+ RhoConnectClient.setObjectNotification(
477
+ url_for(
478
+ :controller => "Product",
479
+ :action => :sync_object_notify
480
+ )
481
+ )
482
+ end
483
+ end]]>
484
+ </RUBY>
485
+ </CODE>
486
+ </SECTION>
487
+ <SECTION>
488
+ <DESC>Next, in your controller action that displays the object(s), add the object notification by passing in a record or collection of records:</DESC>
489
+ <CODE>
490
+ <RUBY><![CDATA[
491
+ class ProductController < Rho::RhoController
492
+ # GET /Product
493
+ def index
494
+ @product = Product.find(:first)
495
+
496
+ RhoConnectClient.addObjectNotify('Product', @product.id)
497
+ render
498
+ end
499
+
500
+ # ...
501
+
502
+ def sync_object_notified
503
+ # process notification data ...
504
+
505
+ # refresh the current page
506
+ WebView.refresh
507
+ # or call System.execute_js to update part of the page
508
+ end
509
+ end
510
+ ]]>
511
+ </RUBY>
512
+ <JAVASCRIPT><![CDATA[
513
+ function syncObjectNotified(params) {
514
+ // handle notifications...
515
+ }
516
+
517
+ var product = Product.find('first');
518
+
519
+ Rho.RhoConnectClient.addObjectNotify('Product', product.id);
520
+ ]]>
521
+ </JAVASCRIPT>
522
+ </CODE>
523
+ </SECTION>
524
+ </SECTIONS>
525
+ </EXAMPLE>
526
+ <EXAMPLE title="Handling Errors">
527
+ <DESC>Sync callbacks are invoked with a hash parameter containing the status and relevant errors (if any) applicable for the current sync process. Using callbacks you can process errors that occurred when the RhoConnectClient last synchronized.</DESC>
528
+ <SECTIONS>
529
+ <SECTION>
530
+ <DESC>Here we will set a notification and log an error code 1 or ERR_NETWORK:</DESC>
531
+ <CODE>
532
+ <RUBY><![CDATA[
533
+ RhoConnectClient.setNotification(
534
+ '*',
535
+ url_for(:action => :sync_notify),
536
+ "sync_complete=true"
537
+ )
538
+
539
+ # In your controller:
540
+ def sync_notify
541
+ error_code = @params['error_code'].to_i
542
+ error_message = @params['error_message']
543
+ if error_code == Rho::RhoError::ERR_NETWORK
544
+ puts "We received a network error: " + error_message
545
+ end
546
+ end
547
+
548
+ ]]>
549
+ </RUBY>
550
+ <JAVASCRIPT><![CDATA[
551
+ function syncNotify(result) {
552
+ var errorCode = parseInt(result.error_code);
553
+ var errorMessage = result.error_message;
554
+ if(errorCode === 1) {
555
+ console.log("We received a network error: " + errorMessage);
556
+ return;
557
+ }
558
+ }
559
+ Rho.RhoConnectClient.setNotification('*', syncNotify);
560
+ ]]>
561
+ </JAVASCRIPT>
562
+ </CODE>
563
+ </SECTION>
564
+ </SECTIONS>
565
+ </EXAMPLE>
566
+ <EXAMPLE title="Using search (Ruby Only)">
567
+ <DESC>Using search consists of two steps: invoking the search function with the search criteria, process the search results in a callback and update the UI.</DESC>
568
+ <SECTIONS>
569
+ <SECTION>
570
+ <DESC>First, call search from your controller action:</DESC>
571
+ <CODE>
572
+ <RUBY><![CDATA[
573
+ def search
574
+ page = @params['page'] || 0
575
+ page_size = @params['page_size'] || 10
576
+ RhoConnectClient.search(
577
+ {
578
+ 'Contact',
579
+ :from => 'search',
580
+ :search_params => {
581
+ :FirstName => @params['FirstName'],
582
+ :LastName => @params['LastName'],
583
+ :Company => @params['Company']
584
+ },
585
+ :offset => page * page_size,
586
+ :max_results => page_size
587
+ }
588
+ url_for(:action => :search_callback)
589
+ )
590
+ render :action => :search_wait
591
+ end
592
+ ]]>
593
+ </RUBY>
594
+ </CODE>
595
+ </SECTION>
596
+ <SECTION>
597
+ <DESC>The `search_params` will be forwarded to your callback so you can update the view with the results:</DESC>
598
+ <CODE>
599
+ <RUBY><![CDATA[
600
+ def search_callback
601
+ status = @params["status"]
602
+ if (status and status == "ok")
603
+ WebView.navigate(
604
+ url_for(
605
+ :action => :show_page,
606
+ :query => @params['search_params']
607
+ )
608
+ )
609
+ else
610
+ render :action => :search_error
611
+ end
612
+ end
613
+
614
+ def show_page
615
+ @contacts = Contact.find(
616
+ :all,
617
+ :conditions => {
618
+ {
619
+ :func => 'LOWER',
620
+ :name => 'FirstName',
621
+ :op => 'LIKE'
622
+ } => @params[:FirstName],
623
+ {
624
+ :func => 'LOWER',
625
+ :name=>'LastName',
626
+ :op=>'LIKE'
627
+ } => @params[:LastName],
628
+ {
629
+ :func=>'LOWER',
630
+ :name=>'Company',
631
+ :op=>'LIKE'
632
+ } => @params[:Company],
633
+ },
634
+ :op => 'OR',
635
+ :select => ['FirstName','LastName', 'Company'],
636
+ :per_page => page_size,
637
+ :offset => page * page_size
638
+ )
639
+ render :action => :show_page
640
+ end
641
+ ]]>
642
+ </RUBY>
643
+ </CODE>
644
+ </SECTION>
645
+ </SECTIONS>
646
+ </EXAMPLE>
647
+ </EXAMPLES>
648
+ <REMARKS>
649
+ <REMARK title="Notification Callback Parameters">
650
+ <DESC><![CDATA[
651
+ When the notification is called, it will receive a variable called @params, just like a normal Rhodes controller action.
652
+
653
+ ## Common Parameters
654
+
655
+ These parameters are included in all notifications.
656
+
657
+ * source_id - The id of the current model that is synchronizing.
658
+ * source_name - Name of the model (i.e. "Product")
659
+ * sync_type - Type of sync used for this model: "incremental" or "bulk"
660
+ * status - Status of the current sync process. See below for the possible values:
661
+
662
+ In the following sections we cover the different status values and parameters available with each status.
663
+
664
+ ### status: "in_progress" - incremental sync progress
665
+
666
+ * total_count - Total number of records that exist for this RhoConnect source.
667
+ * processed_count - Number of records included in the sync page.
668
+ * cumulative_count - Number of records the SyncEngine has processed so far for this source.
669
+
670
+ ### status: "in_progress" - bulk sync progress
671
+
672
+ * bulk_status - The state of the bulk sync process:
673
+ * start - Bulk sync has started for a specific partition
674
+ * download - Bulk sync file download has started
675
+ * change_db - New bulk sync database change has started
676
+ * blobs - Bulk sync blob files have started to download
677
+ * ok - Current partition has completed
678
+ * complete - All partitions have completed
679
+
680
+ * partition - Current bulk sync partition.
681
+
682
+ ### status: "error"
683
+
684
+ * error_code - HTTP response code of the RhoConnect server error: 401, 500, 404, etc.
685
+ * error_message - Response body (if any)
686
+ * server_errors - Hash of Type objects of RhoConnect adapter error (if exists):
687
+ * login-error - An error in adapter login method
688
+ * query-error - An error in adapter query method
689
+ * create-error - An error in adapter create method
690
+ * update-error - An error in adapter update method
691
+ * delete-error - An error in adapter delete method
692
+ * logoff-error - An error in adapter logoff method
693
+
694
+ Each error contains a 'message' key with the error message.
695
+
696
+ Ruby Example:
697
+ :::ruby
698
+ @params["server_errors"]["query-error"]["message"]
699
+ #=> "Error connecting to backend server: http://rhostore.herokuapp.com"
700
+
701
+ JavaScript Example:
702
+ :::javascript
703
+ params.server_errors["query-error"].message
704
+ //=> "Error connecting to backend server: http://rhostore.herokuapp.com"
705
+
706
+ #### Handling 'create-error'
707
+ "create-error" is a unique situation that needs to be handled in your sync callback. See `RhoConnectClient.onSyncCreateError()` for more details.
708
+
709
+ ### status: "complete"
710
+ This status returns only when the sync run is complete (all partitions are done synchronizing).
711
+
712
+ ### status: "schema-changed"
713
+ This is present if a FixedSchema model has changed during the current sync run. A new bulk sync run should be triggered (by setting bulksyncState) and the user should be alerted in the UI.
714
+ ]]>
715
+ </DESC>
716
+ </REMARK>
717
+ <REMARK title="Backround Sync on iOS">
718
+ <DESC>
719
+ <![CDATA[
720
+ On iOS, if the application is backgrounded, it will be suspended. This also means if a current sync is in progress, it will immediately terminate. To prevent this behavior, set 'finish_sync_in_background' to '1' in rhoconfig.txt. When set to '1', the RhoConnectClient will attempt to finish synchronization before the application fully suspends.
721
+ ]]>
722
+ </DESC>
723
+ </REMARK>
724
+ </REMARKS>
725
+ </MODULE>
726
+ </API>