rhodes 2.3.0 → 2.3.1.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. data/CHANGELOG +6 -0
  2. data/Manifest.txt +5819 -0
  3. data/README.md +2 -2
  4. data/Rakefile +9 -5
  5. data/doc/build.txt +7 -13
  6. data/doc/configuration.txt +4 -0
  7. data/doc/connect-to-web-services.txt +0 -1
  8. data/doc/device-caps.txt +2 -2
  9. data/doc/extensions.txt +2 -0
  10. data/doc/linea.txt +699 -0
  11. data/doc/rhom.txt +2 -1
  12. data/doc/synchronization.txt +39 -2
  13. data/doc/ui.txt +1 -0
  14. data/installer/README.html +1 -1
  15. data/lib/build/jake.rb +3 -0
  16. data/lib/framework/res/esri.wm.png +0 -0
  17. data/lib/framework/rho/render.rb +2 -0
  18. data/lib/framework/rho/rho.rb +17 -10
  19. data/lib/framework/rho/rhoapplication.rb +13 -3
  20. data/lib/framework/rho/rhoevent_bb.rb +3 -1
  21. data/lib/framework/rho/rhoevent_c.rb +4 -1
  22. data/lib/framework/rhodes.rb +1 -1
  23. data/lib/framework/rhom/rhom.rb +10 -0
  24. data/lib/framework/rhom/rhom_object_factory.rb +45 -0
  25. data/lib/framework/rhom/rhom_source.rb +1 -1
  26. data/lib/framework/version.rb +1 -1
  27. data/lib/rhodes.rb +1 -1
  28. data/platform/android/Rhodes/AndroidManifest.xml +2 -2
  29. data/platform/android/Rhodes/jni/include/rhodes/RhoClassFactory.h +1 -1
  30. data/platform/android/Rhodes/jni/src/RhoClassFactory.cpp +1 -1
  31. data/platform/android/Rhodes/jni/src/callbacks.cpp +9 -11
  32. data/platform/android/Rhodes/jni/src/event.cpp +17 -9
  33. data/platform/android/Rhodes/jni/src/mapview.cpp +34 -4
  34. data/platform/android/Rhodes/jni/src/rhodes.cpp +1 -1
  35. data/platform/android/Rhodes/res/drawable/esri.png +0 -0
  36. data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +1 -0
  37. data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +3 -0
  38. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +8 -5
  39. data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +80 -9
  40. data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +29 -8
  41. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +4 -1
  42. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +50 -10
  43. data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +3 -0
  44. data/platform/android/build/android.rake +45 -23
  45. data/platform/android/build/librhocommon_build.files +1 -0
  46. data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +6 -1
  47. data/platform/bb/Hsqldb/src/org/hsqldb/CachedDataRow.java +1 -1
  48. data/platform/bb/Hsqldb/src/org/hsqldb/CachedRow.java +3 -2
  49. data/platform/bb/Hsqldb/src/org/hsqldb/Row.java +1 -1
  50. data/platform/bb/Hsqldb/src/org/hsqldb/persist/CachedObject.java +1 -1
  51. data/platform/bb/Hsqldb/src/org/hsqldb/persist/DataFileCache.java +66 -16
  52. data/platform/bb/Hsqldb/src/org/hsqldb/persist/HsqlDatabaseProperties.java +1 -1
  53. data/platform/bb/RubyVM/src/com/rho/RhoCrypto.java +116 -0
  54. data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +39 -2
  55. data/platform/bb/RubyVM/src/com/rho/Tokenizer.java +11 -6
  56. data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +157 -150
  57. data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +1 -1
  58. data/platform/bb/RubyVM/src/com/rho/file/RhoFile.java +15 -0
  59. data/platform/bb/RubyVM/src/com/rho/net/AsyncHttp.java +35 -23
  60. data/platform/bb/RubyVM/src/com/rho/net/NetRequest.java +6 -9
  61. data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +54 -16
  62. data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +18 -9
  63. data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +37 -59
  64. data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +3 -0
  65. data/platform/bb/build/RubyVM_build.files +1 -0
  66. data/platform/bb/build/bb.rake +4 -5
  67. data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +4 -1
  68. data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteStorage.java +8 -3
  69. data/platform/bb/rhodes/resources/esri.png +0 -0
  70. data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +2 -0
  71. data/platform/bb/rhodes/src/com/rho/db/SqliteStorage.java +8 -3
  72. data/platform/bb/rhodes/src/com/rho/rubyext/RhoCalendar.java +4 -1
  73. data/platform/bb/rhodes/src/com/rho/rubyext/System.java +2 -0
  74. data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapField.java +9 -0
  75. data/platform/iphone/Classes/Event/Event.m +12 -2
  76. data/platform/iphone/Classes/NativeBar.h +12 -11
  77. data/platform/iphone/Classes/NativeBar.m +13 -3
  78. data/platform/iphone/Classes/Rhodes.m +48 -10
  79. data/platform/iphone/Classes/SimpleMainView.h +1 -0
  80. data/platform/iphone/Classes/SimpleMainView.m +7 -1
  81. data/platform/iphone/Classes/SplitView/LeftViewController.m +3 -0
  82. data/platform/iphone/Classes/SplitView/RightViewController.m +11 -6
  83. data/platform/iphone/Classes/SplitView/SplittedMainView.m +8 -0
  84. data/platform/iphone/Classes/TabbedMainView.m +39 -3
  85. data/platform/iphone/Info.plist +1 -1
  86. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
  87. data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +3 -3
  88. data/platform/shared/SyncClient/SyncClient.cpp +23 -23
  89. data/platform/shared/common/IRhoClassFactory.h +6 -4
  90. data/platform/shared/common/RhoAppAdapter.h +1 -1
  91. data/platform/shared/common/RhoFile.cpp +10 -0
  92. data/platform/shared/common/RhoFile.h +1 -0
  93. data/platform/shared/common/RhoMutexLock.h +1 -1
  94. data/platform/shared/common/RhoStd.h +5 -0
  95. data/platform/shared/common/RhoThread.cpp +2 -2
  96. data/platform/shared/common/RhoThread.h +1 -2
  97. data/platform/shared/common/RhodesApp.cpp +33 -55
  98. data/platform/shared/common/RhodesApp.h +0 -5
  99. data/platform/shared/common/RhodesAppBase.cpp +1 -1
  100. data/platform/shared/common/SplashScreen.cpp +1 -2
  101. data/platform/shared/common/ThreadQueue.cpp +31 -4
  102. data/platform/shared/common/ThreadQueue.h +10 -3
  103. data/platform/shared/common/Tokenizer.cpp +12 -8
  104. data/platform/shared/common/iphone/RhoClassFactory.cpp +5 -8
  105. data/platform/shared/common/iphone/RhoClassfactory.h +1 -1
  106. data/platform/shared/common/map/ESRIMapEngine.cpp +17 -7
  107. data/platform/shared/common/map/ESRIMapEngine.h +11 -1
  108. data/platform/shared/common/map/GoogleMapEngine.cpp +3 -3
  109. data/platform/shared/common/map/GoogleMapEngine.h +2 -2
  110. data/platform/shared/common/map/MapEngine.cpp +37 -0
  111. data/platform/shared/common/map/MapEngine.h +5 -0
  112. data/platform/shared/db/DBAdapter.cpp +113 -81
  113. data/platform/shared/db/DBAdapter.h +21 -5
  114. data/platform/shared/db/DBAttrManager.cpp +2 -2
  115. data/platform/shared/db/DBResult.h +28 -0
  116. data/platform/shared/net/AsyncHttp.cpp +48 -48
  117. data/platform/shared/net/AsyncHttp.h +15 -12
  118. data/platform/shared/net/CURLNetRequest.cpp +27 -105
  119. data/platform/shared/net/CURLNetRequest.h +8 -15
  120. data/platform/shared/net/INetRequest.cpp +122 -0
  121. data/platform/shared/net/INetRequest.h +96 -23
  122. data/platform/shared/net/ssl.cpp +1 -1
  123. data/platform/shared/ruby/ext/calendar/calendar.i +2 -2
  124. data/platform/shared/ruby/ext/calendar/calendar_wrap.c +30 -3
  125. data/platform/shared/rubyext/GeoLocation.cpp +4 -5
  126. data/platform/shared/rubyext/GeoLocation.h +4 -4
  127. data/platform/shared/rubyext/RhoAppAdapter.cpp +1 -1
  128. data/platform/shared/rubyext/System.cpp +3 -0
  129. data/platform/shared/sync/ClientRegister.cpp +6 -9
  130. data/platform/shared/sync/ClientRegister.h +8 -6
  131. data/platform/shared/sync/SyncEngine.cpp +54 -30
  132. data/platform/shared/sync/SyncEngine.h +9 -11
  133. data/platform/shared/sync/SyncNotify.cpp +19 -14
  134. data/platform/shared/sync/SyncNotify.h +5 -12
  135. data/platform/shared/sync/SyncSource.cpp +53 -76
  136. data/platform/shared/sync/SyncSource.h +5 -4
  137. data/platform/shared/sync/SyncThread.cpp +5 -7
  138. data/platform/shared/sync/SyncThread.h +2 -2
  139. data/platform/wm/RhoLib/RhoLib.vcproj +43 -39
  140. data/platform/wm/build/wm.rake +19 -17
  141. data/platform/wm/rhodes/AppManager.cpp +4 -4
  142. data/platform/wm/rhodes/MainWindow.cpp +0 -1
  143. data/platform/wm/rhodes/MapView/MapViewManager.cpp +4 -0
  144. data/platform/wm/rhodes/Vibrate.cpp +2 -2
  145. data/platform/wm/rhodes/Vibrate.h +1 -1
  146. data/platform/wm/rhodes/rho/common/RhoClassFactory.cpp +7 -5
  147. data/platform/wm/rhodes/rho/common/RhoClassFactory.h +3 -3
  148. data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +24 -10
  149. data/platform/wm/rhodes/rho/net/NetRequestImpl.h +49 -25
  150. data/platform/wm/rhodes/rho/rubyext/calendar.cpp +16 -2
  151. data/platform/wm/rhodes/rhodes.vcproj +77 -85
  152. data/platform/wm/tools/detool/detool.cpp +16 -6
  153. data/rakefile.rb +9 -5
  154. data/res/build-tools/detool.exe +0 -0
  155. data/rhodes.gemspec +2 -2
  156. data/spec/phone_spec/app/spec/blobsync_spec.rb +1 -0
  157. data/spec/phone_spec/app/spec/events_spec.rb +13 -2
  158. data/spec/phone_spec/app/spec/mapview_spec.rb +2 -2
  159. data/spec/phone_spec/app/spec/nativebar_spec.rb +3 -3
  160. data/spec/phone_spec/app/spec/navbar_spec.rb +3 -3
  161. data/spec/phone_spec/app/spec/rho_spec.rb +1 -1
  162. data/spec/phone_spec/app/spec/rhom_object_spec.rb +1 -1
  163. data/spec/phone_spec/app/spec/syncengine_spec.rb +219 -0
  164. data/spec/phone_spec/build.yml +1 -0
  165. metadata +15 -8
  166. data/platform/wm/rhodes/rho/net/NetRequest.cpp +0 -89
  167. data/platform/wm/rhodes/rho/net/NetRequest.h +0 -45
