rhodes 2.3.2 → 2.4.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +18 -0
- data/CREDITS +38 -0
- data/README.md +2 -2
- data/Rakefile +60 -2
- data/bin/set-rhodes-sdk.bat +1 -0
- data/doc/application.txt +11 -0
- data/doc/build.txt +156 -39
- data/doc/configuration.txt +1 -10
- data/doc/connect-to-web-services.txt +6 -6
- data/doc/device-caps.txt +48 -5
- data/doc/extensions.txt +8 -1
- data/doc/rhom.txt +16 -0
- data/doc/synchronization.txt +56 -14
- data/doc/ui.txt +23 -2
- data/installer/instant-rhodes.nsi +6 -6
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +4 -2
- data/lib/extensions/barcode/ext/barcode/platform/wm/Rakefile +1 -1
- data/lib/extensions/digest-md5/ext/Rakefile +3 -3
- data/lib/extensions/digest-md5/ext/build +0 -1
- data/lib/extensions/digest-sha1/ext/Rakefile +1 -1
- data/lib/extensions/digest-sha1/ext/build +0 -1
- data/lib/extensions/digest/ext/Rakefile +3 -3
- data/lib/extensions/digest/ext/build +0 -1
- data/lib/extensions/fcntl/ext/Rakefile +1 -1
- data/lib/extensions/mspec/mspec/guards/guard.rb +4 -0
- data/lib/extensions/mspec/mspec/helpers/environment.rb +4 -0
- data/lib/extensions/nfc/ext.yml +2 -0
- data/lib/extensions/nfc/ext/build +12 -0
- data/lib/extensions/nfc/ext/build.bat +8 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml +25 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/Rakefile +94 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/ext_build.files +4 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/jni/src/nfc.cpp +404 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/Nfc.java +138 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcMessage.java +34 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcMessagePack.java +33 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcRecord.java +149 -0
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc.i +22 -0
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc_wrap.c +2034 -0
- data/lib/extensions/nfc/nfc.rb +120 -0
- data/lib/extensions/rholang/{lang_ca.rb → rholang/lang_ca.rb} +0 -0
- data/lib/extensions/rholang/{lang_cf.rb → rholang/lang_cf.rb} +0 -0
- data/lib/extensions/rholang/{lang_chef.rb → rholang/lang_chef.rb} +0 -0
- data/lib/extensions/rholang/{lang_cs.rb → rholang/lang_cs.rb} +0 -0
- data/lib/extensions/rholang/{lang_da.rb → rholang/lang_da.rb} +0 -0
- data/lib/extensions/rholang/{lang_de.rb → rholang/lang_de.rb} +0 -0
- data/lib/extensions/rholang/{lang_es.rb → rholang/lang_es.rb} +0 -0
- data/lib/extensions/rholang/{lang_es_ar.rb → rholang/lang_es_ar.rb} +0 -0
- data/lib/extensions/rholang/{lang_fi.rb → rholang/lang_fi.rb} +0 -0
- data/lib/extensions/rholang/{lang_fr.rb → rholang/lang_fr.rb} +0 -0
- data/lib/extensions/rholang/{lang_it.rb → rholang/lang_it.rb} +0 -0
- data/lib/extensions/rholang/{lang_ko.rb → rholang/lang_ko.rb} +0 -0
- data/lib/extensions/rholang/{lang_nl.rb → rholang/lang_nl.rb} +0 -0
- data/lib/extensions/rholang/{lang_no.rb → rholang/lang_no.rb} +0 -0
- data/lib/extensions/rholang/{lang_pt.rb → rholang/lang_pt.rb} +0 -0
- data/lib/extensions/rholang/{lang_pt_br.rb → rholang/lang_pt_br.rb} +0 -0
- data/lib/extensions/rholang/{lang_ru.rb → rholang/lang_ru.rb} +0 -0
- data/lib/extensions/rholang/{lang_se.rb → rholang/lang_se.rb} +0 -0
- data/lib/extensions/rholang/{lang_sr.rb → rholang/lang_sr.rb} +0 -0
- data/lib/extensions/rholang/{rhoerror_ru.rb → rholang/rhoerror_ru.rb} +0 -0
- data/lib/extensions/rholang/{rhomsg_ru.rb → rholang/rhomsg_ru.rb} +0 -0
- data/lib/framework/date/format.rb +2 -0
- data/lib/framework/dateOrig.rb +17 -8
- data/lib/framework/rational18.rb +532 -0
- data/lib/framework/res/back_btn.wp7.png +0 -0
- data/lib/framework/res/blue_pushpin.wp7.png +0 -0
- data/lib/framework/res/blue_pushpin_small.wp7.png +0 -0
- data/lib/framework/res/callout.wp7.png +0 -0
- data/lib/framework/res/callout_link.wp7.png +0 -0
- data/lib/framework/res/esri.wp7.png +0 -0
- data/lib/framework/res/forward_btn.wp7.png +0 -0
- data/lib/framework/res/home_btn.wp7.png +0 -0
- data/lib/framework/res/options_btn.wp7.png +0 -0
- data/lib/framework/res/refresh_btn.wp7.png +0 -0
- data/lib/framework/rho/render.rb +8 -1
- data/lib/framework/rho/rho.rb +30 -7
- data/lib/framework/rho/rhoapplication.rb +9 -4
- data/lib/framework/rho/rhofsconnector.rb +5 -1
- data/lib/framework/rho/rhotabbar.rb +8 -0
- data/lib/framework/rho/rhotoolbar.rb +1 -1
- data/lib/framework/rho/rhoviewhelpers.rb +18 -1
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhoframework.rb +46 -1
- data/lib/framework/rholang/localization_simplified.rb +17 -16
- data/lib/framework/rhom/rhom_db_adapter.rb +2 -2
- data/lib/framework/rhom/rhom_object_factory.rb +115 -12
- data/lib/framework/rhosystem.rb +135 -0
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/lib/test/apps/rhoconfig.txt +23 -23
- data/platform/android/Rhodes/AndroidManifest.full.xml +101 -0
- data/platform/android/Rhodes/AndroidManifest.xml +10 -15
- data/platform/android/Rhodes/default.properties +11 -0
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +59 -53
- data/platform/android/Rhodes/jni/include/rhodes.h +1 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesApplication.h +21 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_alert_PopupActivity.h +21 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_file_RhoFileApi.h +10 -2
- data/platform/android/Rhodes/jni/src/alert.cpp +2 -1
- data/platform/android/Rhodes/jni/src/datetimepicker.cpp +2 -0
- data/platform/android/Rhodes/jni/src/fileapi.cpp +671 -84
- data/platform/android/Rhodes/jni/src/nativebar.cpp +18 -0
- data/platform/android/Rhodes/jni/src/rhodes.cpp +92 -1
- data/platform/android/Rhodes/res/values/styles.xml +7 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +35 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +12 -13
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/LocalFileProvider.java +130 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +6 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +5 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +6 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +7 -36
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +43 -20
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +2 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +63 -28
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Utils.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +6 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +19 -282
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/PopupActivity.java +354 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +4 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +1 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +71 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +107 -37
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +10 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +156 -56
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +0 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +40 -32
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java +14 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/LocalFileHandler.java +46 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +4 -24
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/UriHandler.java +3 -1
- data/platform/android/build/RhodesSRC_build.files +28 -25
- data/platform/android/build/android.rake +230 -54
- data/platform/android/build/androidcommon.rb +1 -1
- data/platform/android/build/librhocommon_build.files +1 -0
- data/platform/bb/Hsqldb/BlackBerry_App_Descriptor.xml +20 -0
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +1 -5
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +6 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/rowio/RowOutputBase.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/rowio/RowOutputBinary.java +1 -1
- data/platform/bb/RubyVM/BlackBerry_App_Descriptor.xml +20 -0
- data/platform/bb/RubyVM/src/com/rho/IRhoRubyHelper.java +2 -0
- data/platform/bb/RubyVM/src/com/rho/RhoLogOutputSink.java +0 -1
- data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +12 -10
- data/platform/bb/RubyVM/src/com/rho/RhoThread.java +16 -0
- data/platform/bb/RubyVM/src/com/rho/RhoTimer.java +89 -0
- data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +20 -13
- data/platform/bb/RubyVM/src/com/rho/SplashScreen.java +1 -2
- data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +2 -2
- data/platform/bb/RubyVM/src/com/rho/TimeInterval.java +5 -0
- data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +54 -48
- data/platform/bb/RubyVM/src/com/rho/db/IDBResult.java +0 -1
- data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +1 -0
- data/platform/bb/RubyVM/src/com/rho/net/AsyncHttp.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/ClientRegister.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +16 -8
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +2 -2
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +52 -29
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +1 -3
- data/platform/bb/build/RubyVM_build.files +1 -0
- data/platform/bb/build/bb.rake +29 -9
- data/platform/bb/rhodes/BlackBerry_App_Descriptor.xml +23 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +1 -1
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteCopyResult.java +0 -4
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteResult.java +13 -20
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteStorage.java +183 -157
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +22 -0
- data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +1 -1
- data/platform/bb/rhodes/src/com/rho/db/SqliteCopyResult.java +0 -4
- data/platform/bb/rhodes/src/com/rho/db/SqliteResult.java +13 -20
- data/platform/bb/rhodes/src/com/rho/db/SqliteStorage.java +183 -157
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +46 -1
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +8 -1
- data/platform/bb/rhodes/src/rhomobile/camera/CameraFilesListener.java +13 -3
- data/platform/iphone/Classes/AppManager/AppManager.h +5 -1
- data/platform/iphone/Classes/AppManager/AppManager.m +170 -7
- data/platform/iphone/Classes/DateTimePicker.m +14 -1
- data/platform/iphone/Classes/DateTimePickerDelegate.h +2 -0
- data/platform/iphone/Classes/DateTimePickerDelegate.m +36 -2
- data/platform/iphone/Classes/NativeBar.h +1 -0
- data/platform/iphone/Classes/NativeBar.m +15 -3
- data/platform/iphone/Classes/Phonebook/phonebook.m +8 -9
- data/platform/iphone/Classes/Rhodes.m +50 -6
- data/platform/iphone/Classes/SimpleMainView.m +7 -6
- data/platform/iphone/Classes/SplitView/RightViewController.h +3 -1
- data/platform/iphone/Classes/SplitView/RightViewController.m +14 -1
- data/platform/iphone/Classes/TabbedMainView.h +4 -0
- data/platform/iphone/Classes/TabbedMainView.m +43 -26
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
- data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +3 -3
- data/platform/iphone/rbuild/iphone.rake +168 -119
- data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -2
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +3 -3
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +2 -2
- data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +3 -3
- data/platform/shared/SyncClient/SyncClient.cpp +20 -8
- data/platform/shared/SyncClient/SyncClient.h +2 -1
- data/platform/shared/common/RhoDefs.h +4 -0
- data/platform/shared/common/RhoPort.h +22 -0
- data/platform/shared/common/RhoStd.h +5 -0
- data/platform/shared/common/RhoTime.cpp +73 -0
- data/platform/shared/common/RhoTime.h +26 -53
- data/platform/shared/common/RhodesApp.cpp +29 -28
- data/platform/shared/common/RhodesApp.h +4 -1
- data/platform/shared/common/StringConverter.h +37 -10
- data/platform/shared/common/app_build_capabilities.h +2 -0
- data/platform/shared/common/rhoparams.cpp +25 -12
- data/platform/shared/common/rhoparams.h +10 -8
- data/platform/shared/db/DBAdapter.cpp +0 -22
- data/platform/shared/json/RJSONTokener.c +15 -23
- data/platform/shared/net/AsyncHttp.cpp +9 -8
- data/platform/shared/net/HttpServer.cpp +61 -19
- data/platform/shared/net/HttpServer.h +2 -0
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker.i +3 -0
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +151 -402
- data/platform/shared/ruby/ext/nativebar/nativebar.i +3 -0
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +154 -403
- data/platform/shared/ruby/ext/rho/rhoruby.c +4 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +2 -0
- data/platform/shared/ruby/ext/system/system.i +8 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +80 -5
- data/platform/shared/ruby/file.c +6 -4
- data/platform/shared/ruby/gc.c +1 -1
- data/platform/shared/ruby/linux/ruby/config.h +7 -2
- data/platform/shared/ruby/missing/acosh.c +3 -3
- data/platform/shared/ruby/wince/_time.h +1 -1
- data/platform/shared/ruby/wince/stdlib.c +1 -1
- data/platform/shared/ruby/wince/string_wce.c +2 -2
- data/platform/shared/ruby/wince/sys/timeb.c +1 -0
- data/platform/shared/ruby/wince/time_wce.c +8 -0
- data/platform/shared/ruby/wince/wince.c +7 -7
- data/platform/shared/ruby/wince/wince.h +22 -0
- data/platform/shared/rubyext/System.cpp +19 -1
- data/platform/shared/sqlite/sqlite3.c +18993 -8129
- data/platform/shared/sqlite/sqlite3.h +953 -358
- data/platform/shared/sqlite/sqlite3ext.h +42 -0
- data/platform/shared/sync/SyncEngine.cpp +10 -0
- data/platform/shared/sync/SyncSource.cpp +41 -19
- data/platform/shared/sync/SyncSource.h +1 -1
- data/platform/shared/tcmalloc/rhomem.h +7 -2
- data/platform/shared/tcmalloc/windows/port.h +2 -0
- data/platform/shared/unzip/unzip.cpp +1 -0
- data/platform/shared/xruby/src/com/xruby/compiler/parser/RubyParser.java +11 -1
- data/platform/wm/RhoLib/RhoLib.vcproj +182 -24
- data/platform/wm/build/wm.rake +16 -3
- data/platform/wm/rhodes.sln +106 -113
- data/platform/wm/rhodes/Alert.cpp +6 -7
- data/platform/wm/rhodes/AppManager.cpp +8 -17
- data/platform/wm/rhodes/DateTimePicker.cpp +3 -0
- data/platform/wm/rhodes/DateTimePicker.h +2 -0
- data/platform/wm/rhodes/MainWindow.cpp +36 -16
- data/platform/wm/rhodes/MainWindow.h +6 -3
- data/platform/wm/rhodes/OutlookApp.cpp +3 -3
- data/platform/wm/rhodes/Rhodes.cpp +46 -27
- data/platform/wm/rhodes/Rhodes.rc +16 -3
- data/platform/wm/rhodes/RingtoneManager.cpp +7 -7
- data/platform/wm/rhodes/RingtoneManager.h +1 -1
- data/platform/wm/rhodes/Utils.cpp +2 -1
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +1 -13
- data/platform/wm/rhodes/bluetooth/Bluetooth.h +1 -2
- data/platform/wm/rhodes/camera/Camera.cpp +6 -12
- data/platform/wm/rhodes/phonebook/phonebook.cpp +11 -11
- data/platform/wm/rhodes/phonebook/phonebook.h +1 -1
- data/platform/wm/rhodes/resource.h +3 -1
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +7 -5
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.cpp +6 -6
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +6 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +84 -19
- data/platform/wm/rhodes/rho/rubyext/calendar.cpp +2 -2
- data/platform/wm/rhodes/rhodes.vcproj +316 -73
- data/platform/wm/rhodes/signature/Signature.cpp +336 -6
- data/platform/wm/rhodes/signature/Signature.h +55 -0
- data/platform/wm/rhodes/stdafx.h +7 -4
- data/platform/wm/rubylib/rubylib.vcproj +261 -91
- data/platform/wm/sqlite3/sqlite3.vcproj +223 -69
- data/platform/wm/syncengine/syncengine.vcproj +220 -66
- data/platform/wm/tcmalloc/tcmalloc.vcproj +197 -43
- data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Builtins/ConsoleStream.cs +107 -0
- data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/Loader.cs +1037 -0
- data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/RubyUtils.cs +1476 -0
- data/platform/wp7/RhoAppRunner/Program.cs +55 -0
- data/platform/wp7/RhoAppRunner/Properties/AssemblyInfo.cs +36 -0
- data/platform/wp7/RhoAppRunner/RhoAppRunner.csproj +69 -0
- data/platform/wp7/RhoRubyExtGen/GenerateInitializers.cmd +7 -0
- data/platform/wp7/RhoRubyExtGen/Properties/AssemblyInfo.cs +36 -0
- data/platform/wp7/RhoRubyExtGen/RhoAsyncHttp.cs +38 -0
- data/platform/wp7/RhoRubyExtGen/RhoDatabase.cs +93 -0
- data/platform/wp7/RhoRubyExtGen/RhoJSON.cs +37 -0
- data/platform/wp7/RhoRubyExtGen/RhoNativeBar.cs +106 -0
- data/platform/wp7/RhoRubyExtGen/RhoRubyExtGen.csproj +75 -0
- data/platform/wp7/RhoRubyExtGen/RhoSyncEngine.cs +123 -0
- data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +42 -0
- data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +309 -0
- data/platform/wp7/RhoRubyLib/Properties/AssemblyInfo.cs +36 -0
- data/platform/wp7/RhoRubyLib/RhoAppAdapter.cs +96 -0
- data/platform/wp7/RhoRubyLib/RhoRuby.cs +296 -0
- data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +155 -0
- data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +107 -0
- data/platform/wp7/RhoRubyLib/common/IInputStream.cs +21 -0
- data/platform/wp7/RhoRubyLib/common/Mutex.cs +30 -0
- data/platform/wp7/RhoRubyLib/common/RhoConf.cs +389 -0
- data/platform/wp7/RhoRubyLib/common/RhoEmptyProfiler.cs +27 -0
- data/platform/wp7/RhoRubyLib/common/RhoFile.cs +332 -0
- data/platform/wp7/RhoRubyLib/common/RhoFilePath.cs +89 -0
- data/platform/wp7/RhoRubyLib/common/RhoParamArray.cs +33 -0
- data/platform/wp7/RhoRubyLib/common/RhoParams.cs +66 -0
- data/platform/wp7/RhoRubyLib/common/RhoProfiler.cs +145 -0
- data/platform/wp7/RhoRubyLib/common/RhoResourceMap.cs +68 -0
- data/platform/wp7/RhoRubyLib/common/RhoStd.cs +205 -0
- data/platform/wp7/RhoRubyLib/common/RhoThread.cs +114 -0
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +504 -0
- data/platform/wp7/RhoRubyLib/common/ThreadQueue.cs +199 -0
- data/platform/wp7/RhoRubyLib/common/TimeInterval.cs +56 -0
- data/platform/wp7/RhoRubyLib/common/Tokenizer.cs +52 -0
- data/platform/wp7/RhoRubyLib/db/DBAdapter.cs +1129 -0
- data/platform/wp7/RhoRubyLib/db/DBAttrManager.cs +92 -0
- data/platform/wp7/RhoRubyLib/db/DBException.cs +35 -0
- data/platform/wp7/RhoRubyLib/db/IDBCallback.cs +10 -0
- data/platform/wp7/RhoRubyLib/db/IDBResult.cs +33 -0
- data/platform/wp7/RhoRubyLib/db/IDBStorage.cs +32 -0
- data/platform/wp7/RhoRubyLib/db/SqliteCopyResult.cs +79 -0
- data/platform/wp7/RhoRubyLib/db/SqliteResult.cs +267 -0
- data/platform/wp7/RhoRubyLib/db/SqliteStorage.cs +319 -0
- data/platform/wp7/RhoRubyLib/json/JSONArrayIterator.cs +63 -0
- data/platform/wp7/RhoRubyLib/json/JSONEntry.cs +96 -0
- data/platform/wp7/RhoRubyLib/json/JSONStructIterator.cs +77 -0
- data/platform/wp7/RhoRubyLib/json/JsonParser.cs +483 -0
- data/platform/wp7/RhoRubyLib/json/RJSONTokener.cs +406 -0
- data/platform/wp7/RhoRubyLib/logging/IRhoLogSink.cs +12 -0
- data/platform/wp7/RhoRubyLib/logging/RhoLogConf.cs +161 -0
- data/platform/wp7/RhoRubyLib/logging/RhoLogFileSink.cs +174 -0
- data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +320 -0
- data/platform/wp7/RhoRubyLib/net/AsyncHttp.cs +362 -0
- data/platform/wp7/RhoRubyLib/net/HttpServer.cs +466 -0
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +717 -0
- data/platform/wp7/RhoRubyLib/net/NetResponse.cs +64 -0
- data/platform/wp7/RhoRubyLib/net/URI.cs +187 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoAsyncHttp.cs +43 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoDatabase.cs +177 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoJSON.cs +39 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoKernelOps.cs +19 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoNativeBar.cs +117 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +199 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +49 -0
- data/platform/wp7/RhoRubyLib/sync/ClientRegister.cs +142 -0
- data/platform/wp7/RhoRubyLib/sync/ISyncProtocol.cs +23 -0
- data/platform/wp7/RhoRubyLib/sync/ISyncStatusListener.cs +10 -0
- data/platform/wp7/RhoRubyLib/sync/SyncEngine.cs +1051 -0
- data/platform/wp7/RhoRubyLib/sync/SyncNotify.cs +651 -0
- data/platform/wp7/RhoRubyLib/sync/SyncProtocol_3.cs +79 -0
- data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +1105 -0
- data/platform/wp7/RhoRubyLib/sync/SyncThread.cs +301 -0
- data/platform/wp7/WPApplication.sln +50 -0
- data/platform/wp7/WPApplication/App.xaml +19 -0
- data/platform/wp7/WPApplication/App.xaml.cs +211 -0
- data/platform/wp7/WPApplication/ApplicationIcon.png +0 -0
- data/platform/wp7/WPApplication/Background.png +0 -0
- data/platform/wp7/WPApplication/MainPage.xaml +44 -0
- data/platform/wp7/WPApplication/MainPage.xaml.cs +132 -0
- data/platform/wp7/WPApplication/Properties/AppManifest.xml +6 -0
- data/platform/wp7/WPApplication/Properties/AssemblyInfo.cs +35 -0
- data/platform/wp7/WPApplication/Properties/WMAppManifest.xml +32 -0
- data/platform/wp7/WPApplication/SplashScreenImage.jpg +0 -0
- data/platform/wp7/WPApplication/WPApplication.csproj +201 -0
- data/platform/wp7/WPApplication/WP_PlatformAdaptationLayer.cs +88 -0
- data/platform/wp7/WPApplication/app_manifest.txt +1 -0
- data/platform/wp7/WPApplication/readme.htm +40 -0
- data/platform/wp7/WPApplication/readme2.htm +37 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/edit.bb.erb +29 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/edit.erb +32 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/index.bb.erb +21 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/index.erb +26 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/model1.rb +10 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/model1_controller.rb +58 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/new.bb.erb +29 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/new.erb +31 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/show.bb.erb +26 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/show.erb +28 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/controller.rb +75 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/home.bb.erb +17 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/home.erb +20 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/index.bb.erb +32 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/index.erb +30 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/login.bb.erb +35 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/login.erb +27 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/reset.bb.erb +15 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/reset.erb +17 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/wait.bb.erb +3 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/wait.erb +5 -0
- data/platform/wp7/WPApplication/rho/apps/app/application.rb +16 -0
- data/platform/wp7/WPApplication/rho/apps/app/helpers/application_helper.rb +126 -0
- data/platform/wp7/WPApplication/rho/apps/app/helpers/browser_helper.rb +18 -0
- data/platform/wp7/WPApplication/rho/apps/app/index.bb.erb +26 -0
- data/platform/wp7/WPApplication/rho/apps/app/index.erb +26 -0
- data/platform/wp7/WPApplication/rho/apps/app/layout.erb +45 -0
- data/platform/wp7/WPApplication/rho/apps/app/loading.html +11 -0
- data/platform/wp7/WPApplication/rho/apps/app_manifest.txt +1 -0
- data/platform/wp7/WPApplication/rho/apps/public/css/android.css +330 -0
- data/platform/wp7/WPApplication/rho/apps/public/css/blackberry.css +115 -0
- data/platform/wp7/WPApplication/rho/apps/public/css/iphone.css +410 -0
- data/platform/wp7/WPApplication/rho/apps/public/css/windows_mobile.css +222 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/IUI_LICENSE.txt +21 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_check_off.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_check_on.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_radio_off.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_radio_on.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/disclosure.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/ic_menu_more.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/backButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/blueButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/cancel.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/grayButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/disclosure.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/disclosure_detail.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/backButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/blueButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/cancel.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/chevron.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/grayButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/listArrowSel.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/listGroup.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/loading.gif +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/on_off.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/pinstripes.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/selection.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/thumb.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toggle.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toggleOn.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toolButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toolbar.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/whiteButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/radiobutton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/select.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/switch.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iui-logo-touch-icon.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/listArrow.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/listArrowDown.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/listArrowSel.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/listGroup.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/loading.gif +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/pinstripes.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/right_button.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/selection.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/thumb.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toggle.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toggleOn.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toolButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toolButton_new.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toolbar.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/whiteButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch-iphone.css +9 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.css +374 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.js +742 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.transitions.js +60 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jquery.1.3.2.min.js +19 -0
- data/platform/wp7/WPApplication/rho/apps/public/js/application.js +1 -0
- data/platform/wp7/WPApplication/rho/apps/public/js/rho.js +4 -0
- data/platform/wp7/WPApplication/rho/apps/public/js/rhogeolocation-wm.js +59 -0
- data/platform/wp7/WPApplication/rho/apps/public/js/rhogeolocation.js +11 -0
- data/platform/wp7/WPApplication/rho/apps/rhoconfig.txt +32 -0
- data/platform/wp7/WPApplication/rhoconfig.txt +32 -0
- data/platform/wp7/WPApplication/windows_mobile.css +222 -0
- data/platform/wp7/build/wp.rake +261 -0
- data/platform/wp7/rhodes.sln +79 -0
- data/platform/wp7/rhodes/App.xaml +19 -0
- data/platform/wp7/rhodes/App.xaml.cs +144 -0
- data/platform/wp7/rhodes/Background.png +0 -0
- data/platform/wp7/rhodes/MainPage.xaml +44 -0
- data/platform/wp7/rhodes/MainPage.xaml.cs +98 -0
- data/platform/wp7/rhodes/Properties/AppManifest.xml +6 -0
- data/platform/wp7/rhodes/Properties/AssemblyInfo.cs +35 -0
- data/platform/wp7/rhodes/Properties/WMAppManifest.xml +31 -0
- data/platform/wp7/rhodes/Rhodes.csproj +127 -0
- data/platform/wp7/rhodes/SplashScreenImage.jpg +0 -0
- data/platform/wp7/rhodes/icon.png +0 -0
- data/platform/wp7/sqlite3/Properties/AssemblyInfo.cs +35 -0
- data/platform/wp7/sqlite3/SQLiteClient.cs +550 -0
- data/platform/wp7/sqlite3/SqliteWrapper/BtreeInt_h.cs +774 -0
- data/platform/wp7/sqlite3/SqliteWrapper/Btree_h.cs +280 -0
- data/platform/wp7/sqlite3/SqliteWrapper/ClassDiagram1.cd +1306 -0
- data/platform/wp7/sqlite3/SqliteWrapper/Delagates.cs +365 -0
- data/platform/wp7/sqlite3/SqliteWrapper/Hash_h.cs +133 -0
- data/platform/wp7/sqlite3/SqliteWrapper/VdbeInt_h.cs +620 -0
- data/platform/wp7/sqlite3/SqliteWrapper/Vdbe_h.cs +302 -0
- data/platform/wp7/sqlite3/SqliteWrapper/_Custom.cs +449 -0
- data/platform/wp7/sqlite3/SqliteWrapper/alter_c.cs +872 -0
- data/platform/wp7/sqlite3/SqliteWrapper/analyze_c.cs +757 -0
- data/platform/wp7/sqlite3/SqliteWrapper/attach_c.cs +628 -0
- data/platform/wp7/sqlite3/SqliteWrapper/auth_c.cs +268 -0
- data/platform/wp7/sqlite3/SqliteWrapper/backup_c.cs +737 -0
- data/platform/wp7/sqlite3/SqliteWrapper/bitvec_c.cs +509 -0
- data/platform/wp7/sqlite3/SqliteWrapper/btmutex_c.cs +379 -0
- data/platform/wp7/sqlite3/SqliteWrapper/btree_c.cs +9138 -0
- data/platform/wp7/sqlite3/SqliteWrapper/build_c.cs +4189 -0
- data/platform/wp7/sqlite3/SqliteWrapper/callback_c.cs +548 -0
- data/platform/wp7/sqlite3/SqliteWrapper/complete_c.cs +342 -0
- data/platform/wp7/sqlite3/SqliteWrapper/ctime_cs.cs +408 -0
- data/platform/wp7/sqlite3/SqliteWrapper/date_c.cs +1317 -0
- data/platform/wp7/sqlite3/SqliteWrapper/delete_c.cs +726 -0
- data/platform/wp7/sqlite3/SqliteWrapper/expr_c.cs +4406 -0
- data/platform/wp7/sqlite3/SqliteWrapper/fault_c.cs +115 -0
- data/platform/wp7/sqlite3/SqliteWrapper/fkey_c.cs +1330 -0
- data/platform/wp7/sqlite3/SqliteWrapper/func_c.cs +2025 -0
- data/platform/wp7/sqlite3/SqliteWrapper/global_c.cs +228 -0
- data/platform/wp7/sqlite3/SqliteWrapper/hash_c.cs +351 -0
- data/platform/wp7/sqlite3/SqliteWrapper/hwtime_c.cs +101 -0
- data/platform/wp7/sqlite3/SqliteWrapper/insert_c.cs +2122 -0
- data/platform/wp7/sqlite3/SqliteWrapper/journal_c.cs +247 -0
- data/platform/wp7/sqlite3/SqliteWrapper/keywordhash_h.cs +302 -0
- data/platform/wp7/sqlite3/SqliteWrapper/legacy_c.cs +223 -0
- data/platform/wp7/sqlite3/SqliteWrapper/loadext_c.cs +683 -0
- data/platform/wp7/sqlite3/SqliteWrapper/main_c.cs +2716 -0
- data/platform/wp7/sqlite3/SqliteWrapper/malloc_c.cs +977 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mem_Pool.cs +394 -0
- data/platform/wp7/sqlite3/SqliteWrapper/memjournal_c.cs +315 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mutex_c.cs +182 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mutex_h.cs +91 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mutex_noop_c.cs +202 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mutex_w32.cs +344 -0
- data/platform/wp7/sqlite3/SqliteWrapper/notify_c.cs +347 -0
- data/platform/wp7/sqlite3/SqliteWrapper/opcodes_c.cs +171 -0
- data/platform/wp7/sqlite3/SqliteWrapper/opcodes_h.cs +346 -0
- data/platform/wp7/sqlite3/SqliteWrapper/os_c.cs +367 -0
- data/platform/wp7/sqlite3/SqliteWrapper/os_common_h.cs +174 -0
- data/platform/wp7/sqlite3/SqliteWrapper/os_h.cs +295 -0
- data/platform/wp7/sqlite3/SqliteWrapper/os_win_c.cs +1255 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pager_c.cs +6078 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pager_h.cs +188 -0
- data/platform/wp7/sqlite3/SqliteWrapper/parse_c.cs +4045 -0
- data/platform/wp7/sqlite3/SqliteWrapper/parse_h.cs +331 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pcache1_c.cs +969 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pcache_c.cs +712 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pcache_h.cs +213 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pragma_c.cs +1767 -0
- data/platform/wp7/sqlite3/SqliteWrapper/prepare_c.cs +1015 -0
- data/platform/wp7/sqlite3/SqliteWrapper/printf_c.cs +1300 -0
- data/platform/wp7/sqlite3/SqliteWrapper/random_c.cs +201 -0
- data/platform/wp7/sqlite3/SqliteWrapper/resolve_c.cs +1396 -0
- data/platform/wp7/sqlite3/SqliteWrapper/rowset_c.cs +519 -0
- data/platform/wp7/sqlite3/SqliteWrapper/select_c.cs +4878 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqlite3_h.cs +6253 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqlite3ext_h.cs +397 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqliteInt_h.cs +4075 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqliteLimit_h.cs +214 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqliteicu_h.cs +39 -0
- data/platform/wp7/sqlite3/SqliteWrapper/status_c.cs +155 -0
- data/platform/wp7/sqlite3/SqliteWrapper/table_c.cs +222 -0
- data/platform/wp7/sqlite3/SqliteWrapper/tokenize_c.cs +673 -0
- data/platform/wp7/sqlite3/SqliteWrapper/trigger_c.cs +1219 -0
- data/platform/wp7/sqlite3/SqliteWrapper/update_c.cs +766 -0
- data/platform/wp7/sqlite3/SqliteWrapper/utf_c.cs +612 -0
- data/platform/wp7/sqlite3/SqliteWrapper/util_c.cs +1476 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vacuum_c.cs +382 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbe_c.cs +6566 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbeapi_c.cs +1557 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbeaux_c.cs +4019 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbeblob_c.cs +396 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbemem_c.cs +1480 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbetrace_c.cs +181 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vtab_c.cs +957 -0
- data/platform/wp7/sqlite3/SqliteWrapper/walker_c.cs +174 -0
- data/platform/wp7/sqlite3/SqliteWrapper/where_c.cs +4651 -0
- data/platform/wp7/sqlite3/sqlite3.csproj +155 -0
- data/rakefile.rb +60 -2
- data/res/build-tools/7za.exe +0 -0
- data/res/build-tools/RhoAppRunner.exe +0 -0
- data/res/build-tools/xruby-0.3.3.jar +0 -0
- data/res/generators/rhogen.rb +9 -1
- data/res/generators/templates/application/app/Settings/reset.erb +1 -1
- data/res/generators/templates/application/app/layout.erb +17 -10
- data/res/generators/templates/application/build.yml +5 -3
- data/res/generators/templates/application/public/jqtouch/changes.txt +20 -0
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +12 -4
- data/res/generators/templates/application/public/jqtouch/jquery.1.3.2.min.js +1 -1
- data/res/generators/templates/application/public/js/wp7.js +7 -0
- data/res/generators/templates/model/controller.rb +5 -6
- data/rhobuild.yml.example +1 -0
- data/rhodes.gemspec +2 -1
- data/spec/framework_spec/app/spec/core/dir/close_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/dir/shared/pwd.rb +13 -11
- data/spec/framework_spec/app/spec/core/env/shared/store.rb +12 -10
- data/spec/framework_spec/app/spec/core/env/update_spec.rb +1 -0
- data/spec/framework_spec/app/spec/core/file/expand_path_spec.rb +3 -2
- data/spec/framework_spec/app/spec/core/file/fixtures/file_types.rb +7 -1
- data/spec/framework_spec/app/spec/core/file/flock_spec.rb +8 -1
- data/spec/framework_spec/app/spec/core/file/ftype_spec.rb +5 -3
- data/spec/framework_spec/app/spec/core/file/lchmod_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/file/setgid_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/file/setuid_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/file/stat/ftype_spec.rb +6 -4
- data/spec/framework_spec/app/spec/core/file/truncate_spec.rb +5 -1
- data/spec/framework_spec/app/spec/core/float/to_s_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/process/gid_spec.rb +5 -3
- data/spec/framework_spec/app/spec/core/process/groups_spec.rb +11 -9
- data/spec/framework_spec/app/spec/core/process/uid_spec.rb +5 -3
- data/spec/framework_spec/app/spec/language/execution_spec.rb +10 -6
- data/spec/framework_spec/app/spec/shared/file/directory.rb +6 -1
- data/spec/framework_spec/app/spec/shared/file/executable.rb +7 -1
- data/spec/framework_spec/app/spec/shared/file/file.rb +6 -1
- data/spec/framework_spec/app/spec/shared/file/readable.rb +13 -4
- data/spec/framework_spec/app/spec/shared/file/writable.rb +6 -1
- data/spec/phone_spec/app/spec/rho_controller_spec.rb +11 -0
- data/spec/phone_spec/app/spec/rho_spec.rb +11 -0
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +102 -6
- data/spec/phone_spec/app/spec/string/end_with_spec.rb +4 -1
- data/spec/phone_spec/app/spec/string/slice_spec.rb +5 -1
- data/spec/phone_spec/app/spec/string/start_with_spec.rb +4 -0
- data/spec/phone_spec/app/spec/syncengine_spec.rb +73 -6
- data/spec/phone_spec/app/spec_runner.rb +7 -3
- metadata +380 -41
- data/Manifest.txt +0 -5819
- data/platform/bb/Hsqldb/Hsqldb.cso +0 -5
- data/platform/bb/Hsqldb/Hsqldb.jdp +0 -197
- data/platform/bb/RhoBundle/RhoBundle.cso +0 -5
- data/platform/bb/RhoBundle/RhoBundle.jdp +0 -42
- data/platform/bb/RubyVM/RubyVM.cso +0 -5
- data/platform/bb/RubyVM/RubyVM.jdp +0 -467
- data/platform/bb/rhodes/rhodes.csl +0 -3
- data/platform/bb/rhodes/rhodes.cso +0 -5
- data/platform/bb/rhodes/rhodes.jdp +0 -104
@@ -0,0 +1,79 @@
|
|
1
|
+
using System;
|
2
|
+
using rho.common;
|
3
|
+
|
4
|
+
namespace rho.sync
|
5
|
+
{
|
6
|
+
public class SyncProtocol_3 : ISyncProtocol
|
7
|
+
{
|
8
|
+
String m_strContentType;
|
9
|
+
|
10
|
+
public SyncProtocol_3()
|
11
|
+
{
|
12
|
+
m_strContentType = "application/json";
|
13
|
+
}
|
14
|
+
|
15
|
+
public String getContentType() { return m_strContentType; }
|
16
|
+
public int getVersion() { return 3; }
|
17
|
+
|
18
|
+
public String getLoginUrl()
|
19
|
+
{
|
20
|
+
return RhoConf.getInstance().getPath("syncserver") + "clientlogin";
|
21
|
+
}
|
22
|
+
|
23
|
+
public String getLoginBody(String name, String password)
|
24
|
+
{
|
25
|
+
return "{\"login\":\"" + name + "\",\"password\":\"" + password + "\",\"remember_me\":1}";
|
26
|
+
}
|
27
|
+
|
28
|
+
public String getClientCreateUrl()
|
29
|
+
{
|
30
|
+
return RhoConf.getInstance().getPath("syncserver") + "clientcreate";
|
31
|
+
}
|
32
|
+
|
33
|
+
public String getClientRegisterUrl()
|
34
|
+
{
|
35
|
+
return RhoConf.getInstance().getPath("syncserver") + "clientregister";
|
36
|
+
}
|
37
|
+
|
38
|
+
public String getClientRegisterBody(String strClientID, String strPin, int nPort, String strType)
|
39
|
+
{
|
40
|
+
return "{\"client_id\":\"" + strClientID +
|
41
|
+
"\",\"device_pin\":\"" + strPin +
|
42
|
+
"\",\"device_port\":\"" + nPort +
|
43
|
+
"\",\"device_type\":\"" + strType + "\"}";
|
44
|
+
}
|
45
|
+
|
46
|
+
public String getClientResetUrl(String strClientID)
|
47
|
+
{
|
48
|
+
return RhoConf.getInstance().getPath("syncserver") + "clientreset?client_id=" + strClientID;
|
49
|
+
}
|
50
|
+
|
51
|
+
public String getClientChangesUrl()
|
52
|
+
{
|
53
|
+
String strUrl = RhoConf.getInstance().getPath("syncserver");
|
54
|
+
return strUrl.substring(0, strUrl.length() - 1);
|
55
|
+
}
|
56
|
+
|
57
|
+
public String getServerQueryUrl(String strAction)
|
58
|
+
{
|
59
|
+
String strUrl = RhoConf.getInstance().getPath("syncserver");
|
60
|
+
if (strAction.length() > 0)
|
61
|
+
strUrl = CFilePath.join(strUrl, strAction);
|
62
|
+
else
|
63
|
+
strUrl = strUrl.substring(0, strUrl.length() - 1);
|
64
|
+
|
65
|
+
return strUrl;
|
66
|
+
}
|
67
|
+
|
68
|
+
public String getServerQueryBody(String strSrcName, String strClientID, int nPageSize)
|
69
|
+
{
|
70
|
+
String strQuery = "?client_id=" + strClientID +
|
71
|
+
"&p_size=" + nPageSize + "&version=3";
|
72
|
+
|
73
|
+
if (strSrcName.length() > 0)
|
74
|
+
strQuery += "&source_name=" + strSrcName;
|
75
|
+
|
76
|
+
return strQuery;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
@@ -0,0 +1,1105 @@
|
|
1
|
+
using System;
|
2
|
+
using rho.common;
|
3
|
+
using rho.net;
|
4
|
+
using rho.db;
|
5
|
+
using rho.json;
|
6
|
+
|
7
|
+
namespace rho.sync
|
8
|
+
{
|
9
|
+
public class SyncSource
|
10
|
+
{
|
11
|
+
private static RhoLogger LOG = RhoLogger.RHO_STRIP_LOG ? new RhoEmptyLogger() :
|
12
|
+
new RhoLogger("Sync");
|
13
|
+
private static RhoProfiler PROF = RhoProfiler.RHO_STRIP_PROFILER ? new RhoEmptyProfiler() :
|
14
|
+
new RhoProfiler();
|
15
|
+
private static CRhodesApp RHODESAPP() { return CRhodesApp.Instance; }
|
16
|
+
|
17
|
+
class CAttrValue
|
18
|
+
{
|
19
|
+
public String m_strAttrib = "";
|
20
|
+
public String m_strValue = "";
|
21
|
+
public String m_strBlobSuffix = "";
|
22
|
+
|
23
|
+
public CAttrValue(String strAttrib, String strValue)
|
24
|
+
{
|
25
|
+
m_strAttrib = strAttrib;
|
26
|
+
m_strValue = strValue;
|
27
|
+
|
28
|
+
if ( m_strAttrib.endsWith("-rhoblob") )
|
29
|
+
{
|
30
|
+
m_strBlobSuffix = "-rhoblob";
|
31
|
+
m_strAttrib = m_strAttrib.substring(0,m_strAttrib.length()-m_strBlobSuffix.length());
|
32
|
+
}
|
33
|
+
}
|
34
|
+
};
|
35
|
+
|
36
|
+
SyncEngine m_syncEngine;
|
37
|
+
DBAdapter m_dbAdapter;
|
38
|
+
|
39
|
+
int m_nID;
|
40
|
+
String m_strName = "";
|
41
|
+
long m_token = 0;
|
42
|
+
String m_strSyncType = "";
|
43
|
+
boolean m_bTokenFromDB;
|
44
|
+
|
45
|
+
int m_nCurPageCount, m_nInserted, m_nDeleted, m_nTotalCount;
|
46
|
+
boolean m_bGetAtLeastOnePage = false;
|
47
|
+
public int m_nErrCode = RhoAppAdapter.ERR_NONE;
|
48
|
+
public String m_strError = "", m_strServerError = "";
|
49
|
+
|
50
|
+
int m_nRefreshTime = 0;
|
51
|
+
int m_nProgressStep = -1;
|
52
|
+
boolean m_bSchemaSource;
|
53
|
+
|
54
|
+
public class CAssociation
|
55
|
+
{
|
56
|
+
public String m_strSrcName, m_strAttrib;
|
57
|
+
public CAssociation( String strSrcName, String strAttrib ){m_strSrcName = strSrcName; m_strAttrib = strAttrib; }
|
58
|
+
};
|
59
|
+
|
60
|
+
Vector<CAssociation> m_arAssociations = new Vector<CAssociation>();
|
61
|
+
Vector<NetRequest.MultipartItem> m_arMultipartItems = new Vector<NetRequest.MultipartItem>();
|
62
|
+
Vector<String> m_arBlobAttrs = new Vector<String>();
|
63
|
+
|
64
|
+
public int getID() { return m_nID; }
|
65
|
+
public String getName() { return m_strName; }
|
66
|
+
public String getSyncType() { return m_strSyncType; }
|
67
|
+
public String getServerError() { return m_strServerError; }
|
68
|
+
public int getErrorCode() { return m_nErrCode; }
|
69
|
+
public int getServerObjectsCount() { return m_nInserted + m_nDeleted; }
|
70
|
+
|
71
|
+
public long getToken() { return m_token; }
|
72
|
+
public boolean isTokenFromDB() { return m_bTokenFromDB; }
|
73
|
+
void setToken(long token){ m_token = token; m_bTokenFromDB = false; }
|
74
|
+
public boolean isEmptyToken()
|
75
|
+
{
|
76
|
+
return m_token == 0;
|
77
|
+
}
|
78
|
+
|
79
|
+
int getProgressStep(){ return m_nProgressStep; }
|
80
|
+
public void setProgressStep(int nProgressStep) { m_nProgressStep = nProgressStep; }
|
81
|
+
|
82
|
+
public boolean getGetAtLeastOnePage() { return m_bGetAtLeastOnePage; }
|
83
|
+
public int getRefreshTime() { return m_nRefreshTime; }
|
84
|
+
public Vector<CAssociation> getAssociations() { return m_arAssociations; }
|
85
|
+
|
86
|
+
public int getInsertedCount() { return m_nInserted; }
|
87
|
+
public int getDeletedCount() { return m_nDeleted; }
|
88
|
+
public void setCurPageCount(int nCurPageCount) { m_nCurPageCount = nCurPageCount; }
|
89
|
+
public void setTotalCount(int nTotalCount) { m_nTotalCount = nTotalCount; }
|
90
|
+
public int getCurPageCount() { return m_nCurPageCount; }
|
91
|
+
public int getTotalCount() { return m_nTotalCount; }
|
92
|
+
|
93
|
+
SyncEngine getSync(){ return m_syncEngine; }
|
94
|
+
SyncNotify getNotify(){ return getSync().getNotify(); }
|
95
|
+
NetRequest getNet(){ return getSync().getNet(); }
|
96
|
+
ISyncProtocol getProtocol(){ return getSync().getProtocol(); }
|
97
|
+
void setRefreshTime( int nRefreshTime ){ m_nRefreshTime = nRefreshTime;}
|
98
|
+
public DBAdapter getDB() { return m_dbAdapter; }
|
99
|
+
|
100
|
+
public SyncSource(SyncEngine syncEngine, DBAdapter db)
|
101
|
+
{
|
102
|
+
m_syncEngine = syncEngine;
|
103
|
+
m_dbAdapter = db;
|
104
|
+
|
105
|
+
m_nID = 0;
|
106
|
+
|
107
|
+
m_bTokenFromDB = true;
|
108
|
+
|
109
|
+
m_nCurPageCount = 0;
|
110
|
+
m_nInserted = 0;
|
111
|
+
m_nDeleted = 0;
|
112
|
+
m_nTotalCount = 0;
|
113
|
+
m_bGetAtLeastOnePage = false;
|
114
|
+
|
115
|
+
m_nErrCode = RhoAppAdapter.ERR_NONE;
|
116
|
+
m_bSchemaSource = db.isTableExist(m_strName);
|
117
|
+
}
|
118
|
+
|
119
|
+
public SyncSource(int id, String name, String strSyncType, DBAdapter db, SyncEngine syncEngine )
|
120
|
+
{
|
121
|
+
m_syncEngine = syncEngine;
|
122
|
+
m_dbAdapter = db;
|
123
|
+
m_nID = id;
|
124
|
+
m_strName = name;
|
125
|
+
m_strSyncType = strSyncType;
|
126
|
+
|
127
|
+
m_nCurPageCount = 0;
|
128
|
+
m_nInserted = 0;
|
129
|
+
m_nDeleted = 0;
|
130
|
+
m_nTotalCount = 0;
|
131
|
+
m_bGetAtLeastOnePage = false;
|
132
|
+
|
133
|
+
m_nErrCode = RhoAppAdapter.ERR_NONE;
|
134
|
+
|
135
|
+
IDBResult res = db.executeSQL("SELECT token,associations from sources WHERE source_id=?", m_nID);
|
136
|
+
if ( !res.isEnd() )
|
137
|
+
{
|
138
|
+
m_token = res.getLongByIdx(0);
|
139
|
+
m_bTokenFromDB = true;
|
140
|
+
}else
|
141
|
+
{
|
142
|
+
m_token = 0;
|
143
|
+
m_bTokenFromDB = true;
|
144
|
+
}
|
145
|
+
|
146
|
+
m_bSchemaSource = db.isTableExist(m_strName);
|
147
|
+
parseAssociations(res.getStringByIdx(1));
|
148
|
+
}
|
149
|
+
|
150
|
+
void parseAssociations(String strAssociations)
|
151
|
+
{
|
152
|
+
if (strAssociations.length() == 0 )
|
153
|
+
return;
|
154
|
+
|
155
|
+
Tokenizer oTokenizer = new Tokenizer( strAssociations, "," );
|
156
|
+
|
157
|
+
String strSrcName = "";
|
158
|
+
while (oTokenizer.hasMoreTokens())
|
159
|
+
{
|
160
|
+
String tok = oTokenizer.nextToken();
|
161
|
+
if (tok.length() == 0)
|
162
|
+
continue;
|
163
|
+
|
164
|
+
if ( strSrcName.length() > 0 )
|
165
|
+
{
|
166
|
+
m_arAssociations.addElement( new CAssociation(strSrcName, tok) );
|
167
|
+
strSrcName = "";
|
168
|
+
}else
|
169
|
+
strSrcName = tok;
|
170
|
+
}
|
171
|
+
}
|
172
|
+
|
173
|
+
public void sync()
|
174
|
+
{
|
175
|
+
getNotify().reportSyncStatus(RhoAppAdapter.getMessageText("syncronizing") + getName() + "...", m_nErrCode, m_strError );
|
176
|
+
|
177
|
+
TimeInterval startTime = TimeInterval.getCurrentTime();
|
178
|
+
//m_bIsSearch = false;
|
179
|
+
|
180
|
+
try{
|
181
|
+
if ( isTokenFromDB() && getToken() > 1 )
|
182
|
+
syncServerChanges(); //sync only server changes, which was paused before
|
183
|
+
else
|
184
|
+
{
|
185
|
+
if ( isEmptyToken() )
|
186
|
+
processToken(1);
|
187
|
+
|
188
|
+
boolean bSyncedServer = syncClientChanges();
|
189
|
+
if ( !bSyncedServer )
|
190
|
+
syncServerChanges();
|
191
|
+
}
|
192
|
+
}catch(Exception exc)
|
193
|
+
{
|
194
|
+
getSync().stopSync();
|
195
|
+
throw exc;
|
196
|
+
}finally{
|
197
|
+
TimeInterval endTime = TimeInterval.getCurrentTime();
|
198
|
+
getDB().executeSQL("UPDATE sources set last_updated=?,last_inserted_size=?,last_deleted_size=?, "+
|
199
|
+
"last_sync_duration=?,last_sync_success=?, backend_refresh_time=? WHERE source_id=?",
|
200
|
+
endTime.toULong()/1000, getInsertedCount(), getDeletedCount(),
|
201
|
+
endTime.minus(startTime).toULong(),
|
202
|
+
m_bGetAtLeastOnePage?1:0, m_nRefreshTime, getID() );
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
public boolean syncClientChanges()
|
207
|
+
{
|
208
|
+
boolean bSyncedServer = false;
|
209
|
+
if ( isPendingClientChanges() )
|
210
|
+
{
|
211
|
+
LOG.INFO( "Client has unconfirmed created items. Call server to update them." );
|
212
|
+
syncServerChanges();
|
213
|
+
bSyncedServer = true;
|
214
|
+
}
|
215
|
+
|
216
|
+
if ( bSyncedServer && isPendingClientChanges() )
|
217
|
+
{
|
218
|
+
LOG.INFO( "Server does not sent created items. Stop sync." );
|
219
|
+
getSync().setState(SyncEngine.esStop);
|
220
|
+
}
|
221
|
+
else
|
222
|
+
{
|
223
|
+
PROF.START("Pull");
|
224
|
+
|
225
|
+
boolean bSyncClient = false;
|
226
|
+
{
|
227
|
+
IDBResult res = getDB().executeSQL("SELECT object FROM changed_values WHERE source_id=? LIMIT 1 OFFSET 0", getID());
|
228
|
+
bSyncClient = !res.isEnd();
|
229
|
+
}
|
230
|
+
if ( bSyncClient )
|
231
|
+
{
|
232
|
+
doSyncClientChanges();
|
233
|
+
bSyncedServer = false;
|
234
|
+
}
|
235
|
+
|
236
|
+
PROF.STOP("Pull");
|
237
|
+
}
|
238
|
+
|
239
|
+
return bSyncedServer;
|
240
|
+
}
|
241
|
+
|
242
|
+
boolean isPendingClientChanges()
|
243
|
+
{
|
244
|
+
IDBResult res = getDB().executeSQL("SELECT object FROM changed_values WHERE source_id=? and update_type='create' and sent>1 LIMIT 1 OFFSET 0", getID());
|
245
|
+
return !res.isEnd();
|
246
|
+
}
|
247
|
+
|
248
|
+
void doSyncClientChanges()
|
249
|
+
{
|
250
|
+
String[] arUpdateTypes = {"create", "update", "delete"};
|
251
|
+
boolean[] arUpdateSent = {false, false, false};
|
252
|
+
|
253
|
+
m_arMultipartItems.removeAllElements();
|
254
|
+
m_arBlobAttrs.removeAllElements();
|
255
|
+
String strBody = "{\"source_name\":" + JSONEntry.quoteValue(getName()) + ",\"client_id\":" + JSONEntry.quoteValue(getSync().getClientID());
|
256
|
+
boolean bSend = false;
|
257
|
+
int i = 0;
|
258
|
+
for( i = 0; i < 3 && getSync().isContinueSync(); i++ )
|
259
|
+
{
|
260
|
+
String strBody1;
|
261
|
+
strBody1 = makePushBody_Ver3(arUpdateTypes[i], true);
|
262
|
+
if (strBody1.length() > 0)
|
263
|
+
{
|
264
|
+
strBody += "," + strBody1;
|
265
|
+
|
266
|
+
String strBlobAttrs = "";
|
267
|
+
for ( int j = 0; j < (int)m_arBlobAttrs.size(); j++)
|
268
|
+
{
|
269
|
+
if ( strBlobAttrs.length() > 0 )
|
270
|
+
strBlobAttrs += ",";
|
271
|
+
|
272
|
+
strBlobAttrs += JSONEntry.quoteValue((String)m_arBlobAttrs.elementAt(j));
|
273
|
+
}
|
274
|
+
|
275
|
+
if ( strBlobAttrs.length() > 0 )
|
276
|
+
strBody += ",\"blob_fields\":[" + strBlobAttrs + "]";
|
277
|
+
|
278
|
+
arUpdateSent[i] = true;
|
279
|
+
bSend = true;
|
280
|
+
}
|
281
|
+
}
|
282
|
+
strBody += "}";
|
283
|
+
|
284
|
+
if ( bSend )
|
285
|
+
{
|
286
|
+
LOG.INFO( "Push client changes to server. Source: " + getName() + "Size :" + strBody.length() );
|
287
|
+
LOG.TRACE("Push body: " + strBody);
|
288
|
+
|
289
|
+
try{
|
290
|
+
if ( m_arMultipartItems.size() > 0 )
|
291
|
+
{
|
292
|
+
NetRequest.MultipartItem oItem = new NetRequest.MultipartItem();
|
293
|
+
oItem.m_strBody = strBody;
|
294
|
+
//oItem.m_strContentType = getProtocol().getContentType();
|
295
|
+
oItem.m_strName = "cud";
|
296
|
+
m_arMultipartItems.addElement(oItem);
|
297
|
+
|
298
|
+
NetResponse resp = getNet().pushMultipartData( getProtocol().getClientChangesUrl(), m_arMultipartItems, getSync(), null );
|
299
|
+
if ( !resp.isOK() )
|
300
|
+
{
|
301
|
+
getSync().setState(SyncEngine.esStop);
|
302
|
+
m_nErrCode = RhoAppAdapter.ERR_REMOTESERVER;
|
303
|
+
m_strError = resp.getCharData();
|
304
|
+
}
|
305
|
+
}else
|
306
|
+
{
|
307
|
+
NetResponse resp = getNet().pushData( getProtocol().getClientChangesUrl(), strBody, getSync());
|
308
|
+
if ( !resp.isOK() )
|
309
|
+
{
|
310
|
+
getSync().setState(SyncEngine.esStop);
|
311
|
+
m_nErrCode = RhoAppAdapter.ERR_REMOTESERVER;
|
312
|
+
m_strError = resp.getCharData();
|
313
|
+
}
|
314
|
+
}
|
315
|
+
}catch(Exception exc)
|
316
|
+
{
|
317
|
+
m_nErrCode = RhoAppAdapter.getNetErrorCode(exc);
|
318
|
+
throw exc;
|
319
|
+
}
|
320
|
+
|
321
|
+
}
|
322
|
+
|
323
|
+
for( i = 0; i < 3 && getSync().isContinueSync(); i++ )
|
324
|
+
{
|
325
|
+
if ( arUpdateSent[i] )
|
326
|
+
{
|
327
|
+
//oo conflicts
|
328
|
+
if ( i < 1 ) //create
|
329
|
+
getDB().executeSQL("UPDATE changed_values SET sent=2 WHERE source_id=? and update_type=? and sent=1", getID(), arUpdateTypes[i] );
|
330
|
+
else
|
331
|
+
//
|
332
|
+
getDB().executeSQL("DELETE FROM changed_values WHERE source_id=? and update_type=? and sent=1", getID(), arUpdateTypes[i] );
|
333
|
+
}
|
334
|
+
}
|
335
|
+
|
336
|
+
m_arMultipartItems.removeAllElements();
|
337
|
+
m_arBlobAttrs.removeAllElements();
|
338
|
+
}
|
339
|
+
|
340
|
+
//{"source_name":"SampleAdapter","client_id":1,"create":{"1":{"brand":"Apple","name":"iPhone","price":"199.99"}}}
|
341
|
+
//{"source_name":"SampleAdapter","client_id":1,"update":{"1":{"brand":"Apple","name":"iPhone","price":"199.99"}}}
|
342
|
+
//{"source_name":"SampleAdapter","client_id":1,"delete":{"1":{"brand":"Apple","name":"iPhone","price":"199.99"}}}
|
343
|
+
//{"source_name":"SampleAdapter","client_id":1,"delete":{"3":{"brand":"HTC","name":"Fuze","price":"299.99"}},"create":{"1":{"brand":"Apple","name":"iPhone","price":"199.99"}},"update":{"2":{"brand":"Android","name":"G2","price":"99.99"}}}
|
344
|
+
String makePushBody_Ver3( String strUpdateType, boolean isSync)
|
345
|
+
{
|
346
|
+
String strBody = "";
|
347
|
+
getDB().Lock();
|
348
|
+
|
349
|
+
if ( isSync )
|
350
|
+
getDB().updateAllAttribChanges();
|
351
|
+
|
352
|
+
IDBResult res = getDB().executeSQL("SELECT attrib, object, value, attrib_type "+
|
353
|
+
"FROM changed_values where source_id=? and update_type =? and sent<=1 ORDER BY object", getID(), strUpdateType );
|
354
|
+
|
355
|
+
if ( res.isEnd() )
|
356
|
+
{
|
357
|
+
res.close();
|
358
|
+
getDB().Unlock();
|
359
|
+
return strBody;
|
360
|
+
}
|
361
|
+
|
362
|
+
String strCurObject = "";
|
363
|
+
boolean bFirst = true;
|
364
|
+
for( ; !res.isEnd(); res.next() )
|
365
|
+
{
|
366
|
+
String strAttrib = res.getStringByIdx(0);
|
367
|
+
String strObject = res.getStringByIdx(1);
|
368
|
+
String value = res.getStringByIdx(2);
|
369
|
+
String attribType = res.getStringByIdx(3);
|
370
|
+
|
371
|
+
if ( attribType.compareTo("blob.file") == 0 )
|
372
|
+
{
|
373
|
+
NetRequest.MultipartItem oItem = new NetRequest.MultipartItem();
|
374
|
+
oItem.m_strFilePath = RHODESAPP().resolveDBFilesPath(value);
|
375
|
+
oItem.m_strContentType = "application/octet-stream";
|
376
|
+
oItem.m_strName = strAttrib + "-" + strObject;
|
377
|
+
|
378
|
+
m_arBlobAttrs.addElement(strAttrib);
|
379
|
+
m_arMultipartItems.addElement(oItem);
|
380
|
+
}
|
381
|
+
|
382
|
+
if ( strBody.length() == 0 )
|
383
|
+
{
|
384
|
+
if ( !isSync )
|
385
|
+
strBody += "{";
|
386
|
+
else
|
387
|
+
strBody += "\"" + strUpdateType + "\":{";
|
388
|
+
}
|
389
|
+
|
390
|
+
if ( strObject.compareTo(strCurObject) != 0 )
|
391
|
+
{
|
392
|
+
if ( strCurObject.length() > 0 )
|
393
|
+
{
|
394
|
+
if ( !bFirst )
|
395
|
+
strBody += "}";
|
396
|
+
strBody += ",";
|
397
|
+
}
|
398
|
+
|
399
|
+
bFirst = true;
|
400
|
+
strBody += JSONEntry.quoteValue(strObject);
|
401
|
+
strCurObject = strObject;
|
402
|
+
}
|
403
|
+
|
404
|
+
if (!bFirst)
|
405
|
+
strBody += ",";
|
406
|
+
|
407
|
+
if ( strAttrib.length() > 0 )
|
408
|
+
{
|
409
|
+
if ( bFirst )
|
410
|
+
strBody += ":{";
|
411
|
+
|
412
|
+
strBody += JSONEntry.quoteValue(strAttrib) + ":" + JSONEntry.quoteValue(value);
|
413
|
+
bFirst = false;
|
414
|
+
}
|
415
|
+
}
|
416
|
+
|
417
|
+
if ( strBody.length() > 0 )
|
418
|
+
{
|
419
|
+
if ( !bFirst )
|
420
|
+
strBody += "}";
|
421
|
+
|
422
|
+
strBody += "}";
|
423
|
+
}
|
424
|
+
|
425
|
+
if ( isSync )
|
426
|
+
getDB().executeSQL("UPDATE changed_values SET sent=1 WHERE source_id=? and update_type=? and sent=0", getID(), strUpdateType );
|
427
|
+
|
428
|
+
getDB().Unlock();
|
429
|
+
|
430
|
+
return strBody;
|
431
|
+
}
|
432
|
+
|
433
|
+
public void applyChangedValues()
|
434
|
+
{
|
435
|
+
String strBody = makePushBody_Ver3("create", false);
|
436
|
+
if ( strBody != null && strBody.length() > 0 )
|
437
|
+
{
|
438
|
+
JSONEntry oEntry = new JSONEntry(strBody);
|
439
|
+
processSyncCommand("insert", oEntry, false );
|
440
|
+
}
|
441
|
+
|
442
|
+
strBody = makePushBody_Ver3("delete", false);
|
443
|
+
if ( strBody != null && strBody.length() > 0 )
|
444
|
+
{
|
445
|
+
JSONEntry oEntry = new JSONEntry(strBody);
|
446
|
+
processSyncCommand("delete", oEntry, false );
|
447
|
+
}
|
448
|
+
|
449
|
+
strBody = makePushBody_Ver3("update", false);
|
450
|
+
if ( strBody != null && strBody.length() > 0 )
|
451
|
+
{
|
452
|
+
JSONEntry oEntry = new JSONEntry(strBody);
|
453
|
+
processSyncCommand("insert", oEntry, false );
|
454
|
+
}
|
455
|
+
}
|
456
|
+
|
457
|
+
void syncServerChanges()
|
458
|
+
{
|
459
|
+
LOG.INFO("Sync server changes source ID :" + getID() );
|
460
|
+
|
461
|
+
while( getSync().isContinueSync() )
|
462
|
+
{
|
463
|
+
setCurPageCount(0);
|
464
|
+
String strUrl = getProtocol().getServerQueryUrl("");
|
465
|
+
String strQuery = getProtocol().getServerQueryBody(getName(), getSync().getClientID(), getSync().getSyncPageSize());
|
466
|
+
|
467
|
+
if ( !m_bTokenFromDB && getToken() > 1 )
|
468
|
+
strQuery += "&token=" + getToken();
|
469
|
+
|
470
|
+
LOG.INFO( "Pull changes from server. Url: " + (strUrl+strQuery) );
|
471
|
+
|
472
|
+
NetResponse resp = null;
|
473
|
+
try{
|
474
|
+
PROF.START("Net");
|
475
|
+
resp = getNet().pullData(strUrl+strQuery, getSync());
|
476
|
+
PROF.STOP("Net");
|
477
|
+
|
478
|
+
if ( !resp.isOK() )
|
479
|
+
{
|
480
|
+
getSync().stopSync();
|
481
|
+
m_nErrCode = RhoAppAdapter.getErrorFromResponse(resp);
|
482
|
+
m_strError = resp.getCharData();
|
483
|
+
continue;
|
484
|
+
}
|
485
|
+
}catch(Exception exc)
|
486
|
+
{
|
487
|
+
m_nErrCode = RhoAppAdapter.getNetErrorCode(exc);
|
488
|
+
throw exc;
|
489
|
+
}
|
490
|
+
|
491
|
+
String szData = null;
|
492
|
+
String strTestResp = SyncEngine.getSourceOptions().getProperty(getID(), "rho_server_response");
|
493
|
+
if ( strTestResp != null && strTestResp.length() > 0 )
|
494
|
+
szData = strTestResp;
|
495
|
+
else
|
496
|
+
szData = resp.getCharData();
|
497
|
+
|
498
|
+
PROF.START("Parse");
|
499
|
+
JSONArrayIterator oJsonArr = new JSONArrayIterator(szData);
|
500
|
+
PROF.STOP("Parse");
|
501
|
+
|
502
|
+
processServerResponse_ver3(oJsonArr);
|
503
|
+
|
504
|
+
if (SyncEngine.getSourceOptions().getBoolProperty(getID(), "pass_through"))
|
505
|
+
processToken(0);
|
506
|
+
|
507
|
+
if ( getToken() == 0 )
|
508
|
+
break;
|
509
|
+
}
|
510
|
+
|
511
|
+
if ( getSync().isSchemaChanged() )
|
512
|
+
getSync().stopSync();
|
513
|
+
}
|
514
|
+
|
515
|
+
//{"create-error":{"0_broken_object_id":{"name":"wrongname","an_attribute":"error create"},"0_broken_object_id-error":{"message":"error create"}}}
|
516
|
+
boolean processServerErrors(JSONEntry oCmds)
|
517
|
+
{
|
518
|
+
String[] arErrTypes = {"source-error", "search-error", "create-error", "update-error", "delete-error", null};
|
519
|
+
boolean bRes = false;
|
520
|
+
for( int i = 0; ; i++ )
|
521
|
+
{
|
522
|
+
if ( arErrTypes[i] == null )
|
523
|
+
break;
|
524
|
+
if ( !oCmds.hasName(arErrTypes[i]) )
|
525
|
+
continue;
|
526
|
+
|
527
|
+
bRes = true;
|
528
|
+
m_nErrCode = RhoAppAdapter.ERR_CUSTOMSYNCSERVER;
|
529
|
+
|
530
|
+
JSONEntry errSrc = oCmds.getEntry(arErrTypes[i]);
|
531
|
+
JSONStructIterator errIter = new JSONStructIterator(errSrc);
|
532
|
+
for( ; !errIter.isEnd(); errIter.next() )
|
533
|
+
{
|
534
|
+
String strKey = errIter.getCurKey();
|
535
|
+
|
536
|
+
if ( i == 0 || i == 1 )//"source-error", "search-error"
|
537
|
+
{
|
538
|
+
if ( errIter.getCurValue().hasName("message") )
|
539
|
+
{
|
540
|
+
if ( m_strServerError.length() > 0 )
|
541
|
+
m_strServerError += "&";
|
542
|
+
|
543
|
+
m_strServerError += "server_errors[" + URI.urlEncode(strKey) + "][message]=" + URI.urlEncode(errIter.getCurValue().getString("message"));
|
544
|
+
}
|
545
|
+
}
|
546
|
+
else
|
547
|
+
{
|
548
|
+
//"create-error", "update-error", "delete-error"
|
549
|
+
String strObject = strKey;
|
550
|
+
|
551
|
+
if ( strObject.endsWith("-error") )
|
552
|
+
{
|
553
|
+
strObject = strObject.substring(0, strKey.length()-6);
|
554
|
+
if ( m_strServerError.length() > 0 )
|
555
|
+
m_strServerError += "&";
|
556
|
+
|
557
|
+
m_strServerError += "server_errors[" + arErrTypes[i] + "][" + URI.urlEncode(strObject) + "][message]=" + URI.urlEncode(errIter.getCurValue().getString("message"));
|
558
|
+
}else
|
559
|
+
{
|
560
|
+
JSONStructIterator attrIter = new JSONStructIterator(errIter.getCurValue());
|
561
|
+
for( ; !attrIter.isEnd(); attrIter.next() )
|
562
|
+
{
|
563
|
+
String strAttrName = attrIter.getCurKey();
|
564
|
+
String strAttrValue = attrIter.getCurString();
|
565
|
+
|
566
|
+
if ( m_strServerError.length() > 0 )
|
567
|
+
m_strServerError += "&";
|
568
|
+
|
569
|
+
m_strServerError += "server_errors[" + arErrTypes[i] + "][" + URI.urlEncode(strObject) + "][attributes][" + URI.urlEncode(strAttrName) + "]=" + URI.urlEncode(strAttrValue);
|
570
|
+
}
|
571
|
+
}
|
572
|
+
}
|
573
|
+
}
|
574
|
+
}
|
575
|
+
|
576
|
+
return bRes;
|
577
|
+
}
|
578
|
+
|
579
|
+
public void processServerResponse_ver3(JSONArrayIterator oJsonArr)
|
580
|
+
{
|
581
|
+
PROF.START("Data1");
|
582
|
+
|
583
|
+
int nVersion = 0;
|
584
|
+
if ( !oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("version") )
|
585
|
+
{
|
586
|
+
nVersion = oJsonArr.getCurItem().getInt("version");
|
587
|
+
oJsonArr.next();
|
588
|
+
}
|
589
|
+
|
590
|
+
if ( nVersion != getProtocol().getVersion() )
|
591
|
+
{
|
592
|
+
LOG.ERROR("Sync server send data with incompatible version. Client version: " + getProtocol().getVersion() +
|
593
|
+
"; Server response version: " + nVersion + ". Source name: " + getName() );
|
594
|
+
getSync().stopSync();
|
595
|
+
m_nErrCode = RhoAppAdapter.ERR_UNEXPECTEDSERVERRESPONSE;
|
596
|
+
return;
|
597
|
+
}
|
598
|
+
|
599
|
+
if ( !oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("token"))
|
600
|
+
{
|
601
|
+
processToken(oJsonArr.getCurItem().getUInt64("token"));
|
602
|
+
oJsonArr.next();
|
603
|
+
}
|
604
|
+
|
605
|
+
if ( !oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("source") )
|
606
|
+
{
|
607
|
+
//skip it. it uses in search only
|
608
|
+
oJsonArr.next();
|
609
|
+
}
|
610
|
+
|
611
|
+
if ( !oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("count") )
|
612
|
+
{
|
613
|
+
setCurPageCount(oJsonArr.getCurItem().getInt("count"));
|
614
|
+
oJsonArr.next();
|
615
|
+
}
|
616
|
+
|
617
|
+
if ( !oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("refresh_time") )
|
618
|
+
{
|
619
|
+
setRefreshTime(oJsonArr.getCurItem().getInt("refresh_time"));
|
620
|
+
oJsonArr.next();
|
621
|
+
}
|
622
|
+
|
623
|
+
if ( !oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("progress_count") )
|
624
|
+
{
|
625
|
+
//TODO: progress_count
|
626
|
+
//setTotalCount(oJsonArr.getCurItem().getInt("progress_count"));
|
627
|
+
oJsonArr.next();
|
628
|
+
}
|
629
|
+
|
630
|
+
if ( !oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("total_count") )
|
631
|
+
{
|
632
|
+
setTotalCount(oJsonArr.getCurItem().getInt("total_count"));
|
633
|
+
oJsonArr.next();
|
634
|
+
}
|
635
|
+
|
636
|
+
//if ( getServerObjectsCount() == 0 )
|
637
|
+
// getNotify().fireSyncNotification(this, false, RhoAppAdapter.ERR_NONE, "");
|
638
|
+
|
639
|
+
if ( getToken() == 0 )
|
640
|
+
{
|
641
|
+
//oo conflicts
|
642
|
+
getDB().executeSQL("DELETE FROM changed_values where source_id=? and sent>=3", getID() );
|
643
|
+
//
|
644
|
+
|
645
|
+
}
|
646
|
+
|
647
|
+
LOG.INFO("Got " + getCurPageCount() + "(Processed: " + getServerObjectsCount() + ") records of " + getTotalCount() + " from server. Source: " + getName()
|
648
|
+
+ ". Version: " + nVersion );
|
649
|
+
|
650
|
+
PROF.STOP("Data1");
|
651
|
+
if ( !oJsonArr.isEnd() && getSync().isContinueSync() )
|
652
|
+
{
|
653
|
+
JSONEntry oCmds = oJsonArr.getCurItem();
|
654
|
+
PROF.START("Data");
|
655
|
+
|
656
|
+
if ( oCmds.hasName("schema-changed") )
|
657
|
+
{
|
658
|
+
getSync().setSchemaChanged(true);
|
659
|
+
}else if ( !processServerErrors(oCmds) )
|
660
|
+
{
|
661
|
+
getDB().startTransaction();
|
662
|
+
|
663
|
+
if (SyncEngine.getSourceOptions().getBoolProperty(getID(), "pass_through"))
|
664
|
+
{
|
665
|
+
if ( m_bSchemaSource )
|
666
|
+
getDB().executeSQL( "DELETE FROM " + getName() );
|
667
|
+
else
|
668
|
+
getDB().executeSQL( "DELETE FROM object_values WHERE source_id=?", getID() );
|
669
|
+
}
|
670
|
+
|
671
|
+
if ( oCmds.hasName("metadata") && getSync().isContinueSync() )
|
672
|
+
{
|
673
|
+
String strMetadata = oCmds.getString("metadata");
|
674
|
+
getDB().executeSQL("UPDATE sources SET metadata=? WHERE source_id=?", strMetadata, getID() );
|
675
|
+
}
|
676
|
+
if ( oCmds.hasName("links") && getSync().isContinueSync() )
|
677
|
+
processSyncCommand("links", oCmds.getEntry("links"), true );
|
678
|
+
if ( oCmds.hasName("delete") && getSync().isContinueSync() )
|
679
|
+
processSyncCommand("delete", oCmds.getEntry("delete"), true );
|
680
|
+
if ( oCmds.hasName("insert") && getSync().isContinueSync() )
|
681
|
+
processSyncCommand("insert", oCmds.getEntry("insert"), true );
|
682
|
+
|
683
|
+
PROF.STOP("Data");
|
684
|
+
|
685
|
+
PROF.START("DB");
|
686
|
+
getDB().endTransaction();
|
687
|
+
PROF.STOP("DB");
|
688
|
+
|
689
|
+
getNotify().fireObjectsNotification();
|
690
|
+
}
|
691
|
+
}
|
692
|
+
|
693
|
+
PROF.START("Data1");
|
694
|
+
if ( getCurPageCount() > 0 )
|
695
|
+
getNotify().fireSyncNotification(this, false, RhoAppAdapter.ERR_NONE, "");
|
696
|
+
PROF.STOP("Data1");
|
697
|
+
}
|
698
|
+
|
699
|
+
void processSyncCommand(String strCmd, JSONEntry oCmdEntry, boolean bCheckUIRequest)
|
700
|
+
{
|
701
|
+
JSONStructIterator objIter = new JSONStructIterator(oCmdEntry);
|
702
|
+
|
703
|
+
for( ; !objIter.isEnd() && getSync().isContinueSync(); objIter.next() )
|
704
|
+
{
|
705
|
+
String strObject = objIter.getCurKey();
|
706
|
+
JSONStructIterator attrIter = new JSONStructIterator( objIter.getCurValue() );
|
707
|
+
|
708
|
+
try
|
709
|
+
{
|
710
|
+
if ( m_bSchemaSource )
|
711
|
+
processServerCmd_Ver3_Schema(strCmd,strObject,attrIter);
|
712
|
+
else
|
713
|
+
{
|
714
|
+
for( ; !attrIter.isEnd() && getSync().isContinueSync(); attrIter.next() )
|
715
|
+
{
|
716
|
+
String strAttrib = attrIter.getCurKey();
|
717
|
+
String strValue = attrIter.getCurString();
|
718
|
+
|
719
|
+
processServerCmd_Ver3(strCmd,strObject,strAttrib,strValue);
|
720
|
+
}
|
721
|
+
}
|
722
|
+
}catch(DBException exc)
|
723
|
+
{
|
724
|
+
LOG.ERROR("Sync of server changes failed for " + getName() + ";object: " + strObject, exc);
|
725
|
+
}
|
726
|
+
|
727
|
+
if ( getSyncType().compareTo("none") == 0 )
|
728
|
+
continue;
|
729
|
+
|
730
|
+
if ( bCheckUIRequest )
|
731
|
+
{
|
732
|
+
int nSyncObjectCount = getNotify().incLastSyncObjectCount(getID());
|
733
|
+
if ( getProgressStep() > 0 && (nSyncObjectCount%getProgressStep() == 0) )
|
734
|
+
getNotify().fireSyncNotification(this, false, RhoAppAdapter.ERR_NONE, "");
|
735
|
+
|
736
|
+
if ( getDB().isUIWaitDB() )
|
737
|
+
{
|
738
|
+
LOG.INFO("Commit transaction because of UI request.");
|
739
|
+
getDB().endTransaction();
|
740
|
+
SyncThread.sleep(1000);
|
741
|
+
getDB().startTransaction();
|
742
|
+
}
|
743
|
+
}
|
744
|
+
}
|
745
|
+
}
|
746
|
+
|
747
|
+
void processAssociations(String strOldObject, String strNewObject)
|
748
|
+
{
|
749
|
+
for ( int i = 0; i < m_arAssociations.size(); i++ )
|
750
|
+
{
|
751
|
+
SyncSource pSrc = getSync().findSourceByName( ((CAssociation)m_arAssociations.elementAt(i)).m_strSrcName);
|
752
|
+
if ( pSrc != null )
|
753
|
+
pSrc.updateAssociation(strOldObject, strNewObject, ((CAssociation)m_arAssociations.elementAt(i)).m_strAttrib);
|
754
|
+
}
|
755
|
+
}
|
756
|
+
|
757
|
+
void updateAssociation(String strOldObject, String strNewObject, String strAttrib)
|
758
|
+
{
|
759
|
+
if ( m_bSchemaSource )
|
760
|
+
{
|
761
|
+
String strSqlUpdate = "UPDATE ";
|
762
|
+
strSqlUpdate += getName() + " SET " + strAttrib + "=? where " + strAttrib + "=?";
|
763
|
+
|
764
|
+
getDB().executeSQL(strSqlUpdate, strNewObject, strOldObject );
|
765
|
+
}
|
766
|
+
else
|
767
|
+
getDB().executeSQL("UPDATE object_values SET value=? where attrib=? and source_id=? and value=?",
|
768
|
+
strNewObject, strAttrib, getID(), strOldObject );
|
769
|
+
|
770
|
+
getDB().executeSQL("UPDATE changed_values SET value=? where attrib=? and source_id=? and value=?",
|
771
|
+
strNewObject, strAttrib, getID(), strOldObject );
|
772
|
+
}
|
773
|
+
|
774
|
+
void processServerCmd_Ver3_Schema(String strCmd, String strObject, JSONStructIterator attrIter)
|
775
|
+
{
|
776
|
+
if ( strCmd.compareTo("insert") == 0 )
|
777
|
+
{
|
778
|
+
Vector<String> vecValues = new Vector<String>(), vecAttrs = new Vector<String>();
|
779
|
+
String strCols = "", strQuest = "", strSet = "";
|
780
|
+
for( ; !attrIter.isEnd() && getSync().isContinueSync(); attrIter.next() )
|
781
|
+
{
|
782
|
+
CAttrValue oAttrValue = new CAttrValue(attrIter.getCurKey(),attrIter.getCurString());
|
783
|
+
if ( !processBlob(strCmd,strObject,oAttrValue) )
|
784
|
+
continue;
|
785
|
+
|
786
|
+
if ( strCols.length() > 0 )
|
787
|
+
strCols += ",";
|
788
|
+
if ( strQuest.length() > 0)
|
789
|
+
strQuest += ",";
|
790
|
+
if ( strSet.length() > 0)
|
791
|
+
strSet += ",";
|
792
|
+
|
793
|
+
strCols += oAttrValue.m_strAttrib;
|
794
|
+
strQuest += "?";
|
795
|
+
strSet += oAttrValue.m_strAttrib + "=?";
|
796
|
+
vecAttrs.addElement(oAttrValue.m_strAttrib);
|
797
|
+
vecValues.addElement(oAttrValue.m_strValue);
|
798
|
+
}
|
799
|
+
vecValues.addElement(strObject);
|
800
|
+
if ( strCols.length() > 0 )
|
801
|
+
strCols += ",";
|
802
|
+
if ( strQuest.length() > 0)
|
803
|
+
strQuest += ",";
|
804
|
+
|
805
|
+
strCols += "object";
|
806
|
+
strQuest += "?";
|
807
|
+
|
808
|
+
String strSqlInsert = "INSERT INTO ";
|
809
|
+
strSqlInsert += getName() + " (";
|
810
|
+
strSqlInsert += strCols + ") VALUES(" + strQuest + ")";
|
811
|
+
|
812
|
+
if ( !getSync().isContinueSync() )
|
813
|
+
return;
|
814
|
+
|
815
|
+
IDBResult resInsert = getDB().executeSQLReportNonUniqueEx(strSqlInsert, vecValues );
|
816
|
+
if ( resInsert.isNonUnique() )
|
817
|
+
{
|
818
|
+
String strSqlUpdate = "UPDATE ";
|
819
|
+
strSqlUpdate += getName() + " SET " + strSet + " WHERE object=?";
|
820
|
+
getDB().executeSQLEx(strSqlUpdate, vecValues);
|
821
|
+
|
822
|
+
if ( getSyncType().compareTo("none") != 0 )
|
823
|
+
{
|
824
|
+
// oo conflicts
|
825
|
+
for( int i = 0; i < (int)vecAttrs.size(); i++ )
|
826
|
+
{
|
827
|
+
getDB().executeSQL("UPDATE changed_values SET sent=4 where object=? and attrib=? and source_id=? and sent>1",
|
828
|
+
strObject, vecAttrs.elementAt(i), getID() );
|
829
|
+
}
|
830
|
+
//
|
831
|
+
}
|
832
|
+
}
|
833
|
+
|
834
|
+
if ( getSyncType().compareTo("none") != 0 )
|
835
|
+
getNotify().onObjectChanged(getID(),strObject, SyncNotify.enUpdate);
|
836
|
+
|
837
|
+
m_nInserted++;
|
838
|
+
}else if (strCmd.compareTo("delete") == 0)
|
839
|
+
{
|
840
|
+
Vector<String> vecAttrs = new Vector<String>();
|
841
|
+
String strSet = "";
|
842
|
+
for( ; !attrIter.isEnd() && getSync().isContinueSync(); attrIter.next() )
|
843
|
+
{
|
844
|
+
CAttrValue oAttrValue = new CAttrValue(attrIter.getCurKey(),attrIter.getCurString());
|
845
|
+
|
846
|
+
if ( strSet.length() > 0 )
|
847
|
+
strSet += ",";
|
848
|
+
|
849
|
+
vecAttrs.addElement(oAttrValue.m_strAttrib);
|
850
|
+
strSet += oAttrValue.m_strAttrib + "=NULL";
|
851
|
+
}
|
852
|
+
|
853
|
+
String strSqlUpdate = "UPDATE ";
|
854
|
+
strSqlUpdate += getName() + " SET " + strSet + " WHERE object=?";
|
855
|
+
|
856
|
+
if ( strSet.length() == 0 || !getSync().isContinueSync() )
|
857
|
+
return;
|
858
|
+
|
859
|
+
getDB().executeSQL(strSqlUpdate, strObject);
|
860
|
+
//Remove item if all nulls
|
861
|
+
String strSelect = "SELECT * FROM " + getName() + " WHERE object=?";
|
862
|
+
IDBResult res = getDB().executeSQL( strSelect, strObject );
|
863
|
+
if ( !res.isEnd() )
|
864
|
+
{
|
865
|
+
boolean bAllNulls = true;
|
866
|
+
for( int i = 0; i < res.getColCount(); i ++)
|
867
|
+
{
|
868
|
+
if ( !res.isNullByIdx(i) && res.getColName(i).compareTo("object")!=0 )
|
869
|
+
{
|
870
|
+
bAllNulls = false;
|
871
|
+
break;
|
872
|
+
}
|
873
|
+
}
|
874
|
+
|
875
|
+
if (bAllNulls)
|
876
|
+
{
|
877
|
+
String strDelete = "DELETE FROM " + getName() + " WHERE object=?";
|
878
|
+
getDB().executeSQL( strDelete, strObject);
|
879
|
+
}
|
880
|
+
}
|
881
|
+
|
882
|
+
if ( getSyncType().compareTo("none") != 0 )
|
883
|
+
{
|
884
|
+
getNotify().onObjectChanged(getID(), strObject, SyncNotify.enDelete);
|
885
|
+
// oo conflicts
|
886
|
+
for( int i = 0; i < (int)vecAttrs.size(); i++ )
|
887
|
+
{
|
888
|
+
getDB().executeSQL("UPDATE changed_values SET sent=3 where object=? and attrib=? and source_id=?",
|
889
|
+
strObject, vecAttrs.elementAt(i), getID() );
|
890
|
+
}
|
891
|
+
//
|
892
|
+
}
|
893
|
+
|
894
|
+
m_nDeleted++;
|
895
|
+
}else if ( strCmd.compareTo("links") == 0 )
|
896
|
+
{
|
897
|
+
String strValue = attrIter.getCurString();
|
898
|
+
processAssociations(strObject, strValue);
|
899
|
+
|
900
|
+
String strSqlUpdate = "UPDATE ";
|
901
|
+
strSqlUpdate += getName() + " SET object=? WHERE object=?";
|
902
|
+
getDB().executeSQL(strSqlUpdate, strValue, strObject);
|
903
|
+
|
904
|
+
getDB().executeSQL("UPDATE changed_values SET object=?,sent=3 where object=? and source_id=?", strValue, strObject, getID() );
|
905
|
+
getNotify().onObjectChanged(getID(), strObject, SyncNotify.enCreate);
|
906
|
+
}
|
907
|
+
|
908
|
+
}
|
909
|
+
|
910
|
+
boolean processBlob( String strCmd, String strObject, CAttrValue oAttrValue )
|
911
|
+
{
|
912
|
+
//TODO: when server return delete with rhoblob postfix - delete isBlobAttr
|
913
|
+
if ( !(oAttrValue.m_strBlobSuffix.length() > 0 || getDB().getAttrMgr().isBlobAttr(getID(), oAttrValue.m_strAttrib)) )
|
914
|
+
return true;
|
915
|
+
|
916
|
+
boolean bDownload = true;
|
917
|
+
String strDbValue = "";
|
918
|
+
if ( !getDB().getAttrMgr().isOverwriteBlobFromServer(getID(), oAttrValue.m_strAttrib) )
|
919
|
+
{
|
920
|
+
if ( m_bSchemaSource )
|
921
|
+
{
|
922
|
+
String strSelect = "SELECT " + oAttrValue.m_strAttrib + " FROM " + getName() + " WHERE object=?";
|
923
|
+
IDBResult res = getDB().executeSQL( strSelect, strObject);
|
924
|
+
if (!res.isEnd())
|
925
|
+
{
|
926
|
+
strDbValue = res.getStringByIdx(0);
|
927
|
+
bDownload = strDbValue == null || strDbValue.length() == 0;
|
928
|
+
}
|
929
|
+
}else
|
930
|
+
{
|
931
|
+
IDBResult res = getDB().executeSQL(
|
932
|
+
"SELECT value FROM object_values WHERE object=? and attrib=? and source_id=?",
|
933
|
+
strObject, oAttrValue.m_strAttrib, getID() );
|
934
|
+
if (!res.isEnd())
|
935
|
+
{
|
936
|
+
strDbValue = res.getStringByIdx(0);
|
937
|
+
bDownload = strDbValue == null || strDbValue.length() == 0;
|
938
|
+
}
|
939
|
+
}
|
940
|
+
}
|
941
|
+
|
942
|
+
if ( bDownload )
|
943
|
+
{
|
944
|
+
boolean bRes = false;
|
945
|
+
getDB().endTransaction();
|
946
|
+
try{
|
947
|
+
bRes = downloadBlob(oAttrValue);
|
948
|
+
}finally
|
949
|
+
{
|
950
|
+
getDB().startTransaction();
|
951
|
+
}
|
952
|
+
|
953
|
+
return bRes;
|
954
|
+
}
|
955
|
+
/*
|
956
|
+
String fName = makeFileName( oAttrValue );
|
957
|
+
String fOldName = RHODESAPP().resolveDBFilesPath(strDbValue);
|
958
|
+
RhoClassFactory.createFile().renameOverwrite(fOldName, fName);
|
959
|
+
|
960
|
+
oAttrValue.m_strValue = FilePath.getRelativePath( fName, RhodesApp.getInstance().getRhoRootPath());
|
961
|
+
*/
|
962
|
+
oAttrValue.m_strValue = strDbValue;
|
963
|
+
return true;
|
964
|
+
}
|
965
|
+
|
966
|
+
void processServerCmd_Ver3(String strCmd, String strObject, String strAttriba, String strValuea)
|
967
|
+
{
|
968
|
+
CAttrValue oAttrValue = new CAttrValue(strAttriba,strValuea);
|
969
|
+
|
970
|
+
if ( strCmd.compareTo("insert") == 0 )
|
971
|
+
{
|
972
|
+
if ( !processBlob(strCmd,strObject,oAttrValue) )
|
973
|
+
return;
|
974
|
+
|
975
|
+
IDBResult resInsert = getDB().executeSQLReportNonUnique("INSERT INTO object_values "+
|
976
|
+
"(attrib, source_id, object, value) VALUES(?,?,?,?)",
|
977
|
+
oAttrValue.m_strAttrib, getID(), strObject, oAttrValue.m_strValue );
|
978
|
+
|
979
|
+
if ( resInsert.isNonUnique() )
|
980
|
+
{
|
981
|
+
getDB().executeSQL("UPDATE object_values " +
|
982
|
+
"SET value=? WHERE object=? and attrib=? and source_id=?",
|
983
|
+
oAttrValue.m_strValue, strObject, oAttrValue.m_strAttrib, getID() );
|
984
|
+
|
985
|
+
if ( getSyncType().compareTo("none") != 0 )
|
986
|
+
{
|
987
|
+
// oo conflicts
|
988
|
+
getDB().executeSQL("UPDATE changed_values SET sent=4 where object=? and attrib=? and source_id=? and sent>1",
|
989
|
+
strObject, oAttrValue.m_strAttrib, getID() );
|
990
|
+
//
|
991
|
+
}
|
992
|
+
}
|
993
|
+
|
994
|
+
if ( getSyncType().compareTo("none") != 0 )
|
995
|
+
getNotify().onObjectChanged(getID(),strObject, SyncNotify.enUpdate);
|
996
|
+
|
997
|
+
m_nInserted++;
|
998
|
+
}else if (strCmd.compareTo("delete") == 0)
|
999
|
+
{
|
1000
|
+
getDB().executeSQL("DELETE FROM object_values where object=? and attrib=? and source_id=?", strObject, oAttrValue.m_strAttrib, getID() );
|
1001
|
+
|
1002
|
+
if ( getSyncType().compareTo("none") != 0 )
|
1003
|
+
{
|
1004
|
+
getNotify().onObjectChanged(getID(), strObject, SyncNotify.enDelete);
|
1005
|
+
// oo conflicts
|
1006
|
+
getDB().executeSQL("UPDATE changed_values SET sent=3 where object=? and attrib=? and source_id=?", strObject, oAttrValue.m_strAttrib, getID() );
|
1007
|
+
//
|
1008
|
+
}
|
1009
|
+
m_nDeleted++;
|
1010
|
+
}else if ( strCmd.compareTo("links") == 0 )
|
1011
|
+
{
|
1012
|
+
processAssociations(strObject, oAttrValue.m_strValue);
|
1013
|
+
|
1014
|
+
getDB().executeSQL("UPDATE object_values SET object=? where object=? and source_id=?", oAttrValue.m_strValue, strObject, getID() );
|
1015
|
+
getDB().executeSQL("UPDATE changed_values SET object=?,sent=3 where object=? and source_id=?", oAttrValue.m_strValue, strObject, getID() );
|
1016
|
+
|
1017
|
+
getNotify().onObjectChanged(getID(), strObject, SyncNotify.enCreate);
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
}
|
1021
|
+
|
1022
|
+
private String makeFileName(CAttrValue value)
|
1023
|
+
{
|
1024
|
+
String strExt = "";
|
1025
|
+
|
1026
|
+
String strQuest = URI.getQueryString(value.m_strValue);
|
1027
|
+
|
1028
|
+
if (strQuest != null && strQuest.length() > 0)
|
1029
|
+
{
|
1030
|
+
int nExt = strQuest.indexOf("extension=");
|
1031
|
+
if ( nExt >= 0 )
|
1032
|
+
{
|
1033
|
+
int nExtEnd = strQuest.indexOf("&", nExt);
|
1034
|
+
if (nExtEnd < 0 )
|
1035
|
+
nExtEnd = strQuest.length();
|
1036
|
+
|
1037
|
+
strExt = strQuest.substring(nExt+10, nExtEnd);
|
1038
|
+
}
|
1039
|
+
}
|
1040
|
+
|
1041
|
+
if ( strExt.length() == 0 )
|
1042
|
+
{
|
1043
|
+
String strFileName = URI.getLastNamePart(value.m_strValue);
|
1044
|
+
int nExt = strFileName != null ? strFileName.lastIndexOf('.') : -1;
|
1045
|
+
if ( nExt >= 0 )
|
1046
|
+
strExt = strFileName.substring(nExt);
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
if ( strExt.length() == 0 )
|
1050
|
+
strExt = ".bin";
|
1051
|
+
else if ( strExt.charAt(0) != '.' )
|
1052
|
+
strExt = "." + strExt;
|
1053
|
+
|
1054
|
+
String fName = RHODESAPP().getBlobsDirPath() + "/id_" + TimeInterval.getCurrentTime().toULong() + strExt;
|
1055
|
+
|
1056
|
+
return fName;
|
1057
|
+
}
|
1058
|
+
|
1059
|
+
boolean downloadBlob(CAttrValue value)
|
1060
|
+
{
|
1061
|
+
String fName = makeFileName( value );
|
1062
|
+
String url = value.m_strValue;
|
1063
|
+
int nQuest = url.lastIndexOf('?');
|
1064
|
+
if ( nQuest > 0 )
|
1065
|
+
url += "&";
|
1066
|
+
else
|
1067
|
+
url += "?";
|
1068
|
+
url += "client_id=" + getSync().getClientID();
|
1069
|
+
|
1070
|
+
try{
|
1071
|
+
NetResponse resp = getNet().pullFile(url, fName, getSync(), null);
|
1072
|
+
if ( !resp.isOK() )
|
1073
|
+
{
|
1074
|
+
getSync().stopSync();
|
1075
|
+
m_nErrCode = RhoAppAdapter.getErrorFromResponse(resp);
|
1076
|
+
return false;
|
1077
|
+
}
|
1078
|
+
}catch(Exception exc)
|
1079
|
+
{
|
1080
|
+
m_nErrCode = RhoAppAdapter.getNetErrorCode(exc);
|
1081
|
+
throw exc;
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
value.m_strValue = CFilePath.getRelativePath( fName, CRhodesApp.getRhoRootPath());
|
1085
|
+
|
1086
|
+
return true;
|
1087
|
+
}
|
1088
|
+
|
1089
|
+
public void processToken(long token)
|
1090
|
+
{
|
1091
|
+
if ( token > 1 && getToken() == token ){
|
1092
|
+
//Delete non-confirmed records
|
1093
|
+
|
1094
|
+
setToken( token ); //For m_bTokenFromDB = false;
|
1095
|
+
//getDB().executeSQL("DELETE FROM object_values where source_id=? and token=?", getID(), token );
|
1096
|
+
//TODO: add special table for id,token
|
1097
|
+
}else
|
1098
|
+
{
|
1099
|
+
setToken( token );
|
1100
|
+
getDB().executeSQL("UPDATE sources SET token=? where source_id=?", token, getID() );
|
1101
|
+
}
|
1102
|
+
|
1103
|
+
}
|
1104
|
+
}
|
1105
|
+
}
|