rhoconnect-client 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,209 @@
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
+ #pragma once
50
+
51
+ #include "common/RhoStd.h"
52
+ #include "logging/RhoLog.h"
53
+ #include "common/AutoPointer.h"
54
+ #include "common/IRhoClassFactory.h"
55
+ #include "net/INetRequest.h"
56
+ #include "api_generator/MethodResult.h"
57
+
58
+ typedef int (*RHOC_CALLBACK)(const char* szNotify, void* callback_data);
59
+
60
+ namespace rho {
61
+ namespace db {
62
+ class CDBAdapter;
63
+ }
64
+
65
+ namespace sync {
66
+ class CSyncEngine;
67
+ class CSyncSource;
68
+
69
+ struct CSyncNotification
70
+ {
71
+ apiGenerator::CMethodResult m_callbackData;
72
+
73
+ RHOC_CALLBACK m_cCallback;
74
+ void* m_cCallbackData;
75
+
76
+ boolean m_bRemoveAfterFire;
77
+ CSyncNotification(): m_cCallback(0), m_cCallbackData(0), m_bRemoveAfterFire(false){}
78
+
79
+ CSyncNotification(const apiGenerator::CMethodResult& callbackData, boolean bRemoveAfterFire);
80
+ CSyncNotification(RHOC_CALLBACK callback, void* callback_data, boolean bRemoveAfterFire) :
81
+ m_cCallback(callback), m_cCallbackData(callback_data), m_bRemoveAfterFire(false){}
82
+
83
+ String toString()const;
84
+
85
+ ~CSyncNotification();
86
+ };
87
+
88
+ struct CObjectNotification
89
+ {
90
+ apiGenerator::CMethodResult m_callbackData;
91
+
92
+ RHOC_CALLBACK m_cCallback;
93
+ void* m_cCallbackData;
94
+
95
+ CObjectNotification(): m_cCallback(0), m_cCallbackData(0){}
96
+
97
+ CObjectNotification(const apiGenerator::CMethodResult& callbackData);
98
+ CObjectNotification(RHOC_CALLBACK callback, void* callback_data) :
99
+ m_cCallback(callback), m_cCallbackData(callback_data){}
100
+
101
+ String toString()const;
102
+
103
+ ~CObjectNotification();
104
+ };
105
+
106
+ class CSyncNotify
107
+ {
108
+ DEFINE_LOGCLASS;
109
+
110
+ public:
111
+ enum ENotifyType{ enNone, enDelete, enUpdate, enCreate };
112
+
113
+ private:
114
+
115
+ CSyncEngine& m_syncEngine;
116
+
117
+ static common::CAutoPtr<CObjectNotification> m_pObjectNotify;
118
+ HashtablePtr<int, Hashtable<String,int>* > m_hashSrcIDAndObject;
119
+ HashtablePtr<int, Hashtable<String,String>* > m_hashCreateObjectErrors;
120
+ String m_strSingleObjectSrcName, m_strSingleObjectID;
121
+ Hashtable<int,int> m_hashSrcObjectCount;
122
+ boolean m_bEnableReporting;
123
+ boolean m_bEnableReportingGlobal;
124
+
125
+ static common::CMutex m_mxObjectNotify;
126
+
127
+ HashtablePtr<int,CSyncNotification*> m_mapSyncNotifications;
128
+ common::CAutoPtr<CSyncNotification> m_pAllNotification;
129
+ common::CAutoPtr<CSyncNotification> m_pSearchNotification;
130
+ CSyncNotification m_emptyNotify;
131
+ common::CMutex m_mxSyncNotifications;
132
+ Vector<String> m_arNotifyBody;
133
+ String m_strStatusHide;
134
+ boolean m_bFakeServerResponse;
135
+ boolean m_isInsideCallback;
136
+
137
+ NetRequest m_NetRequest;
138
+
139
+ net::CNetRequestWrapper getNet(){ return getNetRequest(&m_NetRequest); }
140
+ CSyncEngine& getSync(){ return m_syncEngine; }
141
+ public:
142
+ CSyncNotify( CSyncEngine& syncEngine ) : m_syncEngine(syncEngine), m_bEnableReporting(false),
143
+ m_bEnableReportingGlobal(false), m_bFakeServerResponse(false), m_isInsideCallback(false) {}
144
+
145
+ //Object notifications
146
+ void fireObjectsNotification();
147
+ void onObjectChanged(int nSrcID, const String& strObject, int nType);
148
+ void addCreateObjectError(int nSrcID, const String& strObject, const String& strError);
149
+
150
+ void addObjectNotify(int nSrcID, const String& strObject );
151
+ void addObjectNotify(const String& strSrcName, const String& strObject );
152
+ static void setObjectNotification(CObjectNotification* pNotify);
153
+ static CObjectNotification* getObjectNotification();
154
+ void cleanObjectNotifications();
155
+ void cleanCreateObjectErrors();
156
+
157
+ //Sync notifications
158
+ void setSyncNotification(int source_id, CSyncNotification* pNotify);
159
+ void setSearchNotification(CSyncNotification* pNotify);
160
+
161
+ void clearSyncNotification(int source_id);
162
+
163
+ void onSyncSourceEnd( int nSrc, VectorPtr<CSyncSource*>& sources );
164
+ void fireSyncNotification( CSyncSource* psrc, boolean bFinish, int nErrCode, String strMessage);
165
+ void fireSyncNotification2( CSyncSource* src, boolean bFinish, int nErrCode, const Hashtable<String,String>& serverErrors);
166
+
167
+ void fireBulkSyncNotification( boolean bFinish, String status, String partition, int nErrCode );
168
+
169
+ void cleanLastSyncObjectCount();
170
+ int incLastSyncObjectCount(int nSrcID);
171
+ int getLastSyncObjectCount(int nSrcID);
172
+
173
+ void callLoginCallback(const CSyncNotification& oNotify, int nErrCode, String strMessage);
174
+
175
+ boolean isReportingEnabled(){return m_bEnableReporting&&m_bEnableReportingGlobal;}
176
+ bool isStatusPopupEnabled() const { return m_bEnableReportingGlobal; }
177
+ void enableReporting(boolean bEnable){m_bEnableReporting = bEnable;}
178
+ void enableStatusPopup(boolean bEnable){m_bEnableReportingGlobal = bEnable;}
179
+
180
+ const String& getNotifyBody();
181
+ void cleanNotifyBody(){ m_arNotifyBody.removeAllElements(); setFakeServerResponse(false); }
182
+ boolean isFakeServerResponse(){ return m_bFakeServerResponse; }
183
+ void setFakeServerResponse(boolean bFakeServerResponse){ m_bFakeServerResponse = bFakeServerResponse; }
184
+
185
+ void fireAllSyncNotifications( boolean bFinish, int nErrCode, String strError/*, String strServerError*/ );
186
+ void reportSyncStatus(String status, int error, String strDetails);
187
+ void showStatusPopup(const String& status);
188
+
189
+ bool isInsideCallback() const { return m_isInsideCallback; }
190
+ private:
191
+ CSyncNotification* getSyncNotifyBySrc(CSyncSource* src);
192
+
193
+ void appendCreateObjectErrorInfo(int nSrcID, Hashtable< String, Hashtable<String, String> >& result);
194
+ void processSingleObject();
195
+
196
+ void doFireSyncNotification( CSyncSource* src, boolean bFinish, int nErrCode, String strError, const Hashtable<String, String>* params, const Hashtable<String, String>* pServerErrors);
197
+
198
+ boolean callNotify(const CSyncNotification& oNotify, const Hashtable<String, String>& result, const Hashtable<String, Hashtable<String,String> >* l2Result = 0 );
199
+
200
+ void clearNotification(CSyncSource* src);
201
+
202
+ static String notifyParamToStr( const Hashtable<String,String>& result, const Hashtable< String, Hashtable< String, String > >* );
203
+
204
+ };
205
+
206
+ }
207
+ }
208
+
209
+ extern "C" void alert_show_status(const char* title, const char* message, const char* szHide);
@@ -0,0 +1,220 @@
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
+ #pragma once
50
+
51
+ #include "ISyncProtocol.h"
52
+ #include "net/URI.h"
53
+ #include "common/StringConverter.h"
54
+ #include "common/Tokenizer.h"
55
+ #include "common/RhoFilePath.h"
56
+ #include "json/JSONIterator.h"
57
+
58
+ namespace rho {
59
+ namespace sync {
60
+
61
+ struct CSyncProtocol_3 : public ISyncProtocol
62
+ {
63
+ String m_strContentType;
64
+ String m_strClientIDHeader;
65
+
66
+ CSyncProtocol_3()
67
+ {
68
+ m_strContentType = "application/json";
69
+ m_strClientIDHeader = "X-RhoConnect-CLIENT-ID";
70
+ }
71
+
72
+ const String& getClientIDHeader() const { return m_strClientIDHeader; }
73
+ const String& getContentType() const { return m_strContentType; }
74
+ virtual int getVersion() const { return 3; }
75
+
76
+ String getLoginUrl()
77
+ {
78
+ return RHOCONF().getPath("syncserver") + "clientlogin";
79
+ }
80
+
81
+ String getLoginBody( const String& name, const String& password)
82
+ {
83
+ return "{\"login\":" + json::CJSONEntry::quoteValue(name) + ",\"password\":" + json::CJSONEntry::quoteValue(password) + ",\"remember_me\":1}";
84
+ }
85
+
86
+ const char* getClientCreateMethod()
87
+ {
88
+ return "GET";
89
+ }
90
+
91
+ String getClientCreateUrl()
92
+ {
93
+ return RHOCONF().getPath("syncserver") + "clientcreate";
94
+ }
95
+
96
+ String getClientRegisterUrl(const String& /*strClientID*/)
97
+ {
98
+ return RHOCONF().getPath("syncserver") + "clientregister";
99
+ }
100
+
101
+ String getClientRegisterBody( const String& strClientID, const String& strPin, int nPort, const String& strType, const String& strPhoneID, const String& strDevicePushType)
102
+ {
103
+ return "{\"client_id\":" + json::CJSONEntry::quoteValue(strClientID) +
104
+ ",\"device_pin\":" + json::CJSONEntry::quoteValue(strPin) +
105
+ ( strPhoneID.length() > 0 ? ",\"phone_id\":" + json::CJSONEntry::quoteValue(strPhoneID) : "") +
106
+ ",\"device_port\":" + json::CJSONEntry::quoteValue(common::convertToStringA(nPort)) +
107
+ ",\"device_type\":" + json::CJSONEntry::quoteValue(strType) +
108
+ ((strDevicePushType.length() > 0) ? (",\"device_push_type\":" + json::CJSONEntry::quoteValue(strDevicePushType)) : String("")) +
109
+ "}";
110
+ }
111
+
112
+ String getClientAnsRegisterBody( const String& strClientID, const String& strPin, int nPort, const String& strType, const String& strPhoneID )
113
+ {
114
+ return "{\"client_id\":" + json::CJSONEntry::quoteValue(strClientID) +
115
+ ",\"device_pin\":" + json::CJSONEntry::quoteValue(strPin) +
116
+ ( strPhoneID.length() > 0 ? ",\"phone_id\":" + json::CJSONEntry::quoteValue(strPhoneID) : "") +
117
+ ",\"device_port\":" + json::CJSONEntry::quoteValue(common::convertToStringA(nPort)) +
118
+ ",\"device_type\":" + json::CJSONEntry::quoteValue(strType) +
119
+ ",\"device_push_type\":\"rhoconnect_push\"}";
120
+ }
121
+
122
+ const char* getClientResetMethod()
123
+ {
124
+ return "GET";
125
+ }
126
+
127
+ String getClientResetUrl(const String& strClientID)
128
+ {
129
+ String strUrl = RHOCONF().getPath("syncserver") + "clientreset?client_id=" + strClientID;
130
+ String strSources = RHOCONF().getString("reset_models");
131
+ rho::common::CTokenizer tokenizer(strSources, ",");
132
+ while(tokenizer.hasMoreTokens()) {
133
+ String source_name = tokenizer.nextToken();
134
+ if(source_name.length() > 0) {
135
+ strUrl += "&sources[][name]=";
136
+ strUrl += source_name;
137
+ }
138
+ }
139
+ return strUrl;
140
+ }
141
+
142
+ String getClientResetBody()
143
+ {
144
+ return "";
145
+ }
146
+
147
+ String getClientChangesUrl(const String& /*strSrcName*/)
148
+ {
149
+ String strUrl = RHOCONF().getPath("syncserver");
150
+ return strUrl.substr(0,strUrl.length()-1);
151
+ }
152
+
153
+ String getServerQueryUrl(const String& strSrcName, const String& strClientID, int nPageSize)
154
+ {
155
+ String strServerUrl = RHOCONF().getPath("syncserver");
156
+ String strUrl = strServerUrl.substr(0,strServerUrl.length()-1);
157
+
158
+ strUrl += "?client_id=" + strClientID
159
+ + "&p_size=" + common::convertToStringA(nPageSize) + "&version=" + common::convertToStringA(getVersion());
160
+
161
+ if ( strSrcName.length() > 0 )
162
+ strUrl += "&source_name=" + strSrcName;
163
+
164
+ return strUrl;
165
+ }
166
+
167
+ const char* getServerSearchMethod()
168
+ {
169
+ return "GET";
170
+ }
171
+
172
+ String getServerSearchUrl(const String& strClientID, int nPageSize, const String& strFrom, const Vector<String>& sources, const Hashtable<String, String>& source_tokens)
173
+ {
174
+ String strUrl = RHOCONF().getPath("syncserver") + strFrom + "?client_id=" + strClientID + "&p_size="
175
+ + common::convertToStringA(nPageSize) + "&version=" + common::convertToStringA(getVersion());
176
+
177
+ String strSources;
178
+ for ( int i = 0; i < (int)sources.size(); ++i )
179
+ {
180
+ strSources += "&sources[][name]=" + sources[i];
181
+ String strToken = source_tokens.get(sources[i]);
182
+ if(strToken.size() > 0) {
183
+ strSources += "&sources[][token]=" + strToken;
184
+ }
185
+ }
186
+
187
+ return strUrl + strSources;
188
+ }
189
+
190
+ String getServerSearchBody(int nPageSize, const Vector<String>& sources, const Hashtable<String, String>& source_tokens)
191
+ {
192
+ return "";
193
+ }
194
+
195
+ const char* getServerBulkDataMethod()
196
+ {
197
+ return "GET";
198
+ }
199
+
200
+ String getServerBulkDataUrl(const String& strClientID, const String& strPartition, const Vector<String>& sources)
201
+ {
202
+ String strUrl = RHOCONF().getPath("syncserver") + "bulk_data";
203
+ String strParams = "?client_id=" + strClientID + "&partition=" + strPartition + "&sources=";
204
+ for ( int i = 0; i < (int)sources.size(); ++i ) {
205
+ strParams += net::URI::urlEncode(sources[i]);
206
+ if ( i < (int)sources.size()-1 ) {
207
+ strParams += ",";
208
+ }
209
+ }
210
+ return strUrl + strParams;
211
+ }
212
+
213
+ String getServerBulkDataBody(const String& strPartition, const Vector<String>& sources)
214
+ {
215
+ return "";
216
+ }
217
+ };
218
+
219
+ }
220
+ }
@@ -0,0 +1,259 @@
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
+ #pragma once
50
+
51
+ #include "ISyncProtocol.h"
52
+ #include "common/StringConverter.h"
53
+ #include "common/RhoFilePath.h"
54
+ #include "json/JSONIterator.h"
55
+ #include "common/Tokenizer.h"
56
+
57
+ #include <iostream>
58
+
59
+ namespace rho {
60
+ namespace sync {
61
+
62
+ struct CSyncProtocol_4 : public ISyncProtocol
63
+ {
64
+ String m_strContentType;
65
+ String m_strClientIDHeader;
66
+ String m_strAppNamespace;
67
+ String m_strClientNamespace;
68
+ String m_strSANamespace;
69
+
70
+ CSyncProtocol_4()
71
+ {
72
+ m_strContentType = "application/json";
73
+ m_strAppNamespace = "rc/v1/app/";
74
+ m_strClientNamespace = "rc/v1/clients/";
75
+ m_strSANamespace = "app/v1/";
76
+ m_strClientIDHeader = "X-RhoConnect-CLIENT-ID";
77
+ }
78
+
79
+ const String& getAppNamespaceUrl()
80
+ {
81
+ return m_strAppNamespace;
82
+ }
83
+
84
+ const String& getClientNamespaceUrl()
85
+ {
86
+ return m_strClientNamespace;
87
+ }
88
+
89
+ const String& getSANamespaceUrl()
90
+ {
91
+ return m_strSANamespace;
92
+ }
93
+
94
+ const String& getClientIDHeader() const { return m_strClientIDHeader; }
95
+ const String& getContentType() const { return m_strContentType; }
96
+ virtual int getVersion() const { return 3; }
97
+
98
+ String getLoginUrl()
99
+ {
100
+ return RHOCONF().getPath("syncserver") + getAppNamespaceUrl() + "login";
101
+ }
102
+
103
+ String getLoginBody( const String& name, const String& password)
104
+ {
105
+ return "{\"login\":" + json::CJSONEntry::quoteValue(name) + ",\"password\":" + json::CJSONEntry::quoteValue(password) + ",\"remember_me\":1}";
106
+ }
107
+
108
+ const char* getClientCreateMethod()
109
+ {
110
+ return "POST";
111
+ }
112
+
113
+ String getClientCreateUrl()
114
+ {
115
+ String strUrl = RHOCONF().getPath("syncserver") + getClientNamespaceUrl();
116
+ return strUrl.substr(0, strUrl.length() - 1);
117
+ }
118
+
119
+ String getClientRegisterUrl(const String& strClientID)
120
+ {
121
+ return RHOCONF().getPath("syncserver") + getClientNamespaceUrl() + strClientID + "/register";
122
+ }
123
+
124
+ String getClientRegisterBody( const String& /*strClientID*/, const String& strPin, int nPort, const String& strType, const String& strPhoneID, const String& strDevicePushType)
125
+ {
126
+ String strPort = "";
127
+ if (nPort != 0) {
128
+ strPort = common::convertToStringA(nPort);
129
+ }
130
+
131
+ return "{\"device_pin\":" + json::CJSONEntry::quoteValue(strPin) +
132
+ ( strPhoneID.length() > 0 ? ",\"phone_id\":" + json::CJSONEntry::quoteValue(strPhoneID) : "") +
133
+ ",\"device_port\":" + json::CJSONEntry::quoteValue(strPort) +
134
+ ",\"device_type\":" + json::CJSONEntry::quoteValue(strType) +
135
+ ",\"device_push_type\":" + json::CJSONEntry::quoteValue(strDevicePushType) +
136
+ "}";
137
+ }
138
+
139
+ String getClientAnsRegisterBody( const String& /*strClientID*/, const String& strPin, int nPort, const String& strType, const String& strPhoneID )
140
+ {
141
+ return "{\"device_pin\":" + json::CJSONEntry::quoteValue(strPin) +
142
+ ( strPhoneID.length() > 0 ? ",\"phone_id\":" + json::CJSONEntry::quoteValue(strPhoneID) : "") +
143
+ ",\"device_port\":" + json::CJSONEntry::quoteValue(common::convertToStringA(nPort)) +
144
+ ",\"device_type\":" + json::CJSONEntry::quoteValue(strType) +
145
+ ",\"device_push_type\":\"rhoconnect_push\"}";
146
+ }
147
+
148
+ const char* getClientResetMethod()
149
+ {
150
+ return "POST";
151
+ }
152
+
153
+ String getClientResetUrl(const String& strClientID)
154
+ {
155
+ return RHOCONF().getPath("syncserver") + getClientNamespaceUrl() + strClientID + "/reset";
156
+ }
157
+
158
+ String getClientResetBody()
159
+ {
160
+ String strBody;
161
+ String strSources = RHOCONF().getString("reset_models");
162
+ rho::common::CTokenizer tokenizer(strSources, ",");
163
+ String strJSONSources;
164
+ while(tokenizer.hasMoreTokens()) {
165
+ String source_name = tokenizer.nextToken();
166
+ if(source_name.length() > 0) {
167
+
168
+ if (strJSONSources.length() > 0) {
169
+ strJSONSources += ",";
170
+ }
171
+
172
+ strJSONSources += "{\"name\":";
173
+ strJSONSources += json::CJSONEntry::quoteValue(source_name);
174
+ strJSONSources += "}";
175
+ }
176
+ }
177
+ if(strJSONSources.size()) {
178
+ strBody += "{\"sources\":[";
179
+ strBody += strJSONSources;
180
+ strBody += "]}";
181
+ }
182
+ return strBody;
183
+ }
184
+
185
+ String getClientChangesUrl(const String& strSrcName)
186
+ {
187
+ return RHOCONF().getPath("syncserver") + getSANamespaceUrl() + strSrcName;
188
+ }
189
+
190
+ String getServerQueryUrl(const String& strSrcName, const String& strClientID, int nPageSize)
191
+ {
192
+ String strUrl = RHOCONF().getPath("syncserver") + getSANamespaceUrl() + strSrcName;
193
+ strUrl += "?p_size=" + common::convertToStringA(nPageSize) + "&version=" + common::convertToStringA(getVersion());
194
+ return strUrl;
195
+ }
196
+
197
+ const char* getServerSearchMethod()
198
+ {
199
+ return "POST";
200
+ }
201
+
202
+ String getServerSearchUrl(const String& strClientID, int nPageSize, const String& strFrom, const Vector<String>& sources, const Hashtable<String, String>& source_tokens)
203
+ {
204
+ return RHOCONF().getPath("syncserver") + getAppNamespaceUrl() + strFrom +
205
+ "?p_size=" + common::convertToStringA(nPageSize) + "&version=" + common::convertToStringA(getVersion());
206
+ }
207
+
208
+ String getServerSearchBody(int nPageSize, const Vector<String>& sources, const Hashtable<String, String>& source_tokens )
209
+ {
210
+ String strJSONSources;
211
+ for (int i = 0; i < (int)sources.size(); ++i )
212
+ {
213
+ strJSONSources += "{\"name\":";
214
+ strJSONSources += json::CJSONEntry::quoteValue(sources[i]);
215
+ String strToken = source_tokens.get(sources[i]);
216
+ if(strToken.length() > 0) {
217
+ strJSONSources += ",\"token\":";
218
+ strJSONSources += json::CJSONEntry::quoteValue(strToken);
219
+ }
220
+ strJSONSources += "}";
221
+ }
222
+
223
+ String strBody;
224
+ if(strJSONSources.length() > 0) {
225
+ strBody += "\"sources\":[";
226
+ strBody += strJSONSources;
227
+ strBody += "]";
228
+ }
229
+
230
+ if(strBody.size() > 0)
231
+ strBody = String("{") + strBody + "}";
232
+
233
+ return strBody;
234
+ }
235
+
236
+ const char* getServerBulkDataMethod()
237
+ {
238
+ return "POST";
239
+ }
240
+
241
+ String getServerBulkDataUrl(const String& strClientID, const String& strPartition, const Vector<String>& sources)
242
+ {
243
+ return RHOCONF().getPath("syncserver") + getAppNamespaceUrl() + "bulk_data";
244
+ }
245
+
246
+ String getServerBulkDataBody(const String& strPartition, const Vector<String>& sources)
247
+ {
248
+ String strBody = "{\"partition\":";
249
+ strBody += json::CJSONEntry::quoteValue(strPartition);
250
+ strBody += ",\"sources\":";
251
+ strBody += json::CJSONEntry::toJSON(sources);
252
+ strBody += "}";
253
+
254
+ return strBody;
255
+ }
256
+ };
257
+
258
+ }
259
+ }