@@ -101,19 +101,18 @@ public class SyncEngine implements NetRequest.IRhoSession
101
101
  }
102
102
  }
103
103
 
104
- return res;
104
+ return res != null ? res : "";
105
105
  }
106
106
  public boolean getBoolProperty(Integer nSrcID, String szPropName)
107
107
  {
108
108
  String strValue = getProperty(nSrcID, szPropName);
109
-
110
109
  return strValue.compareTo("1") == 0 || strValue.compareTo("true") == 0 ? true : false;
111
110
 
112
111
  }
113
112
  };
114
113
 
115
114
  Vector/*<SyncSource*>*/ m_sources = new Vector();
116
- NetRequest m_NetRequest;
115
+ NetRequest m_NetRequest, m_NetRequestClientID;
117
116
  ISyncProtocol m_SyncProtocol;
118
117
  int m_syncState;
119
118
  String m_clientID = "";
@@ -124,7 +123,7 @@ public class SyncEngine implements NetRequest.IRhoSession
124
123
  int m_nSyncPageSize = 2000;
125
124
  boolean m_bNoThreaded = false;
126
125
  int m_nErrCode = RhoAppAdapter.ERR_NONE;
127
- String m_strError = "";
126
+ String m_strError = "",m_strServerError = "";
128
127
  boolean m_bIsSearch, m_bIsSchemaChanged;
