rhodes 2.2.4.beta.1 → 2.2.5.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +10 -0
- data/Rakefile +119 -3
- data/lib/build/jake.rb +15 -1
- data/lib/framework/dateME.rb +6 -1
- data/lib/framework/rho/render.rb +18 -15
- data/lib/framework/rho/rho.rb +105 -43
- data/lib/framework/rho/rhoapplication.rb +1 -1
- data/lib/framework/rho/rhocontact.rb +41 -13
- data/lib/framework/rho/rhocontroller.rb +10 -1
- data/lib/framework/rho/rhoevent_c.rb +6 -1
- data/lib/framework/rho/rhosupport.rb +1 -1
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rholang/rhomsg_de.rb +1 -1
- data/lib/framework/rholang/rhomsg_es.rb +1 -1
- data/lib/framework/rholang/rhomsg_it.rb +28 -0
- data/lib/framework/rhom/rhom.rb +6 -0
- data/lib/framework/rhom/rhom_model.rb +14 -7
- data/lib/framework/rhom/rhom_object_factory.rb +121 -56
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.full.xml +62 -0
- data/platform/android/Rhodes/AndroidManifest.xml +3 -34
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +17 -2
- data/platform/android/Rhodes/jni/src/alert.cpp +16 -0
- data/platform/android/Rhodes/jni/src/callbacks.cpp +27 -3
- data/platform/android/Rhodes/jni/src/nativebar.cpp +3 -0
- data/platform/android/Rhodes/jni/src/nativeview.cpp +131 -1
- data/platform/android/Rhodes/jni/src/phonebook.cpp +102 -41
- data/platform/android/Rhodes/jni/src/rhodes.cpp +113 -32
- data/platform/android/Rhodes/jni/src/ringtones.cpp +1 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +9 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +184 -49
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +49 -25
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +104 -57
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +36 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +24 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +7 -8
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +185 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +54 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Contact.java +107 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +72 -24
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorOld.java +22 -21
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +91 -11
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +10 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java +11 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +10 -0
- data/platform/android/build/android.rake +50 -9
- data/platform/android/build/librhocommon_build.files +1 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Parser.java +3 -2
- data/platform/bb/Hsqldb/src/org/hsqldb/SchemaManager.java +3 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Session.java +7 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +2 -2
- data/platform/bb/RubyVM/RubyVM.jdp +1 -0
- data/platform/bb/RubyVM/src/com/rho/AppBuildConfig.java +22 -0
- data/platform/bb/RubyVM/src/com/rho/RhoRuby.java +5 -0
- data/platform/bb/RubyVM/src/com/rho/net/RhoConnection.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +51 -4
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +21 -10
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +82 -33
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +59 -6
- data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyFloat_Methods.java +5 -0
- data/platform/bb/RubyVM/src/com/xruby/GeneratedMethods/RubyString_Methods.java +19 -7
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/ArrayPacker.java +1 -1
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyFloat.java +5 -0
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyString.java +55 -11
- data/platform/bb/RubyVM/src/com/xruby/runtime/builtin/RubyTime.java +18 -2
- data/platform/bb/RubyVM/src/com/xruby/runtime/lang/RubyKernelModule.java +8 -5
- data/platform/bb/RubyVM/src/j2me/lang/CharacterMe.java +1 -1
- data/platform/bb/RubyVM/src/j2me/util/StringParser.java +2 -0
- data/platform/bb/build/RubyVM_build.files +1 -0
- data/platform/bb/build/bb.rake +21 -2
- data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +3 -3
- data/platform/bb/rhodes/platform/common/com/rho/RhoMainScreen.java +1 -1
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +1 -2
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +15 -16
- data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +4 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +58 -0
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +90 -4
- data/platform/iphone/Classes/AppManager/AppManager.m +43 -5
- data/platform/iphone/Classes/Event/Event.h +2 -0
- data/platform/iphone/Classes/Event/Event.m +12 -1
- data/platform/iphone/Classes/GeoLocation/LocationController.m +9 -3
- data/platform/iphone/Classes/MapView/MapViewController.m +20 -9
- data/platform/iphone/Classes/NativeBar.m +27 -0
- data/platform/iphone/Classes/Phonebook/phonebook.m +17 -0
- data/platform/iphone/Classes/RhoAlert.m +61 -1
- data/platform/iphone/Classes/RhoMainView.h +1 -0
- data/platform/iphone/Classes/Rhodes.h +2 -0
- data/platform/iphone/Classes/Rhodes.m +108 -1
- data/platform/iphone/Classes/SimpleMainView.h +4 -0
- data/platform/iphone/Classes/SimpleMainView.m +30 -3
- data/platform/iphone/Classes/SplashViewController.m +3 -1
- data/platform/iphone/Classes/TabbedMainView.h +2 -0
- data/platform/iphone/Classes/TabbedMainView.m +63 -11
- data/platform/iphone/Classes/rho/net/NetRequestImpl.m +26 -0
- data/platform/iphone/Info.plist +12 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +8 -0
- data/platform/iphone/rbuild/iphone.rake +181 -25
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +5 -5
- data/platform/shared/common/IRhoThreadImpl.h +1 -1
- data/platform/shared/common/PosixThreadImpl.cpp +5 -3
- data/platform/shared/common/PosixThreadImpl.h +1 -1
- data/platform/shared/common/RhoFilePath.h +11 -0
- data/platform/shared/common/RhoNativeViewManager.h +17 -0
- data/platform/shared/common/RhoThread.h +1 -1
- data/platform/shared/common/RhodesApp.cpp +29 -8
- data/platform/shared/common/ThreadQueue.cpp +5 -3
- data/platform/shared/common/ThreadQueue.h +2 -1
- data/platform/shared/common/app_build_configs.c +25 -0
- data/platform/shared/common/app_build_configs.h +11 -0
- data/platform/shared/net/AsyncHttp.cpp +5 -5
- data/platform/shared/net/CURLNetRequest.cpp +25 -7
- data/platform/shared/net/CURLNetRequest.h +2 -1
- data/platform/shared/net/HttpServer.cpp +28 -0
- data/platform/shared/ruby/ext/nativebar/nativebar.i +3 -0
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +26 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +6 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +1 -0
- data/platform/shared/ruby/ext/rho/rhosupport.c +15 -2
- data/platform/shared/ruby/ext/syncengine/syncengine.i +14 -2
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +97 -2
- data/platform/shared/ruby/ext/system/system.i +13 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +104 -1
- data/platform/shared/rubyext/RhoAppAdapter.cpp +7 -0
- data/platform/shared/sync/SyncEngine.cpp +43 -3
- data/platform/shared/sync/SyncEngine.h +13 -0
- data/platform/shared/sync/SyncNotify.cpp +41 -23
- data/platform/shared/sync/SyncNotify.h +18 -4
- data/platform/shared/sync/SyncSource.cpp +52 -14
- data/platform/shared/sync/SyncSource.h +1 -0
- data/platform/shared/sync/SyncThread.cpp +29 -9
- data/platform/shared/sync/SyncThread.h +4 -2
- data/platform/wm/RhoLib/RhoLib.vcproj +8 -0
- data/platform/wm/build/build_inf.js +15 -9
- data/platform/wm/build/wm.rake +10 -5
- data/platform/wm/rhodes/Alert.cpp +10 -0
- data/platform/wm/rhodes/Alert.h +3 -3
- data/platform/wm/rhodes/MainWindow.cpp +171 -26
- data/platform/wm/rhodes/MainWindow.h +23 -1
- data/platform/wm/rhodes/MetaHandler.cpp +192 -0
- data/platform/wm/rhodes/MetaHandler.h +31 -0
- data/platform/wm/rhodes/RhoNativeViewManager.cpp +126 -0
- data/platform/wm/rhodes/RhoNativeViewManagerWM.h +20 -0
- data/platform/wm/rhodes/Rhodes.cpp +91 -2
- data/platform/wm/rhodes/Rhodes.rc +15 -6
- data/platform/wm/rhodes/SyncStatusDlg.cpp +32 -0
- data/platform/wm/rhodes/SyncStatusDlg.h +29 -0
- data/platform/wm/rhodes/resource.h +5 -2
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.cpp +3 -1
- data/platform/wm/rhodes/rho/common/RhoThreadImpl.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +146 -14
- data/platform/wm/rhodes/rhodes.vcproj +28 -0
- data/rakefile.rb +119 -3
- data/res/build-tools/iphonesim/README +58 -0
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.h +43 -0
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +224 -0
- data/res/build-tools/iphonesim/Source/main.m +52 -0
- data/res/build-tools/iphonesim/Source/nsprintf.h +3 -0
- data/res/build-tools/iphonesim/Source/nsprintf.m +42 -0
- data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
- data/res/build-tools/iphonesim/iPhoneSimulatorRemoteClient/iPhoneSimulatorRemoteClient.h +124 -0
- data/res/build-tools/iphonesim/iphonesim.xcodeproj/project.pbxproj +261 -0
- data/res/build-tools/iphonesim/iphonesim_Prefix.pch +7 -0
- data/res/generators/rhogen.rb +5 -0
- data/res/generators/templates/application/app/layout.erb +7 -13
- data/res/generators/templates/application/app/loading.png +0 -0
- data/res/generators/templates/application/build.yml +3 -0
- data/res/generators/templates/application/icon/icon114.png +0 -0
- data/res/generators/templates/application/icon/icon57.png +0 -0
- data/res/generators/templates/application/icon/icon72.png +0 -0
- data/res/generators/templates/application/public/css/iphone.css +96 -0
- data/res/generators/templates/application/public/images/backButton.png +0 -0
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +2 -1
- data/res/generators/templates/application/rhoconfig.txt +2 -0
- data/rhodes.gemspec +1 -1
- data/spec/phone_spec/app/spec/array_pack_spec.rb +108 -0
- data/spec/phone_spec/app/spec/bulksync_spec.rb +1 -0
- data/spec/phone_spec/app/spec/date_spec.rb +27 -0
- data/spec/phone_spec/app/spec/fixtures/classes.rb +91 -0
- data/spec/phone_spec/app/spec/lstrip_spec.rb +57 -0
- data/spec/phone_spec/app/spec/rho_spec.rb +50 -19
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +78 -0
- data/spec/phone_spec/app/spec/rstrip_spec.rb +51 -0
- data/spec/phone_spec/app/spec/strip_spec.rb +50 -0
- data/spec/phone_spec/app/spec/syncengine_spec.rb +46 -3
- data/spec/phone_spec/app/spec_runner.rb +6 -0
- metadata +34 -4
@@ -129,7 +129,8 @@ def set_app_name_android(newname)
|
|
129
129
|
doc.elements.delete "manifest/application/uses-library[@android:name='com.google.android.maps']" unless $use_geomapping
|
130
130
|
|
131
131
|
caps_proc = []
|
132
|
-
|
132
|
+
# Default permissions. Need to be always enabled.
|
133
|
+
caps = ['INTERNET', 'PERSISTENT_ACTIVITY', 'WAKE_LOCK', 'ACCESS_NETWORK_STATE']
|
133
134
|
$app_config["capabilities"].each do |cap|
|
134
135
|
cap = ANDROID_PERMISSIONS[cap]
|
135
136
|
next if cap.nil?
|
@@ -146,19 +147,37 @@ def set_app_name_android(newname)
|
|
146
147
|
manifest = doc.elements["manifest"]
|
147
148
|
|
148
149
|
manifest.elements.each('uses-sdk') { |e| manifest.delete e }
|
150
|
+
|
149
151
|
element = REXML::Element.new('uses-sdk')
|
150
152
|
element.add_attribute('android:minSdkVersion', ANDROID_API_LEVEL.to_s)
|
151
153
|
manifest.add element
|
152
154
|
|
155
|
+
# Remove category LAUNCHER from all activities if hidden_app is set
|
156
|
+
hidden_app = get_boolean($app_config['hidden_app'])
|
157
|
+
if hidden_app
|
158
|
+
manifest.elements.each('application') do |app|
|
159
|
+
app.elements.each('activity') do |activity|
|
160
|
+
activity.elements.each('intent-filter') do |intf|
|
161
|
+
intf.elements.each('category') do |c|
|
162
|
+
name = c.attribute('name', 'android')
|
163
|
+
next if name.nil?
|
164
|
+
intf.delete(c) if name.to_s == 'android.intent.category.LAUNCHER'
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
153
171
|
# Clear C2DM stuff
|
154
|
-
doc.elements.delete "manifest/application/receiver[@android:name='
|
172
|
+
doc.elements.delete "manifest/application/receiver[@android:name='#{JAVA_PACKAGE_NAME}.PushReceiver']"
|
155
173
|
manifest.elements.each('permission') do |e|
|
156
174
|
name = e.attribute('name', 'android')
|
157
175
|
next if name.nil?
|
158
176
|
manifest.delete(e) if name.to_s =~ /\.C2D_MESSAGE$/
|
159
177
|
end
|
160
178
|
|
161
|
-
manifest.elements.each('uses-permission') { |e| manifest.delete e }
|
179
|
+
#manifest.elements.each('uses-permission') { |e| manifest.delete e }
|
180
|
+
|
162
181
|
caps.sort.each do |cap|
|
163
182
|
element = REXML::Element.new('uses-permission')
|
164
183
|
element.add_attribute('android:name', "android.permission.#{cap}")
|
@@ -250,7 +269,10 @@ namespace "config" do
|
|
250
269
|
$libs = File.join($androidpath, "Rhodes", "libs")
|
251
270
|
$appname = $app_config["name"]
|
252
271
|
$appname = "Rhodes" if $appname.nil?
|
253
|
-
$
|
272
|
+
$vendor = $app_config["vendor"]
|
273
|
+
$vendor = "rhomobile" if $vendor.nil?
|
274
|
+
$vendor = $vendor.gsub(/^[^A-Za-z]/, '_').gsub(/[^A-Za-z0-9]/, '_').gsub(/_+/, '_').downcase
|
275
|
+
$app_package_name = "com.#{$vendor}." + $appname.downcase.gsub(/[^A-Za-z_0-9]/, '')
|
254
276
|
|
255
277
|
$rhomanifest = File.join $androidpath, "Rhodes", "AndroidManifest.xml"
|
256
278
|
$appmanifest = File.join $tmpdir, "AndroidManifest.xml"
|
@@ -416,9 +438,13 @@ namespace "config" do
|
|
416
438
|
puts "+++ API LEVEL of #{dir}: #{apilevel}" if USE_TRACES
|
417
439
|
|
418
440
|
if apilevel > napilevel
|
419
|
-
|
420
|
-
|
421
|
-
|
441
|
+
|
442
|
+
sgapijar = File.join(dir, 'libs', 'maps.jar')
|
443
|
+
if File.exists? sgapijar
|
444
|
+
napilevel = apilevel
|
445
|
+
$gapijar = sgapijar
|
446
|
+
$found_api_level = apilevel
|
447
|
+
end
|
422
448
|
end
|
423
449
|
end
|
424
450
|
if $gapijar.nil?
|
@@ -435,6 +461,11 @@ namespace "config" do
|
|
435
461
|
$avdname += "ext" if $use_google_addon_api
|
436
462
|
$avdtarget = $androidtargets[get_api_level($emuversion)]
|
437
463
|
|
464
|
+
$appavdname = nil
|
465
|
+
if $app_config["android"] != nil
|
466
|
+
$appavdname = $app_config["android"]["emulator"]
|
467
|
+
end
|
468
|
+
|
438
469
|
setup_ndk($androidndkpath, ANDROID_API_LEVEL)
|
439
470
|
|
440
471
|
$stlport_includes = File.join $shareddir, "stlport", "stlport"
|
@@ -831,7 +862,6 @@ namespace "build" do
|
|
831
862
|
end
|
832
863
|
|
833
864
|
# Generate Push.java
|
834
|
-
puts "app_push_java: #{$app_push_java.inspect}"
|
835
865
|
File.open($app_push_java, "w") do |f|
|
836
866
|
f.puts "package #{JAVA_PACKAGE_NAME};"
|
837
867
|
f.puts "public class Push {"
|
@@ -1100,7 +1130,7 @@ namespace "package" do
|
|
1100
1130
|
end
|
1101
1131
|
|
1102
1132
|
def get_app_log(appname, device, silent = false)
|
1103
|
-
pkgname =
|
1133
|
+
pkgname = "com.#{$vendor}." + appname.downcase.gsub(/[^A-Za-z_0-9]/, '')
|
1104
1134
|
path = File.join('/data/data', pkgname, 'rhodata', 'RhoLog.txt')
|
1105
1135
|
cc_run($adb, [device ? '-d' : '-e', 'pull', path, $app_path]) or return false
|
1106
1136
|
puts "RhoLog.txt stored to " + $app_path unless silent
|
@@ -1139,6 +1169,10 @@ namespace "device" do
|
|
1139
1169
|
#remove temporary files
|
1140
1170
|
rm_rf simple_apkfile
|
1141
1171
|
|
1172
|
+
File.open(File.join(File.dirname(final_apkfile), "app_info.txt"), "w") do |f|
|
1173
|
+
f.puts $app_package_name
|
1174
|
+
end
|
1175
|
+
|
1142
1176
|
end
|
1143
1177
|
|
1144
1178
|
task :install => :debug do
|
@@ -1224,6 +1258,10 @@ namespace "device" do
|
|
1224
1258
|
#remove temporary files
|
1225
1259
|
rm_rf simple_apkfile
|
1226
1260
|
rm_rf signed_apkfile
|
1261
|
+
|
1262
|
+
File.open(File.join(File.dirname(final_apkfile), "app_info.txt"), "w") do |f|
|
1263
|
+
f.puts $app_package_name
|
1264
|
+
end
|
1227
1265
|
end
|
1228
1266
|
|
1229
1267
|
task :getlog => "config:android" do
|
@@ -1372,6 +1410,9 @@ namespace "run" do
|
|
1372
1410
|
puts 'Sleep for 5 sec. waiting for "adb start-server"'
|
1373
1411
|
sleep 5
|
1374
1412
|
|
1413
|
+
if $appavdname != nil
|
1414
|
+
$avdname = $appavdname
|
1415
|
+
end
|
1375
1416
|
createavd = "\"#{$androidbin}\" create avd --name #{$avdname} --target #{$avdtarget} --sdcard 32M --skin HVGA"
|
1376
1417
|
system(createavd) unless File.directory?( File.join(ENV['HOME'], ".android", "avd", "#{$avdname}.avd" ) )
|
1377
1418
|
|
@@ -8,6 +8,7 @@ platform/shared/common/SplashScreen.cpp
|
|
8
8
|
platform/shared/common/Tokenizer.cpp
|
9
9
|
platform/shared/common/AppMenu.cpp
|
10
10
|
platform/shared/common/rhoparams.cpp
|
11
|
+
platform/shared/common/app_build_configs.c
|
11
12
|
platform/shared/net/AsyncHttp.cpp
|
12
13
|
platform/shared/net/CURLNetRequest.cpp
|
13
14
|
platform/shared/net/HttpServer.cpp
|
@@ -235,11 +235,12 @@ class Parser {
|
|
235
235
|
if (full) {
|
236
236
|
String token = t.getSimpleName();
|
237
237
|
boolean quoted = t.wasQuotedIdentifier();
|
238
|
-
HsqlName name = db.nameManager.newHsqlName(token
|
238
|
+
HsqlName name = db.nameManager.newHsqlName(t.sTokenOrig/*token*/, quoted);
|
239
239
|
|
240
240
|
columns.add(name);
|
241
241
|
} else {
|
242
|
-
|
242
|
+
String token = t.getName();
|
243
|
+
columns.add(t.sTokenOrig);
|
243
244
|
|
244
245
|
if (t.wasLongName()
|
245
246
|
&& !t.getLongNameFirst().equals(
|
@@ -351,7 +351,9 @@ public class SchemaManager {
|
|
351
351
|
String schema) throws HsqlException {
|
352
352
|
|
353
353
|
Table t = findUserTable(session, name, schema);
|
354
|
-
|
354
|
+
if (t == null)
|
355
|
+
t = findUserTable(session, session.getOrigToken(), schema);
|
356
|
+
|
355
357
|
if (t == null) {
|
356
358
|
if (!INFORMATION_SCHEMA.equals(schema)) {
|
357
359
|
throw Trace.error(Trace.TABLE_NOT_FOUND);
|
@@ -159,6 +159,13 @@ public class Session implements SessionInterface {
|
|
159
159
|
Session getSession() {
|
160
160
|
return this;
|
161
161
|
}
|
162
|
+
String getOrigToken()
|
163
|
+
{
|
164
|
+
if ( tokenizer!= null)
|
165
|
+
return tokenizer.sTokenOrig;
|
166
|
+
|
167
|
+
return "";
|
168
|
+
}
|
162
169
|
|
163
170
|
//RHO
|
164
171
|
private IDBCallback m_dbCallback;
|
@@ -380,7 +380,7 @@ public class Tokenizer {
|
|
380
380
|
return false;
|
381
381
|
}
|
382
382
|
|
383
|
-
return !Token.isKeyword(
|
383
|
+
return !Token.isKeyword(sTokenOrig);
|
384
384
|
}
|
385
385
|
|
386
386
|
String getLongNamePre() throws HsqlException {
|
@@ -874,7 +874,7 @@ public class Tokenizer {
|
|
874
874
|
iIndex++;
|
875
875
|
|
876
876
|
sToken = getString('"');//.toUpperCase();
|
877
|
-
|
877
|
+
sTokenOrig = sToken;
|
878
878
|
if (iIndex == sCommand.length()) {
|
879
879
|
return;
|
880
880
|
}
|
@@ -67,6 +67,7 @@ src\com\rho\Sprintf.java
|
|
67
67
|
src\com\rho\StringScanner.java
|
68
68
|
src\com\rho\Capabilities.java
|
69
69
|
src\com\rho\Extensions.java
|
70
|
+
src\com\rho\AppBuildConfig.java
|
70
71
|
src\com\rho\sync\ClientRegister.java
|
71
72
|
src\com\rho\sync\ISyncStatusListener.java
|
72
73
|
src\com\rho\sync\JSONArrayIterator.java
|
@@ -0,0 +1,22 @@
|
|
1
|
+
// WARNING! THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT IT MANUALLY!
|
2
|
+
// Generated 2010-12-07 21:11:23 +0300
|
3
|
+
package com.rho;
|
4
|
+
|
5
|
+
public class AppBuildConfig {
|
6
|
+
static final String keys[] = { ""
|
7
|
+
};
|
8
|
+
|
9
|
+
static final String values[] = { ""
|
10
|
+
};
|
11
|
+
|
12
|
+
static final int APP_BUILD_CONFIG_COUNT = 1;
|
13
|
+
|
14
|
+
public static String getItem(String key){
|
15
|
+
for (int i = 1; i < APP_BUILD_CONFIG_COUNT; i++) {
|
16
|
+
if ( key.compareTo( keys[i]) == 0) {
|
17
|
+
return values[i];
|
18
|
+
}
|
19
|
+
}
|
20
|
+
return null;
|
21
|
+
}
|
22
|
+
}
|
@@ -30,6 +30,7 @@ public class RhoRuby {
|
|
30
30
|
public static final RubyID raiseRhoError = RubyID.intern("raise_rhoerror");
|
31
31
|
public static final RubyID initApp = RubyID.intern("init_app");
|
32
32
|
public static final RubyID activateApp = RubyID.intern("activate_app");
|
33
|
+
public static final RubyID deactivateApp = RubyID.intern("deactivate_app");
|
33
34
|
|
34
35
|
// public static final RubyID getStartPath = RubyID.intern("get_start_path");
|
35
36
|
// public static final RubyID getOptionsPath = RubyID.intern("get_options_path");
|
@@ -82,6 +83,10 @@ public class RhoRuby {
|
|
82
83
|
RubyAPI.callPublicNoArgMethod(receiver, null, activateApp);
|
83
84
|
}
|
84
85
|
|
86
|
+
public static void rho_ruby_deactivateApp(){
|
87
|
+
RubyAPI.callPublicNoArgMethod(receiver, null, deactivateApp);
|
88
|
+
}
|
89
|
+
|
85
90
|
public static boolean rho_ruby_isValid(){
|
86
91
|
return receiver!= null && receiver != RubyConstant.QNIL;
|
87
92
|
}
|
@@ -689,7 +689,7 @@ public class RhoConnection implements IHttpConnection {
|
|
689
689
|
|
690
690
|
protected boolean dispatch()throws IOException
|
691
691
|
{
|
692
|
-
LOG.INFO("dispatch start : " + uri.getPath());
|
692
|
+
//LOG.INFO("dispatch start : " + uri.getPath());
|
693
693
|
|
694
694
|
UrlParser up = new UrlParser(uri.getPath());
|
695
695
|
String apps = up.next();
|
@@ -66,6 +66,50 @@ public class SyncEngine implements NetRequest.IRhoSession
|
|
66
66
|
}
|
67
67
|
};
|
68
68
|
|
69
|
+
static class SourceOptions
|
70
|
+
{
|
71
|
+
private Mutex m_mxSrcOptions = new Mutex();
|
72
|
+
private Hashtable/*Ptr<int, Hashtable<String,String>* >*/ m_hashSrcOptions = new Hashtable();
|
73
|
+
|
74
|
+
public void setProperty(Integer nSrcID, String szPropName, String szPropValue)
|
75
|
+
{
|
76
|
+
synchronized(m_mxSrcOptions)
|
77
|
+
{
|
78
|
+
Hashtable/*<String,String>* */phashOptions = (Hashtable)m_hashSrcOptions.get(nSrcID);
|
79
|
+
if ( phashOptions == null )
|
80
|
+
{
|
81
|
+
phashOptions = new Hashtable/*<String,String>*/();
|
82
|
+
m_hashSrcOptions.put( nSrcID, phashOptions );
|
83
|
+
}
|
84
|
+
|
85
|
+
//Hashtable<String,String>& hashOptions = *phashOptions;
|
86
|
+
phashOptions.put(szPropName,szPropValue!=null?szPropValue:"");
|
87
|
+
}
|
88
|
+
}
|
89
|
+
public String getProperty(Integer nSrcID, String szPropName)
|
90
|
+
{
|
91
|
+
String res = "";
|
92
|
+
synchronized(m_mxSrcOptions)
|
93
|
+
{
|
94
|
+
Hashtable/*<String,String>* */phashOptions = (Hashtable)m_hashSrcOptions.get(nSrcID);
|
95
|
+
if ( phashOptions != null )
|
96
|
+
{
|
97
|
+
//Hashtable<String,String>& hashOptions = *phashOptions;
|
98
|
+
res = (String)phashOptions.get(szPropName);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
return res;
|
103
|
+
}
|
104
|
+
public boolean getBoolProperty(Integer nSrcID, String szPropName)
|
105
|
+
{
|
106
|
+
String strValue = getProperty(nSrcID, szPropName);
|
107
|
+
|
108
|
+
return strValue.compareTo("1") == 0 || strValue.compareTo("true") == 0 ? true : false;
|
109
|
+
|
110
|
+
}
|
111
|
+
};
|
112
|
+
|
69
113
|
Vector/*<SyncSource*>*/ m_sources = new Vector();
|
70
114
|
Vector/*<String>*/ m_arPartitions = new Vector();
|
71
115
|
NetRequest m_NetRequest;
|
@@ -81,6 +125,7 @@ public class SyncEngine implements NetRequest.IRhoSession
|
|
81
125
|
int m_nErrCode = RhoAppAdapter.ERR_NONE;
|
82
126
|
String m_strError = "";
|
83
127
|
boolean m_bIsSearch, m_bIsSchemaChanged;
|
128
|
+
static SourceOptions m_oSourceOptions = new SourceOptions();
|
84
129
|
|
85
130
|
void setState(int eState){ m_syncState = eState; }
|
86
131
|
int getState(){ return m_syncState; }
|
@@ -112,6 +157,7 @@ public class SyncEngine implements NetRequest.IRhoSession
|
|
112
157
|
|
113
158
|
boolean isNoThreadedMode(){ return m_bNoThreaded; }
|
114
159
|
void setNonThreadedMode(boolean b){m_bNoThreaded = b;}
|
160
|
+
static SourceOptions getSourceOptions(){ return m_oSourceOptions; }
|
115
161
|
|
116
162
|
SyncEngine(){
|
117
163
|
m_NetRequest = null;
|
@@ -130,6 +176,7 @@ public class SyncEngine implements NetRequest.IRhoSession
|
|
130
176
|
|
131
177
|
void setFactory(RhoClassFactory factory)throws Exception{
|
132
178
|
m_NetRequest = RhoClassFactory.createNetRequest();
|
179
|
+
m_oSyncNotify.setFactory(factory);
|
133
180
|
}
|
134
181
|
|
135
182
|
void prepareSync(int eState, SourceID oSrcID)throws Exception
|
@@ -677,7 +724,7 @@ public class SyncEngine implements NetRequest.IRhoSession
|
|
677
724
|
{
|
678
725
|
LOG.ERROR( "Bulk sync failed: server return an error." );
|
679
726
|
stopSync();
|
680
|
-
getNotify().fireBulkSyncNotification(true, "", strPartition,
|
727
|
+
getNotify().fireBulkSyncNotification(true, "", strPartition,RhoAppAdapter.getErrorFromResponse(resp));
|
681
728
|
return;
|
682
729
|
}
|
683
730
|
|
@@ -721,7 +768,7 @@ public class SyncEngine implements NetRequest.IRhoSession
|
|
721
768
|
{
|
722
769
|
LOG.ERROR("Bulk sync failed: cannot download database file: " + resp1.getRespCode() );
|
723
770
|
stopSync();
|
724
|
-
getNotify().fireBulkSyncNotification(true, "", strPartition, RhoAppAdapter.
|
771
|
+
getNotify().fireBulkSyncNotification(true, "", strPartition, RhoAppAdapter.getErrorFromResponse(resp1));
|
725
772
|
return;
|
726
773
|
}
|
727
774
|
}
|
@@ -738,7 +785,7 @@ public class SyncEngine implements NetRequest.IRhoSession
|
|
738
785
|
{
|
739
786
|
LOG.ERROR("Bulk sync failed: cannot download database file.");
|
740
787
|
stopSync();
|
741
|
-
getNotify().fireBulkSyncNotification(true, "", strPartition, RhoAppAdapter.
|
788
|
+
getNotify().fireBulkSyncNotification(true, "", strPartition, RhoAppAdapter.getErrorFromResponse(resp1));
|
742
789
|
return;
|
743
790
|
}
|
744
791
|
}
|
@@ -828,7 +875,7 @@ public class SyncEngine implements NetRequest.IRhoSession
|
|
828
875
|
bError = !syncOneSource(i);
|
829
876
|
}
|
830
877
|
|
831
|
-
if ( !bError)
|
878
|
+
if ( !bError && !isSchemaChanged() )
|
832
879
|
getNotify().fireSyncNotification(null, true, RhoAppAdapter.ERR_NONE, RhoAppAdapter.getMessageText("sync_completed"));
|
833
880
|
}
|
834
881
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
package com.rho.sync;
|
2
2
|
|
3
3
|
import com.rho.Mutex;
|
4
|
+
import com.rho.RhoClassFactory;
|
4
5
|
import com.rho.RhoEmptyLogger;
|
5
6
|
import com.rho.RhoLogger;
|
6
7
|
import com.rho.RhoAppAdapter;
|
@@ -10,6 +11,7 @@ import java.util.Hashtable;
|
|
10
11
|
import com.rho.*;
|
11
12
|
import com.rho.db.*;
|
12
13
|
import com.rho.net.*;
|
14
|
+
|
13
15
|
import java.util.Vector;
|
14
16
|
|
15
17
|
public class SyncNotify {
|
@@ -47,19 +49,29 @@ public class SyncNotify {
|
|
47
49
|
Mutex m_mxSyncNotifications = new Mutex();
|
48
50
|
ISyncStatusListener m_syncStatusListener = null;
|
49
51
|
boolean m_bEnableReporting = false;
|
52
|
+
boolean m_bEnableReportingGlobal = true;
|
50
53
|
String m_strNotifyBody = "";
|
54
|
+
NetRequest m_NetRequest;
|
51
55
|
|
52
56
|
SyncEngine getSync(){ return m_syncEngine; }
|
53
|
-
|
57
|
+
NetRequest getNet() { return m_NetRequest;}
|
54
58
|
|
55
59
|
String getNotifyBody(){ return m_strNotifyBody; }
|
56
60
|
void cleanNotifyBody(){ m_strNotifyBody = ""; }
|
57
|
-
|
61
|
+
|
62
|
+
boolean isReportingEnabled(){return m_bEnableReporting&&m_bEnableReportingGlobal;}
|
63
|
+
void enableReporting(boolean bEnable) { m_bEnableReporting = bEnable; }
|
64
|
+
void enableStatusPopup(boolean bEnable){m_bEnableReportingGlobal = bEnable;}
|
65
|
+
|
58
66
|
SyncNotify( SyncEngine syncEngine )
|
59
67
|
{
|
60
68
|
m_syncEngine = syncEngine;
|
61
69
|
}
|
62
70
|
|
71
|
+
void setFactory(RhoClassFactory factory)throws Exception{
|
72
|
+
m_NetRequest = RhoClassFactory.createNetRequest();
|
73
|
+
}
|
74
|
+
|
63
75
|
void addObjectNotify(Integer nSrcID, String strObject)
|
64
76
|
{
|
65
77
|
synchronized(m_mxObjectNotify)
|
@@ -262,8 +274,11 @@ public class SyncNotify {
|
|
262
274
|
|
263
275
|
if ( getSync().getState() == SyncEngine.esStop && src.m_nErrCode != RhoAppAdapter.ERR_NONE )
|
264
276
|
{
|
265
|
-
|
266
|
-
|
277
|
+
SyncNotification pSN = getSyncNotifyBySrc(src);
|
278
|
+
if ( pSN != null )
|
279
|
+
fireSyncNotification(src, true, src.m_nErrCode, "");
|
280
|
+
else
|
281
|
+
fireAllSyncNotifications(true, src.m_nErrCode, src.m_strError );
|
267
282
|
}
|
268
283
|
else
|
269
284
|
fireSyncNotification( src, true, src.m_nErrCode, "");
|
@@ -316,16 +331,11 @@ public class SyncNotify {
|
|
316
331
|
}
|
317
332
|
}
|
318
333
|
|
319
|
-
void enableReporting(boolean bEnable)
|
320
|
-
{
|
321
|
-
m_bEnableReporting = bEnable;
|
322
|
-
}
|
323
|
-
|
324
334
|
public void reportSyncStatus(String status, int error, String strDetails)
|
325
335
|
{
|
326
336
|
synchronized(m_mxSyncNotifications)
|
327
337
|
{
|
328
|
-
if (m_syncStatusListener != null && (
|
338
|
+
if (m_syncStatusListener != null && (isReportingEnabled() || error == RhoAppAdapter.ERR_SYNCVERSION) ) {
|
329
339
|
|
330
340
|
if ( error == RhoAppAdapter.ERR_SYNCVERSION )
|
331
341
|
status = RhoAppAdapter.getErrorText(error);
|
@@ -463,6 +473,7 @@ public class SyncNotify {
|
|
463
473
|
|
464
474
|
strBody += "error";
|
465
475
|
strBody += "&error_code=" + nErrCode;
|
476
|
+
strBody += "&error_type=" + (src != null ? src.m_strErrorType : "");
|
466
477
|
|
467
478
|
if ( strError != null && strError.length() > 0 )
|
468
479
|
strBody += "&error_message=" + URI.urlEncode(strError);
|
@@ -77,6 +77,7 @@ class SyncSource
|
|
77
77
|
boolean m_bGetAtLeastOnePage = false;
|
78
78
|
int m_nErrCode = RhoAppAdapter.ERR_NONE;
|
79
79
|
String m_strError = "";
|
80
|
+
String m_strErrorType = "";
|
80
81
|
|
81
82
|
//String m_strPushBody = "";
|
82
83
|
Vector/*Ptr<CSyncBlob*>*/ m_arSyncBlobs = new Vector();
|
@@ -210,7 +211,7 @@ class SyncSource
|
|
210
211
|
//m_bIsSearch = false;
|
211
212
|
|
212
213
|
try{
|
213
|
-
if ( isTokenFromDB() &&
|
214
|
+
if ( isTokenFromDB() && getToken() > 1 )
|
214
215
|
syncServerChanges(); //sync only server changes, which was paused before
|
215
216
|
else
|
216
217
|
{
|
@@ -314,29 +315,36 @@ class SyncSource
|
|
314
315
|
LOG.INFO( "Push client changes to server. Source: " + getName() + "Size :" + strBody.length() );
|
315
316
|
LOG.TRACE("Push body: " + strBody);
|
316
317
|
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
318
|
+
try{
|
319
|
+
if ( m_arMultipartItems.size() > 0 )
|
320
|
+
{
|
321
|
+
MultipartItem oItem = new MultipartItem();
|
322
|
+
oItem.m_strBody = strBody;
|
323
|
+
//oItem.m_strContentType = getProtocol().getContentType();
|
324
|
+
oItem.m_strName = "cud";
|
325
|
+
m_arMultipartItems.addElement(oItem);
|
326
|
+
|
327
|
+
NetResponse resp = getNet().pushMultipartData( getProtocol().getClientChangesUrl(), m_arMultipartItems, getSync(), null );
|
328
|
+
if ( !resp.isOK() )
|
329
|
+
{
|
330
|
+
getSync().setState(SyncEngine.esStop);
|
331
|
+
m_nErrCode = RhoAppAdapter.ERR_REMOTESERVER;
|
332
|
+
}
|
333
|
+
}else
|
334
|
+
{
|
335
|
+
NetResponse resp = getNet().pushData( getProtocol().getClientChangesUrl(), strBody, getSync());
|
336
|
+
if ( !resp.isOK() )
|
337
|
+
{
|
338
|
+
getSync().setState(SyncEngine.esStop);
|
339
|
+
m_nErrCode = RhoAppAdapter.ERR_REMOTESERVER;
|
340
|
+
}
|
341
|
+
}
|
342
|
+
}catch(Exception exc)
|
343
|
+
{
|
344
|
+
m_nErrCode = RhoAppAdapter.getNetErrorCode(exc);
|
345
|
+
throw exc;
|
346
|
+
}
|
347
|
+
|
340
348
|
}
|
341
349
|
|
342
350
|
for( i = 0; i < 3 && getSync().isContinueSync(); i++ )
|
@@ -503,6 +511,9 @@ class SyncSource
|
|
503
511
|
}
|
504
512
|
|
505
513
|
String szData = resp.getCharData();
|
514
|
+
//String szData = "[{\"version\":3},{\"token\":\"\"},{\"count\":0},{\"progress_count\":28},{\"total_count\":28},{\"source-error\":{\"login-error\":{\"message\":\"s currently connected from another machine\"}}}]";
|
515
|
+
//String szData = "[{\"version\":3},{\"token\":\"\"},{\"count\":0},{\"progress_count\":0},{\"total_count\":0},{\"create-error\":{\"0_broken_object_id\":{\"name\":\"wrongname\",\"an_attribute\":\"error create\"},\"0_broken_object_id-error\":{\"message\":\"error create\"}}}]";
|
516
|
+
//String szData = "[{\"version\":3},{\"token\":\"35639160294387\"},{\"count\":3},{\"progress_count\":0},{\"total_count\":3},{\"metadata\":\"{\\\"foo\\\":\\\"bar\\\"}\",\"insert\":{\"1\":{\"price\":\"199.99\",\"brand\":\"Apple\",\"name\":\"iPhone\"}}}]";
|
506
517
|
|
507
518
|
PROF.START("Parse");
|
508
519
|
JSONArrayIterator oJsonArr = new JSONArrayIterator(szData);
|
@@ -510,9 +521,15 @@ class SyncSource
|
|
510
521
|
|
511
522
|
processServerResponse_ver3(oJsonArr);
|
512
523
|
|
524
|
+
if (getSync().getSourceOptions().getBoolProperty(getID(), "pass_through"))
|
525
|
+
processToken(0);
|
526
|
+
|
513
527
|
if ( getToken() == 0 )
|
514
528
|
break;
|
515
529
|
}
|
530
|
+
|
531
|
+
if ( getSync().isSchemaChanged() )
|
532
|
+
getSync().stopSync();
|
516
533
|
}
|
517
534
|
|
518
535
|
void processServerResponse_ver3(JSONArrayIterator oJsonArr)throws Exception
|
@@ -571,14 +588,6 @@ class SyncSource
|
|
571
588
|
setTotalCount(oJsonArr.getCurItem().getInt("total_count"));
|
572
589
|
oJsonArr.next();
|
573
590
|
}
|
574
|
-
/* if ( !oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("source-error") )
|
575
|
-
{
|
576
|
-
CJSONEntry oJsonErr = oJsonArr.getCurItem().getEntry("source-error");
|
577
|
-
m_strError = oJsonErr.getString("message");
|
578
|
-
m_nErrCode = RhoAppAdapter.ERR_CUSTOMSYNCSERVER;
|
579
|
-
getSync().stopSync();
|
580
|
-
return;
|
581
|
-
}*/
|
582
591
|
|
583
592
|
//if ( getServerObjectsCount() == 0 )
|
584
593
|
// getNotify().fireSyncNotification(this, false, RhoAppAdapter.ERR_NONE, "");
|
@@ -602,11 +611,51 @@ class SyncSource
|
|
602
611
|
|
603
612
|
if ( oCmds.hasName("schema-changed") )
|
604
613
|
{
|
605
|
-
getSync().stopSync();
|
606
614
|
getSync().setSchemaChanged(true);
|
615
|
+
}else if ( oCmds.hasName("source-error") )
|
616
|
+
{
|
617
|
+
JSONEntry errSrc = oCmds.getEntry("source-error");
|
618
|
+
JSONStructIterator errIter = new JSONStructIterator(errSrc);
|
619
|
+
for( ; !errIter.isEnd(); errIter.next() )
|
620
|
+
{
|
621
|
+
m_nErrCode = RhoAppAdapter.ERR_CUSTOMSYNCSERVER;
|
622
|
+
m_strError = errIter.getCurValue().getString("message");
|
623
|
+
m_strErrorType = errIter.getCurKey();
|
624
|
+
}
|
625
|
+
}else if ( oCmds.hasName("search-error") )
|
626
|
+
{
|
627
|
+
JSONEntry errSrc = oCmds.getEntry("search-error");
|
628
|
+
JSONStructIterator errIter = new JSONStructIterator(errSrc);
|
629
|
+
for( ; !errIter.isEnd(); errIter.next() )
|
630
|
+
{
|
631
|
+
m_nErrCode = RhoAppAdapter.ERR_CUSTOMSYNCSERVER;
|
632
|
+
m_strError = errIter.getCurValue().getString("message");
|
633
|
+
m_strErrorType = errIter.getCurKey();
|
634
|
+
}
|
635
|
+
}else if ( oCmds.hasName("create-error") )
|
636
|
+
{
|
637
|
+
m_nErrCode = RhoAppAdapter.ERR_CUSTOMSYNCSERVER;
|
638
|
+
m_strErrorType = "create-error";
|
639
|
+
}else if ( oCmds.hasName("update-error") )
|
640
|
+
{
|
641
|
+
m_nErrCode = RhoAppAdapter.ERR_CUSTOMSYNCSERVER;
|
642
|
+
m_strErrorType = "update-error";
|
643
|
+
}else if ( oCmds.hasName("delete-error") )
|
644
|
+
{
|
645
|
+
m_nErrCode = RhoAppAdapter.ERR_CUSTOMSYNCSERVER;
|
646
|
+
m_strErrorType = "delete-error";
|
607
647
|
}else
|
608
648
|
{
|
609
649
|
getDB().startTransaction();
|
650
|
+
|
651
|
+
if (getSync().getSourceOptions().getBoolProperty(getID(), "pass_through"))
|
652
|
+
{
|
653
|
+
if ( m_bSchemaSource )
|
654
|
+
getDB().executeSQL( "DELETE FROM " + getName() );
|
655
|
+
else
|
656
|
+
getDB().executeSQL( "DELETE FROM object_values WHERE source_id=?", getID() );
|
657
|
+
}
|
658
|
+
|
610
659
|
if ( oCmds.hasName("metadata") && getSync().isContinueSync() )
|
611
660
|
{
|
612
661
|
String strMetadata = oCmds.getString("metadata");
|