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
@@ -0,0 +1,58 @@
1
+ describe("Player", function() {
2
+ var player;
3
+ var song;
4
+
5
+ beforeEach(function() {
6
+ player = new Player();
7
+ song = new Song();
8
+ });
9
+
10
+ it("should be able to play a Song", function() {
11
+ player.play(song);
12
+ expect(player.currentlyPlayingSong).toEqual(song);
13
+
14
+ //demonstrates use of custom matcher
15
+ expect(player).toBePlaying(song);
16
+ });
17
+
18
+ describe("when song has been paused", function() {
19
+ beforeEach(function() {
20
+ player.play(song);
21
+ player.pause();
22
+ });
23
+
24
+ it("should indicate that the song is currently paused", function() {
25
+ expect(player.isPlaying).toBeFalsy();
26
+
27
+ // demonstrates use of 'not' with a custom matcher
28
+ expect(player).not.toBePlaying(song);
29
+ });
30
+
31
+ it("should be possible to resume", function() {
32
+ player.resume();
33
+ expect(player.isPlaying).toBeTruthy();
34
+ expect(player.currentlyPlayingSong).toEqual(song);
35
+ });
36
+ });
37
+
38
+ // demonstrates use of spies to intercept and test method calls
39
+ it("tells the current song if the user has made it a favorite", function() {
40
+ spyOn(song, 'persistFavoriteStatus');
41
+
42
+ player.play(song);
43
+ player.makeFavorite();
44
+
45
+ expect(song.persistFavoriteStatus).toHaveBeenCalledWith(true);
46
+ });
47
+
48
+ //demonstrates use of expected exceptions
49
+ describe("#resume", function() {
50
+ it("should throw an exception if song is already playing", function() {
51
+ player.play(song);
52
+
53
+ expect(function() {
54
+ player.resume();
55
+ }).toThrow("song is already playing");
56
+ });
57
+ });
58
+ });
@@ -0,0 +1,17 @@
1
+ onmessage = function(e){
2
+ if ( e.data === "start" ) {
3
+ // Do some computation
4
+ done()
5
+ }
6
+ };
7
+ function done(){
8
+ // Send back the results to the parent page
9
+ var async = null;
10
+ var sync = null;
11
+ try { async = openDatabase } catch (ex) { async = ex };
12
+ try { sync = openDatabaseSync } catch (ex) { sync = ex };
13
+ postMessage('In the Worker:');
14
+ postMessage('  openDatabase is: ' +async);
15
+ postMessage('  openDatabaseSync is: ' +sync);
16
+ }
17
+
@@ -0,0 +1,41 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2008-2010 Rhomobile, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+
23
+ Copyright (c) 2011-2016 Symbol Technologies, Inc.
24
+
25
+ Permission is hereby granted, free of charge, to any person obtaining a copy
26
+ of this software and associated documentation files (the "Software"), to deal
27
+ in the Software without restriction, including without limitation the rights
28
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
+ copies of the Software, and to permit persons to whom the Software is
30
+ furnished to do so, subject to the following conditions:
31
+
32
+ The above copyright notice and this permission notice shall be included in
33
+ all copies or substantial portions of the Software.
34
+
35
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
41
+ THE SOFTWARE.
@@ -0,0 +1,118 @@
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
+ #import <Foundation/Foundation.h>
50
+ #import "RhomModel.h"
51
+ #import "RhoConnectNotify.h"
52
+ #import "RhoConnectObjectNotify.h"
53
+ #include "RhoConnectClient/RhoConnectClient.h"
54
+
55
+ @interface RhoConnectClient : NSObject {
56
+ }
57
+
58
+ @property(setter=setThreadedMode:) BOOL threaded_mode;
59
+ @property(setter=setPollInterval:) int poll_interval;
60
+ @property(setter=setLogSeverity:) int log_severity;
61
+ @property(assign, setter=setSyncServer:) NSString* sync_server;
62
+ @property(setter=setBulkSyncState:, getter=getBulkSyncState) int bulksync_state;
63
+ @property(assign, setter=setLogServer:) NSString* log_server;
64
+ @property(assign, setter=setLogName:) NSString* log_name;
65
+
66
+ + (void) initDatabase;
67
+ + (void) setNotification: (SEL) callback target:(id)target;
68
+ + (void) setModelNotification: (int) nSrcID callback: (SEL) callback target:(id)target;
69
+
70
+ - (void) setObjectNotification: (SEL) callback target:(id)target;
71
+ - (void) clearObjectNotification;
72
+ - (void) addObjectNotify: (int) nSrcID szObject:(NSString*) szObject;
73
+
74
+ - (id) init;
75
+ - (void)dealloc;
76
+
77
+ - (void) addModels:(NSMutableArray*)models;
78
+ - (void) updateModels:(NSMutableArray*)models;
79
+ - (void) database_full_reset_and_logout;
80
+ - (void) database_client_reset;
81
+ - (BOOL) is_logged_in;
82
+
83
+ - (NSString*) database_export: (NSString*) partition;
84
+ - (BOOL) database_import: (NSString*) partition zip:(NSString*) zip;
85
+
86
+ - (RhoConnectNotify*) loginWithUser: (NSString*) user pwd:(NSString*) pwd;
87
+ - (void) loginWithUser: (NSString*) user pwd:(NSString*) pwd callback:(SEL) callback target:(id)target;
88
+ - (void) logout;
89
+ - (void) setNotification: (SEL) callback target:(id)target;
90
+ - (void) clearNotification;
91
+
92
+ - (RhoConnectNotify*) syncAll;
93
+ - (BOOL) is_syncing;
94
+ - (void) stop_sync;
95
+
96
+ - (RhoConnectNotify*) search: (NSArray*)models from: (NSString*) from params: (NSString*)params sync_changes: (BOOL) sync_changes progress_step: (int) progress_step;
97
+
98
+ - (void) setConfigString: (NSString*)name param: (NSString*) param;
99
+ - (NSString*) getConfigString: (NSString*)name;
100
+
101
+ - (void) setSourceProperty: (int) nSrcID szPropName:(NSString*) szPropName szPropValue:(NSString*) szPropValue;
102
+
103
+ - (void) onCreateError: (RhoConnectNotify*)notify action: (NSString*)action;
104
+ - (void) onUpdateError: (RhoConnectNotify*)notify action: (NSString*)action;
105
+ - (void) onDeleteError: (RhoConnectNotify*)notify action: (NSString*)action;
106
+
107
+ - (void) sendLog;
108
+
109
+ + (NSString*) storagePath;
110
+ + (NSString*) pathForStorageFile: (NSString*) file;
111
+
112
+ + (NSString*) blobFolder;
113
+ + (NSString*) blobPath;
114
+ + (NSString*) pathForBlob: (NSString*) uri;
115
+
116
+ + (void) fromMainBundle: (NSFileManager*) fileManager copyFile: (NSString*) source toStorage: (NSString*) target forceRemove: (BOOL) remove;
117
+
118
+ @end
@@ -0,0 +1,641 @@
1
+ //
2
+ // RhoConnectClient.m
3
+ // RhoCoonectClientTest
4
+ //
5
+ // Created by evgeny vovchenko on 8/23/10.
6
+ // Copyright 2010 RhoMobile. All rights reserved.
7
+ // Copyright 2011-2016 Symbol Technologies. All rights reserved.
8
+ //
9
+
10
+ #import "RhoConnectClient.h"
11
+
12
+ #include "sync/SyncThread.h"
13
+ #include "common/RhoConf.h"
14
+ #import "common/RhodesAppBase.h"
15
+ #include "logging/RhoLogConf.h"
16
+ #import "logging/RhoLog.h"
17
+ #undef DEFAULT_LOGCATEGORY
18
+ #define DEFAULT_LOGCATEGORY "RhoConnectClient"
19
+
20
+ @interface CCallbackData : NSObject {
21
+ }
22
+
23
+ @property(assign) NSThread *targetThread;
24
+ @property SEL targetMethod;
25
+ @property(assign) id targetObject;
26
+
27
+ - (id)init:(SEL)selector target:(id)target thread:(NSThread *)thread;
28
+ @end
29
+
30
+ @implementation CCallbackData
31
+ @synthesize targetThread;
32
+ @synthesize targetMethod;
33
+ @synthesize targetObject;
34
+ - (id)init:(SEL)selector target:(id)target thread:(NSThread *)thread
35
+ {
36
+ self = [super init];
37
+
38
+ targetMethod = selector;
39
+ targetObject = target;
40
+ targetThread = thread;
41
+ return self;
42
+ }
43
+
44
+ @end
45
+
46
+ int callback_impl(const char *szNotify, void *data)
47
+ {
48
+ RHO_CONNECT_NOTIFY oNotify = { 0 };
49
+
50
+ rho_connectclient_parsenotify(szNotify, &oNotify);
51
+
52
+ RhoConnectNotify *notify = [[RhoConnectNotify alloc] init:&oNotify];
53
+
54
+ CCallbackData *callbackObj = data;
55
+
56
+ if (callbackObj.targetThread != [NSThread currentThread])
57
+ {
58
+ [ callbackObj.targetObject performSelector:callbackObj.targetMethod onThread:callbackObj.targetThread withObject:notify waitUntilDone:TRUE];
59
+ }
60
+ else
61
+ {
62
+ [ callbackObj.targetObject performSelector:callbackObj.targetMethod withObject:notify];
63
+ }
64
+
65
+
66
+ [callbackObj autorelease];
67
+ [notify autorelease];
68
+ return 0;
69
+ }
70
+
71
+ int callback_object_impl(const char *szNotify, void *data)
72
+ {
73
+ RHO_CONNECT_OBJECT_NOTIFY oNotify = { 0 };
74
+
75
+ rho_connectclient_parse_objectnotify(szNotify, &oNotify);
76
+
77
+ RhoConnectObjectNotify *notify = [[RhoConnectObjectNotify alloc] init:&oNotify];
78
+
79
+ CCallbackData *callbackObj = data;
80
+
81
+ if (callbackObj.targetThread != [NSThread currentThread])
82
+ {
83
+ [ callbackObj.targetObject performSelector:callbackObj.targetMethod onThread:callbackObj.targetThread withObject:notify waitUntilDone:TRUE];
84
+ }
85
+ else
86
+ {
87
+ [ callbackObj.targetObject performSelector:callbackObj.targetMethod withObject:notify];
88
+ }
89
+
90
+ [callbackObj autorelease];
91
+ [notify autorelease];
92
+ return 0;
93
+ }
94
+
95
+ int callback_send_log_impl(const char *szNotify, void *data)
96
+ {
97
+ return 0;
98
+ }
99
+
100
+ void rho_free_callbackdata(void *pData)
101
+ {
102
+ // CCallbackData* callbackObj = pData;
103
+ // [callbackObj release];
104
+ }
105
+
106
+ @implementation RhoConnectClient
107
+
108
+ @synthesize threaded_mode;
109
+ @synthesize poll_interval;
110
+ @synthesize log_severity;
111
+ @synthesize sync_server;
112
+ @synthesize bulksync_state;
113
+ @synthesize log_server;
114
+ @synthesize log_name;
115
+
116
+ - (id)init
117
+ {
118
+ self = [super init];
119
+
120
+ // initRhoconnectClient();
121
+
122
+ return self;
123
+ }
124
+
125
+ - (void)dealloc
126
+ {
127
+ rho_connectclient_destroy();
128
+
129
+ [sync_server release];
130
+ [log_server release];
131
+ [log_name release];
132
+ [super dealloc];
133
+ }
134
+
135
+ - (void)setSyncServer:(NSString *)server
136
+ {
137
+ sync_server = [server retain];
138
+ rho_sync_set_syncserver([server cStringUsingEncoding:[NSString defaultCStringEncoding]]);
139
+ }
140
+
141
+ - (void)setThreadedMode:(BOOL)mode
142
+ {
143
+ threaded_mode = mode;
144
+ rho_sync_set_threaded_mode(mode ? 1 : 0);
145
+ }
146
+
147
+ - (void)setPollInterval:(int)interval
148
+ {
149
+ poll_interval = interval;
150
+ rho_sync_set_pollinterval(interval);
151
+ }
152
+
153
+ - (void)setLogSeverity:(int)severity
154
+ {
155
+ log_severity = severity;
156
+ rho_logconf_setSeverity(log_severity);
157
+ }
158
+
159
+ - (void)setBulkSyncState:(int)state
160
+ {
161
+ rho_conf_setInt("bulksync_state", state);
162
+ }
163
+
164
+ - (int)getBulkSyncState
165
+ {
166
+ return rho_conf_getInt("bulksync_state");
167
+ }
168
+
169
+ - (void)setConfigString:(NSString *)name param:(NSString *)param
170
+ {
171
+ if ([name compare:@"MinSeverity"] == 0)
172
+ {
173
+ rho_logconf_setSeverity([param intValue]);
174
+ }
175
+ else
176
+ {
177
+ rho_conf_setString([name cStringUsingEncoding:[NSString defaultCStringEncoding]],
178
+ [param cStringUsingEncoding:[NSString defaultCStringEncoding]]);
179
+ }
180
+ }
181
+
182
+ - (NSString *)getConfigString:(NSString *)name
183
+ {
184
+ NSString *ret;
185
+ char *res = rho_conf_getString([name cStringUsingEncoding:[NSString defaultCStringEncoding]]);
186
+
187
+ if (res)
188
+ {
189
+ ret = [NSString stringWithUTF8String:res];
190
+ rho_conf_freeString(res);
191
+ }
192
+ else
193
+ {
194
+ ret = [NSString stringWithUTF8String:""];
195
+ }
196
+
197
+ return ret;
198
+ }
199
+
200
+ - (void)setLogServer:(NSString *)server
201
+ {
202
+ log_server = [server retain];
203
+ rho_conf_setString("logserver", [ log_server cStringUsingEncoding:[ NSString defaultCStringEncoding ]]);
204
+ }
205
+
206
+ - (void)setLogName:(NSString *)name
207
+ {
208
+ log_name = [name retain];
209
+ rho_conf_setString("logname", [ log_name cStringUsingEncoding:[ NSString defaultCStringEncoding ]]);
210
+ }
211
+
212
+ - (void)addModels:(NSMutableArray *)models
213
+ {
214
+ RHOM_MODEL rhom_models[models.count];
215
+ int nModel = 0;
216
+
217
+ for (RhomModel *model in models)
218
+ {
219
+ rho_connectclient_initmodel(&rhom_models[nModel]);
220
+ rhom_models[nModel].name = [model.name cStringUsingEncoding:[NSString defaultCStringEncoding]];
221
+ rhom_models[nModel].partition = [model.partition cStringUsingEncoding:[NSString defaultCStringEncoding]];
222
+
223
+ rhom_models[nModel].sync_type = model.sync_type;
224
+ rhom_models[nModel].type = model.model_type;
225
+
226
+ if (model.associations != NULL)
227
+ {
228
+ for (NSString *key in model.associations)
229
+ {
230
+ rho_connectclient_hash_put(rhom_models[nModel].associations,
231
+ [key cStringUsingEncoding:[NSString defaultCStringEncoding]],
232
+ [[model.associations objectForKey:key] cStringUsingEncoding:[NSString defaultCStringEncoding]]
233
+ );
234
+ }
235
+ }
236
+
237
+ if (0 < [model.blob_attribs length])
238
+ {
239
+ rhom_models[nModel].blob_attribs = [model.blob_attribs cStringUsingEncoding:[NSString defaultCStringEncoding]];
240
+ }
241
+ nModel++;
242
+ }
243
+
244
+ rho_connectclient_init(rhom_models, models.count);
245
+
246
+ int i = 0;
247
+ for (RhomModel *model in models)
248
+ {
249
+ model.source_id = rhom_models[i].source_id;
250
+ rho_connectclient_destroymodel(&rhom_models[i]);
251
+ i++;
252
+ }
253
+
254
+ [self setThreadedMode:FALSE];
255
+ [self setPollInterval:0];
256
+ }
257
+
258
+ - (void)updateModels:(NSMutableArray *)models
259
+ {
260
+ RHOM_MODEL rhom_models[models.count];
261
+ int nModel = 0;
262
+
263
+ for (RhomModel *model in models)
264
+ {
265
+ rho_connectclient_initmodel(&rhom_models[nModel]);
266
+ rhom_models[nModel].name = [model.name cStringUsingEncoding:[NSString defaultCStringEncoding]];
267
+
268
+ rhom_models[nModel].sync_type = model.sync_type;
269
+ rhom_models[nModel].type = model.model_type;
270
+
271
+ nModel++;
272
+ }
273
+
274
+ rho_connectclient_updatemodels(rhom_models, models.count);
275
+
276
+ int i = 0;
277
+ for (RhomModel *model in models)
278
+ {
279
+ model.source_id = rhom_models[i].source_id;
280
+ rho_connectclient_destroymodel(&rhom_models[i]);
281
+ i++;
282
+ }
283
+ }
284
+
285
+ - (void)setSourceProperty:(int)nSrcID szPropName:(NSString *)szPropName szPropValue:(NSString *)szPropValue
286
+ {
287
+ rho_sync_set_source_property(nSrcID, [szPropName cStringUsingEncoding:[NSString defaultCStringEncoding]],
288
+ [szPropValue cStringUsingEncoding:[NSString defaultCStringEncoding]]);
289
+ }
290
+
291
+ - (void)database_full_reset_and_logout
292
+ {
293
+ rho_connectclient_database_full_reset_and_logout();
294
+ }
295
+
296
+ - (void)database_client_reset
297
+ {
298
+ rho_connectclient_database_client_reset();
299
+ }
300
+
301
+ - (NSString *)database_export:(NSString *)partition
302
+ {
303
+ NSString *ret;
304
+ char *res = rho_connectclient_database_export([partition cStringUsingEncoding:[NSString defaultCStringEncoding]]);
305
+
306
+ if (res != 0)
307
+ {
308
+ ret = [NSString stringWithUTF8String:res];
309
+ free(res);
310
+ }
311
+ else
312
+ {
313
+ ret = [NSString stringWithUTF8String:""];
314
+ }
315
+
316
+ return ret;
317
+ }
318
+
319
+ - (BOOL)database_import:(NSString *)partition zip:(NSString *)zip
320
+ {
321
+ int res = rho_connectclient_database_import([partition cStringUsingEncoding:[NSString defaultCStringEncoding]], [zip cStringUsingEncoding:[NSString defaultCStringEncoding]]);
322
+
323
+ return res == 0 ? FALSE : TRUE;
324
+ }
325
+
326
+ - (BOOL)is_logged_in
327
+ {
328
+ return rho_sync_logged_in() == 1 ? TRUE : FALSE;
329
+ }
330
+
331
+ - (RhoConnectNotify *)loginWithUser:(NSString *)user pwd:(NSString *)pwd
332
+ {
333
+ char *res = (char *)rho_sync_login_c([user cStringUsingEncoding:[NSString defaultCStringEncoding]],
334
+ [pwd cStringUsingEncoding:[NSString defaultCStringEncoding]], NULL, NULL);
335
+
336
+ RHO_CONNECT_NOTIFY oNotify = { 0 };
337
+
338
+ rho_connectclient_parsenotify(res, &oNotify);
339
+ rho_sync_free_string(res);
340
+
341
+ return [[[RhoConnectNotify alloc] init:&oNotify] autorelease];
342
+ }
343
+
344
+ - (void)loginWithUser:(NSString *)user pwd:(NSString *)pwd callback:(SEL)callback target:(id)target
345
+ {
346
+ rho_sync_login_c([user cStringUsingEncoding:NSUTF8StringEncoding],
347
+ [pwd cStringUsingEncoding:NSUTF8StringEncoding],
348
+ callback_impl, [[CCallbackData alloc] init:callback target:target thread:[NSThread currentThread]]
349
+ );
350
+ }
351
+
352
+ - (void)logout
353
+ {
354
+ rho_sync_logout();
355
+ }
356
+
357
+ + (void)setNotification:(SEL)callback target:(id)target
358
+ {
359
+ rho_sync_set_notification_c(-1, callback_impl,
360
+ [[CCallbackData alloc] init:callback target:target thread:[NSThread currentThread]]);
361
+ }
362
+
363
+ - (void)setNotification:(SEL)callback target:(id)target
364
+ {
365
+ rho_sync_set_notification_c(-1, callback_impl,
366
+ [[CCallbackData alloc] init:callback target:target thread:[NSThread currentThread]]);
367
+ }
368
+
369
+ + (void)setModelNotification:(int)nSrcID callback:(SEL)callback target:(id)target
370
+ {
371
+ rho_sync_set_notification_c(nSrcID, callback_impl,
372
+ [[CCallbackData alloc] init:callback target:target thread:[NSThread currentThread]]);
373
+ }
374
+
375
+ - (void)clearNotification
376
+ {
377
+ rho_sync_clear_notification(-1);
378
+ }
379
+
380
+ - (void)setObjectNotification:(SEL)callback target:(id)target
381
+ {
382
+ rho_sync_setobjectnotify_url_c(callback_object_impl,
383
+ [[ CCallbackData alloc] init:callback target:target thread:[NSThread currentThread]]);
384
+ }
385
+
386
+ - (void)clearObjectNotification
387
+ {
388
+ rho_sync_clear_object_notification();
389
+ }
390
+
391
+ - (void)addObjectNotify:(int)nSrcID szObject:(NSString *)szObject
392
+ {
393
+ rho_sync_addobjectnotify(nSrcID, [szObject cStringUsingEncoding:[NSString defaultCStringEncoding]]);
394
+ }
395
+
396
+ - (RhoConnectNotify *)syncAll
397
+ {
398
+ char *res = (char *)rho_sync_doSyncAllSources(0, "", false);
399
+
400
+ RHO_CONNECT_NOTIFY oNotify = { 0 };
401
+
402
+ rho_connectclient_parsenotify(res, &oNotify);
403
+ rho_sync_free_string(res);
404
+
405
+ return [[[RhoConnectNotify alloc] init:&oNotify] autorelease];
406
+ }
407
+
408
+ - (BOOL)is_syncing
409
+ {
410
+ return rho_sync_issyncing() == 1 ? TRUE : FALSE;
411
+ }
412
+
413
+ - (void)stop_sync
414
+ {
415
+ rho_sync_stop();
416
+ }
417
+
418
+ - (RhoConnectNotify *)search:(NSArray *)models from:(NSString *)from params:(NSString *)params sync_changes:(BOOL)sync_changes progress_step:(int)progress_step
419
+ {
420
+ unsigned long ar_sources = rho_connectclient_strarray_create();
421
+
422
+ for (RhomModel *model in models)
423
+ {
424
+ rho_connectclient_strarray_add(ar_sources, [model.name cStringUsingEncoding:[NSString defaultCStringEncoding]]);
425
+ }
426
+
427
+ char *res = (char *)rho_sync_doSearchByNames(ar_sources,
428
+ [from cStringUsingEncoding:[NSString defaultCStringEncoding]],
429
+ [params cStringUsingEncoding:[NSString defaultCStringEncoding]],
430
+ sync_changes ? 1 : 0,
431
+ progress_step, "", "");
432
+
433
+ rho_connectclient_strarray_delete(ar_sources);
434
+
435
+ RHO_CONNECT_NOTIFY oNotify = { 0 };
436
+ rho_connectclient_parsenotify(res, &oNotify);
437
+ rho_sync_free_string(res);
438
+
439
+ return [[[RhoConnectNotify alloc] init:&oNotify] autorelease];
440
+ }
441
+
442
+ - (void)onCreateError:(RhoConnectNotify *)notify action:(NSString *)action
443
+ {
444
+ rho_connectclient_on_sync_create_error(
445
+ [notify.source_name cStringUsingEncoding:[NSString defaultCStringEncoding]],
446
+ [notify getNotifyPtr],
447
+ [action cStringUsingEncoding:[NSString defaultCStringEncoding]]
448
+ );
449
+ }
450
+
451
+ - (void)onUpdateError:(RhoConnectNotify *)notify action:(NSString *)action
452
+ {
453
+ rho_connectclient_on_sync_update_error(
454
+ [notify.source_name cStringUsingEncoding:[NSString defaultCStringEncoding]],
455
+ [notify getNotifyPtr],
456
+ [action cStringUsingEncoding:[NSString defaultCStringEncoding]]
457
+ );
458
+ }
459
+
460
+ - (void)onDeleteError:(RhoConnectNotify *)notify action:(NSString *)action
461
+ {
462
+ rho_connectclient_on_sync_delete_error(
463
+ [notify.source_name cStringUsingEncoding:[NSString defaultCStringEncoding]],
464
+ [notify getNotifyPtr],
465
+ [action cStringUsingEncoding:[NSString defaultCStringEncoding]]
466
+ );
467
+ }
468
+
469
+ - (void)sendLog
470
+ {
471
+ rho_conf_send_log_in_same_thread();
472
+ }
473
+
474
+ void copyFromMainBundle(NSFileManager *fileManager, NSString *source, NSString *target, BOOL remove);
475
+ void createFolder(NSFileManager *fileManager, NSString *target, BOOL remove);
476
+ const char * rho_native_rhopath();
477
+ + (void)initDatabase
478
+ {
479
+ NSFileManager *fileManager = [NSFileManager defaultManager];
480
+
481
+ NSString *bundleRoot = [[NSBundle mainBundle] resourcePath];
482
+ NSString *rhoRoot = [NSString stringWithUTF8String:rho_native_rhopath()];
483
+
484
+ NSString *dirs[] = { @"db" };
485
+
486
+ copyFromMainBundle(fileManager,
487
+ [bundleRoot stringByAppendingPathComponent:dirs[0]],
488
+ [rhoRoot stringByAppendingPathComponent:dirs[0]],
489
+ NO);
490
+ createFolder(fileManager, [self blobPath], NO);
491
+ }
492
+
493
+ + (NSString *)storagePath
494
+ {
495
+ return [NSString stringWithUTF8String:rho_native_rhopath()];
496
+ }
497
+
498
+ + (NSString *)pathForStorageFile:(NSString *)file
499
+ {
500
+ return [[self storagePath] stringByAppendingString:file];
501
+ }
502
+
503
+ + (NSString *)blobFolder
504
+ {
505
+ return @"db/db-files/";
506
+ }
507
+
508
+ + (NSString *)blobPath
509
+ {
510
+ return [[self storagePath] stringByAppendingString:[self blobFolder]];
511
+ }
512
+
513
+ + (NSString *)pathForBlob:(NSString *)uri
514
+ {
515
+ return [[self storagePath] stringByAppendingString:uri];
516
+ }
517
+
518
+ + (void)fromMainBundle:(NSFileManager *)fileManager copyFile:(NSString *)source toStorage:(NSString *)target forceRemove:(BOOL)remove
519
+ {
520
+ NSString *bundleRoot = [[NSBundle mainBundle] resourcePath];
521
+
522
+ copyFromMainBundle(fileManager, [bundleRoot stringByAppendingPathComponent:source], [self pathForStorageFile:target], remove);
523
+ }
524
+
525
+ @end
526
+
527
+ const char * rho_native_rhopath()
528
+ {
529
+ static bool loaded = FALSE;
530
+ static char root[FILENAME_MAX];
531
+
532
+ if (!loaded)
533
+ {
534
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
535
+ NSString *documentsDirectory = // [paths objectAtIndex:0];
536
+ [ [paths objectAtIndex:0] stringByAppendingString:@"/"];
537
+ [documentsDirectory getFileSystemRepresentation:root maxLength:sizeof(root)];
538
+ loaded = TRUE;
539
+ }
540
+
541
+ return root;
542
+ }
543
+
544
+ const char * rho_native_rhodbpath()
545
+ {
546
+ return rho_native_rhopath();
547
+ }
548
+
549
+ void copyFromMainBundle(NSFileManager *fileManager, NSString *source, NSString *target, BOOL remove)
550
+ {
551
+ BOOL dir;
552
+
553
+ if (![fileManager fileExistsAtPath:source isDirectory:&dir])
554
+ {
555
+ // NSAssert1(0, @"Source item '%@' does not exists in bundle", source);
556
+ return;
557
+ }
558
+
559
+ if (!remove && dir)
560
+ {
561
+ if (![fileManager fileExistsAtPath:target])
562
+ {
563
+ [fileManager createDirectoryAtPath:target attributes:nil];
564
+ }
565
+
566
+ NSDirectoryEnumerator *enumerator = [fileManager enumeratorAtPath:source];
567
+ NSString *child;
568
+ while (nil != (child = [enumerator nextObject]))
569
+ copyFromMainBundle(fileManager, [source stringByAppendingPathComponent:child],
570
+ [target stringByAppendingPathComponent:child], NO);
571
+ }
572
+ else
573
+ {
574
+ NSError *error;
575
+ if ([fileManager fileExistsAtPath:target] && ![fileManager removeItemAtPath:target error:&error])
576
+ {
577
+ // NSAssert2(0, @"Failed to remove '%@': %@", target, [error localizedDescription]);
578
+ return;
579
+ }
580
+ if (![fileManager copyItemAtPath:source toPath:target error:&error])
581
+ {
582
+ // NSAssert3(0, @"Failed to copy '%@' to '%@': %@", source, target, [error localizedDescription]);
583
+ return;
584
+ }
585
+ }
586
+ }
587
+
588
+ void createFolder(NSFileManager *fileManager, NSString *target, BOOL remove)
589
+ {
590
+ BOOL dir;
591
+
592
+ [fileManager fileExistsAtPath:target isDirectory:&dir];
593
+ if (!remove && dir)
594
+ {
595
+ return;
596
+ }
597
+
598
+ NSError *error;
599
+ if (remove)
600
+ {
601
+ if (![fileManager removeItemAtPath:target error:&error])
602
+ {
603
+ return;
604
+ }
605
+ }
606
+
607
+ if (![fileManager createDirectoryAtPath:target withIntermediateDirectories:YES attributes:nil error:&error])
608
+ {
609
+ return;
610
+ }
611
+ }
612
+
613
+ int rho_net_ping_network(const char *szHost)
614
+ {
615
+ RAWLOG_INFO("PING network.");
616
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
617
+
618
+ NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
619
+ NSString *linkString = [NSString stringWithUTF8String:szHost];
620
+
621
+ [request setURL:[NSURL URLWithString:linkString]];
622
+ [request setTimeoutInterval:10];
623
+
624
+ NSError *error = nil;
625
+ NSHTTPURLResponse *response;
626
+ NSData *returnData = NULL;
627
+ returnData = [ NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error ];
628
+
629
+ if (!returnData)
630
+ {
631
+ RAWLOG_ERROR2("PING network FAILED. NSError: %d. NSErrorInfo : %s", [error code], [[error localizedDescription] UTF8String]);
632
+ }
633
+ else
634
+ {
635
+ RAWLOG_INFO("PING network SUCCEEDED.");
636
+ }
637
+
638
+ [pool release];
639
+
640
+ return returnData == NULL ? 0 : 1;
641
+ }