129
128
  static SourceOptions m_oSourceOptions = new SourceOptions();
130
129
 
@@ -133,9 +132,28 @@ public class SyncEngine implements NetRequest.IRhoSession
133
132
  boolean isSearch(){ return m_bIsSearch; }
134
133
  boolean isContinueSync(){ return m_syncState != esExit && m_syncState != esStop; }
135
134
  boolean isSyncing(){ return m_syncState == esSyncAllSources || m_syncState == esSyncSource; }
136
- void stopSync(){ if (isContinueSync()){ setState(esStop); m_NetRequest.cancel(); } }
135
+ void stopSync()
136
+ {
137
+ if (isContinueSync())
138
+ {
139
+ setState(esStop);
140
+ if (m_NetRequest!=null)
141
+ m_NetRequest.cancel();
142
+
143
+ if (m_NetRequestClientID!=null)
144
+ m_NetRequestClientID.cancel();
145
+ }
146
+ }
137
147
  void stopSyncByUser(){ m_bStopByUser = true; stopSync(); }
138
- void exitSync(){ setState(esExit); m_NetRequest.cancel(); }
148
+ void exitSync()
149
+ {
150
+ setState(esExit);
151
+ if (m_NetRequest!=null)
152
+ m_NetRequest.cancel();
153
+
154
+ if (m_NetRequestClientID!=null)
155
+ m_NetRequestClientID.cancel();
156
+ }
139
157
  boolean isStoppedByUser(){ return m_bStopByUser; }
140
158
 
141
159
  String getClientID(){ return m_clientID; }
@@ -154,6 +172,7 @@ public class SyncEngine implements NetRequest.IRhoSession
154
172
 
155
173
  SyncNotify getNotify(){ return m_oSyncNotify; }
156
174
  NetRequest getNet() { return m_NetRequest;}
175
+ NetRequest getNetClientID(){ return m_NetRequestClientID; }
157
176
  ISyncProtocol getProtocol(){ return m_SyncProtocol; }
158
177
 
159
178
  boolean isNoThreadedMode(){ return m_bNoThreaded; }
@@ -162,6 +181,7 @@ public class SyncEngine implements NetRequest.IRhoSession
162
181
 
163
182
  SyncEngine(){
164
183
  m_NetRequest = null;
184
+ m_NetRequestClientID = null;
165
185
  m_syncState = esNone;
166
186
 
167
187
  initProtocol();
@@ -177,6 +197,8 @@ public class SyncEngine implements NetRequest.IRhoSession
177
197
 
178
198
  void setFactory(RhoClassFactory factory)throws Exception{
179
199
  m_NetRequest = RhoClassFactory.createNetRequest();
200
+ m_NetRequestClientID = RhoClassFactory.createNetRequest();
201
+
180
202
  m_oSyncNotify.setFactory(factory);
181
203
  }
182
204
 
@@ -187,6 +209,7 @@ public class SyncEngine implements NetRequest.IRhoSession
187
209
  m_bStopByUser = false;
188
210
  m_nErrCode = RhoAppAdapter.ERR_NONE;
189
211
  m_strError = "";
212
+ m_strServerError = "";
190
213
  m_bIsSchemaChanged = false;
191
214
 
192
215
  loadAllSources();
@@ -216,7 +239,7 @@ public class SyncEngine implements NetRequest.IRhoSession
216
239
  getNotify().fireSyncNotification(src, true, src.m_nErrCode, "");
217
240
  }else
218
241
  {
219
- getNotify().fireAllSyncNotifications(true, m_nErrCode, m_strError);
242
+ getNotify().fireAllSyncNotifications(true, m_nErrCode, m_strError, "");
220
243
  }
221
244
 
222
245
  stopSync();
@@ -293,6 +316,7 @@ public class SyncEngine implements NetRequest.IRhoSession
293
316
  if ( strParams.length() > 0 )
294
317
  strQuery += strParams;
295
318
 
319
+ String strTestResp = "";
296
320
  for ( int i = 0; i < (int)arSources.size(); i++ )
