rhodes 2.2.6 → 2.3.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +20 -0
- data/README.md +46 -0
- data/Rakefile +85 -80
- data/bin/rhodes +2 -2
- data/bin/rhogen +1 -1
- data/doc/application.txt +277 -0
- data/doc/bb-css.txt +209 -0
- data/doc/build.txt +785 -0
- data/doc/configuration.txt +236 -0
- data/doc/connect-to-web-services.txt +282 -0
- data/doc/contributing.txt +64 -0
- data/doc/css-framework.txt +144 -0
- data/doc/device-caps.txt +1152 -0
- data/doc/extensions.txt +528 -0
- data/doc/files.txt +4 -0
- data/doc/generator.txt +141 -0
- data/doc/install.txt +35 -0
- data/doc/introduction.txt +88 -0
- data/doc/rhom.txt +826 -0
- data/doc/standard-css.txt +392 -0
- data/doc/synchronization.txt +542 -0
- data/doc/test-log-debug.txt +148 -0
- data/doc/tutorial.txt +136 -0
- data/doc/ui.txt +766 -0
- data/installer/EnvVarUpdate.nsh +328 -0
- data/installer/README.html +81 -0
- data/installer/RHOSYNC-LICENSE.txt +675 -0
- data/installer/icon.ico +0 -0
- data/installer/instant-rhodes.nsi +427 -0
- data/lib/build/jake.rb +15 -1
- data/lib/extensions/barcode/ext/barcode/platform/android/jni/src/imageprovider.cpp +1 -1
- data/lib/extensions/barcode/ext/barcode/platform/bb/Barcode6.files +45 -0
- data/lib/extensions/barcode/ext/barcode/platform/bb/Rakefile +6 -0
- data/lib/extensions/barcode/ext/barcode/platform/bb/barcode6.jdp +92 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +7 -4
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Rakefile +2 -1
- data/lib/extensions/barcode/ext/barcode/platform/wm/src/wm_imageprovider.cpp +1 -1
- data/lib/extensions/digest-sha1/ext/build.bat +1 -0
- data/lib/extensions/digest-sha1/ext/digest-sha1.vcproj +335 -0
- data/lib/extensions/esri/ext/build +17 -0
- data/lib/extensions/esri/ext/build.bat +29 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactory.h +7 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactory.mm +58 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewFactoryRegister.mm +22 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewManager.h +21 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/ESRIViewManager.mm +32 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/InitESRI.c +5 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/MapViewControllerESRI.h +143 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Classes/MapViewControllerESRI.m +919 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/ESRI.xcodeproj/project.pbxproj +320 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/ESRI_Prefix.pch +7 -0
- data/lib/extensions/esri/ext/esri/platform/iphone/Rakefile +76 -0
- data/lib/extensions/esri/ext.yml +3 -0
- data/lib/extensions/net-http/monitor.rb +265 -0
- data/lib/extensions/net-http/net/ftp.rb +981 -0
- data/lib/extensions/net-http/thread.rb +367 -0
- data/lib/extensions/rhocgi/cgi.rb +16 -0
- data/lib/extensions/rhospec/rhospec.rb +118 -0
- data/lib/framework/base64.rb +91 -0
- data/lib/framework/builtinME.rb +13 -10
- data/lib/framework/ostruct.rb +145 -0
- data/lib/framework/res/back_btn.wm.png +0 -0
- data/lib/framework/res/blue_pushpin.wm.png +0 -0
- data/lib/framework/res/blue_pushpin_small.wm.png +0 -0
- data/lib/framework/res/callout.wm.png +0 -0
- data/lib/framework/res/callout_link.wm.png +0 -0
- data/lib/framework/res/forward_btn.wm.png +0 -0
- data/lib/framework/res/home_btn.wm.png +0 -0
- data/lib/framework/res/options_btn.wm.png +0 -0
- data/lib/framework/res/refresh_btn.wm.png +0 -0
- data/lib/framework/rho/render.rb +5 -2
- data/lib/framework/rho/rho.rb +320 -50
- data/lib/framework/rho/rhoapplication.rb +48 -10
- data/lib/framework/rho/rhonativeviewmanager.rb +73 -0
- data/lib/framework/rho/rhosupport.rb +15 -1
- data/lib/framework/rho/rhotabbar.rb +29 -0
- data/lib/framework/rho/rhotoolbar.rb +17 -0
- data/lib/framework/rho/rhoutils.rb +22 -6
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rholang/rhomsg_de.rb +4 -3
- data/lib/framework/rholang/rhomsg_en.rb +1 -0
- data/lib/framework/rholang/rhomsg_es.rb +1 -0
- data/lib/framework/rholang/rhomsg_it.rb +1 -0
- data/lib/framework/rhom/rhom.rb +31 -10
- data/lib/framework/rhom/rhom_db_adapter.rb +33 -23
- data/lib/framework/rhom/rhom_object_factory.rb +465 -249
- data/lib/framework/rhom/rhom_source.rb +22 -7
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.xml +83 -20
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +5 -0
- data/platform/android/Rhodes/jni/include/rhodes/RhoClassFactory.h +2 -0
- data/platform/android/Rhodes/jni/include/rhodes/details/rhojava.inc +9 -5
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesAppOptions.h +53 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesService.h +46 -56
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_SplashScreen.h +10 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_mapview_MapView.h +93 -0
- data/platform/android/Rhodes/jni/include/rhodes/rhocryptimpl.h +38 -0
- data/platform/android/Rhodes/jni/include/rhodes.h +64 -8
- data/platform/android/Rhodes/jni/src/RhoClassFactory.cpp +6 -0
- data/platform/android/Rhodes/jni/src/alert.cpp +5 -11
- data/platform/android/Rhodes/jni/src/bluetooth.cpp +66 -29
- data/platform/android/Rhodes/jni/src/callbacks.cpp +24 -21
- data/platform/android/Rhodes/jni/src/camera.cpp +2 -6
- data/platform/android/Rhodes/jni/src/datetimepicker.cpp +13 -11
- data/platform/android/Rhodes/jni/src/event.cpp +9 -15
- data/platform/android/Rhodes/jni/src/fileapi.cpp +13 -27
- data/platform/android/Rhodes/jni/src/logconf.cpp +3 -3
- data/platform/android/Rhodes/jni/src/mapview.cpp +696 -16
- data/platform/android/Rhodes/jni/src/menu.cpp +3 -3
- data/platform/android/Rhodes/jni/src/nativebar.cpp +55 -4
- data/platform/android/Rhodes/jni/src/nativeview.cpp +33 -0
- data/platform/android/Rhodes/jni/src/phonebook.cpp +6 -11
- data/platform/android/Rhodes/jni/src/rhoconf.cpp +4 -4
- data/platform/android/Rhodes/jni/src/rhocryptimpl.cpp +87 -0
- data/platform/android/Rhodes/jni/src/rhodes.cpp +55 -34
- data/platform/android/Rhodes/jni/src/ringtones.cpp +2 -3
- data/platform/android/Rhodes/jni/src/signature.cpp +3 -5
- data/platform/android/Rhodes/jni/src/splashscreen.cpp +7 -0
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +17 -20
- data/platform/android/Rhodes/jni/src/webview.cpp +13 -12
- data/platform/android/Rhodes/res/drawable/callout.png +0 -0
- data/platform/android/Rhodes/res/drawable/callout_link.png +0 -0
- data/platform/android/Rhodes/res/drawable/signature_cancel.png +0 -0
- data/platform/android/Rhodes/res/drawable/signature_clear.png +0 -0
- data/platform/android/Rhodes/res/drawable/signature_ok.png +0 -0
- data/platform/android/Rhodes/res/layout/datetime.xml +4 -0
- data/platform/android/Rhodes/res/layout/signature.xml +24 -17
- data/platform/android/Rhodes/res/layout/status_bar_ongoing_event_progress_bar.xml +102 -0
- data/platform/android/Rhodes/res/values/strings.xml +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +6 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Base64.java +575 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +83 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +21 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +23 -15
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoCryptImpl.java +151 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +372 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesAppOptions.java +11 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +58 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +705 -523
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RingtoneManager.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +167 -85
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Utils.java +36 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +4 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +33 -20
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/IRhoBluetoothManager.java +2 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManager.java +2 -24
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerNew.java +106 -36
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerOld.java +15 -58
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothSession.java +0 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +6 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/FileList.java +4 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +91 -27
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePicker.java +6 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +275 -42
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +1 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +120 -43
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +518 -28
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/AnnotationsOverlay.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java +434 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapTouch.java +20 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +296 -336
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MultiTouchHandler.java +111 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/OneTouchHandler.java +77 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/TouchHandler.java +10 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +0 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +5 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/ImageCapture.java +6 -11
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +6 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +0 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/ui/LogViewDialog.java +9 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +8 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java +5 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientOld.java +11 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +3 -5
- data/platform/android/build/RhodesSRC_build.files +32 -23
- data/platform/android/build/android.rake +28 -11
- data/platform/android/build/androidcommon.rb +2 -0
- data/platform/android/build/librhocommon_build.files +9 -5
- data/platform/android/build/librhodes_build.files +1 -0
- data/platform/android/build/libruby_build.files +1 -0
- data/platform/bb/Hsqldb/Hsqldb.jdp +0 -2
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +10 -2
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +37 -5
- data/platform/bb/Hsqldb/src/org/hsqldb/Column.java +5 -5
- data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Function.java +73 -78
- data/platform/bb/Hsqldb/src/org/hsqldb/Library.java +288 -8
- data/platform/bb/RubyVM/RubyVM.jdp +3 -0
- data/platform/bb/RubyVM/src/com/rho/FilePath.java +13 -1
- data/platform/bb/RubyVM/src/com/rho/IRhoRubyHelper.java +2 -2
- data/platform/bb/RubyVM/src/com/rho/RhoAppAdapter.java +12 -0
- data/platform/bb/RubyVM/src/com/rho/RhoClassFactory.java +18 -1
- data/platform/bb/RubyVM/src/com/rho/RhoConf.java +128 -108
- data/platform/bb/RubyVM/src/com/rho/RhoLogConf.java +9 -10
- data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +16 -1
- data/platform/bb/RubyVM/src/com/rho/RhoProfiler.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +20 -0
- data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +5 -2
- data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +65 -46
- data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +192 -50
- data/platform/bb/RubyVM/src/com/rho/db/DBAttrManager.java +8 -114
- data/platform/bb/RubyVM/src/com/rho/db/DBException.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/db/IDBCallback.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/db/IDBResult.java +5 -3
- data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +5 -1
- data/platform/bb/RubyVM/src/com/rho/file/FileAccessBB.java +109 -0
- data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +85 -0
- data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +12 -4
- data/platform/bb/RubyVM/src/com/rho/net/NetResponse.java +5 -0
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +37 -23
- data/platform/bb/RubyVM/src/com/rho/net/URI.java +84 -0
- data/platform/bb/RubyVM/src/com/rho/sync/ClientRegister.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +119 -61
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +61 -24
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +108 -54
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +121 -163
- data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyString_Methods.java +23 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyMutex.java +1 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyRange.java +3 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyRegexp.java +3 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyString.java +208 -25
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyTime.java +3 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RhoSupport.java +5 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyAPI.java +12 -5
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyID.java +1 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule.java +16 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule_Methods.java +5 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyValue.java +1 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/stdlib/RubyStringIO.java +4 -1
- data/platform/bb/{Hsqldb → RubyVM}/src/j2me/math/Number.java +33 -0
- data/platform/bb/build/RubyVM_build.files +3 -0
- data/platform/bb/build/bb.rake +140 -62
- data/platform/bb/build/hsqldb_build.files +0 -2
- data/platform/bb/build/rhodes_build.files +5 -0
- data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +43 -7
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +23 -2
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +5 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteCopyResult.java +143 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteResult.java +269 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteStorage.java +446 -0
- data/platform/bb/rhodes/platform/common/com/rho/BrowserAdapter5.java +3 -0
- data/platform/bb/rhodes/platform/common/com/rho/RhoMainScreen.java +12 -2
- data/platform/bb/rhodes/platform/common/com/rho/db/SqliteCopyResult.java +2 -0
- data/platform/bb/rhodes/platform/common/com/rho/db/SqliteResult.java +2 -0
- data/platform/bb/rhodes/platform/common/com/rho/db/SqliteStorage.java +2 -0
- data/platform/bb/rhodes/resources/mappin.png +0 -0
- data/platform/bb/rhodes/rhodes.jdp +3 -0
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +21 -18
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +150 -0
- data/platform/bb/rhodes/src/com/rho/IBrowserAdapter.java +1 -0
- data/platform/bb/rhodes/src/com/rho/RhoMainScreen.java +63 -4
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +6 -5
- data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +242 -2
- data/platform/bb/rhodes/src/com/rho/db/SqliteCopyResult.java +143 -0
- data/platform/bb/rhodes/src/com/rho/db/SqliteResult.java +269 -0
- data/platform/bb/rhodes/src/com/rho/db/SqliteStorage.java +446 -0
- data/platform/bb/rhodes/src/com/rho/file/Jsr75File.java +1 -1
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +71 -14
- data/platform/bb/rhodes/src/com/rho/net/bb/BBHttpConnection.java +4 -2
- data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +28 -12
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +100 -4
- data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +3 -2
- data/platform/bb/rhodes/src/com/rho/rubyext/XMLParser.java +1 -1
- data/platform/bb/rhodes/src/rhomobile/NativeBar.java +32 -0
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +9 -2
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +174 -41
- data/platform/bb/rhodes/src/rhomobile/datetime/DateTimePicker.java +52 -3
- data/platform/bb/rhodes/src/rhomobile/datetime/DateTimeScreen.java +33 -1
- data/platform/bb/rhodes/src/rhomobile/mapview/Annotation.java +2 -14
- data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapField.java +686 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapProvider.java +14 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GeoCoding.java +13 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GoogleGeoCoding.java +174 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GoogleMapField.java +104 -330
- data/platform/bb/rhodes/src/rhomobile/mapview/MapTools.java +79 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/MapView.java +35 -12
- data/platform/bb/rhodes/src/rhomobile/mapview/MapViewParent.java +2 -1
- data/platform/bb/rhodes/src/rhomobile/mapview/MapViewScreen.java +336 -44
- data/platform/bb/rhodes/src/rhomobile/mapview/RhoMapField.java +3 -6
- data/platform/iphone/Classes/AppManager/AppManager.m +19 -4
- data/platform/iphone/Classes/DateTime.h +4 -0
- data/platform/iphone/Classes/DateTime.m +1 -1
- data/platform/iphone/Classes/DateTimePicker.m +8 -1
- data/platform/iphone/Classes/DateTimePickerDelegate.m +7 -1
- data/platform/iphone/Classes/Event/Event.m +2 -2
- data/platform/iphone/Classes/MapView/MapViewController.h +4 -1
- data/platform/iphone/Classes/MapView/MapViewController.m +6 -46
- data/platform/iphone/Classes/MapView/MapViewManager.h +26 -0
- data/platform/iphone/Classes/MapView/MapViewManager.m +172 -0
- data/platform/iphone/Classes/NativeBar.h +34 -0
- data/platform/iphone/Classes/NativeBar.m +131 -26
- data/platform/iphone/Classes/NativeView/NVDelegate.h +26 -0
- data/platform/iphone/Classes/NativeView/NVDelegate.m +40 -0
- data/platform/iphone/Classes/NativeView/NVViewController.h +24 -0
- data/platform/iphone/Classes/NativeView/NVViewController.m +90 -0
- data/platform/iphone/Classes/NativeView/RhoNativeViewManager.mm +449 -0
- data/platform/iphone/Classes/{RhoNativeViewManagerOC.h → NativeView/RhoNativeViewManagerOC.h} +15 -0
- data/platform/iphone/Classes/RhoAlert.m +3 -3
- data/platform/iphone/Classes/RhoMainView.h +3 -0
- data/platform/iphone/Classes/Rhodes.h +6 -2
- data/platform/iphone/Classes/Rhodes.m +47 -79
- data/platform/iphone/Classes/Signature/SignatureViewController.m +1 -0
- data/platform/iphone/Classes/SimpleMainView.h +18 -1
- data/platform/iphone/Classes/SimpleMainView.m +180 -35
- data/platform/iphone/Classes/SplitView/LeftViewController.h +1 -1
- data/platform/iphone/Classes/SplitView/LeftViewController.m +13 -7
- data/platform/iphone/Classes/SplitView/RightViewController.h +1 -1
- data/platform/iphone/Classes/SplitView/RightViewController.m +26 -11
- data/platform/iphone/Classes/SplitView/SplittedMainView.h +1 -6
- data/platform/iphone/Classes/SplitView/SplittedMainView.m +14 -52
- data/platform/iphone/Classes/TabbedMainView.h +25 -3
- data/platform/iphone/Classes/TabbedMainView.m +340 -14
- data/platform/iphone/ESRI/BluePushpin.png +0 -0
- data/platform/iphone/ESRI/BluePushpin@2x.png +0 -0
- data/platform/iphone/ESRI/esri.png +0 -0
- data/platform/iphone/ESRI/esri@2x.png +0 -0
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +26 -3
- data/platform/iphone/rbuild/iphone.rake +100 -4
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +12 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +116 -12
- data/platform/shared/SyncClient/SyncClient.cpp +29 -3
- data/platform/shared/SyncClient/SyncClient.h +2 -1
- data/platform/shared/common/IRhoClassFactory.h +3 -0
- data/platform/shared/common/IRhoCrypt.h +16 -0
- data/platform/shared/common/IRhoThreadImpl.h +1 -0
- data/platform/shared/common/RhoAppAdapter.h +2 -0
- data/platform/shared/common/RhoConf.cpp +97 -46
- data/platform/shared/common/RhoConf.h +14 -13
- data/platform/shared/common/RhoFile.cpp +10 -0
- data/platform/shared/common/RhoFile.h +1 -0
- data/platform/shared/common/RhoMath.cpp +43 -0
- data/platform/shared/common/RhoMath.h +27 -0
- data/platform/shared/common/RhoNativeViewManager.h +27 -1
- data/platform/shared/common/RhoPort.h +11 -0
- data/platform/shared/common/RhoStd.h +5 -0
- data/platform/shared/common/RhoThread.cpp +1 -1
- data/platform/shared/common/RhoThread.h +1 -1
- data/platform/shared/common/RhodesApp.cpp +381 -139
- data/platform/shared/common/RhodesApp.h +24 -10
- data/platform/shared/common/RhodesAppBase.cpp +72 -1
- data/platform/shared/common/RhodesAppBase.h +5 -1
- data/platform/shared/common/SplashScreen.h +4 -4
- data/platform/shared/common/ThreadQueue.cpp +44 -17
- data/platform/shared/common/ThreadQueue.h +4 -0
- data/platform/shared/common/app_build_configs.c +0 -1
- data/platform/shared/common/iphone/RhoClassfactory.h +6 -0
- data/platform/shared/common/iphone/RhoCryptImpl.h +47 -0
- data/platform/shared/common/iphone/RhoCryptImpl.mm +286 -0
- data/platform/shared/common/map/ESRIMapEngine.cpp +921 -0
- data/platform/shared/common/map/ESRIMapEngine.h +255 -0
- data/platform/shared/common/map/GoogleMapEngine.cpp +160 -0
- data/platform/shared/common/map/GoogleMapEngine.h +52 -0
- data/platform/shared/common/map/MapEngine.cpp +304 -0
- data/platform/shared/common/map/MapEngine.h +214 -0
- data/platform/shared/db/DBAdapter.cpp +147 -18
- data/platform/shared/db/DBAdapter.h +38 -12
- data/platform/shared/db/DBAttrManager.cpp +4 -3
- data/platform/shared/db/DBAttrManager.h +7 -7
- data/platform/shared/db/res/db/syncdb.triggers +0 -5
- data/platform/shared/db/res/db/syncdb_java.triggers +21 -0
- data/platform/shared/json/JSONIterator.cpp +11 -1
- data/platform/shared/json/JSONIterator.h +1 -0
- data/platform/shared/logging/RhoLogConf.cpp +29 -12
- data/platform/shared/net/CURLNetRequest.cpp +80 -25
- data/platform/shared/net/CURLNetRequest.h +6 -2
- data/platform/shared/net/HttpServer.cpp +12 -6
- data/platform/shared/net/HttpServer.h +2 -1
- data/platform/shared/net/INetRequest.h +1 -0
- data/platform/shared/ruby/ext/alert/alert.i +5 -0
- data/platform/shared/ruby/ext/alert/alert_wrap.c +439 -108
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker.i +42 -0
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +521 -120
- data/platform/shared/ruby/ext/nativebar/nativebar.i +16 -0
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +623 -128
- data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager.i +18 -0
- data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager_wrap.c +2321 -0
- data/platform/shared/ruby/ext/rho/extensions.c +0 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +53 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +6 -0
- data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +6 -3
- data/platform/shared/ruby/ext/syncengine/syncengine.i +9 -1
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +61 -0
- data/platform/shared/ruby/ext/system/system.i +4 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +33 -5
- data/platform/shared/rubyext/RhoAppAdapter.cpp +11 -1
- data/platform/shared/rubyext/System.cpp +9 -0
- data/platform/shared/rubyext/WebView.h +1 -0
- data/platform/shared/sqlite/crypto.c +907 -0
- data/platform/shared/sqlite/sqlite3.c +6 -0
- data/platform/shared/sync/SyncEngine.cpp +49 -19
- data/platform/shared/sync/SyncEngine.h +0 -1
- data/platform/shared/sync/SyncNotify.cpp +14 -5
- data/platform/shared/sync/SyncNotify.h +2 -2
- data/platform/shared/sync/SyncSource.cpp +79 -33
- data/platform/shared/sync/SyncSource.h +1 -0
- data/platform/shared/sync/SyncThread.cpp +26 -11
- data/platform/shared/xruby/src/com/xruby/compiler/codedom/StringExpression.java +4 -2
- data/platform/wm/RhoLib/RhoLib.vcproj +108 -72
- data/platform/wm/build/wm.rake +6 -0
- data/platform/wm/rhodes/Alert.cpp +4 -3
- data/platform/wm/rhodes/Alert.h +1 -1
- data/platform/wm/rhodes/DateTimePicker.cpp +30 -3
- data/platform/wm/rhodes/DateTimePicker.h +9 -1
- data/platform/wm/rhodes/MainWindow.cpp +121 -61
- data/platform/wm/rhodes/MainWindow.h +29 -4
- data/platform/wm/rhodes/MapView/Graphics.cpp +547 -0
- data/platform/wm/rhodes/MapView/Graphics.h +136 -0
- data/platform/wm/rhodes/MapView/MapViewManager.cpp +391 -0
- data/platform/wm/rhodes/MapView/MapViewManager.h +158 -0
- data/platform/wm/rhodes/RhoCryptImpl.cpp +248 -0
- data/platform/wm/rhodes/RhoCryptImpl.h +51 -0
- data/platform/wm/rhodes/RhoNativeViewManager.cpp +208 -0
- data/platform/wm/rhodes/Rhodes.cpp +94 -102
- data/platform/wm/rhodes/Rhodes.rc +27 -0
- data/platform/wm/rhodes/SyncStatusDlg.cpp +1 -0
- data/platform/wm/rhodes/SyncStatusDlg.h +2 -1
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +7 -4
- data/platform/wm/rhodes/camera/Camera.cpp +36 -15
- data/platform/wm/rhodes/camera/Camera.h +0 -4
- data/platform/wm/rhodes/resource.h +10 -2
- data/platform/wm/rhodes/rho/common/RhoClassFactory.cpp +7 -0
- data/platform/wm/rhodes/rho/common/RhoClassFactory.h +1 -0
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +10 -2
- data/platform/wm/rhodes/rho/net/NetRequestImpl.h +10 -0
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +513 -0
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.h +74 -0
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +22 -10
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +5 -0
- data/platform/wm/rhodes/rhodes.vcproj +38 -2
- data/platform/wm/rhodes/stdafx.h +2 -1
- data/platform/wm/rubylib/rubylib.vcproj +12 -0
- data/rakefile.rb +85 -80
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +14 -3
- data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
- data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +2 -0
- data/res/build-tools/xruby-0.3.3.jar +0 -0
- data/res/generators/templates/application/app/application.rb +2 -2
- data/res/generators/templates/application/app/helpers/application_helper.rb +1 -1
- data/res/generators/templates/application/public/css/android.css +1 -0
- data/res/generators/templates/application/public/jqtouch/jquery.1.3.2.min.js +1 -1
- data/res/generators/templates/application/rhoconfig.txt +66 -14
- data/rhodes.gemspec +3 -3
- data/spec/framework_spec/app/spec/core/file/expand_path_spec.rb +7 -3
- data/spec/framework_spec/build.yml +1 -1
- data/spec/phone_spec/Rakefile +1 -0
- data/spec/phone_spec/app/Account/account.rb +2 -0
- data/spec/phone_spec/app/Account_s/account_s.rb +7 -0
- data/spec/phone_spec/app/spec/{fixtures → array/fixtures}/classes.rb +0 -0
- data/spec/phone_spec/app/spec/{array_pack_spec.rb → array/pack_spec.rb} +2 -1
- data/spec/phone_spec/app/spec/bulksync_spec.rb +1 -0
- data/spec/phone_spec/app/spec/contacts_spec.rb +2 -0
- data/spec/phone_spec/app/spec/rho_spec.rb +34 -233
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +396 -87
- data/spec/phone_spec/app/spec/string/element_set_spec.rb +251 -0
- data/spec/phone_spec/app/spec/string/end_with_spec.rb +49 -0
- data/spec/phone_spec/app/spec/string/fixtures/classes.rb +27 -0
- data/spec/phone_spec/app/spec/{lstrip_spec.rb → string/lstrip_spec.rb} +0 -0
- data/spec/phone_spec/app/spec/string/replace_spec.rb +52 -0
- data/spec/phone_spec/app/spec/{rstrip_spec.rb → string/rstrip_spec.rb} +0 -0
- data/spec/phone_spec/app/spec/string/slice_spec.rb +473 -0
- data/spec/phone_spec/app/spec/string/split_spec.rb +302 -0
- data/spec/phone_spec/app/spec/string/start_with_spec.rb +48 -0
- data/spec/phone_spec/app/spec/{strip_spec.rb → string/strip_spec.rb} +0 -0
- data/spec/phone_spec/app/spec/syncengine_spec.rb +30 -1
- data/spec/phone_spec/app/spec_runner.rb +15 -7
- data/spec/phone_spec/build.yml +2 -2
- metadata +154 -25
- data/README.textile +0 -45
- data/platform/android/Rhodes/AndroidManifest.full.xml +0 -62
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/Manifest.java +0 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoActivity.java +0 -20
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +0 -193
- data/platform/bb/Hsqldb/src/com/rho/file/FileAccessBB.java +0 -25
- data/platform/bb/RubyVM/src/com/rho/AppBuildConfig.java +0 -22
- data/platform/bb/RubyVM/src/com/rho/Capabilities.java +0 -6
- data/platform/bb/RubyVM/src/com/rho/Extensions.java +0 -11
- data/platform/iphone/Classes/RhoNativeViewManager.mm +0 -226
data/doc/rhom.txt
ADDED
@@ -0,0 +1,826 @@
|
|
1
|
+
# Using the Local Database with Rhom
|
2
|
+
|
3
|
+
Rhom is a mini database object mapper for Rhodes. It provides a high level interface to make it very powerful and simple to use a local database. That database is SQLite on all platforms except BlackBerry where it is HSQLDB.
|
4
|
+
|
5
|
+
Rhom currently supports two model types: ***Property Bag (default)*** and ***Fixed Schema***
|
6
|
+
|
7
|
+
## Property Bag
|
8
|
+
With a property bag model, all data is stored in a single table using the object-attribute-value pattern also referred to as the [Entity-attribute-value model](http://en.wikipedia.org/wiki/Entity-attribute-value_model).
|
9
|
+
|
10
|
+
### Property Bag Advantages
|
11
|
+
* Simple to use, it doesn't require specifying attributes.
|
12
|
+
* Data migrations are not necessary.
|
13
|
+
* Attributes can be added or removed without modifying the database schema.
|
14
|
+
|
15
|
+
### Property Bag Disadvantages
|
16
|
+
* For some applications, the database size may be significantly larger than fixed schema. This is because each attribute is indexed for fast lookup.
|
17
|
+
* Sync process may be slightly slower because inserts are performed at attribute level.
|
18
|
+
|
19
|
+
In a property bag model, Rhom groups objects by their source id and object id. The following example illustrates this idea:
|
20
|
+
|
21
|
+
<pre>
|
22
|
+
Source ID: 1, Model Name: Account
|
23
|
+
+-----------+----------+--------------+----------------------+
|
24
|
+
| source_id | attrib | object | value |
|
25
|
+
+-----------+----------+--------------+------- --------------+
|
26
|
+
| 1 | name | 48f39f63741b | A.G. Parr PLC 37862 |
|
27
|
+
| 1 | industry | 48f39f63741b | Entertainment |
|
28
|
+
| 1 | name | 48f39f230529 | Jones Group |
|
29
|
+
| 1 | industry | 48f39f230529 | Sales |
|
30
|
+
+-----------+----------+--------------+----------------------+
|
31
|
+
</pre>
|
32
|
+
|
33
|
+
Here, Rhom will expose a class `Account` with two attributes: `name` and `industry`
|
34
|
+
|
35
|
+
:::ruby
|
36
|
+
account = Account.find('48f39f63741b')
|
37
|
+
account.name
|
38
|
+
#=> "A.G. Parr PLC 37862"
|
39
|
+
|
40
|
+
account.industry
|
41
|
+
#=> "Entertainment"
|
42
|
+
|
43
|
+
### Using Property Bag Models
|
44
|
+
To use a property bag model, simply generate a new model with some attributes:
|
45
|
+
|
46
|
+
:::term
|
47
|
+
$ rhodes model product name,brand,price,quantity,sku
|
48
|
+
|
49
|
+
This will generate a file called `product.rb` which looks like:
|
50
|
+
|
51
|
+
:::ruby
|
52
|
+
class Product
|
53
|
+
include Rhom::PropertyBag
|
54
|
+
|
55
|
+
# Uncomment the following line to enable sync with Product.
|
56
|
+
# enable :sync
|
57
|
+
|
58
|
+
#add model specifc code here
|
59
|
+
end
|
60
|
+
|
61
|
+
There are several features you can enable or disable in the model, below is a complete list:
|
62
|
+
|
63
|
+
:::ruby
|
64
|
+
class SomeModel
|
65
|
+
include Rhom::PropertyBag
|
66
|
+
|
67
|
+
# rhosync settings
|
68
|
+
# Enable sync for this model.
|
69
|
+
# Default is disabled.
|
70
|
+
enable :sync
|
71
|
+
|
72
|
+
# Set the type of sync this model
|
73
|
+
# will use (default :incrmental).
|
74
|
+
# Set to :bulk_only to disable incremental
|
75
|
+
# sync and only use bulk sync.
|
76
|
+
set :sync_type, :bulk_only
|
77
|
+
|
78
|
+
# Set the sync priority for this model.
|
79
|
+
# 1000 is default, set to lower number
|
80
|
+
# for a higher priority.
|
81
|
+
set :sync_priority, 1
|
82
|
+
|
83
|
+
# Instruct Rhom to send all attributes
|
84
|
+
# to RhoSync when an object is updated.
|
85
|
+
# Default is disabled, only changed attributes
|
86
|
+
# are sent.
|
87
|
+
enable :full_update
|
88
|
+
|
89
|
+
|
90
|
+
# model settings
|
91
|
+
|
92
|
+
# Define how data is partitioned for this model.
|
93
|
+
# For synced models default is :user.
|
94
|
+
# For non-synced models default is :local
|
95
|
+
# If you have an :app partition
|
96
|
+
# for your RhoSync source adapter and use bulk sync,
|
97
|
+
# set this to :app also.
|
98
|
+
set :partition, :app
|
99
|
+
|
100
|
+
# Define blob attributes for the model.
|
101
|
+
# :blob Declare property as a blob type
|
102
|
+
#
|
103
|
+
# :overwrite (optional) Overwrite client copy
|
104
|
+
# of blob with new copy from server.
|
105
|
+
# This is useful when RhoSync modifies
|
106
|
+
# images sent from Rhodes, for example
|
107
|
+
# zooming or cropping.
|
108
|
+
property :image_url, :blob, :overwrite
|
109
|
+
|
110
|
+
# You can define your own properties also
|
111
|
+
property :mycustomproperty, 'hello'
|
112
|
+
end
|
113
|
+
|
114
|
+
## Fixed Schema
|
115
|
+
With a fixed schema model, each model has a separate database table and each attribute exists as a column in the table. In this sense, fixed schema models are similar to traditional relational tables.
|
116
|
+
|
117
|
+
### Fixed Schema Advantages
|
118
|
+
* Smaller database size, indexes can be specified only on specific attributes.
|
119
|
+
* Sync process may perform faster because whole objects are inserted at a time.
|
120
|
+
|
121
|
+
### Fixed Schema Disadvantages
|
122
|
+
* Schema changes must be handled with data migrations.
|
123
|
+
* Database performance may be slow unless you specify proper indexes.
|
124
|
+
|
125
|
+
### Using Fixed Schema Models
|
126
|
+
Using a fixed schema model involves an additional step to using a property bag model.
|
127
|
+
|
128
|
+
First, generate the model using the `rhodes` command:
|
129
|
+
|
130
|
+
:::term
|
131
|
+
$ rhodes model product name,brand,price,quantity,sku
|
132
|
+
|
133
|
+
Next, change the include statement in `product.rb` to `include Rhom::FixedSchema` and add the attributes:
|
134
|
+
|
135
|
+
:::ruby
|
136
|
+
class Product
|
137
|
+
include Rhom::FixedSchema
|
138
|
+
|
139
|
+
# Uncomment the following line to enable sync with Product.
|
140
|
+
# enable :sync
|
141
|
+
|
142
|
+
property :name, :string
|
143
|
+
property :brand, :string
|
144
|
+
property :price, :string
|
145
|
+
property :quantity, :string
|
146
|
+
property :sku, :string
|
147
|
+
end
|
148
|
+
|
149
|
+
That's it! Now your model is a fixed schema model, the table will be generated automatically for you when the application launches.
|
150
|
+
|
151
|
+
Below is a full list of options available to fixed schema models:
|
152
|
+
|
153
|
+
:::ruby
|
154
|
+
class SomeModel
|
155
|
+
include Rhom::FixedSchema
|
156
|
+
|
157
|
+
# rhosync settings
|
158
|
+
# Enable sync for this model.
|
159
|
+
# Default is disabled.
|
160
|
+
enable :sync
|
161
|
+
|
162
|
+
# Set the type of sync this model
|
163
|
+
# will use (default :incrmental).
|
164
|
+
# Set to :bulk_only to disable incremental
|
165
|
+
# sync and only use bulk sync.
|
166
|
+
set :sync_type, :bulk_only
|
167
|
+
|
168
|
+
# Set the sync priority for this model.
|
169
|
+
# 1000 is default, set to lower number
|
170
|
+
# for a higher priority.
|
171
|
+
set :sync_priority, 1
|
172
|
+
|
173
|
+
# Instruct Rhom to send all attributes
|
174
|
+
# to RhoSync when an object is updated.
|
175
|
+
# Default is disabled, only changed attributes
|
176
|
+
# are sent.
|
177
|
+
enable :full_update
|
178
|
+
|
179
|
+
|
180
|
+
# model settings
|
181
|
+
|
182
|
+
# Define how data is partitioned for this model.
|
183
|
+
# Default is :user. If you have an :app partition
|
184
|
+
# for your RhoSync source adapter and use bulk sync,
|
185
|
+
# set this to :app also.
|
186
|
+
set :partition, :app
|
187
|
+
|
188
|
+
# Set the current version of the fixed schema.
|
189
|
+
# Your application may use it for data migrations.
|
190
|
+
set :schema_version, '1.0'
|
191
|
+
|
192
|
+
# Define fixed schema attributes.
|
193
|
+
# :string and :blob types are supported.
|
194
|
+
property :name, :string
|
195
|
+
property :tag, :string
|
196
|
+
property :phone, :string
|
197
|
+
property :image_url, :blob
|
198
|
+
|
199
|
+
# Define a named index on a set of attributes.
|
200
|
+
# For example, this will create index for name and tag columns.
|
201
|
+
index :by_name_tag, [:name, :tag]
|
202
|
+
|
203
|
+
# Define a unique named index on a set of attributes.
|
204
|
+
# For example, this will create unique index for the phone column.
|
205
|
+
unique_index :by_phone, [:phone]
|
206
|
+
|
207
|
+
# Define blob attributes for the model.
|
208
|
+
# :blob Declare property as a blob type
|
209
|
+
#
|
210
|
+
# :overwrite (optional) Overwrite client copy
|
211
|
+
# of blob with new copy from server.
|
212
|
+
# This is useful when RhoSync modifies
|
213
|
+
# images sent from Rhodes, for example
|
214
|
+
# zooming or cropping.
|
215
|
+
property :image_url, :blob, :overwrite
|
216
|
+
|
217
|
+
# You can define your own properties also
|
218
|
+
property :mycustomproperty, 'hello'
|
219
|
+
end
|
220
|
+
|
221
|
+
### Fixed Schema Data Migrations
|
222
|
+
When the application starts the first time after an update, the database will be (re)created if the `app_db_version` in `rhoconfig.txt` is different from what existed before. If the database is recreated, the existing database is removed along with all data.
|
223
|
+
|
224
|
+
For this scenario, Rhom provides an application hook to migrate the data manually, overriding the default behavior which deletes the data. You can also use this hook to run business logic related to updating the database. For example, your application may want to display a customized alert notifying the user that a migration is in progress and it may take a few moments.
|
225
|
+
|
226
|
+
To use this hook, first we need to track the `:schema_version` in our model:
|
227
|
+
|
228
|
+
:::ruby
|
229
|
+
class Product
|
230
|
+
include Rhom::FixedSchema
|
231
|
+
|
232
|
+
set :schema_version, '1.1'
|
233
|
+
end
|
234
|
+
|
235
|
+
Next, we will implement the following hook in our `application.rb` class:
|
236
|
+
|
237
|
+
#### `on_migrate_source(old_version, new_src)`
|
238
|
+
This is called on application start when `:schema_version` has changed.
|
239
|
+
|
240
|
+
:::ruby
|
241
|
+
class AppApplication < Rho::RhoApplication
|
242
|
+
|
243
|
+
# old_version String containing old version value (i.e. '1.0')
|
244
|
+
# new_src Hash with source information:
|
245
|
+
# 'schema_version', 'name', 'schema'
|
246
|
+
# new_src['schema']['sql'] contains new schema sql
|
247
|
+
def on_migrate_source(old_version, new_src)
|
248
|
+
# ... do something like alert user ...
|
249
|
+
super
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
To let Rhom automatically delete the table and replace the schema:
|
254
|
+
|
255
|
+
:::ruby
|
256
|
+
def on_migrate_source(old_version, new_src)
|
257
|
+
# ... do something like alert user ...
|
258
|
+
super
|
259
|
+
end
|
260
|
+
|
261
|
+
Return `false` to run the custom sql specified by the new_src['schema']['sql'] string:
|
262
|
+
|
263
|
+
:::ruby
|
264
|
+
def on_migrate_source(old_version, new_src)
|
265
|
+
# ... do something like alert user ...
|
266
|
+
false
|
267
|
+
end
|
268
|
+
|
269
|
+
|
270
|
+
## Rhom API
|
271
|
+
Below is the full list of methods available to Rhom models:
|
272
|
+
|
273
|
+
### `clear_notification`
|
274
|
+
Used to clear the notification for the object, see the [sync notification section](/rhodes/synchronization#notifications) for more details.
|
275
|
+
|
276
|
+
### `delete_all(conditions)`
|
277
|
+
Deletes all rhom objects for a source, optionally filtering by conditions:
|
278
|
+
|
279
|
+
:::ruby
|
280
|
+
# :conditions Delete only objects matching these criteria.
|
281
|
+
# Supports find() conditions.
|
282
|
+
# :op See advanced find syntax
|
283
|
+
Account.delete_all(:conditions => {'industry'=>'electronics'})
|
284
|
+
|
285
|
+
### `destroy`
|
286
|
+
Delete a rhom object.
|
287
|
+
|
288
|
+
:::ruby
|
289
|
+
@account = Account.find(:all).first
|
290
|
+
@account.destroy
|
291
|
+
|
292
|
+
### `find(*args)`
|
293
|
+
Returns rhom object(s) based on the following arguments:
|
294
|
+
|
295
|
+
:::ruby
|
296
|
+
# :all returns all objects w/ optional conditions
|
297
|
+
#
|
298
|
+
# :first returns first object matching conditions
|
299
|
+
#
|
300
|
+
# :count returns number of objects matching conditions
|
301
|
+
#
|
302
|
+
# :conditions (optional) hash of attribute/values to match
|
303
|
+
# supports sql fragment(i.e. "name like 'rhomobile')
|
304
|
+
# or sql fragment with binding (you have to define :select with sql queries)
|
305
|
+
# (i.e. ["name like ?", "'#{company#}'"])
|
306
|
+
# Note: use single comma around string values
|
307
|
+
#
|
308
|
+
# :order (optional) attribute(s) to order the list
|
309
|
+
#
|
310
|
+
# :orderdir (optional) order direction('ASC' (default), 'DESC' )
|
311
|
+
#
|
312
|
+
# :select (optional) array of string attributes to return
|
313
|
+
# with the object. This is useful if your model
|
314
|
+
# has a lot of attributes but your query only needs
|
315
|
+
# a few of them.
|
316
|
+
#
|
317
|
+
# :per_page (optional) maximum number of items return
|
318
|
+
#
|
319
|
+
# :offset (optional) offset from beginning of the list
|
320
|
+
|
321
|
+
acct = Account.find "3560c0a0-ef58-2f40-68a5-48f39f63741b"
|
322
|
+
|
323
|
+
acct.name
|
324
|
+
#=> "A.G. Parr PLC 37862"
|
325
|
+
|
326
|
+
accts = Account.find(:all, :select => ['name','address'])
|
327
|
+
|
328
|
+
accts[0].name
|
329
|
+
#=> "A.G. Parr PLC 37862"
|
330
|
+
|
331
|
+
accts[0].telephone
|
332
|
+
#=> nil
|
333
|
+
|
334
|
+
**NOTE: Use SQL fragments with caution. They are considerably slower than advanced queries [described below](/rhodes/rhom#advanced-queries). You also have to specify :select parameter.**
|
335
|
+
|
336
|
+
#### Order Examples
|
337
|
+
The `:order` argument accepts several forms:
|
338
|
+
|
339
|
+
* `:order` by one attribute:
|
340
|
+
|
341
|
+
:::ruby
|
342
|
+
@accts = Account.find(
|
343
|
+
:all,
|
344
|
+
:order => 'name',
|
345
|
+
:orderdir => 'DESC'
|
346
|
+
)
|
347
|
+
|
348
|
+
* `:order` by one attribute with a block:
|
349
|
+
|
350
|
+
:::ruby
|
351
|
+
@accts = Account.find(:all, :order => 'name') do |x,y|
|
352
|
+
y <=> x
|
353
|
+
end
|
354
|
+
|
355
|
+
* `:order` with a block:
|
356
|
+
|
357
|
+
:::ruby
|
358
|
+
@accts = Account.find(:all) do |item1,item2|
|
359
|
+
item2.name <=> item1.name
|
360
|
+
end
|
361
|
+
|
362
|
+
* `:order` by multiple attributes:
|
363
|
+
|
364
|
+
:::ruby
|
365
|
+
@accts = Account.find(
|
366
|
+
:all,
|
367
|
+
:order => ['name', 'industry'],
|
368
|
+
:orderdir => ['ASC', 'DESC']
|
369
|
+
)
|
370
|
+
|
371
|
+
### `find_all(*args)`
|
372
|
+
Alias for find(:all,*args).
|
373
|
+
|
374
|
+
### `new(attributes = nil)`
|
375
|
+
Creates a new rhom object and assigns given attributes, or initializes an empty rhom object.
|
376
|
+
|
377
|
+
:::ruby
|
378
|
+
@account = Account.new(
|
379
|
+
{"name" => "ABC Inc.","address" => "555 5th St."}
|
380
|
+
)
|
381
|
+
@account.name
|
382
|
+
#=> "ABC Inc."
|
383
|
+
|
384
|
+
### `create(attributes)`
|
385
|
+
Creates a new rhom object and saves to the database.
|
386
|
+
|
387
|
+
**NOTE: This is the fastest way to insert a single item into the database.**
|
388
|
+
|
389
|
+
:::ruby
|
390
|
+
@account = Account.create(
|
391
|
+
{"name" => "some new record", "industry" => "electronics"}
|
392
|
+
)
|
393
|
+
|
394
|
+
### `paginate(*args)`
|
395
|
+
Calls `find` with a limit on the # of records. This emulates rails' classic pagination syntax. Default page size is 10.
|
396
|
+
|
397
|
+
:::ruby
|
398
|
+
# :page which page to return, used as offset
|
399
|
+
# in combination with :per_page
|
400
|
+
#
|
401
|
+
# :per_page number of records to return (used as limit)
|
402
|
+
#
|
403
|
+
# :conditions same as find with :conditions
|
404
|
+
#
|
405
|
+
# :order same as find with :order
|
406
|
+
#
|
407
|
+
# :select same as find with :select
|
408
|
+
|
409
|
+
Account.paginate(:page => 0)
|
410
|
+
#=> returns first 10 records
|
411
|
+
Account.paginate(:page => 1, :per_page => 20)
|
412
|
+
#=> returns records 21-40
|
413
|
+
Account.paginate(
|
414
|
+
:page => 5,
|
415
|
+
:conditions => {'industry' => 'Technology'},
|
416
|
+
:order => 'name'
|
417
|
+
) #=> you can have :conditions and :order as well
|
418
|
+
|
419
|
+
### `sync(callback = nil, callback_data = "", show_status_popup = nil)`
|
420
|
+
Start the sync process for a model. If the callback is set, `SyncEngine.set_notification` is called before `SyncEngine.dosync`.
|
421
|
+
|
422
|
+
:::ruby
|
423
|
+
Account.sync( url_for(:action => :sync_callback) )
|
424
|
+
|
425
|
+
### `set_notification(url, params = nil)`
|
426
|
+
Set a notification to be called when the sync is complete for this model. This is useful for example if you want to refresh the current list page or display an alert when new data is synchronized. See the [sync notification docs](/rhodes/synchronization#notifications) for more information.
|
427
|
+
|
428
|
+
:::ruby
|
429
|
+
Account.set_notification( url_for(:action => :sync_notify) )
|
430
|
+
|
431
|
+
### `update_attributes(attributes)`
|
432
|
+
Updates the current rhom object's attributes and saves it to the database
|
433
|
+
|
434
|
+
**NOTE: This is the fastest way to add or update item attributes.**
|
435
|
+
|
436
|
+
:::ruby
|
437
|
+
@account = Account.find(
|
438
|
+
:all,
|
439
|
+
:conditions => {'name' => 'ABC Inc.'}
|
440
|
+
)
|
441
|
+
@account.update_attributes(
|
442
|
+
{"name" => "ABC Inc.", "industry" => "Technology"}
|
443
|
+
)
|
444
|
+
@account.industry
|
445
|
+
#=> "Technology"
|
446
|
+
|
447
|
+
### `save`
|
448
|
+
Saves the current rhom object to the database.
|
449
|
+
|
450
|
+
:::ruby
|
451
|
+
@account = Account.new(
|
452
|
+
{"name" => "some new record", "industry" => "electronics"}
|
453
|
+
)
|
454
|
+
@account.save
|
455
|
+
|
456
|
+
### `can_modify`
|
457
|
+
Before displaying an edit page for an object, your application can check if the object is currently being accessed by the sync process. If it is, you should disable editing of the object. `can_modify` could return true, for example, on a new local record that was created and sent to the RhoSync application, but no response has been received yet.
|
458
|
+
|
459
|
+
:::ruby
|
460
|
+
def edit
|
461
|
+
@product = Product.find(@params['id'])
|
462
|
+
if @product && !@product.can_modify
|
463
|
+
render :action => :show_edit_error
|
464
|
+
else
|
465
|
+
render :action => :edit
|
466
|
+
end
|
467
|
+
end
|
468
|
+
|
469
|
+
### `changed?`
|
470
|
+
Determine if a rhom model has local database changes that need to be synchronized.
|
471
|
+
|
472
|
+
:::ruby
|
473
|
+
def should_sync_product_object
|
474
|
+
if Product.changed?
|
475
|
+
#... do stuff ...
|
476
|
+
end
|
477
|
+
end
|
478
|
+
|
479
|
+
## Associations
|
480
|
+
For sync-enabled models, Rhom offers associations as a means to automatically trigger sync updates for dependent objects. This is useful where you have relationships between backend service objects.
|
481
|
+
|
482
|
+
For example, you can have a list of customers who have purchased a product:
|
483
|
+
|
484
|
+
:::ruby
|
485
|
+
class Customer
|
486
|
+
include Rhom::PropertyBag
|
487
|
+
|
488
|
+
# Declare container model and attribute.
|
489
|
+
belongs_to :product_id, 'Product'
|
490
|
+
end
|
491
|
+
|
492
|
+
In your `product_controller.rb`, assign the `:belongs_to` attribute when a product is created:
|
493
|
+
|
494
|
+
:::ruby
|
495
|
+
def create
|
496
|
+
@product = Product.new(@params['product'])
|
497
|
+
@product.save
|
498
|
+
|
499
|
+
cust = Customer.find(:first) # find the customer
|
500
|
+
cust.product_id = @product.object
|
501
|
+
cust.save
|
502
|
+
redirect :action => :index
|
503
|
+
end
|
504
|
+
|
505
|
+
You can also define polymorphic associations, or associations across multiple classes.
|
506
|
+
|
507
|
+
Using array notation:
|
508
|
+
|
509
|
+
:::ruby
|
510
|
+
belongs_to :parent_id, ['Product', 'Cases']
|
511
|
+
|
512
|
+
Or multiple declarations:
|
513
|
+
|
514
|
+
:::ruby
|
515
|
+
belongs_to :parent_id, 'Product'
|
516
|
+
belongs_to :parent_id, 'Cases'
|
517
|
+
|
518
|
+
|
519
|
+
**NOTE: After a new product is created, the `:product_id` for the `Customer` records will be updated to the new value.**
|
520
|
+
|
521
|
+
|
522
|
+
## Accessing Sync Info with RhomSource
|
523
|
+
Rhom exposes sync information as a `RhomSource` object. You can use this information for alerts, status pages, etc.
|
524
|
+
|
525
|
+
To access a RhomSource, load it by id:
|
526
|
+
|
527
|
+
:::ruby
|
528
|
+
@source = RhomSource.find(@params['id'])
|
529
|
+
|
530
|
+
Here are the available statistics:
|
531
|
+
|
532
|
+
### `source_id`
|
533
|
+
Returns the id of a source.
|
534
|
+
|
535
|
+
:::ruby
|
536
|
+
@source.source_id
|
537
|
+
#=> 1
|
538
|
+
|
539
|
+
### `name`
|
540
|
+
Name of the source.
|
541
|
+
|
542
|
+
:::ruby
|
543
|
+
@source.name
|
544
|
+
#=> "Product"
|
545
|
+
|
546
|
+
### `last_updated`
|
547
|
+
Last time the source was synchronzied (in `Time.at` format).
|
548
|
+
|
549
|
+
:::ruby
|
550
|
+
@source.last_updated.to_s
|
551
|
+
#=> "Wed Jan 19 18:35:05 -0800 2011"
|
552
|
+
|
553
|
+
For example, to show the formatted time for the `Product` model:
|
554
|
+
|
555
|
+
:::ruby
|
556
|
+
RhomSource.find(
|
557
|
+
Product.get_source_id
|
558
|
+
).last_updated.strftime("%m/%d/%Y, %I:%M%p")
|
559
|
+
#=> "01/19/2011, 06:40PM"
|
560
|
+
|
561
|
+
### `last_inserted_size`
|
562
|
+
Number of records inserted on last sync.
|
563
|
+
|
564
|
+
:::ruby
|
565
|
+
@source.last_inserted_size
|
566
|
+
#=> 3
|
567
|
+
|
568
|
+
### `last_deleted_size`
|
569
|
+
Number of records deleted on last sync.
|
570
|
+
|
571
|
+
:::ruby
|
572
|
+
@source.last_deleted_size
|
573
|
+
#=> 1
|
574
|
+
|
575
|
+
### `last_sync_duration`
|
576
|
+
This returns the duration in seconds of the last sync for this source.
|
577
|
+
|
578
|
+
:::ruby
|
579
|
+
@source.last_sync_duration
|
580
|
+
#=> 7
|
581
|
+
### `last_sync_success`
|
582
|
+
Returns 1 if last sync was successful, 0 if it failed.
|
583
|
+
|
584
|
+
:::ruby
|
585
|
+
@source.last_sync_success
|
586
|
+
#=> 1
|
587
|
+
|
588
|
+
### `distinct_object`
|
589
|
+
Number of records for this source.
|
590
|
+
|
591
|
+
:::ruby
|
592
|
+
@source.distinct_object
|
593
|
+
#=> 837
|
594
|
+
|
595
|
+
## Resetting the Database
|
596
|
+
Rhodes provides the following functions for recovering the database from a bad or corrupt state, or if the RhoSync server returns errors.
|
597
|
+
|
598
|
+
### `Rhom::Rhom.database_full_reset(reset_client_info=false, reset_local_models=true)`
|
599
|
+
Deletes all records from the property bag and model tables.
|
600
|
+
|
601
|
+
:::ruby
|
602
|
+
# reset_client_info If set to true, client_info
|
603
|
+
# table will be cleaned.
|
604
|
+
#
|
605
|
+
# reset_local_models If set to true, local(non-synced models)
|
606
|
+
# will be cleaned.
|
607
|
+
Rhom::Rhom.database_full_reset(false,true)
|
608
|
+
|
609
|
+
### `Rhom::Rhom.database_full_reset_and_logout`
|
610
|
+
Perform a full reset and then logout the RhoSync client.
|
611
|
+
|
612
|
+
:::ruby
|
613
|
+
Rhom::Rhom.database_full_reset_and_logout
|
614
|
+
|
615
|
+
### `Rhom::Rhom.database_fullclient_reset_and_logout`
|
616
|
+
Equivalent to `Rhom::Rhom.database_full_reset(true)` followed by `SyncEngine.logout`.
|
617
|
+
|
618
|
+
:::ruby
|
619
|
+
Rhom::Rhom.database_fullclient_reset_and_logout
|
620
|
+
|
621
|
+
**NOTE: If you receive a sync error "Unknown client" message in your sync callback, this means that the RhoSync server no longer knows about the client and a `Rhom::Rhom.database_fullclient_reset_and_logout` is recommended. This error requires proper intervention in your app so you can handle the state before resetting the client. For example, your sync notification could contain the following:**
|
622
|
+
|
623
|
+
:::ruby
|
624
|
+
if @params['error_message'].downcase == 'unknown client'
|
625
|
+
puts "Received unknown client, resetting!"
|
626
|
+
Rhom::Rhom.database_fullclient_reset_and_logout
|
627
|
+
end
|
628
|
+
|
629
|
+
### `Rhom::Rhom.database_local_reset`
|
630
|
+
Reset only local(non-sync-enabled) models.
|
631
|
+
|
632
|
+
:::ruby
|
633
|
+
Rhom::Rhom.database_local_reset
|
634
|
+
|
635
|
+
## Seeding the Database
|
636
|
+
If your application requires seeding some initial data, you can use the following function:
|
637
|
+
|
638
|
+
### `Rho::RhoUtils.load_offline_data(table_array, seed_prefix_directory)`
|
639
|
+
|
640
|
+
:::ruby
|
641
|
+
# table_array Array containing table names
|
642
|
+
# corresponding to pipe-delimited files.
|
643
|
+
#
|
644
|
+
# seed_prefix_directory Relative path to directory containing
|
645
|
+
# a 'fixtures' directory of files.
|
646
|
+
Rho::RhoUtils.load_offline_data(table_array, seed_prefix_directory)
|
647
|
+
|
648
|
+
|
649
|
+
For example, in the rhodes/spec/framework_spec, we use `load_offline_data` to seed the device database for each test:
|
650
|
+
|
651
|
+
:::ruby
|
652
|
+
Rho::RhoUtils.load_offline_data(
|
653
|
+
['client_info','object_values'], 'spec'
|
654
|
+
)
|
655
|
+
|
656
|
+
In this example, there is a 'spec/fixtures' directory which contains a `client_info.txt` and `object_values.txt` pipe-delimited files. These files are structured as follows:
|
657
|
+
|
658
|
+
`client_info.txt`:
|
659
|
+
<pre>
|
660
|
+
client_id|last_sync_success
|
661
|
+
67320d31-e42e-4156-af91-5d9bd7175b08|
|
662
|
+
</pre>
|
663
|
+
|
664
|
+
`object_values.txt`:
|
665
|
+
<pre>
|
666
|
+
source_name|attrib|object|value
|
667
|
+
Case|status|4900dc4c072c|New|
|
668
|
+
Case|assigned_user_id|4900dc4c072c|48fce5e9fb16|
|
669
|
+
Case|work_log|4900dc4c072c||
|
670
|
+
Case|priority|4900dc4c072c|High|
|
671
|
+
...
|
672
|
+
</pre>
|
673
|
+
|
674
|
+
**NOTE: The column names are always the first line of the file.**
|
675
|
+
|
676
|
+
## Advanced Queries
|
677
|
+
|
678
|
+
### `find(*args)` (advanced conditions)
|
679
|
+
Rhom also supports advanced find `:conditions`. Using advanced `:conditions`, rhom can optimize the query for the property bag table.
|
680
|
+
|
681
|
+
Let's say we have the following SQL fragment condition:
|
682
|
+
|
683
|
+
:::ruby
|
684
|
+
Product.find(
|
685
|
+
:all,
|
686
|
+
:conditions => [
|
687
|
+
"LOWER(description) like ? or LOWER(title) like ?",
|
688
|
+
query,
|
689
|
+
query
|
690
|
+
],
|
691
|
+
:select => ['title','description']
|
692
|
+
)
|
693
|
+
|
694
|
+
Using advanced `:conditions`, this becomes:
|
695
|
+
|
696
|
+
:::ruby
|
697
|
+
Product.find(
|
698
|
+
:all,
|
699
|
+
:conditions => {
|
700
|
+
{
|
701
|
+
:func => 'LOWER',
|
702
|
+
:name => 'description',
|
703
|
+
:op => 'LIKE'
|
704
|
+
} => query,
|
705
|
+
{
|
706
|
+
:func => 'LOWER',
|
707
|
+
:name => 'title',
|
708
|
+
:op => 'LIKE'
|
709
|
+
} => query
|
710
|
+
},
|
711
|
+
:op => 'OR',
|
712
|
+
:select => ['title','description']
|
713
|
+
)
|
714
|
+
|
715
|
+
You can also use the 'IN' operator:
|
716
|
+
|
717
|
+
:::ruby
|
718
|
+
Product.find(
|
719
|
+
:all,
|
720
|
+
:conditions => {
|
721
|
+
{
|
722
|
+
:name => "image_uri",
|
723
|
+
:op => "IN"
|
724
|
+
} => "'15704','15386'"
|
725
|
+
}
|
726
|
+
)
|
727
|
+
|
728
|
+
# or use array notation
|
729
|
+
Product.find(
|
730
|
+
:all,
|
731
|
+
:conditions => {
|
732
|
+
{
|
733
|
+
:name => "image_uri",
|
734
|
+
:op => "IN"
|
735
|
+
} => ["15704","15386"]
|
736
|
+
}
|
737
|
+
)
|
738
|
+
|
739
|
+
You can also group `:conditions`:
|
740
|
+
|
741
|
+
:::ruby
|
742
|
+
cond1 = {
|
743
|
+
:conditions => {
|
744
|
+
{
|
745
|
+
:func => 'UPPER',
|
746
|
+
:name => 'name',
|
747
|
+
:op => 'LIKE'
|
748
|
+
} => query,
|
749
|
+
{
|
750
|
+
:func => 'UPPER',
|
751
|
+
:name => 'industry',
|
752
|
+
:op => 'LIKE'
|
753
|
+
} => query
|
754
|
+
},
|
755
|
+
:op => 'OR'
|
756
|
+
}
|
757
|
+
|
758
|
+
cond2 = {
|
759
|
+
:conditions => {
|
760
|
+
{
|
761
|
+
:name => 'description',
|
762
|
+
:op => 'LIKE'
|
763
|
+
} => 'Hello%'
|
764
|
+
}
|
765
|
+
}
|
766
|
+
|
767
|
+
@accts = Account.find(
|
768
|
+
:all,
|
769
|
+
:conditions => [cond1, cond2],
|
770
|
+
:op => 'AND',
|
771
|
+
:select => ['name','industry','description']
|
772
|
+
)
|
773
|
+
|
774
|
+
## Database Encryption
|
775
|
+
If your application requires that the local database is encrypted on the filesystem, you can enable it by setting a flag in `build.yml`:
|
776
|
+
|
777
|
+
:::yaml
|
778
|
+
encrypt_database: 1
|
779
|
+
|
780
|
+
**NOTE: Database encryption is not supported for applications that use bulk sync at this time.**
|
781
|
+
|
782
|
+
### Platform Notes
|
783
|
+
* iOS: Uses AES 128 encryption algorithm from iOS SDK.
|
784
|
+
* Android: Uses AES 128 ecryption algorithm from Android SDK.
|
785
|
+
* Windows Mobile: Uses RC4 algorithm from Windows Mobile SDK.
|
786
|
+
|
787
|
+
### Blackberry Notes
|
788
|
+
* Blackberry JDE >= 5.0: Uses built-in encryption library for SQLite database.
|
789
|
+
|
790
|
+
**NOTE: Bulk sync is not supported in this mode.**
|
791
|
+
|
792
|
+
* Any Blackberry Version: The user can turn on memory encryption (device memory and sdcard), This policy can also can be enforced by the Blackberry enterprise server: <a href="http://docs.blackberry.com/en/admin/deliverables/3940/file_encryption_STO.pdf"/>
|
793
|
+
|
794
|
+
**NOTE: In this case you have to use HSQLDB even on Blackberry device OS >= 5.0, because SQLite does not encrypt database file. You can force Rhodes to use HSQLDB for all Blackberry OS versions by adding the following to `build.yml`:**
|
795
|
+
|
796
|
+
:::yaml
|
797
|
+
bb:
|
798
|
+
use_sqlite: 0
|
799
|
+
|
800
|
+
## Perfomance Tips
|
801
|
+
* Before test application for perfomance set warning log level in rhoconfig.txt(MUST set for Blackberry testing):
|
802
|
+
|
803
|
+
MinSeverity = 3
|
804
|
+
|
805
|
+
* All database modification operations can be slow, especially on big databases. So optimize object modification - prepare data and call create/update_attributes once
|
806
|
+
* Do not use sql conditions in Model.find, use Advanced Queries.
|
807
|
+
* Use Model.create to insert object to database
|
808
|
+
* Use update_attributes to add or modify object attributes
|
809
|
+
* To insert/update multiple object/models use database transaction
|
810
|
+
|
811
|
+
db = ::Rho::RHO.get_src_db('Model')
|
812
|
+
db.start_transaction
|
813
|
+
begin
|
814
|
+
items.each do |item|
|
815
|
+
# create hash of attribute/value pairs
|
816
|
+
data = {
|
817
|
+
:field1 => item['value1'],
|
818
|
+
:field2 => item['value2']
|
819
|
+
}
|
820
|
+
# Creates a new Model object and saves it
|
821
|
+
new_item = Model.create(data)
|
822
|
+
end
|
823
|
+
db.commit
|
824
|
+
rescue
|
825
|
+
db.rollback
|
826
|
+
end
|