rhodes 1.5.5 → 2.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/Manifest.txt +214 -32
- data/Rakefile +33 -10
- data/bin/upgrade-rhodes-app +0 -1
- data/lib/build/compileERB/bb.rb +2 -2
- data/lib/build/compileERB/default.rb +7 -5
- data/lib/build/jake.rb +1 -1
- data/lib/extensions/digest-md5/ext.yml +1 -1
- data/lib/extensions/digest-md5/ext/Rakefile +35 -36
- data/lib/extensions/digest-md5/ext/build.bat +1 -0
- data/lib/extensions/digest-md5/ext/digest-md5.vcproj +203 -0
- data/lib/extensions/digest-sha1/ext.yml +1 -1
- data/lib/extensions/digest/ext.yml +1 -1
- data/lib/extensions/digest/ext/Rakefile +35 -39
- data/lib/extensions/digest/ext/build.bat +1 -2
- data/lib/extensions/digest/ext/digest.vcproj +203 -0
- data/lib/framework/rho/render.rb +79 -22
- data/lib/framework/rho/rho.rb +294 -56
- data/lib/framework/rho/rhoapplication.rb +10 -0
- data/lib/framework/rho/rhofsconnector.rb +2 -6
- data/lib/framework/rho/rhoutils.rb +56 -14
- data/lib/framework/rho/rhoviewhelpers.rb +2 -0
- data/lib/framework/rhodes.rb +2 -2
- data/lib/framework/rhom/rhom.rb +42 -15
- data/lib/framework/rhom/rhom_db_adapter.rb +165 -159
- data/lib/framework/rhom/rhom_object.rb +0 -1
- data/lib/framework/rhom/rhom_object_factory.rb +343 -166
- data/lib/framework/rhom/rhom_source.rb +28 -15
- data/lib/framework/version.rb +2 -2
- data/lib/rhodes.rb +2 -2
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +39 -44
- data/platform/android/Rhodes/jni/include/JNIRhodes.h +1 -1
- data/platform/android/Rhodes/jni/include/details/rhojava.inc +23 -20
- data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_RhoMenu.h +61 -0
- data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_Rhodes.h +16 -0
- data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_alert_Alert.h +21 -0
- data/platform/android/Rhodes/jni/include/sslimpl.h +1 -1
- data/platform/android/Rhodes/jni/src/alert.cpp +32 -5
- data/platform/android/Rhodes/jni/src/callbacks.cpp +51 -21
- data/platform/android/Rhodes/jni/src/mapview.cpp +3 -8
- data/platform/android/Rhodes/jni/src/menu.cpp +70 -0
- data/platform/android/Rhodes/jni/src/navbar.cpp +16 -0
- data/platform/android/Rhodes/jni/src/rhodes.cpp +37 -0
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +3 -3
- data/platform/android/Rhodes/jni/src/webview.cpp +21 -7
- data/platform/android/Rhodes/res/drawable/alert_alert.png +0 -0
- data/platform/android/Rhodes/res/drawable/alert_info.png +0 -0
- data/platform/android/Rhodes/res/drawable/alert_question.png +0 -0
- data/platform/android/Rhodes/res/drawable/camera.png +0 -0
- data/platform/android/Rhodes/res/layout/camera.xml +18 -3
- data/platform/android/Rhodes/res/menu/options.xml +0 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +5 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +12 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +105 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +157 -122
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +7 -58
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +16 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +220 -17
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +22 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +44 -25
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +10 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +3 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +10 -21
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +15 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +44 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java +47 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +13 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/TelUriHandler.java +11 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/UriHandler.java +1 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/VideoUriHandler.java +61 -0
- data/platform/android/build/RhodesSRC_build.files +3 -0
- data/platform/android/build/android.rake +173 -60
- data/platform/android/build/androidcommon.rb +1 -2
- data/platform/android/build/librhocommon_build.files +5 -0
- data/platform/android/build/librhodes_build.files +2 -0
- data/platform/android/build/libruby_build.files +2 -1
- data/platform/bb/Hsqldb/Hsqldb.jdp +0 -3
- data/platform/bb/Hsqldb/src/com/rho/db/FileUtilBB.java +1 -1
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +16 -1
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBRowResult.java +5 -0
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +25 -4
- data/platform/bb/Hsqldb/src/com/rho/db/Journal.java +1 -1
- data/platform/bb/Hsqldb/src/com/rho/file/FileAccessBB.java +0 -1
- data/platform/bb/Hsqldb/src/j2me/math/Number.java +6 -3
- data/platform/bb/Hsqldb/src/org/hsqldb/CompiledStatementExecutor.java +2 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +1 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Parser.java +1 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Result.java +2 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Select.java +12 -6
- data/platform/bb/Hsqldb/src/org/hsqldb/Session.java +19 -12
- data/platform/bb/Hsqldb/src/org/hsqldb/Table.java +10 -4
- data/platform/bb/Hsqldb/src/org/hsqldb/Token.java +10 -2
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +3 -3
- data/platform/bb/Hsqldb/src/org/hsqldb/lib/java/JavaSystem.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/HsqlProperties.java +2 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/ScaledRAFile.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/scriptio/ScriptReaderText.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/scriptio/ScriptWriterBase.java +1 -1
- data/platform/bb/RubyVM/RubyVM.jdp +9 -10
- data/platform/bb/build/RubyVM_build.files +9 -7
- data/platform/bb/build/bb.rake +13 -3
- data/platform/bb/build/hsqldb_build.files +0 -2
- data/platform/bb/build/rhodes_build.files +5 -2
- data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +8 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +154 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/RhoMainScreen.java +8 -0
- data/platform/bb/rhodes/platform/common/com/rho/BrowserAdapter5.java +28 -0
- data/platform/bb/rhodes/rhodes.jdp +12 -7
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +331 -0
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +28 -0
- data/platform/bb/rhodes/src/com/rho/IBrowserAdapter.java +10 -0
- data/platform/bb/rhodes/src/com/rho/RhoMainScreen.java +4 -0
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +2 -4
- data/platform/bb/rhodes/src/com/rho/{Jsr75File.java → file/Jsr75File.java} +83 -36
- data/platform/bb/{Hsqldb → rhodes}/src/com/rho/file/Jsr75RAFileImpl.java +0 -1
- data/platform/bb/{Hsqldb → rhodes}/src/com/rho/file/PersistRAFileImpl.java +0 -2
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +8 -10
- data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +1 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +39 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +63 -2
- data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +100 -0
- data/platform/bb/rhodes/src/rhomobile/LogScreen.java +1 -1
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +13 -1
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +138 -492
- data/platform/bb/rhodes/src/rhomobile/SecondaryResourceFetchThread.java +11 -2
- data/platform/bb/rhodes/src/rhomobile/Utilities.java +14 -10
- data/platform/bb/rhodes/src/rhomobile/camera/CameraScreen.java +5 -14
- data/platform/bb/rhodes/src/rhomobile/camera/ImageBrowserScreen.java +1 -1
- data/platform/bb/rhodes/src/rhomobile/mapview/GoogleMapField.java +2 -2
- data/platform/iphone/Classes/AppManager/AppManager.m +37 -14
- data/platform/iphone/Classes/Camera/PickImageDelegate.h +15 -4
- data/platform/iphone/Classes/Camera/PickImageDelegate.m +53 -50
- data/platform/iphone/Classes/DateTimePicker.h +17 -0
- data/platform/iphone/Classes/DateTimePicker.m +35 -0
- data/platform/iphone/Classes/GeoLocation/LocationController.m +2 -3
- data/platform/iphone/Classes/LogOptionsController.m +3 -2
- data/platform/iphone/Classes/LogViewController.m +4 -2
- data/platform/iphone/Classes/MapView/GoogleGeocoder.m +12 -20
- data/platform/iphone/Classes/MapView/MapAnnotation.h +9 -13
- data/platform/iphone/Classes/MapView/MapAnnotation.m +17 -65
- data/platform/iphone/Classes/MapView/MapViewController.h +1 -7
- data/platform/iphone/Classes/MapView/MapViewController.m +51 -25
- data/platform/iphone/Classes/NativeBar.h +0 -12
- data/platform/iphone/Classes/NativeBar.m +121 -2
- data/platform/iphone/Classes/NavBar.h +16 -0
- data/platform/iphone/Classes/NavBar.m +115 -0
- data/platform/iphone/Classes/RhoAlert.h +19 -0
- data/platform/iphone/Classes/RhoAlert.m +258 -0
- data/platform/iphone/Classes/RhoDelegate.m +1 -0
- data/platform/iphone/Classes/RhoMainView.h +33 -0
- data/platform/iphone/Classes/Rhodes.h +56 -0
- data/platform/iphone/Classes/Rhodes.m +533 -0
- data/platform/iphone/Classes/RingtoneManager.h +17 -0
- data/platform/iphone/Classes/RingtoneManager.m +73 -0
- data/platform/iphone/Classes/SimpleMainView.h +30 -0
- data/platform/iphone/Classes/SimpleMainView.m +380 -0
- data/platform/iphone/Classes/TabbedMainView.h +24 -0
- data/platform/iphone/Classes/TabbedMainView.m +202 -0
- data/platform/iphone/Classes/WebView.m +123 -0
- data/platform/iphone/Classes/rho/net/NetRequestImpl.m +2 -2
- data/platform/iphone/Classes/rho/net/sslimpl.cpp +13 -1
- data/platform/iphone/Classes/rho/net/sslimpl.h +1 -1
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +44 -0
- data/platform/iphone/main.m +1 -2
- data/platform/iphone/rbuild/iphone.rake +8 -16
- data/platform/iphone/rhoextlib/dosyscall.c +1 -1
- data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +6 -4
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +12 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +97 -62
- data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +12 -0
- data/platform/osx/Rhodes Launcher/launch.rb +14 -21
- data/platform/shared/common/AppMenu.cpp +122 -0
- data/platform/shared/common/AppMenu.h +46 -0
- data/platform/shared/common/PosixThreadImpl.cpp +1 -1
- data/platform/shared/common/RhoConf.cpp +27 -2
- data/platform/shared/common/RhoConf.h +5 -0
- data/platform/shared/common/RhoFilePath.h +21 -0
- data/platform/shared/common/RhoStd.h +44 -5
- data/platform/shared/common/RhoTime.h +20 -7
- data/platform/shared/common/RhodesApp.cpp +236 -177
- data/platform/shared/common/RhodesApp.h +36 -13
- data/platform/shared/common/SplashScreen.cpp +2 -2
- data/platform/shared/common/StringConverter.h +10 -11
- data/platform/shared/common/rhoparams.c +0 -6
- data/platform/shared/curl/lib/rhossl.c +3 -2
- data/platform/shared/curl/lib/url.c +0 -5
- data/platform/shared/db/DBAdapter.cpp +304 -81
- data/platform/shared/db/DBAdapter.h +24 -7
- data/platform/shared/db/DBAttrManager.cpp +83 -30
- data/platform/shared/db/DBAttrManager.h +6 -0
- data/platform/shared/db/DBResult.h +15 -4
- data/platform/shared/json/JSONIterator.cpp +100 -3
- data/platform/shared/json/JSONIterator.h +28 -3
- data/platform/shared/net/AsyncHttp.cpp +25 -22
- data/platform/shared/net/AsyncHttp.h +10 -6
- data/platform/shared/net/CURLNetRequest.cpp +115 -36
- data/platform/shared/net/CURLNetRequest.h +6 -0
- data/platform/shared/net/HttpServer.cpp +6 -4
- data/platform/shared/net/HttpServer.h +0 -1
- data/platform/shared/net/INetRequest.h +19 -3
- data/platform/shared/net/URI.cpp +2 -2
- data/platform/shared/net/ssl.cpp +2 -2
- data/platform/shared/net/ssl.h +2 -2
- data/platform/shared/ruby/ext/alert/alert.i +14 -2
- data/platform/shared/ruby/ext/alert/alert_wrap.c +40 -20
- data/platform/shared/ruby/ext/asynchttp/asynchttp.i +8 -8
- data/platform/shared/ruby/ext/asynchttp/asynchttp_wrap.c +112 -16
- data/platform/shared/ruby/ext/geolocation/geolocation.i +16 -12
- data/platform/shared/ruby/ext/geolocation/geolocation_wrap.c +481 -125
- data/platform/shared/ruby/ext/navbar/navbar.i +20 -0
- data/platform/shared/ruby/ext/navbar/navbar_wrap.c +1859 -0
- data/platform/shared/ruby/ext/rho/extensions.c +1 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +32 -2
- data/platform/shared/ruby/ext/rho/rhoruby.h +7 -2
- data/platform/shared/ruby/ext/rhoconf/rhoconf.i +4 -0
- data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +31 -0
- data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +188 -3226
- data/platform/shared/ruby/ext/syncengine/syncengine.i +14 -25
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +96 -104
- data/platform/shared/ruby/ext/system/system.i +12 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +101 -7
- data/platform/shared/ruby/ext/webview/webview.i +20 -15
- data/platform/shared/ruby/ext/webview/webview_wrap.c +42 -16
- data/platform/shared/ruby/thread_pthread.c +4 -4
- data/platform/shared/ruby/thread_win32.c +4 -4
- data/platform/shared/ruby/wince/io_wce.c +0 -1
- data/platform/shared/rubyJVM/src/com/rho/FilePath.java +18 -2
- data/platform/shared/rubyJVM/src/com/rho/IRhoRubyHelper.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/Properties.java +9 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoClassFactory.java +2 -3
- data/platform/shared/rubyJVM/src/com/rho/RhoConf.java +47 -8
- data/platform/shared/rubyJVM/src/com/rho/RhoLogConf.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoLogFileSink.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoRuby.java +43 -5
- data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +98 -3
- data/platform/shared/rubyJVM/src/com/rho/db/DBAdapter.java +460 -175
- data/platform/shared/rubyJVM/src/com/rho/db/DBAttrManager.java +81 -33
- data/platform/shared/rubyJVM/src/com/rho/db/IDBCallback.java +3 -5
- data/platform/shared/rubyJVM/src/com/rho/db/IDBResult.java +2 -0
- data/platform/shared/rubyJVM/src/com/rho/db/IDBStorage.java +2 -0
- data/platform/shared/rubyJVM/src/com/rho/{IFile.java → file/IFile.java} +1 -1
- data/platform/shared/rubyJVM/src/com/rho/{IFileAccess.java → file/IFileAccess.java} +1 -1
- data/platform/shared/rubyJVM/src/com/rho/{IRAFile.java → file/IRAFile.java} +1 -1
- data/platform/{bb/Hsqldb/src/com/rho/db → shared/rubyJVM/src/com/rho/file}/RandomAccessFile.java +1 -2
- data/platform/shared/rubyJVM/src/com/rho/{SimpleFile.java → file/SimpleFile.java} +5 -1
- data/platform/shared/rubyJVM/src/com/rho/net/AsyncHttp.java +23 -18
- data/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java +167 -250
- data/platform/shared/rubyJVM/src/com/rho/net/RhoConnection.java +100 -30
- data/platform/shared/rubyJVM/src/com/rho/net/URI.java +0 -1
- data/platform/shared/rubyJVM/src/com/rho/sync/ClientRegister.java +30 -33
- data/platform/shared/rubyJVM/src/com/rho/sync/ISyncProtocol.java +20 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/JSONEntry.java +5 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/JSONStructIterator.java +74 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +486 -257
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncNotify.java +89 -58
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncProtocol_3.java +79 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +634 -495
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +74 -90
- data/platform/shared/rubyJVM/src/com/xruby/GeneratedMethods/RubySymbol_Methods.java +1 -0
- data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/RubyThread.java +6 -0
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubyRuntime.java +6 -2
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubySymbol.java +17 -1
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubyValue.java +1 -0
- data/platform/shared/rubyJVM/src/org/json/me/JSONObject.java +3 -0
- data/platform/shared/rubyext/GeoLocation.cpp +23 -0
- data/platform/shared/rubyext/GeoLocation.h +2 -0
- data/platform/shared/rubyext/RhoRuby.cpp +31 -0
- data/platform/shared/rubyext/RhoRuby.h +32 -0
- data/platform/shared/rubyext/System.cpp +14 -3
- data/platform/shared/rubyext/WebView.h +21 -0
- data/platform/shared/sync/ClientRegister.cpp +23 -28
- data/platform/shared/sync/ClientRegister.h +6 -2
- data/platform/shared/sync/ISyncProtocol.h +29 -0
- data/platform/shared/sync/SyncEngine.cpp +450 -190
- data/platform/shared/sync/SyncEngine.h +28 -38
- data/platform/shared/sync/SyncNotify.cpp +43 -41
- data/platform/shared/sync/SyncNotify.h +7 -7
- data/platform/shared/sync/SyncProtocol_3.h +86 -0
- data/platform/shared/sync/SyncSource.cpp +535 -371
- data/platform/shared/sync/SyncSource.h +48 -55
- data/platform/shared/sync/SyncThread.cpp +59 -103
- data/platform/shared/sync/SyncThread.h +10 -23
- data/platform/shared/unzip/unzip.cpp +3 -2
- data/platform/shared/unzip/unzip.h +5 -1
- data/platform/shared/wtl80/include/atlapp.h +10 -10
- data/platform/wm/RhoLib/RhoLib.vcproj +32 -0
- data/platform/wm/build/build_inf.js +40 -3
- data/platform/wm/build/wm.rake +95 -9
- data/platform/wm/rhodes/Alert.cpp +4 -0
- data/platform/wm/rhodes/DateTimePicker.cpp +183 -0
- data/platform/wm/rhodes/DateTimePicker.h +100 -0
- data/platform/wm/rhodes/MainWindow.cpp +222 -209
- data/platform/wm/rhodes/MainWindow.h +28 -35
- data/platform/wm/rhodes/Rhodes.cpp +20 -60
- data/platform/wm/rhodes/Rhodes.rc +41 -7
- data/platform/wm/rhodes/Utils.cpp +65 -0
- data/platform/wm/rhodes/Utils.h +9 -0
- data/platform/wm/rhodes/camera/Camera.cpp +2 -2
- data/platform/wm/rhodes/menubar.cpp +2 -33
- data/platform/wm/rhodes/menubar.h +0 -14
- data/platform/wm/rhodes/resource.h +13 -11
- data/platform/wm/rhodes/rho/net/NetRequest.cpp +16 -35
- data/platform/wm/rhodes/rho/net/NetRequest.h +8 -2
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +264 -46
- data/platform/wm/rhodes/rho/net/NetRequestImpl.h +14 -4
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.cpp +1 -1
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +77 -4
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +63 -0
- data/platform/wm/rhodes/rhodes.vcproj +20 -66
- data/platform/wm/rhodes/stdafx.h +22 -0
- data/platform/wm/rubylib/rubylib.vcproj +4 -0
- data/platform/wm/syncengine/syncengine.vcproj +8 -0
- data/platform/wm/tools/detool.sln +66 -0
- data/platform/wm/tools/detool/DEMComInterface.tlb +0 -0
- data/platform/wm/tools/detool/ReadMe.txt +33 -0
- data/platform/wm/tools/detool/detool.cpp +559 -0
- data/platform/wm/tools/detool/detool.h +5 -0
- data/platform/wm/tools/detool/detool.vcproj +233 -0
- data/platform/wm/tools/detool/stdafx.cpp +8 -0
- data/platform/wm/tools/detool/stdafx.h +15 -0
- data/platform/wm/tools/detool/targetver.h +24 -0
- data/platform/wm/tools/rhosetup/ReadMe.txt +41 -0
- data/platform/wm/tools/rhosetup/rhosetup.cpp +52 -0
- data/platform/wm/tools/rhosetup/rhosetup.vcproj +641 -0
- data/platform/wm/tools/rhosetup/stdafx.cpp +8 -0
- data/platform/wm/tools/rhosetup/stdafx.h +59 -0
- data/rakefile.rb +33 -10
- data/res/build-tools/db/syncdb.schema +25 -23
- data/res/build-tools/db/syncdb.triggers +1 -1
- data/res/build-tools/detool.exe +0 -0
- data/res/build-tools/rhosetup.dll +0 -0
- data/res/generators/rhogen.rb +27 -22
- data/res/generators/templates/application/app/Settings/controller.rb +3 -1
- data/res/generators/templates/application/app/Settings/home.bb.erb +17 -0
- data/res/generators/templates/application/app/Settings/home.erb +21 -12
- data/res/generators/templates/application/app/Settings/index.bb.erb +32 -0
- data/res/generators/templates/application/app/Settings/index.erb +44 -15
- data/res/generators/templates/application/app/Settings/login.bb.erb +35 -0
- data/res/generators/templates/application/app/Settings/login.erb +29 -30
- data/res/generators/templates/application/app/Settings/reset.bb.erb +15 -0
- data/res/generators/templates/application/app/Settings/reset.erb +16 -13
- data/res/generators/templates/application/app/Settings/wait.bb.erb +3 -0
- data/res/generators/templates/application/app/Settings/wait.erb +4 -4
- data/res/generators/templates/application/app/application.rb +8 -0
- data/res/generators/templates/application/app/helpers/browser_helper.rb +13 -0
- data/res/generators/templates/application/app/index.bb.erb +26 -0
- data/res/generators/templates/application/app/index.erb +21 -12
- data/res/generators/templates/application/app/layout.erb +9 -11
- data/res/generators/templates/application/public/css/android.css +285 -0
- data/res/generators/templates/application/public/css/blackberry.css +85 -78
- data/res/generators/templates/application/public/css/iphone.css +286 -296
- data/res/generators/templates/application/public/css/webkit.css +34 -0
- data/res/generators/templates/application/public/css/windows_mobile.css +208 -0
- data/res/generators/templates/application/public/icons/Read me first - license.txt +14 -0
- data/res/generators/templates/application/public/icons/about.png +0 -0
- data/res/generators/templates/application/public/icons/airplane.png +0 -0
- data/res/generators/templates/application/public/icons/baby.png +0 -0
- data/res/generators/templates/application/public/icons/badge.png +0 -0
- data/res/generators/templates/application/public/icons/bandaid.png +0 -0
- data/res/generators/templates/application/public/icons/bar-chart.png +0 -0
- data/res/generators/templates/application/public/icons/battery.png +0 -0
- data/res/generators/templates/application/public/icons/beaker.png +0 -0
- data/res/generators/templates/application/public/icons/beaker2.png +0 -0
- data/res/generators/templates/application/public/icons/beermug.png +0 -0
- data/res/generators/templates/application/public/icons/bird.png +0 -0
- data/res/generators/templates/application/public/icons/book.png +0 -0
- data/res/generators/templates/application/public/icons/bookmark.png +0 -0
- data/res/generators/templates/application/public/icons/brightness.png +0 -0
- data/res/generators/templates/application/public/icons/bug.png +0 -0
- data/res/generators/templates/application/public/icons/cabinet.png +0 -0
- data/res/generators/templates/application/public/icons/calendar.png +0 -0
- data/res/generators/templates/application/public/icons/camera.png +0 -0
- data/res/generators/templates/application/public/icons/changeName.rb +22 -0
- data/res/generators/templates/application/public/icons/chat2.png +0 -0
- data/res/generators/templates/application/public/icons/chicken.png +0 -0
- data/res/generators/templates/application/public/icons/clock.png +0 -0
- data/res/generators/templates/application/public/icons/cloud.png +0 -0
- data/res/generators/templates/application/public/icons/coffee.png +0 -0
- data/res/generators/templates/application/public/icons/compass.png +0 -0
- data/res/generators/templates/application/public/icons/contrast.png +0 -0
- data/res/generators/templates/application/public/icons/dashboard.png +0 -0
- data/res/generators/templates/application/public/icons/display.png +0 -0
- data/res/generators/templates/application/public/icons/dogpaw.png +0 -0
- data/res/generators/templates/application/public/icons/download.png +0 -0
- data/res/generators/templates/application/public/icons/dumbbell.png +0 -0
- data/res/generators/templates/application/public/icons/ekg.png +0 -0
- data/res/generators/templates/application/public/icons/envelope.png +0 -0
- data/res/generators/templates/application/public/icons/equalizer.png +0 -0
- data/res/generators/templates/application/public/icons/eye.png +0 -0
- data/res/generators/templates/application/public/icons/film-roll.png +0 -0
- data/res/generators/templates/application/public/icons/flag.png +0 -0
- data/res/generators/templates/application/public/icons/fork-and-knife.png +0 -0
- data/res/generators/templates/application/public/icons/fuel.png +0 -0
- data/res/generators/templates/application/public/icons/gameplan.png +0 -0
- data/res/generators/templates/application/public/icons/gear.png +0 -0
- data/res/generators/templates/application/public/icons/gear2.png +0 -0
- data/res/generators/templates/application/public/icons/gift.png +0 -0
- data/res/generators/templates/application/public/icons/heart.png +0 -0
- data/res/generators/templates/application/public/icons/house.png +0 -0
- data/res/generators/templates/application/public/icons/inbox.png +0 -0
- data/res/generators/templates/application/public/icons/index-cards.png +0 -0
- data/res/generators/templates/application/public/icons/iphone.png +0 -0
- data/res/generators/templates/application/public/icons/ipod.png +0 -0
- data/res/generators/templates/application/public/icons/key.png +0 -0
- data/res/generators/templates/application/public/icons/lifebuoy.png +0 -0
- data/res/generators/templates/application/public/icons/lightbulb.png +0 -0
- data/res/generators/templates/application/public/icons/line-chart.png +0 -0
- data/res/generators/templates/application/public/icons/location.png +0 -0
- data/res/generators/templates/application/public/icons/lock.png +0 -0
- data/res/generators/templates/application/public/icons/loopback.png +0 -0
- data/res/generators/templates/application/public/icons/magnifying-glass.png +0 -0
- data/res/generators/templates/application/public/icons/map-marker.png +0 -0
- data/res/generators/templates/application/public/icons/map.png +0 -0
- data/res/generators/templates/application/public/icons/medical-bag.png +0 -0
- data/res/generators/templates/application/public/icons/medical.png +0 -0
- data/res/generators/templates/application/public/icons/microphone.png +0 -0
- data/res/generators/templates/application/public/icons/movie1.png +0 -0
- data/res/generators/templates/application/public/icons/movie2.png +0 -0
- data/res/generators/templates/application/public/icons/network.png +0 -0
- data/res/generators/templates/application/public/icons/note.png +0 -0
- data/res/generators/templates/application/public/icons/outlet.png +0 -0
- data/res/generators/templates/application/public/icons/palette.png +0 -0
- data/res/generators/templates/application/public/icons/paperclip.png +0 -0
- data/res/generators/templates/application/public/icons/phone.png +0 -0
- data/res/generators/templates/application/public/icons/photos.png +0 -0
- data/res/generators/templates/application/public/icons/piano.png +0 -0
- data/res/generators/templates/application/public/icons/picture-frame.png +0 -0
- data/res/generators/templates/application/public/icons/pill.png +0 -0
- data/res/generators/templates/application/public/icons/pin.png +0 -0
- data/res/generators/templates/application/public/icons/pinetree.png +0 -0
- data/res/generators/templates/application/public/icons/planet.png +0 -0
- data/res/generators/templates/application/public/icons/puzzle.png +0 -0
- data/res/generators/templates/application/public/icons/radar.png +0 -0
- data/res/generators/templates/application/public/icons/redo.png +0 -0
- data/res/generators/templates/application/public/icons/refresh.png +0 -0
- data/res/generators/templates/application/public/icons/runner.png +0 -0
- data/res/generators/templates/application/public/icons/shoebox.png +0 -0
- data/res/generators/templates/application/public/icons/shopping-bag.png +0 -0
- data/res/generators/templates/application/public/icons/shopping-cart.png +0 -0
- data/res/generators/templates/application/public/icons/shuffle.png +0 -0
- data/res/generators/templates/application/public/icons/signpost.png +0 -0
- data/res/generators/templates/application/public/icons/skull-n-crossbones.png +0 -0
- data/res/generators/templates/application/public/icons/skull.png +0 -0
- data/res/generators/templates/application/public/icons/sliders.png +0 -0
- data/res/generators/templates/application/public/icons/spraycan.png +0 -0
- data/res/generators/templates/application/public/icons/squiggle.png +0 -0
- data/res/generators/templates/application/public/icons/star.png +0 -0
- data/res/generators/templates/application/public/icons/stopwatch.png +0 -0
- data/res/generators/templates/application/public/icons/suitcase.png +0 -0
- data/res/generators/templates/application/public/icons/tag.png +0 -0
- data/res/generators/templates/application/public/icons/tags.png +0 -0
- data/res/generators/templates/application/public/icons/target.png +0 -0
- data/res/generators/templates/application/public/icons/testtube.png +0 -0
- data/res/generators/templates/application/public/icons/thermometer.png +0 -0
- data/res/generators/templates/application/public/icons/toolbox.png +0 -0
- data/res/generators/templates/application/public/icons/trophy.png +0 -0
- data/res/generators/templates/application/public/icons/tshirt.png +0 -0
- data/res/generators/templates/application/public/icons/tv.png +0 -0
- data/res/generators/templates/application/public/icons/umbrella.png +0 -0
- data/res/generators/templates/application/public/icons/walk.png +0 -0
- data/res/generators/templates/application/public/icons/weather.png +0 -0
- data/res/generators/templates/application/public/icons/widescreen.png +0 -0
- data/res/generators/templates/application/public/icons/wineglass.png +0 -0
- data/res/generators/templates/application/public/icons/zap.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_check_off.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_check_on.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_radio_off.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_radio_on.png +0 -0
- data/res/generators/templates/application/public/images/android/ic_menu_more.png +0 -0
- data/res/generators/templates/application/public/images/iphone/disclosure.png +0 -0
- data/res/generators/templates/application/public/images/iphone/disclosure_detail.png +0 -0
- data/res/generators/templates/application/public/images/iphone/radiobutton.png +0 -0
- data/res/generators/templates/application/public/images/iphone/select.png +0 -0
- data/res/generators/templates/application/public/images/iphone/switch.png +0 -0
- data/res/generators/templates/application/public/images/listArrow.png +0 -0
- data/res/generators/templates/application/public/images/listArrowDown.png +0 -0
- data/res/generators/templates/model/controller.rb +2 -0
- data/res/generators/templates/model/edit.bb.erb +24 -0
- data/res/generators/templates/model/edit.erb +21 -25
- data/res/generators/templates/model/index.bb.erb +21 -0
- data/res/generators/templates/model/index.erb +28 -14
- data/res/generators/templates/model/new.bb.erb +24 -0
- data/res/generators/templates/model/new.erb +20 -20
- data/res/generators/templates/model/show.bb.erb +21 -0
- data/res/generators/templates/model/show.erb +15 -15
- data/rhobuild.yml +37 -0
- data/rhodes.gemspec +1 -1
- data/spec/framework_spec/app/Account/config.rb +57 -1
- data/spec/framework_spec/app/Case/config.rb +1 -1
- data/spec/framework_spec/app/Customer/config.rb +1 -1
- data/spec/framework_spec/app/Product/config.rb +15 -1
- data/spec/framework_spec/app/spec/fixtures/object_values.txt +90 -90
- data/spec/framework_spec/app/spec/pagination/fixtures/object_values.txt +91 -91
- data/spec/framework_spec/app/spec/rho_spec.rb +1 -1
- data/spec/framework_spec/app/spec/rhom_object_spec.rb +47 -28
- data/spec/framework_spec/app/spec/rhom_spec.rb +8 -8
- data/spec/framework_spec/app/spec/spec_helper.rb +13 -5
- data/spec/framework_spec/app/spec_runner.rb +5 -4
- data/spec/framework_spec/public/css/base.css +0 -1
- data/spec/framework_spec/public/css/iphone.css +0 -1
- data/spec/framework_spec/rhoconfig.txt +3 -1
- metadata +220 -37
- data/platform/bb/rhodes/src/rhomobile/WebView.java +0 -90
- data/platform/iphone/Classes/BarItem.h +0 -27
- data/platform/iphone/Classes/BarItem.m +0 -32
- data/platform/iphone/Classes/JSString.h +0 -12
- data/platform/iphone/Classes/JSString.m +0 -7
- data/platform/iphone/Classes/RhoRunnerAppDelegate.h +0 -48
- data/platform/iphone/Classes/RhoRunnerAppDelegate.m +0 -617
- data/platform/iphone/Classes/Server/ServerHost.h +0 -81
- data/platform/iphone/Classes/Server/ServerHost.m +0 -597
- data/platform/iphone/Classes/Server/WebViewUrl.h +0 -13
- data/platform/iphone/Classes/Server/WebViewUrl.m +0 -8
- data/platform/iphone/Classes/TabBarDelegate.h +0 -39
- data/platform/iphone/Classes/TabBarDelegate.m +0 -151
- data/platform/iphone/Classes/Utils/unzip.cpp +0 -4328
- data/platform/iphone/Classes/Utils/unzip.h +0 -234
- data/platform/iphone/Classes/WebViewController.h +0 -59
- data/platform/iphone/Classes/WebViewController.m +0 -472
- data/platform/wm/rhodes/GetURLDialog.cpp +0 -64
- data/platform/wm/rhodes/GetURLDialog.h +0 -39
- data/res/generators/templates/application/public/css/base.css +0 -39
- data/res/generators/templates/application/public/css/rho.css +0 -3
- data/res/generators/templates/application/public/css/xhtml.css +0 -114
- data/spec/framework_spec/app/Question/config.rb +0 -3
- data/spec/generator_spec/source_generator_spec.rb +0 -27
@@ -10,12 +10,13 @@ import com.rho.RhoRuby;
|
|
10
10
|
public class DBAttrManager {
|
11
11
|
private Mutex m_mxSrcAttrs = new Mutex();
|
12
12
|
private Hashtable/*< int, Hashtable<String,int>* >*/ m_mapSrcAttrs = new Hashtable();
|
13
|
+
private Hashtable/*Ptr< int, Hashtable<String,int>* >*/ m_mapBlobAttrs = new Hashtable();
|
14
|
+
private Hashtable/*Ptr< String, int>*/ m_mapSrcNames = new Hashtable();
|
13
15
|
|
14
|
-
public void add(
|
16
|
+
public void add( Integer nSrcID, String szAttr )
|
15
17
|
{
|
16
18
|
synchronized(m_mxSrcAttrs)
|
17
19
|
{
|
18
|
-
Integer nSrcID = new Integer(iSrcID);
|
19
20
|
Hashtable/*<String,int>*/ mapAttr = (Hashtable)m_mapSrcAttrs.get(nSrcID);
|
20
21
|
if ( mapAttr != null )
|
21
22
|
{
|
@@ -33,11 +34,10 @@ public class DBAttrManager {
|
|
33
34
|
}
|
34
35
|
}
|
35
36
|
|
36
|
-
public void remove(
|
37
|
+
public void remove( Integer nSrcID, String szAttr )
|
37
38
|
{
|
38
39
|
synchronized(m_mxSrcAttrs)
|
39
40
|
{
|
40
|
-
Integer nSrcID = new Integer(iSrcID);
|
41
41
|
Hashtable/*<String,int>*/ mapAttr = (Hashtable)m_mapSrcAttrs.get(nSrcID);
|
42
42
|
if ( mapAttr != null )
|
43
43
|
{
|
@@ -88,34 +88,7 @@ public class DBAttrManager {
|
|
88
88
|
{
|
89
89
|
synchronized(m_mxSrcAttrs)
|
90
90
|
{
|
91
|
-
|
92
|
-
for ( ; !res.isEnd(); res.next() )
|
93
|
-
{
|
94
|
-
Integer nSrcID = new Integer(res.getIntByIdx(0));
|
95
|
-
String strAttribs = res.getStringByIdx(1);
|
96
|
-
if ( strAttribs.length() == 0 )
|
97
|
-
continue;
|
98
|
-
|
99
|
-
Tokenizer oTokenizer = new Tokenizer( strAttribs, "," );
|
100
|
-
|
101
|
-
Hashtable/*<String,int>*/ mapAttr = new Hashtable/*<String,int>*/();
|
102
|
-
String strAttr = "";
|
103
|
-
while (oTokenizer.hasMoreTokens())
|
104
|
-
{
|
105
|
-
String tok = oTokenizer.nextToken();
|
106
|
-
if (tok.length() == 0)
|
107
|
-
continue;
|
108
|
-
|
109
|
-
if ( strAttr.length() > 0 )
|
110
|
-
{
|
111
|
-
mapAttr.put(strAttr, new Integer(Integer.parseInt(tok)) );
|
112
|
-
strAttr = "";
|
113
|
-
}else
|
114
|
-
strAttr = tok;
|
115
|
-
}
|
116
|
-
|
117
|
-
m_mapSrcAttrs.put( nSrcID, mapAttr );
|
118
|
-
}
|
91
|
+
loadAttrs(db, m_mapSrcAttrs, "source_attribs", null);
|
119
92
|
}
|
120
93
|
}
|
121
94
|
|
@@ -149,5 +122,80 @@ public class DBAttrManager {
|
|
149
122
|
|
150
123
|
return arRes;
|
151
124
|
}
|
152
|
-
}
|
125
|
+
}
|
126
|
+
|
127
|
+
public boolean isBlobAttr(Integer nSrcID, String szAttr)
|
128
|
+
{
|
129
|
+
Hashtable/*<String,int>**/ mapAttr = (Hashtable)m_mapBlobAttrs.get(nSrcID);
|
130
|
+
if ( mapAttr != null )
|
131
|
+
return mapAttr.containsKey(szAttr);
|
132
|
+
|
133
|
+
return false;
|
134
|
+
}
|
135
|
+
|
136
|
+
public Integer getSrcIDHasBlobsByName(String strName)
|
137
|
+
{
|
138
|
+
Integer nSrcID = (Integer)m_mapSrcNames.get(strName);
|
139
|
+
if ( nSrcID == null )
|
140
|
+
return null;
|
141
|
+
|
142
|
+
Hashtable/*<String,int>**/ mapAttr = (Hashtable)m_mapBlobAttrs.get(nSrcID);
|
143
|
+
if ( mapAttr.size() == 0 )
|
144
|
+
return null;
|
145
|
+
|
146
|
+
return nSrcID;
|
147
|
+
}
|
148
|
+
|
149
|
+
public boolean isOverwriteBlobFromServer(Integer nSrcID, String strAttr)
|
150
|
+
{
|
151
|
+
Hashtable/*<String,int>**/ mapAttr = (Hashtable)m_mapBlobAttrs.get(nSrcID);
|
152
|
+
if ( mapAttr != null )
|
153
|
+
return ((Integer)mapAttr.get(strAttr)).intValue() != 0;
|
154
|
+
|
155
|
+
return false;
|
156
|
+
}
|
157
|
+
|
158
|
+
void loadBlobAttrs(DBAdapter db)throws DBException
|
159
|
+
{
|
160
|
+
loadAttrs(db, m_mapBlobAttrs, "blob_attribs", m_mapSrcNames);
|
161
|
+
//TODO: update/delete trigger for schema sources
|
162
|
+
}
|
163
|
+
|
164
|
+
static void loadAttrs(DBAdapter db, Hashtable/*Ptr< int, Hashtable<String,int>* >&*/ mapAttrs, String strDBAttr, Hashtable mapSrcNames)throws DBException
|
165
|
+
{
|
166
|
+
mapAttrs.clear();
|
167
|
+
String strSql = "SELECT source_id,";
|
168
|
+
strSql += strDBAttr + ",name from sources";
|
169
|
+
|
170
|
+
IDBResult res = db.executeSQL(strSql);
|
171
|
+
for ( ; !res.isEnd(); res.next() )
|
172
|
+
{
|
173
|
+
Integer nSrcID = new Integer(res.getIntByIdx(0));
|
174
|
+
String strAttribs = res.getStringByIdx(1);
|
175
|
+
if ( strAttribs.length() == 0 )
|
176
|
+
continue;
|
177
|
+
|
178
|
+
Tokenizer oTokenizer = new Tokenizer( strAttribs, "," );
|
179
|
+
|
180
|
+
Hashtable/*<String,int>*/ mapAttr = new Hashtable/*<String,int>*/();
|
181
|
+
String strAttr = "";
|
182
|
+
while (oTokenizer.hasMoreTokens())
|
183
|
+
{
|
184
|
+
String tok = oTokenizer.nextToken();
|
185
|
+
if (tok.length() == 0)
|
186
|
+
continue;
|
187
|
+
|
188
|
+
if ( strAttr.length() > 0 )
|
189
|
+
{
|
190
|
+
mapAttr.put(strAttr, new Integer(Integer.parseInt(tok)) );
|
191
|
+
strAttr = "";
|
192
|
+
}else
|
193
|
+
strAttr = tok;
|
194
|
+
}
|
195
|
+
|
196
|
+
mapAttrs.put( nSrcID, mapAttr );
|
197
|
+
if ( mapSrcNames != null )
|
198
|
+
mapSrcNames.put(res.getStringByIdx(2).toUpperCase(), nSrcID);
|
199
|
+
}
|
200
|
+
}
|
153
201
|
}
|
@@ -2,9 +2,7 @@ package com.rho.db;
|
|
2
2
|
|
3
3
|
public interface IDBCallback
|
4
4
|
{
|
5
|
-
|
6
|
-
|
7
|
-
public abstract void
|
8
|
-
public abstract void OnInsertIntoTable(String tableName, IDBResult rows2Insert);
|
9
|
-
|
5
|
+
public abstract void onBeforeDelete(String tableName, IDBResult rows2Delete);
|
6
|
+
public abstract void onBeforeUpdate(String tableName, IDBResult rows2Insert, int[] cols);
|
7
|
+
public abstract void onAfterInsert(String tableName, IDBResult rows2Insert);
|
10
8
|
}
|
@@ -6,6 +6,7 @@ public interface IDBResult {
|
|
6
6
|
//public abstract int getCount();
|
7
7
|
public abstract int getColCount();
|
8
8
|
public abstract String getColName(int nCol);
|
9
|
+
public abstract String getOrigColName(int nCol);
|
9
10
|
/*
|
10
11
|
public abstract RubyValue getRubyValueByIdx(int nItem, int nCol);
|
11
12
|
public abstract long getLongByIdx(int nItem, int nCol);
|
@@ -28,6 +29,7 @@ public interface IDBResult {
|
|
28
29
|
public abstract String getUInt64ByIdx(int nCol);
|
29
30
|
|
30
31
|
public abstract RubyValue getRubyValueByIdx(int nCol);
|
32
|
+
public abstract boolean isNullByIdx(int nCol);
|
31
33
|
|
32
34
|
public abstract RubyValue getRubyValue(String colname);
|
33
35
|
public abstract int getInt(String colname);
|
@@ -6,6 +6,8 @@ public interface IDBStorage {
|
|
6
6
|
public abstract void close()throws DBException;
|
7
7
|
|
8
8
|
public abstract IDBResult executeSQL(String strStatement, Object[] values, boolean bReportNonUnique)throws DBException;
|
9
|
+
public abstract void executeBatchSQL(String strStatement)throws DBException;
|
10
|
+
|
9
11
|
public abstract IDBResult createResult();
|
10
12
|
|
11
13
|
public abstract void deleteAllFiles(String strPath)throws Exception;
|
data/platform/{bb/Hsqldb/src/com/rho/db → shared/rubyJVM/src/com/rho/file}/RandomAccessFile.java
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
package com.rho.
|
1
|
+
package com.rho.file;
|
2
2
|
|
3
3
|
import java.io.*;
|
4
4
|
|
@@ -9,7 +9,6 @@ import javax.microedition.io.Connector;
|
|
9
9
|
import com.rho.RhoClassFactory;
|
10
10
|
//import com.rho.RhoEmptyLogger;
|
11
11
|
//import com.rho.RhoLogger;
|
12
|
-
import com.rho.IRAFile;
|
13
12
|
|
14
13
|
import j2me.nio.channels.*;
|
15
14
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
package com.rho;
|
1
|
+
package com.rho.file;
|
2
2
|
|
3
3
|
import java.io.IOException;
|
4
4
|
import java.io.InputStream;
|
@@ -27,6 +27,8 @@ public interface SimpleFile extends IFile {
|
|
27
27
|
void truncate(int nSize)throws IOException;
|
28
28
|
InputStream getInputStream()throws IOException;
|
29
29
|
OutputStream getOutStream();
|
30
|
+
OutputStream getOutStreamEx(long pos)throws IOException;
|
31
|
+
long length();
|
30
32
|
|
31
33
|
/**
|
32
34
|
*
|
@@ -43,4 +45,6 @@ public interface SimpleFile extends IFile {
|
|
43
45
|
public abstract InputStream getResourceAsStream(Class fromClass, String path);
|
44
46
|
|
45
47
|
public abstract void renameOverwrite(String oldName, String newName);
|
48
|
+
|
49
|
+
public abstract void copyJarFileToMemory(String strFileName, InputStream jarStream)throws IOException;
|
46
50
|
}
|
@@ -9,6 +9,7 @@ import java.util.Hashtable;
|
|
9
9
|
|
10
10
|
import com.xruby.runtime.builtin.RubyArray;
|
11
11
|
import com.xruby.runtime.lang.*;
|
12
|
+
import com.rho.net.NetRequest.MultipartItem;
|
12
13
|
|
13
14
|
import java.io.IOException;
|
14
15
|
|
@@ -148,8 +149,14 @@ public class AsyncHttp extends RhoThread
|
|
148
149
|
break;
|
149
150
|
|
150
151
|
case hcUpload:
|
151
|
-
|
152
|
-
|
152
|
+
{
|
153
|
+
MultipartItem oItem = new MultipartItem();
|
154
|
+
oItem.m_strFilePath = m_strBody;
|
155
|
+
oItem.m_strContentType = "application/octet-stream";
|
156
|
+
|
157
|
+
m_pNetResponse = m_pNetRequest.pushMultipartData( m_strUrl, oItem, null, m_mapHeaders );
|
158
|
+
break;
|
159
|
+
}
|
153
160
|
}
|
154
161
|
|
155
162
|
if ( !m_pNetRequest.isCancelled() )
|
@@ -237,13 +244,7 @@ public class AsyncHttp extends RhoThread
|
|
237
244
|
else
|
238
245
|
{
|
239
246
|
m_strResBody += "error&error_code=";
|
240
|
-
|
241
|
-
strBody += RhoRuby.ERR_NETWORK;
|
242
|
-
else */if ( resp.isUnathorized() )
|
243
|
-
m_strResBody += RhoRuby.ERR_UNATHORIZED;
|
244
|
-
else
|
245
|
-
m_strResBody += RhoRuby.ERR_REMOTESERVER;
|
246
|
-
|
247
|
+
m_strResBody += RhoRuby.getErrorFromResponse(resp);
|
247
248
|
//if ( resp.isResponseRecieved())
|
248
249
|
m_strResBody += "&http_error=" + resp.getRespCode();
|
249
250
|
}
|
@@ -280,14 +281,15 @@ public class AsyncHttp extends RhoThread
|
|
280
281
|
klass.getSingletonClass().defineMethod("do_get", new RubyVarArgMethod(){
|
281
282
|
protected RubyValue run(RubyValue receiver, RubyArray args, RubyBlock block )
|
282
283
|
{
|
283
|
-
if ( args.size() !=
|
284
|
+
if ( args.size() != 5 )
|
284
285
|
throw new RubyException(RubyRuntime.ArgumentErrorClass,
|
285
|
-
"in AsyncHttp.do_get: wrong number of arguments ( " + args.size() + " for " +
|
286
|
+
"in AsyncHttp.do_get: wrong number of arguments ( " + args.size() + " for " + 5 + " )");
|
286
287
|
|
287
288
|
try {
|
288
289
|
String url = args.get(0).toStr();
|
289
290
|
String callback = args.get(2).toStr();
|
290
291
|
String callback_params = args.get(3).toStr();
|
292
|
+
boolean ssl_verify_peer = args.get(4).toInt() != 0 ? true : false;
|
291
293
|
AsyncHttp pHttp = new AsyncHttp(new RhoClassFactory(), AsyncHttp.hcGet, url, args.get(1), null, callback, callback_params );
|
292
294
|
return pHttp.getRetValue();
|
293
295
|
} catch(Exception e) {
|
@@ -300,15 +302,16 @@ public class AsyncHttp extends RhoThread
|
|
300
302
|
klass.getSingletonClass().defineMethod("do_post", new RubyVarArgMethod(){
|
301
303
|
protected RubyValue run(RubyValue receiver, RubyArray args, RubyBlock block )
|
302
304
|
{
|
303
|
-
if ( args.size() !=
|
305
|
+
if ( args.size() != 6 )
|
304
306
|
throw new RubyException(RubyRuntime.ArgumentErrorClass,
|
305
|
-
"in AsyncHttp.do_post: wrong number of arguments ( " + args.size() + " for " +
|
307
|
+
"in AsyncHttp.do_post: wrong number of arguments ( " + args.size() + " for " + 6 + " )");
|
306
308
|
|
307
309
|
try {
|
308
310
|
String url = args.get(0).toStr();
|
309
311
|
String body = args.get(2).toStr();
|
310
312
|
String callback = args.get(3).toStr();
|
311
313
|
String callback_params = args.get(4).toStr();
|
314
|
+
boolean ssl_verify_peer = args.get(5).toInt() != 0 ? true : false;
|
312
315
|
AsyncHttp pHttp = new AsyncHttp(new RhoClassFactory(), AsyncHttp.hcPost, url, args.get(1), body, callback, callback_params );
|
313
316
|
return pHttp.getRetValue();
|
314
317
|
} catch(Exception e) {
|
@@ -321,15 +324,16 @@ public class AsyncHttp extends RhoThread
|
|
321
324
|
klass.getSingletonClass().defineMethod("do_downloadfile", new RubyVarArgMethod(){
|
322
325
|
protected RubyValue run(RubyValue receiver, RubyArray args, RubyBlock block )
|
323
326
|
{
|
324
|
-
if ( args.size() !=
|
327
|
+
if ( args.size() != 6 )
|
325
328
|
throw new RubyException(RubyRuntime.ArgumentErrorClass,
|
326
|
-
"in AsyncHttp.do_downloadfile: wrong number of arguments ( " + args.size() + " for " +
|
329
|
+
"in AsyncHttp.do_downloadfile: wrong number of arguments ( " + args.size() + " for " + 6 + " )");
|
327
330
|
|
328
331
|
try {
|
329
332
|
String url = args.get(0).toStr();
|
330
333
|
String filepath = args.get(2).toStr();
|
331
334
|
String callback = args.get(3).toStr();
|
332
335
|
String callback_params = args.get(4).toStr();
|
336
|
+
boolean ssl_verify_peer = args.get(5).toInt() != 0 ? true : false;
|
333
337
|
AsyncHttp pHttp = new AsyncHttp(new RhoClassFactory(), AsyncHttp.hcDownload, url, args.get(1), filepath, callback, callback_params );
|
334
338
|
return pHttp.getRetValue();
|
335
339
|
} catch(Exception e) {
|
@@ -342,15 +346,16 @@ public class AsyncHttp extends RhoThread
|
|
342
346
|
klass.getSingletonClass().defineMethod("do_uploadfile", new RubyVarArgMethod(){
|
343
347
|
protected RubyValue run(RubyValue receiver, RubyArray args, RubyBlock block )
|
344
348
|
{
|
345
|
-
if ( args.size() !=
|
349
|
+
if ( args.size() != 6 )
|
346
350
|
throw new RubyException(RubyRuntime.ArgumentErrorClass,
|
347
|
-
"in AsyncHttp.do_uploadfile: wrong number of arguments ( " + args.size() + " for " +
|
351
|
+
"in AsyncHttp.do_uploadfile: wrong number of arguments ( " + args.size() + " for " + 6 + " )");
|
348
352
|
|
349
353
|
try {
|
350
354
|
String url = args.get(0).toStr();
|
351
355
|
String filepath = args.get(2).toStr();
|
352
356
|
String callback = args.get(3).toStr();
|
353
357
|
String callback_params = args.get(4).toStr();
|
358
|
+
boolean ssl_verify_peer = args.get(5).toInt() != 0 ? true : false;
|
354
359
|
AsyncHttp pHttp = new AsyncHttp(new RhoClassFactory(), AsyncHttp.hcUpload, url, args.get(1), filepath, callback, callback_params );
|
355
360
|
return pHttp.getRetValue();
|
356
361
|
} catch(Exception e) {
|
@@ -376,4 +381,4 @@ public class AsyncHttp extends RhoThread
|
|
376
381
|
|
377
382
|
}
|
378
383
|
|
379
|
-
}
|
384
|
+
}
|
@@ -13,68 +13,52 @@ import com.rho.IRhoRubyHelper;
|
|
13
13
|
import com.rho.RhoConf;
|
14
14
|
import com.rho.RhoEmptyLogger;
|
15
15
|
import com.rho.RhoLogger;
|
16
|
-
import com.rho.
|
17
|
-
import com.rho.IRAFile;
|
18
|
-
import com.rho.Tokenizer;
|
16
|
+
import com.rho.file.*;
|
19
17
|
|
20
18
|
import java.util.Enumeration;
|
21
19
|
import java.util.Hashtable;
|
22
|
-
|
20
|
+
import java.util.Vector;
|
23
21
|
|
24
22
|
public class NetRequest
|
25
23
|
{
|
26
24
|
private static final RhoLogger LOG = RhoLogger.RHO_STRIP_LOG ? new RhoEmptyLogger() :
|
27
25
|
new RhoLogger("Net");
|
28
26
|
|
29
|
-
static final int MAX_NETREQUEST_RETRY = 1;
|
30
27
|
boolean m_bCancel = false;
|
31
28
|
|
32
29
|
public static interface IRhoSession
|
33
30
|
{
|
34
31
|
public abstract void logout()throws Exception;
|
35
32
|
public abstract String getSession();
|
33
|
+
public abstract String getContentType();
|
36
34
|
}
|
37
35
|
|
36
|
+
public static class MultipartItem
|
37
|
+
{
|
38
|
+
//mutually exclusive
|
39
|
+
public String m_strFilePath = "";
|
40
|
+
public String m_strBody = "";
|
41
|
+
//
|
42
|
+
|
43
|
+
public String m_strName = "", m_strFileName = "", m_strContentType = "";
|
44
|
+
|
45
|
+
public String m_strDataPrefix = "";
|
46
|
+
};
|
47
|
+
|
38
48
|
private IHttpConnection m_connection = null;
|
39
|
-
|
40
|
-
public byte[] m_byteBuffer = new byte[4096];
|
49
|
+
|
41
50
|
private boolean m_bIgnoreSuffixOnSim = true;
|
42
51
|
private Hashtable m_OutHeaders;
|
43
52
|
public boolean isCancelled(){ return m_bCancel;}
|
44
53
|
public NetResponse pullData(String strUrl, IRhoSession oSession ) throws Exception
|
45
54
|
{
|
46
|
-
return
|
55
|
+
return doRequest("GET", strUrl, "", oSession, null);
|
47
56
|
}
|
48
57
|
|
49
58
|
public void setIgnoreSuffixOnSim(boolean bset)
|
50
59
|
{
|
51
60
|
m_bIgnoreSuffixOnSim = bset;
|
52
61
|
}
|
53
|
-
|
54
|
-
private NetResponse doRequestTry(String strUrl, String strBody, IRhoSession oSession ) throws Exception
|
55
|
-
{
|
56
|
-
NetResponse resp = null;
|
57
|
-
|
58
|
-
int nTry = 0;
|
59
|
-
m_bCancel = false;
|
60
|
-
do
|
61
|
-
{
|
62
|
-
try{
|
63
|
-
resp = doRequest(strBody != null && strBody.length() > 0 ? "POST" : "GET", strUrl, strBody, oSession, null);
|
64
|
-
break;
|
65
|
-
}catch(IOException exc)
|
66
|
-
{
|
67
|
-
if ( m_bCancel )
|
68
|
-
break;
|
69
|
-
if ( nTry+1 >= MAX_NETREQUEST_RETRY )
|
70
|
-
throw exc;
|
71
|
-
}
|
72
|
-
nTry++;
|
73
|
-
|
74
|
-
}while( true );
|
75
|
-
|
76
|
-
return resp;
|
77
|
-
}
|
78
62
|
|
79
63
|
private void writeHeaders(Hashtable headers) throws Exception
|
80
64
|
{
|
@@ -133,6 +117,7 @@ public class NetRequest
|
|
133
117
|
OutputStream os = null;
|
134
118
|
int code = -1;
|
135
119
|
|
120
|
+
m_bCancel = false;
|
136
121
|
try{
|
137
122
|
closeConnection();
|
138
123
|
m_connection = RhoClassFactory.getNetworkAccess().connect(strUrl, m_bIgnoreSuffixOnSim);
|
@@ -146,27 +131,34 @@ public class NetRequest
|
|
146
131
|
m_connection.setRequestProperty("Cookie", strSession );
|
147
132
|
}
|
148
133
|
|
149
|
-
m_connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
150
134
|
//m_connection.setRequestProperty("Connection", "keep-alive");
|
151
135
|
//m_connection.setRequestProperty("Accept", "application/x-www-form-urlencoded,application/json,text/html");
|
152
136
|
|
153
|
-
writeHeaders(headers);
|
154
|
-
LOG.INFO("writeHeaders done");
|
155
137
|
if ( strBody != null && strBody.length() > 0 )
|
156
138
|
{
|
157
|
-
|
139
|
+
if ( oSession != null )
|
140
|
+
m_connection.setRequestProperty("Content-Type", oSession.getContentType());
|
141
|
+
else
|
142
|
+
m_connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
143
|
+
|
144
|
+
writeHeaders(headers);
|
145
|
+
LOG.INFO("writeHeaders done");
|
146
|
+
m_connection.setRequestMethod(IHttpConnection.POST);
|
147
|
+
|
158
148
|
os = m_connection.openOutputStream();
|
159
149
|
os.write(strBody.getBytes(), 0, strBody.length());
|
150
|
+
LOG.INFO("write body done");
|
160
151
|
}else
|
152
|
+
{
|
153
|
+
writeHeaders(headers);
|
161
154
|
m_connection.setRequestMethod(strMethod);
|
155
|
+
}
|
162
156
|
|
163
|
-
|
157
|
+
code = m_connection.getResponseCode();
|
158
|
+
LOG.INFO("getResponseCode : " + code);
|
164
159
|
|
165
160
|
is = m_connection.openInputStream();
|
166
161
|
LOG.INFO("openInputStream done");
|
167
|
-
code = m_connection.getResponseCode();
|
168
|
-
|
169
|
-
LOG.INFO("getResponseCode : " + code);
|
170
162
|
|
171
163
|
if (code != IHttpConnection.HTTP_OK)
|
172
164
|
{
|
@@ -222,6 +214,8 @@ public class NetRequest
|
|
222
214
|
|
223
215
|
public NetResponse pushData(String strUrl, String strBody, IRhoSession oSession)throws Exception
|
224
216
|
{
|
217
|
+
m_bCancel = false;
|
218
|
+
|
225
219
|
if ( URI.isLocalHost(strUrl) )
|
226
220
|
{
|
227
221
|
IRhoRubyHelper helper = RhoClassFactory.createRhoRubyHelper();
|
@@ -231,24 +225,23 @@ public class NetRequest
|
|
231
225
|
return doRequest("POST", strUrl, strBody, oSession, null);
|
232
226
|
}
|
233
227
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
228
|
+
public NetResponse pushMultipartData(String strUrl, MultipartItem oItem, IRhoSession oSession, Hashtable/*<String,String>**/ pHeaders)throws Exception
|
229
|
+
{
|
230
|
+
Vector arItems = new Vector();
|
231
|
+
arItems.addElement(oItem);
|
238
232
|
|
233
|
+
return pushMultipartData(strUrl, arItems, oSession, pHeaders);
|
234
|
+
}
|
235
|
+
|
239
236
|
public NetResponse pullCookies(String strUrl, String strBody, IRhoSession oSession)throws Exception
|
240
237
|
{
|
241
238
|
Hashtable headers = new Hashtable();
|
242
239
|
m_bIgnoreSuffixOnSim = false;
|
240
|
+
m_bCancel = false;
|
241
|
+
|
243
242
|
NetResponse resp = doRequest/*Try*/("POST", strUrl, strBody, oSession, headers);
|
244
243
|
if ( resp.isOK() )
|
245
244
|
{
|
246
|
-
//ParsedCookie cookie = makeCookie(headers);
|
247
|
-
//if ( cookie.strAuth.length() > 0 || cookie.strSession.length() >0 )
|
248
|
-
//resp.setCharData(cookie.strAuth + ";" + cookie.strSession + ";");
|
249
|
-
//else
|
250
|
-
// resp.setCharData("");
|
251
|
-
|
252
245
|
resp.setCharData(resp.getCookies());
|
253
246
|
LOG.INFO("pullCookies: " + resp.getCharData() );
|
254
247
|
}
|
@@ -256,61 +249,80 @@ public class NetRequest
|
|
256
249
|
return resp;
|
257
250
|
}
|
258
251
|
|
259
|
-
static String szMultipartPrefix =
|
260
|
-
"------------A6174410D6AD474183FDE48F5662FCC5\r\n"+
|
261
|
-
"Content-Disposition: form-data; name=\"blob\"; filename=\"doesnotmatter.png\"\r\n"+
|
262
|
-
"Content-Type: application/octet-stream\r\n\r\n";
|
263
|
-
|
264
252
|
static String szMultipartPostfix =
|
265
253
|
"\r\n------------A6174410D6AD474183FDE48F5662FCC5--";
|
266
254
|
|
267
255
|
static String szMultipartContType =
|
268
256
|
"multipart/form-data; boundary=----------A6174410D6AD474183FDE48F5662FCC5";
|
269
257
|
|
270
|
-
|
258
|
+
void processMultipartItems( Vector/*Ptr<CMultipartItem*>&*/ arItems )throws Exception
|
271
259
|
{
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
260
|
+
for( int i = 0; i < (int)arItems.size(); i++ )
|
261
|
+
{
|
262
|
+
MultipartItem oItem = (MultipartItem)arItems.elementAt(i);
|
263
|
+
|
264
|
+
if ( oItem.m_strName.length() == 0 )
|
265
|
+
oItem.m_strName = "blob";
|
266
|
+
|
267
|
+
if ( oItem.m_strFileName.length() == 0 )
|
268
|
+
{
|
269
|
+
if ( oItem.m_strFilePath.length() > 0 )
|
270
|
+
{
|
271
|
+
FilePath oPath = new FilePath(oItem.m_strFilePath);
|
272
|
+
oItem.m_strFileName = oPath.getBaseName();
|
273
|
+
}
|
274
|
+
//else
|
275
|
+
// oItem.m_strFileName = "doesnotmatter.txt";
|
276
|
+
}
|
277
|
+
|
278
|
+
oItem.m_strDataPrefix = i > 0 ? "\r\n" : "";
|
279
|
+
oItem.m_strDataPrefix +=
|
280
|
+
"------------A6174410D6AD474183FDE48F5662FCC5\r\n"+
|
281
|
+
"Content-Disposition: form-data; name=\"";
|
282
|
+
oItem.m_strDataPrefix += oItem.m_strName + "\"";
|
283
|
+
if (oItem.m_strFileName.length()>0)
|
284
|
+
oItem.m_strDataPrefix += "; filename=\"" + oItem.m_strFileName + "\"";
|
285
|
+
oItem.m_strDataPrefix += "\r\n";
|
286
|
+
if ( oItem.m_strContentType.length() > 0 )
|
287
|
+
oItem.m_strDataPrefix += "Content-Type: " + oItem.m_strContentType + "\r\n";
|
288
|
+
|
289
|
+
long nContentSize = 0;
|
290
|
+
if ( oItem.m_strFilePath.length() > 0 )
|
291
|
+
{
|
292
|
+
SimpleFile file = null;
|
293
|
+
try{
|
294
|
+
file = RhoClassFactory.createFile();
|
295
|
+
file.open(oItem.m_strFilePath, true, true);
|
296
|
+
nContentSize = file.length();
|
297
|
+
if ( !file.isOpened() ){
|
298
|
+
LOG.ERROR("File not found: " + oItem.m_strFilePath);
|
299
|
+
throw new RuntimeException("File not found:" + oItem.m_strFilePath);
|
300
|
+
}
|
301
|
+
}finally{
|
302
|
+
if ( file != null )
|
303
|
+
try{ file.close(); }catch(IOException e){}
|
304
|
+
}
|
305
|
+
}
|
306
|
+
else
|
307
|
+
nContentSize = oItem.m_strBody.length();
|
308
|
+
|
309
|
+
if ( oItem.m_strContentType.length() > 0 )
|
310
|
+
oItem.m_strDataPrefix += "Content-Length: " + nContentSize + "\r\n";
|
311
|
+
|
312
|
+
oItem.m_strDataPrefix += "\r\n";
|
313
|
+
}
|
314
|
+
|
304
315
|
}
|
305
316
|
|
306
|
-
|
317
|
+
public NetResponse pushMultipartData(String strUrl, Vector/*Ptr<CMultipartItem*>&*/ arItems, IRhoSession oSession, Hashtable/*<String,String>**/ headers)throws Exception
|
307
318
|
{
|
308
319
|
String strRespBody = null;
|
309
320
|
InputStream is = null;
|
310
321
|
OutputStream os = null;
|
311
|
-
InputStream fis = null;
|
312
322
|
int code = -1;
|
313
323
|
|
324
|
+
m_bCancel = false;
|
325
|
+
|
314
326
|
try{
|
315
327
|
closeConnection();
|
316
328
|
m_connection = RhoClassFactory.getNetworkAccess().connect(strUrl, false);
|
@@ -322,26 +334,58 @@ public class NetRequest
|
|
322
334
|
m_connection.setRequestProperty("Cookie", strSession );
|
323
335
|
}
|
324
336
|
|
337
|
+
m_connection.setRequestProperty("Connection", "keep-alive");
|
325
338
|
m_connection.setRequestProperty("content-type", szMultipartContType);
|
326
339
|
writeHeaders(headers);
|
327
340
|
m_connection.setRequestMethod(IHttpConnection.POST);
|
328
341
|
|
329
342
|
//PUSH specific
|
343
|
+
processMultipartItems( arItems );
|
330
344
|
os = m_connection.openOutputStream();
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
345
|
+
//write all items
|
346
|
+
for( int i = 0; i < (int)arItems.size(); i++ )
|
347
|
+
{
|
348
|
+
MultipartItem oItem = (MultipartItem)arItems.elementAt(i);
|
349
|
+
os.write(oItem.m_strDataPrefix.getBytes(), 0, oItem.m_strDataPrefix.length());
|
350
|
+
|
351
|
+
if ( oItem.m_strFilePath.length() > 0 )
|
352
|
+
{
|
353
|
+
|
354
|
+
SimpleFile file = null;
|
355
|
+
InputStream fis = null;
|
356
|
+
|
357
|
+
try{
|
358
|
+
file = RhoClassFactory.createFile();
|
359
|
+
file.open(oItem.m_strFilePath, true, true);
|
360
|
+
|
361
|
+
if ( !file.isOpened() ){
|
362
|
+
LOG.ERROR("File not found: " + oItem.m_strFilePath);
|
363
|
+
throw new RuntimeException("File not found:" + oItem.m_strFilePath);
|
364
|
+
}
|
365
|
+
|
366
|
+
fis = file.getInputStream();
|
367
|
+
byte[] byteBuffer = new byte[1024*4];
|
368
|
+
int nRead = 0;
|
369
|
+
do{
|
370
|
+
nRead = fis.read(byteBuffer);
|
371
|
+
if ( nRead > 0 )
|
372
|
+
os.write(byteBuffer, 0, nRead);
|
373
|
+
}while( nRead > 0 );
|
374
|
+
}finally{
|
375
|
+
if (fis != null)
|
376
|
+
try{ fis.close(); }catch(IOException e){}
|
377
|
+
|
378
|
+
if ( file != null )
|
379
|
+
try{ file.close(); }catch(IOException e){}
|
380
|
+
}
|
381
|
+
|
382
|
+
}else
|
383
|
+
{
|
384
|
+
os.write(oItem.m_strBody.getBytes(), 0, oItem.m_strBody.length());
|
385
|
+
}
|
386
|
+
}
|
343
387
|
os.write(szMultipartPostfix.getBytes(), 0, szMultipartPostfix.length());
|
344
|
-
os.flush();
|
388
|
+
//os.flush();
|
345
389
|
//PUSH specific
|
346
390
|
|
347
391
|
is = m_connection.openInputStream();
|
@@ -371,9 +415,6 @@ public class NetRequest
|
|
371
415
|
readHeaders(headers);
|
372
416
|
}finally{
|
373
417
|
try{
|
374
|
-
if (fis != null)
|
375
|
-
fis.close();
|
376
|
-
|
377
418
|
if ( is != null )
|
378
419
|
is.close();
|
379
420
|
if (os != null)
|
@@ -384,6 +425,7 @@ public class NetRequest
|
|
384
425
|
}catch(IOException exc2){}
|
385
426
|
}
|
386
427
|
|
428
|
+
copyHashtable(m_OutHeaders, headers);
|
387
429
|
return makeResponse(strRespBody, code );
|
388
430
|
}
|
389
431
|
|
@@ -397,7 +439,8 @@ public class NetRequest
|
|
397
439
|
|
398
440
|
m_nMaxPacketSize = RhoClassFactory.getNetworkAccess().getMaxPacketSize();
|
399
441
|
m_bFlushFileAfterWrite = RhoConf.getInstance().getBool("use_persistent_storage");
|
400
|
-
|
442
|
+
m_bCancel = false;
|
443
|
+
|
401
444
|
try{
|
402
445
|
|
403
446
|
if (!strFileName.startsWith("file:")) {
|
@@ -413,19 +456,8 @@ public class NetRequest
|
|
413
456
|
file.open(strFileName, "rw");
|
414
457
|
file.seek(file.size());
|
415
458
|
|
416
|
-
int nFailTry = 0;
|
417
459
|
do{
|
418
|
-
|
419
|
-
try{
|
420
|
-
resp = pullFile1( strUrl, file, file.size(), oSession, headers );
|
421
|
-
}catch(IOException e)
|
422
|
-
{
|
423
|
-
if ( m_bCancel || nFailTry+1 >= MAX_NETREQUEST_RETRY )
|
424
|
-
throw e;
|
425
|
-
|
426
|
-
nFailTry++;
|
427
|
-
m_nCurDownloadSize = 1;
|
428
|
-
}
|
460
|
+
resp = pullFile1( strUrl, file, file.size(), oSession, headers );
|
429
461
|
}while( !m_bCancel && (resp == null || resp.isOK()) && m_nCurDownloadSize > 0 && m_nMaxPacketSize > 0 );
|
430
462
|
|
431
463
|
}finally{
|
@@ -441,7 +473,6 @@ public class NetRequest
|
|
441
473
|
return resp != null && !m_bCancel ? resp : makeResponse("", IHttpConnection.HTTP_INTERNAL_ERROR );
|
442
474
|
}
|
443
475
|
|
444
|
-
static byte[] m_byteDownloadBuffer = new byte[1024*20];
|
445
476
|
NetResponse pullFile1( String strUrl, IRAFile file, long nStartPos, IRhoSession oSession, Hashtable headers )throws Exception
|
446
477
|
{
|
447
478
|
String strRespBody = null;
|
@@ -498,12 +529,13 @@ public class NetRequest
|
|
498
529
|
int nRead = 0;
|
499
530
|
|
500
531
|
is = m_connection.openInputStream();
|
501
|
-
|
532
|
+
byte[] byteBuffer = new byte[1024*20];
|
533
|
+
|
502
534
|
do{
|
503
|
-
nRead = /*bufferedReadByByte(m_byteBuffer, is);*/is.read(
|
535
|
+
nRead = /*bufferedReadByByte(m_byteBuffer, is);*/is.read(byteBuffer);
|
504
536
|
if ( nRead > 0 )
|
505
537
|
{
|
506
|
-
file.write(
|
538
|
+
file.write(byteBuffer, 0, nRead);
|
507
539
|
|
508
540
|
if (m_bFlushFileAfterWrite)
|
509
541
|
file.sync();
|
@@ -573,62 +605,6 @@ public class NetRequest
|
|
573
605
|
m_bCancel = true;
|
574
606
|
closeConnection();
|
575
607
|
}
|
576
|
-
/*
|
577
|
-
private static void parseCookie(String value, ParsedCookie cookie) {
|
578
|
-
boolean bAuth = false;
|
579
|
-
boolean bSession = false;
|
580
|
-
Tokenizer stringtokenizer = new Tokenizer(value, ";");
|
581
|
-
while (stringtokenizer.hasMoreTokens()) {
|
582
|
-
String tok = stringtokenizer.nextToken();
|
583
|
-
tok = tok.trim();
|
584
|
-
if (tok.length() == 0) {
|
585
|
-
continue;
|
586
|
-
}
|
587
|
-
|
588
|
-
int i = 0;
|
589
|
-
if ( (i=tok.indexOf("auth_token=")) >= 0 )
|
590
|
-
{
|
591
|
-
String val = tok.substring(i+11);
|
592
|
-
val.trim();
|
593
|
-
if ( val.length() > 0 )
|
594
|
-
{
|
595
|
-
cookie.strAuth = "auth_token=" + val;
|
596
|
-
bAuth = true;
|
597
|
-
}
|
598
|
-
}else if ( (i=tok.indexOf("path=")) >= 0 )
|
599
|
-
{
|
600
|
-
String val = tok.substring(i+6);
|
601
|
-
val.trim();
|
602
|
-
if ( val.length() > 0 )
|
603
|
-
{
|
604
|
-
if (bAuth)
|
605
|
-
cookie.strAuth += ";path=" + val;
|
606
|
-
else if (bSession)
|
607
|
-
cookie.strSession += ";path=" + val;
|
608
|
-
}
|
609
|
-
}else if ( (i=tok.indexOf("rhosync_session=")) >= 0 )
|
610
|
-
{
|
611
|
-
String val = tok.substring(i+16);
|
612
|
-
val.trim();
|
613
|
-
if ( val.length() > 0 )
|
614
|
-
{
|
615
|
-
cookie.strSession = "rhosync_session=" + val;
|
616
|
-
bSession = true;
|
617
|
-
}
|
618
|
-
}
|
619
|
-
}
|
620
|
-
}*/
|
621
|
-
/*
|
622
|
-
private static String extractToc(String toc_name, String data) {
|
623
|
-
int start = data.indexOf(toc_name);
|
624
|
-
if (start != -1) {
|
625
|
-
int end = data.indexOf(';', start);
|
626
|
-
if (end != -1) {
|
627
|
-
return data.substring(start, end);
|
628
|
-
}
|
629
|
-
}
|
630
|
-
return null;
|
631
|
-
}*/
|
632
608
|
|
633
609
|
/*static{
|
634
610
|
TEST();
|
@@ -662,89 +638,30 @@ public class NetRequest
|
|
662
638
|
LOG.INFO("Set-Cookie: " + strValue);
|
663
639
|
|
664
640
|
strRes += URI.parseCookie(strValue);
|
665
|
-
//parseCookie(strValue, cookie);
|
666
|
-
// Hack to make it work on 4.6 device which doesn't parse
|
667
|
-
// cookies correctly
|
668
|
-
// if (cookie.strAuth==null) {
|
669
|
-
// String auth = extractToc("auth_token", header_field);
|
670
|
-
// cookie.strAuth = auth;
|
671
|
-
// System.out.println("Extracted auth_token: " + auth);
|
672
|
-
// }
|
673
|
-
/*if (cookie.strSession == null) {
|
674
|
-
String rhosync_session = extractToc("rhosync_session", strValue);
|
675
|
-
cookie.strSession = rhosync_session;
|
676
|
-
LOG.INFO("Extracted rhosync_session: " + rhosync_session);
|
677
|
-
}*/
|
678
641
|
}
|
679
642
|
}
|
680
643
|
|
681
644
|
return strRes;
|
682
645
|
}
|
683
|
-
/*
|
684
|
-
private final StringBuffer readFully(InputStream in) throws Exception
|
685
|
-
{
|
686
|
-
boolean bReadByBytes = false;
|
687
|
-
if ( RhoConf.getInstance().getInt("bb_netreadbybytes") > 0 )
|
688
|
-
bReadByBytes = RhoClassFactory.createRhoRubyHelper().isSimulator();
|
689
|
-
|
690
|
-
StringBuffer buffer = new StringBuffer();
|
691
|
-
UTF8StreamReader reader = new UTF8StreamReader(4096,bReadByBytes);
|
692
|
-
reader.setInput(in);
|
693
|
-
while (true) {
|
694
|
-
synchronized (m_charBuffer) {
|
695
|
-
int len = reader.read(m_charBuffer);
|
696
|
-
if (len < 0) {
|
697
|
-
break;
|
698
|
-
}
|
699
|
-
buffer.append(m_charBuffer, 0, len);
|
700
|
-
}
|
701
|
-
}
|
702
|
-
return buffer;
|
703
|
-
}*/
|
704
646
|
|
705
647
|
private final String readFully(InputStream in) throws Exception
|
706
648
|
{
|
707
649
|
String strRes = "";
|
708
|
-
|
709
|
-
int nRead = 0;
|
710
|
-
do{
|
711
|
-
nRead = in.read(m_byteBuffer);
|
712
|
-
if (nRead>0)
|
713
|
-
{
|
714
|
-
String strTemp = new String(m_byteBuffer,0,nRead);
|
715
|
-
strRes += strTemp;
|
716
|
-
}
|
717
|
-
}while( nRead > 0 );
|
718
|
-
}
|
650
|
+
byte[] byteBuffer = new byte[1024*4];
|
719
651
|
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
if (read < 0) {
|
728
|
-
break;
|
652
|
+
int nRead = 0;
|
653
|
+
do{
|
654
|
+
nRead = in.read(byteBuffer);
|
655
|
+
if (nRead>0)
|
656
|
+
{
|
657
|
+
String strTemp = new String(byteBuffer,0,nRead);
|
658
|
+
strRes += strTemp;
|
729
659
|
}
|
730
|
-
|
731
|
-
|
732
|
-
return
|
660
|
+
}while( nRead > 0 );
|
661
|
+
|
662
|
+
return strRes;
|
733
663
|
}
|
734
664
|
|
735
|
-
private final int bufferedReadByByte(byte[] a, InputStream in) throws IOException {
|
736
|
-
int bytesRead = 0;
|
737
|
-
while (bytesRead < (a.length)) {
|
738
|
-
int read = in.read();// a, 0, a.length );
|
739
|
-
if (read < 0) {
|
740
|
-
return bytesRead > 0 ? bytesRead : -1;
|
741
|
-
}
|
742
|
-
a[bytesRead] = (byte)read;
|
743
|
-
bytesRead ++;
|
744
|
-
}
|
745
|
-
return bytesRead;
|
746
|
-
}*/
|
747
|
-
|
748
665
|
public void closeConnection(){
|
749
666
|
if ( m_connection != null ){
|
750
667
|
try{
|