297
321
  {
298
322
  SyncSource pSrc = findSourceByName((String)arSources.elementAt(i));
@@ -302,6 +326,8 @@ public class SyncEngine implements NetRequest.IRhoSession
302
326
 
303
327
  if ( !pSrc.isTokenFromDB() && pSrc.getToken() > 1 )
304
328
  strQuery += "&sources[][token]=" + pSrc.getToken();
329
+
330
+ strTestResp = getSourceOptions().getProperty(pSrc.getID(), "rho_server_response");
305
331
  }
306
332
  }
307
333
 
@@ -316,7 +342,11 @@ public class SyncEngine implements NetRequest.IRhoSession
316
342
  continue;
317
343
  }
318
344
 
319
- String szData = resp.getCharData();
345
+ String szData = null;
346
+ if ( strTestResp != null && strTestResp.length() > 0 )
347
+ szData = strTestResp;
348
+ else
349
+ szData = resp.getCharData();
320
350
 
321
351
  JSONArrayIterator oJsonArr = new JSONArrayIterator(szData);
322
352
 
@@ -338,8 +368,7 @@ public class SyncEngine implements NetRequest.IRhoSession
338
368
  LOG.ERROR( "Sync server send search data with incompatible version. Client version: " + getProtocol().getVersion() +
339
369
  "; Server response version: " + nVersion );
340
370
  stopSync();
341
- m_nErrCode = RhoAppAdapter.ERR_UNEXPECTEDSERVERRESPONSE;
342
- m_strError = resp.getCharData();
371
+ m_nErrCode = RhoAppAdapter.ERR_SYNCVERSION;
343
372
  continue;
344
373
  }
345
374
 
@@ -353,7 +382,7 @@ public class SyncEngine implements NetRequest.IRhoSession
353
382
  LOG.ERROR( "Sync server send search data without source name." );
354
383
  stopSync();
355
384
  m_nErrCode = RhoAppAdapter.ERR_UNEXPECTEDSERVERRESPONSE;
356
- m_strError = resp.getCharData();
385
+ m_strError = szData;
357
386
  continue;
358
387
  }
359
388
 
@@ -364,7 +393,7 @@ public class SyncEngine implements NetRequest.IRhoSession
364
393
  LOG.ERROR("Sync server send search data for unknown source name:" + strSrcName);
365
394
  stopSync();
366
395
  m_nErrCode = RhoAppAdapter.ERR_UNEXPECTEDSERVERRESPONSE;
367
- m_strError = resp.getCharData();
396
+ m_strError = szData;
368
397
  continue;
369
398
  }
370
399
 
@@ -373,13 +402,22 @@ public class SyncEngine implements NetRequest.IRhoSession
373
402
  pSrc.processServerResponse_ver3(oSrcArr);
374
403
 
375
404
  nSearchCount += pSrc.getCurPageCount();
405
+
406
+ if ( pSrc.getServerError().length() > 0 )
407
+ {
408
+ if ( m_strServerError.length() > 0 )
409
+ m_strServerError += "&";
410
+
411
+ m_strServerError += pSrc.getServerError();
412
+ m_nErrCode = pSrc.getErrorCode();
413
+ }
376
414
  }
377
415
 
378
416
  if ( nSearchCount == 0 )
379
417
  break;
380
418
  }
381
419
 
382
- getNotify().fireAllSyncNotifications(true, m_nErrCode, m_strError);
420
+ getNotify().fireAllSyncNotifications(true, m_nErrCode, m_strError, m_strServerError);
383
421
 
384
422
  //update db info
385
423
  TimeInterval endTime = TimeInterval.getCurrentTime();
@@ -404,7 +442,7 @@ public class SyncEngine implements NetRequest.IRhoSession
404
442
  } catch(Exception exc) {
405
443
  LOG.ERROR("Search failed.", exc);
406
444
 
407
- getNotify().fireAllSyncNotifications(true, RhoAppAdapter.ERR_RUNTIME, "");
445
+ getNotify().fireAllSyncNotifications(true, RhoAppAdapter.ERR_RUNTIME, "", "");
408
446
  }
409
447
 
410
448
  }
@@ -637,7 +675,7 @@ public class SyncEngine implements NetRequest.IRhoSession
637
675
  // if ( ClientRegister.getInstance() != null )
638
676
  // strBody += ClientRegister.getInstance().getRegisterBody();
639
677
 
640
- NetResponse resp = getNet().pullData(getProtocol().getClientResetUrl(strClientID), this);
678
+ NetResponse resp = getNetClientID().pullData(getProtocol().getClientResetUrl(strClientID), this);
641
679
  /*
642
680
  processServerSources("{\"server_sources\":[{\"name\":\"Product\",\"partition\":\"application\",\"source_id\":\"2\",\"sync_priority\":\"0\","+
643
681
  "\"schema_version\":\"7.0\",\"schema\":{"+
@@ -665,7 +703,7 @@ public class SyncEngine implements NetRequest.IRhoSession
665
703
  // if ( ClientRegister.getInstance() != null )
666
704
  // strBody += ClientRegister.getInstance().getRegisterBody();
667
705
 
668
- NetResponse resp = getNet().pullData(getProtocol().getClientCreateUrl(), this);
706
+ NetResponse resp = getNetClientID().pullData(getProtocol().getClientCreateUrl(), this);
669
707
  if ( resp.isOK() && resp.getCharData() != null )
670
708
  {
671
709
  String szData = resp.getCharData();
@@ -284,7 +284,7 @@ public class SyncNotify {
284
284
  if ( pSN != null )
285
285
  fireSyncNotification(src, true, src.m_nErrCode, "");
286
286
  else
287
- fireAllSyncNotifications(true, src.m_nErrCode, src.m_strError );
287
+ fireAllSyncNotifications(true, src.m_nErrCode, src.m_strError, "" );
288
288
  }
289
289
  else
290
290
  fireSyncNotification( src, true, src.m_nErrCode, "");
@@ -394,10 +394,10 @@ public class SyncNotify {
394
394
  strParams += "&bulk_status="+status;
395
395
  strParams += "&sync_type=bulk";
396
396
 
397
- doFireSyncNotification( null, bFinish, nErrCode, "", strParams );
397
+ doFireSyncNotification( null, bFinish, nErrCode, "", strParams, "" );
398
398
  }
399
399
 
400
- void fireAllSyncNotifications( boolean bFinish, int nErrCode, String strError )
400
+ void fireAllSyncNotifications( boolean bFinish, int nErrCode, String strError, String strServerError )
401
401
  {
402
402
  if ( getSync().getState() == SyncEngine.esExit )
403
403
  return;
@@ -416,7 +416,7 @@ public class SyncNotify {
416
416
  {
417
417
  SyncNotification pSN = getSyncNotifyBySrc(null);
418
418
  if ( pSN != null )
419
- doFireSyncNotification( null, bFinish, nErrCode, strError, "" );
419
+ doFireSyncNotification( null, bFinish, nErrCode, strError, "", strServerError );
420
420
  }
421
421
  }
422
422
 
@@ -436,7 +436,7 @@ public class SyncNotify {
436
436
  }
437
437
  }
438
438
 
439
- doFireSyncNotification(src, bFinish, nErrCode, "", "" );
439
+ doFireSyncNotification(src, bFinish, nErrCode, "", "", "" );
440
440
  }
441
441
 
442
442
  SyncNotification getSyncNotifyBySrc(SyncSource src)
@@ -459,7 +459,7 @@ public class SyncNotify {
459
459
  return pSN != null ? pSN : m_emptyNotify;
460
460
  }
461
461
 
462
- void doFireSyncNotification( SyncSource src, boolean bFinish, int nErrCode, String strError, String strParams )
462
+ void doFireSyncNotification( SyncSource src, boolean bFinish, int nErrCode, String strError, String strParams, String strServerError )
463
463
  {
464
464
  if ( getSync().isStoppedByUser() )
465
465
  return;
@@ -509,12 +509,16 @@ public class SyncNotify {
509
509
 
510
510
  strBody += "error";
511
511
  strBody += "&error_code=" + nErrCode;
512
- strBody += "&error_type=" + (src != null ? src.m_strErrorType : "");
513
512
 
514
513
  if ( strError != null && strError.length() > 0 )
515
514
  strBody += "&error_message=" + URI.urlEncode(strError);
516
515
  else if ( src != null )
517
516
  strBody += "&error_message=" + URI.urlEncode(src.m_strError);
517
+
518
+ if ( strServerError != null && strServerError.length() > 0 )
519
+ strBody += "&" + strServerError;
520
+ else if ( src != null && src.m_strServerError != null && src.m_strServerError.length() > 0 )
521
+ strBody += "&" + src.m_strServerError;
518
522
  }
519
523
 
520
524
  if ( src != null )
@@ -524,8 +528,13 @@ public class SyncNotify {
524
528
  strBody += "in_progress";
525
529
 
526
530
  strBody += "&rho_callback=1";
527
- if ( pSN.m_strParams.length() > 0 )
528
- strBody += "&" + pSN.m_strParams;
531
+ if ( pSN.m_strParams != null && pSN.m_strParams.length() > 0 )
532
+ {
533
+ if ( !pSN.m_strParams.startsWith("&") )
534
+ strBody += "&";
535
+
536
+ strBody += pSN.m_strParams;
537
+ }
529
538
 
530
539
  bRemoveAfterFire = bRemoveAfterFire && pSN.m_bRemoveAfterFire;
531
540
  }
@@ -76,8 +76,7 @@ public class SyncSource
76
76
  int m_nCurPageCount, m_nInserted, m_nDeleted, m_nTotalCount, m_nAttribCounter=0;
77
77
  boolean m_bGetAtLeastOnePage = false;
78
78
  int m_nErrCode = RhoAppAdapter.ERR_NONE;
79
- String m_strError = "";
80
- String m_strErrorType = "";
79
+ String m_strError = "", m_strServerError = "";
81
80
 
82
81
  //String m_strPushBody = "";
83
82
  Vector/*Ptr<CSyncBlob*>*/ m_arSyncBlobs = new Vector();
@@ -99,6 +98,8 @@ public class SyncSource
99
98
  Integer getID() { return m_nID; }
100
99
  String getName() { return m_strName; }
101
100
  String getSyncType(){ return m_strSyncType; }
101
+ String getServerError(){ return m_strServerError; }
102
+ int getErrorCode(){ return m_nErrCode; }
102
103
  int getServerObjectsCount(){ return m_nInserted+m_nDeleted; }
103
104
 
104
105
  long getToken(){ return m_token; }
@@ -521,11 +522,12 @@ public class SyncSource
521
522
  throw exc;
522
523
  }
523
524
 
524
- String szData = resp.getCharData();
525
- //String szData = "[{\"version\":3},{\"token\":\"\"},{\"count\":0},{\"progress_count\":28},{\"total_count\":28},{\"source-error\":{\"login-error\":{\"message\":\"s currently connected from another machine\"}}}]";
526
- //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\"}}}]";
527
- //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\"}}}]";
528
- //String szData = "[{\"version\":3},{\"token\":\"\"},{\"count\":0},{\"progress_count\":1},{\"total_count\":1},{\"update-error\":{\"1-error\":{\"message\":\"Update failed!\"},\"1\":{\"foo\":\"bar5\"}}}]";
525
+ String szData = null;
526
+ String strTestResp = getSync().getSourceOptions().getProperty(getID(), "rho_server_response");
527
+ if ( strTestResp != null && strTestResp.length() > 0 )
528
+ szData = strTestResp;
529
+ else
530
+ szData = resp.getCharData();
529
531
 
530
532
  PROF.START("Parse");
531
533
  JSONArrayIterator oJsonArr = new JSONArrayIterator(szData);
@@ -544,71 +546,47 @@ public class SyncSource
544
546
  getSync().stopSync();
545
547
  }
546
548
 
549
+ //{"create-error":{"0_broken_object_id":{"name":"wrongname","an_attribute":"error create"},"0_broken_object_id-error":{"message":"error create"}}}
547
550
  boolean processServerErrors(JSONEntry oCmds)throws Exception
548
551
  {
549
- if ( oCmds.hasName("source-error") )
552
+ String arErrTypes[] = {"source-error", "search-error", "create-error", "update-error", "delete-error", null};
553
+ boolean bRes = false;
554
+ for( int i = 0; ; i++ )
550
555
  {
551
- JSONEntry errSrc = oCmds.getEntry("source-error");
552
- JSONStructIterator errIter = new JSONStructIterator(errSrc);
553
- for( ; !errIter.isEnd(); errIter.next() )
554
- {
555
- m_nErrCode = RhoAppAdapter.ERR_CUSTOMSYNCSERVER;
556
- m_strError = errIter.getCurValue().getString("message");
557
- m_strErrorType = errIter.getCurKey();
558
- }
559
- }else if ( oCmds.hasName("search-error") )
560
- {
561
- JSONEntry errSrc = oCmds.getEntry("search-error");
562
- JSONStructIterator errIter = new JSONStructIterator(errSrc);
563
- for( ; !errIter.isEnd(); errIter.next() )
564
- {
565
- m_nErrCode = RhoAppAdapter.ERR_CUSTOMSYNCSERVER;
566
- m_strError = errIter.getCurValue().getString("message");
567
- m_strErrorType = errIter.getCurKey();
568
- }
569
- }else if ( oCmds.hasName("create-error") )
570
- {
571
- m_nErrCode = RhoAppAdapter.ERR_CUSTOMSYNCSERVER;
572
- m_strErrorType = "create-error";
556
+ if ( arErrTypes[i] == null )
557
+ break;
558
+ if ( !oCmds.hasName(arErrTypes[i]) )
559
+ continue;
573
560
 
574
- JSONEntry errSrc = oCmds.getEntry(m_strErrorType);
575
- JSONStructIterator errIter = new JSONStructIterator(errSrc);
576
- for( ; !errIter.isEnd(); errIter.next() )
577
- {
578
- String strKey = errIter.getCurKey();
579
- if ( strKey.endsWith("-error") )
580
- m_strError = errIter.getCurValue().getString("message");
581
- }
582
- }else if ( oCmds.hasName("update-error") )
583
- {
561
+ bRes = true;
584
562
  m_nErrCode = RhoAppAdapter.ERR_CUSTOMSYNCSERVER;
585
- m_strErrorType = "update-error";
586
563
 
587
- JSONEntry errSrc = oCmds.getEntry(m_strErrorType);
564
+ JSONEntry errSrc = oCmds.getEntry(arErrTypes[i]);
588
565
  JSONStructIterator errIter = new JSONStructIterator(errSrc);
589
566
  for( ; !errIter.isEnd(); errIter.next() )
590
567
  {
591
568
  String strKey = errIter.getCurKey();
592
- if ( strKey.endsWith("-error") )
593
- m_strError = errIter.getCurValue().getString("message");
594
- }
595
- }else if ( oCmds.hasName("delete-error") )
596
- {
597
- m_nErrCode = RhoAppAdapter.ERR_CUSTOMSYNCSERVER;
598
- m_strErrorType = "delete-error";
599
569
 
600
- JSONEntry errSrc = oCmds.getEntry(m_strErrorType);
601
- JSONStructIterator errIter=new JSONStructIterator(errSrc);
602
- for( ; !errIter.isEnd(); errIter.next() )
603
- {
604
- String strKey = errIter.getCurKey();
605
- if ( strKey.endsWith( "-error") )
606
- m_strError = errIter.getCurValue().getString("message");
570
+ if ( i == 0 || i == 1 )//"source-error", "search-error"
571
+ {
572
+ if ( errIter.getCurValue().hasName("message") )
573
+ m_strServerError += "server_errors[" + strKey + "][message]=" + URI.urlEncode(errIter.getCurValue().getString("message"));
574
+ }
575
+ else
576
+ {
577
+ //"create-error", "update-error", "delete-error"
578
+ String strObject = strKey;
579
+
580
+ if ( strObject.endsWith("-error") )
581
+ {
582
+ strObject = strObject.substring(0, strKey.length()-6);
583
+ m_strServerError += "server_errors[" + arErrTypes[i] + "][" + strObject + "][message]=" + URI.urlEncode(errIter.getCurValue().getString("message"));
584
+ }
585
+ }
607
586
  }
608
- }else
609
- return false;
587
+ }
610
588
 
611
- return true;
589
+ return bRes;
612
590
  }
613
591
 
614
592
  void processServerResponse_ver3(JSONArrayIterator oJsonArr)throws Exception
@@ -108,6 +108,8 @@ public class SyncThread extends ThreadQueue
108
108
  return "Unknown; Code : " + m_nCmdCode;
109
109
  }
110
110
 
111
+ public void cancel(){}
112
+
111
113
  };
112
114
  static private class SyncLoginCommand extends SyncCommand
113
115
  {
@@ -800,6 +802,7 @@ public class SyncThread extends ThreadQueue
800
802
  try{
801
803
  boolean bVerify = arg1 == RubyConstant.QTRUE;
802
804
  getSyncEngine().getNet().sslVerifyPeer(bVerify);
805
+ getSyncEngine().getNetClientID().sslVerifyPeer(bVerify);
803
806
  }catch(Exception e)
804
807
  {
805
808
  LOG.ERROR("set_ssl_verify_peer failed", e);
@@ -46,6 +46,7 @@ platform/bb/RubyVM/src/com/rho/StringScanner.java
46
46
  platform/bb/RubyVM/src/com/rho/Capabilities.java
47
47
  platform/bb/RubyVM/src/com/rho/AppBuildConfig.java
48
48
  platform/bb/RubyVM/src/com/rho/Extensions.java
49
+ platform/bb/RubyVM/src/com/rho/RhoCrypto.java
49
50
  platform/bb/RubyVM/src/com/rho/sync/JSONArrayIterator.java
50
51
  platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java
51
52
  platform/bb/RubyVM/src/com/rho/sync/JSONEntry.java
@@ -614,12 +614,12 @@ namespace "build" do
614
614
  # http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=11152
615
615
  mkdir_p vsrcdir + "/com/rho/file"
616
616
  cp_r $builddir + "/../rhodes/src/com/rho/file/PersistRAFileImpl.java", vsrcdir + "/com/rho/file"
617
- freplace( vsrcdir + "/com/rho/file/PersistRAFileImpl.java", /FileInfoWrapper/, $outfilebase + "_FileInfoWrapper" )
618
- freplace( vsrcdir + "/com/rho/file/PersistRAFileImpl.java", /PageWrapper/, $outfilebase + "_PageWrapper" )
617
+ freplace( vsrcdir + "/com/rho/file/PersistRAFileImpl.java", /FileInfoWrapper/, "_" + $outfilebase + "_FileInfoWrapper" )
618
+ freplace( vsrcdir + "/com/rho/file/PersistRAFileImpl.java", /PageWrapper/, "_" + $outfilebase + "_PageWrapper" )
619
619
 
620
620
  fvsrc = File.new( vsrclist, "w" )
621
621
  Dir.glob( vsrcdir + "/**/*.java" ).each do |line|
622
- fvsrc.puts line
622
+ fvsrc.puts "\""+line+"\""
623
623
  end
624
624
  fvsrc.close
625
625
 
@@ -1019,8 +1019,7 @@ namespace "run" do
1019
1019
  end
1020
1020
 
1021
1021
  task :phone_spec do
1022
- exit 1 if Jake.run_spec_app('bb','phone_spec')
1023
- exit 0
1022
+ exit Jake.run_spec_app('bb','phone_spec')
1024
1023
  end
1025
1024
 
1026
1025
  task :testsim => ["config:bb"] do
@@ -38,6 +38,7 @@ public class RhodesApplicationPlatform extends UiApplication implements PushAppl
38
38
  m_strStatus = strStatus;
39
39
  }
40
40
  public boolean equals(IQueueCommand cmd){return false;}
41
+ public void cancel(){}
41
42
 
42
43
  public void execute()
43
44
  {
@@ -62,6 +63,7 @@ public class RhodesApplicationPlatform extends UiApplication implements PushAppl
62
63
  m_conn = conn;
63
64
  }
64
65
  public boolean equals(IQueueCommand cmd){return false;}
66
+ public void cancel(){}
65
67
 
66
68
  public void execute()
67
69
  {
@@ -189,7 +191,8 @@ public class RhodesApplicationPlatform extends UiApplication implements PushAppl
189
191
 
190
192
  LOG.INFO("onStatusChange : " + strMsg);
191
193
 
192
- m_PushMessageThread.addQueueCommand( new PushStatusCommand(strMsg) );
194
+ if ( m_PushMessageThread != null )
195
+ m_PushMessageThread.addQueueCommand( new PushStatusCommand(strMsg) );
193
196
  }
194
197
 
195
198
  public void onPlatformActivate()
@@ -37,6 +37,12 @@ public class SqliteStorage implements IDBStorage
37
37
  String strDbName = getNameNoExt(strPath);
38
38
  m_fs.delete(strDbName + ".data");
39
39
  m_fs.delete(strDbName + ".data-journal");
40
+
41
+ //hsql old files
42
+ m_fs.delete(strDbName + ".script");
43
+ m_fs.delete(strDbName + ".script.new");
44
+ m_fs.delete(strDbName + ".journal");
45
+ m_fs.delete(strDbName + ".properties");
40
46
  }
41
47
 
42
48
  public IDBResult createResult() {
@@ -245,7 +251,7 @@ public class SqliteStorage implements IDBStorage
245
251
  executeBatchSQL( strTriggers );
246
252
  }
247
253
 
248
- public void open(String strPath, String strSqlScript) throws DBException
254
+ public void open(String strPath, String strSqlScript, String strEncryptionInfo) throws DBException
249
255
  {
250
256
  try{
251
257
  String strDbName = getNameNoExt(strPath) + ".data";
@@ -253,8 +259,7 @@ public class SqliteStorage implements IDBStorage
253
259
  //m_dbSess.setDBCallback(this);
254
260
 
255
261
  URI myURI = URI.create(strDbName);
256
- boolean bEncrypted = AppBuildConfig.getItem("encrypt_database") != null &&
257
- AppBuildConfig.getItem("encrypt_database").compareTo("1") == 0;
262
+ boolean bEncrypted = strEncryptionInfo != null && strEncryptionInfo.length() >0;
258
263
  DatabaseSecurityOptions dbso = new DatabaseSecurityOptions(bEncrypted);
259
264
 
260
265
  if ( !m_fs.exists(strDbName) )
@@ -38,6 +38,7 @@ public class RhodesApplicationPlatform extends UiApplication implements PushAppl
38
38
  m_strStatus = strStatus;
39
39
  }
40
40
  public boolean equals(IQueueCommand cmd){return false;}
41
+ public void cancel(){}
41
42
 
42
43
  public void execute()
43
44
  {
@@ -62,6 +63,7 @@ public class RhodesApplicationPlatform extends UiApplication implements PushAppl
62
63
  m_conn = conn;
63
64
  }
64
65
  public boolean equals(IQueueCommand cmd){return false;}
66
+ public void cancel(){}
65
67
 
66
68
  public void execute()
67
69
  {
@@ -37,6 +37,12 @@ public class SqliteStorage implements IDBStorage
37
37
  String strDbName = getNameNoExt(strPath);
38
38
  m_fs.delete(strDbName + ".data");
39
39
  m_fs.delete(strDbName + ".data-journal");
40
+
41
+ //hsql old files
42
+ m_fs.delete(strDbName + ".script");
43
+ m_fs.delete(strDbName + ".script.new");
44
+ m_fs.delete(strDbName + ".journal");
45
+ m_fs.delete(strDbName + ".properties");
40
46
  }
41
47
 
42
48
  public IDBResult createResult() {
@@ -245,7 +251,7 @@ public class SqliteStorage implements IDBStorage
245
251
  executeBatchSQL( strTriggers );
246
252
  }
247
253
 
248
- public void open(String strPath, String strSqlScript) throws DBException
254
+ public void open(String strPath, String strSqlScript, String strEncryptionInfo) throws DBException
249
255
  {
250
256
  try{
251
257
  String strDbName = getNameNoExt(strPath) + ".data";
@@ -253,8 +259,7 @@ public class SqliteStorage implements IDBStorage
253
259
  //m_dbSess.setDBCallback(this);
254
260
 
255
261
  URI myURI = URI.create(strDbName);
256
- boolean bEncrypted = AppBuildConfig.getItem("encrypt_database") != null &&
257
- AppBuildConfig.getItem("encrypt_database").compareTo("1") == 0;
262
+ boolean bEncrypted = strEncryptionInfo != null && strEncryptionInfo.length() >0;
258
263
  DatabaseSecurityOptions dbso = new DatabaseSecurityOptions(bEncrypted);
259
264
 
260
265
  if ( !m_fs.exists(strDbName) )
@@ -478,7 +478,10 @@ public class RhoCalendar extends RubyBasic {
478
478
 
479
479
  public static RubyValue addEvent(RubyValue arg0, RubyValue arg1)throws Exception
480
480
  {
481
- return saveEvent(arg0, arg1);
481
+ saveEvent(arg0, arg1);
482
+ RhoCalendar pb = (RhoCalendar)arg0;
483
+ EVRecord record = (EVRecord)arg1;
484
+ return pb.getEVRecord(record.m_event);
482
485
  }
483
486
 
484
487
  public static RubyValue deleteEvent(RubyValue arg0, RubyValue arg1)throws Exception
@@ -311,6 +311,8 @@ public class System {
311
311
  return ObjectFactory.createBoolean(RhoCalendar.has_calendar());
312
312
  if ( strPropName.equalsIgnoreCase("has_touchscreen") )
313
313
  return ObjectFactory.createBoolean(rhomobile.RhodesApplication.getInstance().hasTouchScreen());
314
+ if ( strPropName.equalsIgnoreCase("has_sqlite") )
315
+ return ObjectFactory.createBoolean(com.rho.Capabilities.USE_SQLITE);
314
316
 
315
317
  return RubyConstant.QNIL;
316
318
  }
@@ -62,6 +62,8 @@ public class ESRIMapField extends Field implements RhoMapField {
62
62
 
63
63
  private int mWidth;
64
64
  private int mHeight;
65
+
66
+ private Bitmap mapLogoImage;
65
67
 
66
68
  private static class ByCoordinatesComparator implements Comparator {
67
69
 
@@ -427,6 +429,8 @@ public class ESRIMapField extends Field implements RhoMapField {
427
429
  mMapUrls.put("satellite", url);
428
430
 
429
431
  mMapType = "roadmap";
432
+
433
+ mapLogoImage = Bitmap.getBitmapResource("esri.png");
430
434
 
431
435
  LOG.TRACE("ESRIMapField ctor: mLatitude=" + mLatitude + ", mLongitude=" + mLongitude);
432
436
 
@@ -476,6 +480,11 @@ public class ESRIMapField extends Field implements RhoMapField {
476
480
 
477
481
  paintImage(graphics, img);
478
482
  }
483
+
484
+ int logoWidth = mapLogoImage.getWidth();
485
+ int logoHeight = mapLogoImage.getHeight();
486
+ graphics.drawBitmap(0, mHeight - logoHeight, logoWidth, logoHeight, mapLogoImage, 0, 0);
487
+
479
488
  }
480
489
 
481
490
  private void paintImage(Graphics graphics, CachedImage img) {