rhodes 3.0.0 → 3.0.1.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Rakefile +9 -2
- data/doc/application.txt +1 -1
- data/doc/build.txt +49 -70
- data/doc/device-caps.txt +22 -97
- data/doc/extensions.txt +1 -1
- data/doc/nfc.txt +542 -0
- data/doc/rhom.txt +7 -5
- data/doc/simulator.txt +116 -0
- data/doc/ui.txt +1 -1
- data/lib/build/jake.rb +5 -5
- data/lib/extensions/debugger/debugger.rb +63 -35
- data/lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml +8 -6
- data/lib/extensions/nfc/ext/nfc/platform/android/jni/src/nfc.cpp +1070 -249
- data/lib/extensions/nfc/ext/nfc/platform/android/res/xml/filter_nfc.xml +1 -5
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +894 -72
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcActivity.java +82 -18
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcMessage.java +65 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcRecord.java +88 -24
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcTechActivity.java +3 -0
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc.i +204 -3
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc_wrap.c +1047 -5
- data/lib/extensions/nfc/nfc.rb +635 -91
- data/lib/extensions/rhoxml/rexml/encodings/CP-1252.rb +103 -0
- data/lib/extensions/rhoxml/rexml/encodings/ISO-8859-1.rb +7 -0
- data/lib/framework/dateME.rb +26 -0
- data/lib/framework/rho/render.rb +21 -9
- data/lib/framework/rho/rho.rb +12 -0
- data/lib/framework/rho/rhoevent_bb.rb +3 -0
- data/lib/framework/rho/rhoevent_c.rb +3 -0
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhom/rhom_db_adapter.rb +9 -9
- data/lib/framework/rhosystem.rb +17 -0
- data/lib/framework/stringio.rb +18 -0
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/res/xml/filter_nfc.xml +1 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +0 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +10 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoCryptImpl.java +29 -18
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +67 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityListener.java +14 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +102 -28
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +35 -66
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +5 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +69 -41
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/PopupActivity.java +7 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +68 -35
- data/platform/android/build/RhodesSRC_build.files +1 -0
- data/platform/android/build/android.rake +2 -2
- data/platform/bb/RubyVM/src/com/rho/RhoConf.java +1 -0
- data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +18 -6
- data/platform/bb/build/bb.rake +1 -1
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +5 -4
- data/platform/iphone/Classes/SimpleMainView.m +1 -1
- data/platform/iphone/Info.plist +1 -1
- data/platform/shared/common/RhodesApp.cpp +9 -3
- data/platform/shared/curl/lib/rhossl.c +5 -2
- data/platform/shared/db/DBAdapter.cpp +9 -0
- data/platform/shared/net/CURLNetRequest.cpp +8 -3
- data/platform/shared/net/iphone/sslimpl.cpp +3 -2
- data/platform/shared/net/ssl.cpp +8 -0
- data/platform/shared/ruby/ext/rho/rhoruby.c +10 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +1 -0
- data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +3 -4
- data/platform/win32/RhoSimulator/QtCore4.dll +0 -0
- data/platform/win32/RhoSimulator/QtGui4.dll +0 -0
- data/platform/win32/RhoSimulator/QtNetwork4.dll +0 -0
- data/platform/win32/RhoSimulator/QtWebKit4.dll +0 -0
- data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
- data/platform/win32/RhoSimulator/imageformats/qgif4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qico4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qjpeg4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qmng4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qsvg4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qtiff4.dll +0 -0
- data/platform/win32/RhoSimulator/libeay32.dll +0 -0
- data/platform/win32/RhoSimulator/ssleay32.dll +0 -0
- data/platform/wm/build/wm.rake +27 -3
- data/platform/wm/rhodes/Rhodes.cpp +4 -0
- data/platform/wm/rhodes/emulator/MainWindowCallback.h +1 -0
- data/platform/wm/rhodes/emulator/MainWindowProxy.cpp +3 -1
- data/platform/wm/rhodes/emulator/MainWindowQt.cpp +23 -12
- data/platform/wm/rhodes/emulator/MainWindowQt.h +5 -1
- data/platform/wm/rhodes/emulator/QtMainWindow.cpp +39 -6
- data/platform/wm/rhodes/emulator/QtMainWindow.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +5 -0
- data/platform/wp7/IronRuby/{Bin → bin}/Silverlight3Release/IronRuby.Libraries.dll +0 -0
- data/platform/wp7/IronRuby/{Bin → bin}/Silverlight3Release/IronRuby.dll +0 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/Microsoft.Dynamic.dll +0 -0
- data/platform/wp7/IronRuby/{Bin → bin}/Silverlight3Release/Microsoft.Scripting.Core.dll +0 -0
- data/platform/wp7/IronRuby/{Bin → bin}/Silverlight3Release/Microsoft.Scripting.dll +0 -0
- data/platform/wp7/RhoAppRunner/Program.cs +2 -2
- data/platform/wp7/RhoRubyLib/RhoRuby.cs +8 -0
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +29 -7
- data/platform/wp7/RhoRubyLib/db/DBAdapter.cs +5 -2
- data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +12 -0
- data/platform/wp7/RhoRubyLib/net/HttpServer.cs +2 -0
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +1 -1
- data/platform/wp7/RhoRubyLib/rubyext/RhoAsyncHttp.cs +52 -7
- data/platform/wp7/RhoRubyLib/rubyext/RhoDatabase.cs +85 -18
- data/platform/wp7/RhoRubyLib/rubyext/RhoJSON.cs +38 -3
- data/platform/wp7/RhoRubyLib/rubyext/RhoKernelOps.cs +27 -2
- data/platform/wp7/RhoRubyLib/rubyext/RhoNativeBar.cs +111 -15
- data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +330 -55
- data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +61 -4
- data/platform/wp7/build/wp.rake +89 -72
- data/platform/wp7/rhodes/App.xaml.cs +1 -1
- data/rakefile.rb +9 -2
- data/rhodes.gemspec +1 -3
- data/spec/phone_spec/app/spec/asynchttp_spec.rb +7 -9
- data/spec/phone_spec/app/spec/uri_spec.rb +75 -0
- data/spec/phone_spec/app/spec_runner.rb +4 -0
- metadata +21 -15
- data/Manifest.txt +0 -6403
- data/platform/win32/RhoSimulator/codecs/qcncodecs4.dll +0 -0
- data/platform/win32/RhoSimulator/codecs/qjpcodecs4.dll +0 -0
- data/platform/win32/RhoSimulator/codecs/qkrcodecs4.dll +0 -0
- data/platform/win32/RhoSimulator/codecs/qtwcodecs4.dll +0 -0
- data/platform/wp7/IronRuby/Bin/Silverlight3Release/Microsoft.Dynamic.dll +0 -0
@@ -4,6 +4,7 @@ using IronRuby.Runtime;
|
|
4
4
|
using IronRuby.Builtins;
|
5
5
|
using System;
|
6
6
|
using System.Runtime.InteropServices;
|
7
|
+
using rho.common;
|
7
8
|
|
8
9
|
namespace rho.rubyext
|
9
10
|
{
|
@@ -15,6 +16,9 @@ namespace rho.rubyext
|
|
15
16
|
{
|
16
17
|
#region Private Implementation Details
|
17
18
|
|
19
|
+
private static RhoLogger LOG = RhoLogger.RHO_STRIP_LOG ? new RhoEmptyLogger() :
|
20
|
+
new RhoLogger("RhoJSON");
|
21
|
+
|
18
22
|
#endregion
|
19
23
|
|
20
24
|
#region Private Instance & Singleton Methods
|
@@ -22,15 +26,46 @@ namespace rho.rubyext
|
|
22
26
|
[RubyMethodAttribute("parse", RubyMethodAttributes.PublicSingleton)]
|
23
27
|
public static object parse(RubyModule/*!*/ self, [NotNull]string/*!*/ strData)
|
24
28
|
{
|
25
|
-
|
29
|
+
object res = null;
|
30
|
+
try
|
31
|
+
{
|
32
|
+
res = fastJSON.RJSONTokener.JsonDecode(strData);
|
33
|
+
}
|
34
|
+
catch (Exception ex)
|
35
|
+
{
|
36
|
+
Exception rubyEx = self.Context.CurrentException;
|
37
|
+
if (rubyEx == null)
|
38
|
+
{
|
39
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
40
|
+
}
|
41
|
+
LOG.ERROR("parse", ex);
|
42
|
+
throw rubyEx;
|
43
|
+
}
|
44
|
+
|
45
|
+
return res;
|
26
46
|
}
|
27
47
|
|
28
48
|
[RubyMethodAttribute("quote_value", RubyMethodAttributes.PublicSingleton)]
|
29
49
|
public static object quote_value(RubyModule/*!*/ self, [NotNull]string/*!*/ strData)
|
30
50
|
{
|
31
|
-
|
51
|
+
object res = null;
|
52
|
+
try
|
53
|
+
{
|
54
|
+
String strRes = rho.json.JSONEntry.quoteValue(strData);
|
55
|
+
res = CRhoRuby.Instance.createString(strRes);
|
56
|
+
}
|
57
|
+
catch (Exception ex)
|
58
|
+
{
|
59
|
+
Exception rubyEx = self.Context.CurrentException;
|
60
|
+
if (rubyEx == null)
|
61
|
+
{
|
62
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
63
|
+
}
|
64
|
+
LOG.ERROR("quote_value", ex);
|
65
|
+
throw rubyEx;
|
66
|
+
}
|
32
67
|
|
33
|
-
return
|
68
|
+
return res;
|
34
69
|
}
|
35
70
|
|
36
71
|
#endregion
|
@@ -9,16 +9,41 @@ namespace rho.rubyext
|
|
9
9
|
{
|
10
10
|
public static class RhoKernelOps
|
11
11
|
{
|
12
|
+
private static RhoLogger LOG = RhoLogger.RHO_STRIP_LOG ? new RhoEmptyLogger() :
|
13
|
+
new RhoLogger("RhoKernelOps");
|
14
|
+
|
15
|
+
static CRhoRuby RhoRuby { get { return CRhoRuby.Instance; } }
|
16
|
+
|
12
17
|
private static CRhodesApp RhodesApp { get { return CRhodesApp.Instance; } }
|
13
18
|
|
14
19
|
public static Object __rhoGetCallbackObject(Object/*!*/ self, int index)
|
15
20
|
{
|
16
|
-
|
21
|
+
Object res = null;
|
22
|
+
try
|
23
|
+
{
|
24
|
+
res = RhodesApp.getCallbackObject(index);
|
25
|
+
}
|
26
|
+
catch (Exception ex)
|
27
|
+
{
|
28
|
+
LOG.HandleRubyException(ex, RhoRuby.rubyContext.CurrentException, "__rhoGetCallbackObject");
|
29
|
+
}
|
30
|
+
|
31
|
+
return res;
|
17
32
|
}
|
18
33
|
|
19
34
|
public static Object __rho_exist_in_resources(Object/*!*/ self, String path)
|
20
35
|
{
|
21
|
-
|
36
|
+
Object res = null;
|
37
|
+
try
|
38
|
+
{
|
39
|
+
res = CRhoFile.isResourceFileExist(path);
|
40
|
+
}
|
41
|
+
catch (Exception ex)
|
42
|
+
{
|
43
|
+
LOG.HandleRubyException(ex, RhoRuby.rubyContext.CurrentException, "__rho_exist_in_resources");
|
44
|
+
}
|
45
|
+
|
46
|
+
return res;
|
22
47
|
}
|
23
48
|
|
24
49
|
}
|
@@ -14,6 +14,8 @@ namespace rho.rubyext
|
|
14
14
|
|
15
15
|
#region Private Implementation Details
|
16
16
|
|
17
|
+
private static RhoLogger LOG = RhoLogger.RHO_STRIP_LOG ? new RhoEmptyLogger() :
|
18
|
+
new RhoLogger("RhoNativeBar");
|
17
19
|
private static CRhodesApp RhodesApp { get { return CRhodesApp.Instance; } }
|
18
20
|
|
19
21
|
#endregion
|
@@ -23,27 +25,66 @@ namespace rho.rubyext
|
|
23
25
|
[RubyMethodAttribute("create", RubyMethodAttributes.PublicSingleton)]
|
24
26
|
public static void Create(RubyModule/*!*/ self, int barType, RubyArray args)
|
25
27
|
{
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
try
|
29
|
+
{
|
30
|
+
if (args != null && args.Count > 0)
|
31
|
+
RhodesApp.createToolBar(barType, (Object)args);
|
32
|
+
|
33
|
+
if (barType == 2)
|
34
|
+
RhodesApp.removeToolBar();
|
35
|
+
}
|
36
|
+
catch (Exception ex)
|
37
|
+
{
|
38
|
+
Exception rubyEx = self.Context.CurrentException;
|
39
|
+
if (rubyEx == null)
|
40
|
+
{
|
41
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
42
|
+
}
|
43
|
+
LOG.ERROR("create", ex);
|
44
|
+
throw rubyEx;
|
45
|
+
}
|
31
46
|
}
|
32
47
|
|
33
48
|
[RubyMethodAttribute("create", RubyMethodAttributes.PublicSingleton)]
|
34
49
|
public static void Create(RubyModule/*!*/ self, int barType, Hash args)
|
35
50
|
{
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
51
|
+
try
|
52
|
+
{
|
53
|
+
if (args != null && args.Count > 0)
|
54
|
+
RhodesApp.createToolBar(barType, (Object)args);
|
55
|
+
|
56
|
+
if (barType == 2)
|
57
|
+
RhodesApp.removeToolBar();
|
58
|
+
}
|
59
|
+
catch (Exception ex)
|
60
|
+
{
|
61
|
+
Exception rubyEx = self.Context.CurrentException;
|
62
|
+
if (rubyEx == null)
|
63
|
+
{
|
64
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
65
|
+
}
|
66
|
+
LOG.ERROR("create", ex);
|
67
|
+
throw rubyEx;
|
68
|
+
}
|
41
69
|
}
|
42
70
|
|
43
71
|
[RubyMethodAttribute("remove", RubyMethodAttributes.PublicSingleton)]
|
44
72
|
public static void Remove(RubyModule/*!*/ self)
|
45
73
|
{
|
46
|
-
|
74
|
+
try
|
75
|
+
{
|
76
|
+
RhodesApp.removeToolBar();
|
77
|
+
}
|
78
|
+
catch (Exception ex)
|
79
|
+
{
|
80
|
+
Exception rubyEx = self.Context.CurrentException;
|
81
|
+
if (rubyEx == null)
|
82
|
+
{
|
83
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
84
|
+
}
|
85
|
+
LOG.ERROR("remove", ex);
|
86
|
+
throw rubyEx;
|
87
|
+
}
|
47
88
|
}
|
48
89
|
|
49
90
|
[RubyMethodAttribute("switch_tab", RubyMethodAttributes.PublicSingleton)]
|
@@ -55,7 +96,23 @@ namespace rho.rubyext
|
|
55
96
|
[RubyMethodAttribute("started", RubyMethodAttributes.PublicSingleton)]
|
56
97
|
public static Boolean isStarted(RubyModule/*!*/ self)
|
57
98
|
{
|
58
|
-
|
99
|
+
Boolean res = false;
|
100
|
+
try
|
101
|
+
{
|
102
|
+
res = RhodesApp.barIsStarted;
|
103
|
+
}
|
104
|
+
catch (Exception ex)
|
105
|
+
{
|
106
|
+
Exception rubyEx = self.Context.CurrentException;
|
107
|
+
if (rubyEx == null)
|
108
|
+
{
|
109
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
110
|
+
}
|
111
|
+
LOG.ERROR("started", ex);
|
112
|
+
throw rubyEx;
|
113
|
+
}
|
114
|
+
|
115
|
+
return res;
|
59
116
|
}
|
60
117
|
|
61
118
|
[RubyMethodAttribute("set_tab_badge", RubyMethodAttributes.PublicSingleton)]
|
@@ -67,19 +124,58 @@ namespace rho.rubyext
|
|
67
124
|
[RubyMethodAttribute("create_native_toolbar", RubyMethodAttributes.PublicSingleton)]
|
68
125
|
public static void createNativeToolBar(RubyModule/*!*/ self, int barType, RubyArray args)
|
69
126
|
{
|
70
|
-
|
127
|
+
try
|
128
|
+
{
|
129
|
+
Create(self, barType, args);
|
130
|
+
}
|
131
|
+
catch (Exception ex)
|
132
|
+
{
|
133
|
+
Exception rubyEx = self.Context.CurrentException;
|
134
|
+
if (rubyEx == null)
|
135
|
+
{
|
136
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
137
|
+
}
|
138
|
+
LOG.ERROR("create_native_toolbar", ex);
|
139
|
+
throw rubyEx;
|
140
|
+
}
|
71
141
|
}
|
72
142
|
|
73
143
|
[RubyMethodAttribute("create_native_toolbar", RubyMethodAttributes.PublicSingleton)]
|
74
144
|
public static void createNativeToolBar(RubyModule/*!*/ self, int barType, Hash args)
|
75
145
|
{
|
76
|
-
|
146
|
+
try
|
147
|
+
{
|
148
|
+
Create(self, barType, args);
|
149
|
+
}
|
150
|
+
catch (Exception ex)
|
151
|
+
{
|
152
|
+
Exception rubyEx = self.Context.CurrentException;
|
153
|
+
if (rubyEx == null)
|
154
|
+
{
|
155
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
156
|
+
}
|
157
|
+
LOG.ERROR("create_native_toolbar", ex);
|
158
|
+
throw rubyEx;
|
159
|
+
}
|
77
160
|
}
|
78
161
|
|
79
162
|
[RubyMethodAttribute("remove_native_toolbar", RubyMethodAttributes.PublicSingleton)]
|
80
163
|
public static void removeNativeToolBar(RubyModule/*!*/ self)
|
81
164
|
{
|
82
|
-
|
165
|
+
try
|
166
|
+
{
|
167
|
+
Remove(self);
|
168
|
+
}
|
169
|
+
catch (Exception ex)
|
170
|
+
{
|
171
|
+
Exception rubyEx = self.Context.CurrentException;
|
172
|
+
if (rubyEx == null)
|
173
|
+
{
|
174
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
175
|
+
}
|
176
|
+
LOG.ERROR("remove_native_toolbar", ex);
|
177
|
+
throw rubyEx;
|
178
|
+
}
|
83
179
|
}
|
84
180
|
|
85
181
|
[RubyMethodAttribute("create_native_tabbar", RubyMethodAttributes.PublicSingleton)]
|
@@ -19,69 +19,169 @@ namespace rho.rubyext
|
|
19
19
|
[RubyMethod("dosync", RubyMethodAttributes.PublicSingleton)]
|
20
20
|
public static object dosync(RubyModule/*!*/ self)
|
21
21
|
{
|
22
|
-
|
23
|
-
|
22
|
+
object res = null;
|
23
|
+
try
|
24
|
+
{
|
25
|
+
SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncAll, false));
|
26
|
+
|
27
|
+
res = SyncThread.getInstance().getRetValue();
|
28
|
+
}
|
29
|
+
catch (Exception ex)
|
30
|
+
{
|
31
|
+
Exception rubyEx = self.Context.CurrentException;
|
32
|
+
if (rubyEx == null)
|
33
|
+
{
|
34
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
35
|
+
}
|
36
|
+
LOG.ERROR("dosync", ex);
|
37
|
+
throw rubyEx;
|
38
|
+
}
|
39
|
+
|
40
|
+
return res;
|
24
41
|
}
|
25
42
|
|
26
43
|
[RubyMethod("dosync", RubyMethodAttributes.PublicSingleton)]
|
27
44
|
public static object dosync(RubyModule/*!*/ self, bool/*!*/ show_status_popup)
|
28
45
|
{
|
29
|
-
|
30
|
-
|
46
|
+
object res = null;
|
47
|
+
try
|
48
|
+
{
|
49
|
+
SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncAll, show_status_popup));
|
50
|
+
|
51
|
+
res = SyncThread.getInstance().getRetValue();
|
52
|
+
}
|
53
|
+
catch (Exception ex)
|
54
|
+
{
|
55
|
+
Exception rubyEx = self.Context.CurrentException;
|
56
|
+
if (rubyEx == null)
|
57
|
+
{
|
58
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
59
|
+
}
|
60
|
+
LOG.ERROR("dosync", ex);
|
61
|
+
throw rubyEx;
|
62
|
+
}
|
63
|
+
|
64
|
+
return res;
|
31
65
|
}
|
32
66
|
|
33
67
|
[RubyMethod("dosync_source", RubyMethodAttributes.PublicSingleton)]
|
34
68
|
public static object dosync_source(RubyModule/*!*/ self, [NotNull]object/*!*/ srcID)
|
35
69
|
{
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
nSrcID =
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
70
|
+
object res = null;
|
71
|
+
try
|
72
|
+
{
|
73
|
+
int nSrcID = 0;
|
74
|
+
String strName = "";
|
75
|
+
if (srcID is long)
|
76
|
+
nSrcID = (int)(long)srcID;
|
77
|
+
else if (srcID is int)
|
78
|
+
nSrcID = (int)srcID;
|
79
|
+
else
|
80
|
+
strName = srcID.ToString();
|
81
|
+
|
82
|
+
SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncOne, strName, nSrcID, true));
|
83
|
+
|
84
|
+
res = SyncThread.getInstance().getRetValue();
|
85
|
+
}
|
86
|
+
catch (Exception ex)
|
87
|
+
{
|
88
|
+
Exception rubyEx = self.Context.CurrentException;
|
89
|
+
if (rubyEx == null)
|
90
|
+
{
|
91
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
92
|
+
}
|
93
|
+
LOG.ERROR("dosync_source", ex);
|
94
|
+
throw rubyEx;
|
95
|
+
}
|
44
96
|
|
45
|
-
|
46
|
-
return SyncThread.getInstance().getRetValue();
|
97
|
+
return res;
|
47
98
|
}
|
48
99
|
|
49
100
|
[RubyMethod("dosync_source", RubyMethodAttributes.PublicSingleton)]
|
50
101
|
public static object dosync_source(RubyModule/*!*/ self, [NotNull]object/*!*/ srcID, bool/*!*/ show_status_popup)
|
51
102
|
{
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
nSrcID =
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
103
|
+
object res = null;
|
104
|
+
try
|
105
|
+
{
|
106
|
+
int nSrcID = 0;
|
107
|
+
String strName = "";
|
108
|
+
if (srcID is long)
|
109
|
+
nSrcID = (int)(long)srcID;
|
110
|
+
else if (srcID is int)
|
111
|
+
nSrcID = (int)srcID;
|
112
|
+
else
|
113
|
+
strName = srcID.ToString();
|
114
|
+
|
115
|
+
SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncOne, strName, nSrcID, show_status_popup));
|
116
|
+
|
117
|
+
res = SyncThread.getInstance().getRetValue();
|
118
|
+
}
|
119
|
+
catch (Exception ex)
|
120
|
+
{
|
121
|
+
Exception rubyEx = self.Context.CurrentException;
|
122
|
+
if (rubyEx == null)
|
123
|
+
{
|
124
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
125
|
+
}
|
126
|
+
LOG.ERROR("dosync_source", ex);
|
127
|
+
throw rubyEx;
|
128
|
+
}
|
60
129
|
|
61
|
-
|
62
|
-
return SyncThread.getInstance().getRetValue();
|
130
|
+
return res;
|
63
131
|
}
|
64
132
|
|
65
133
|
[RubyMethod("dosearch", RubyMethodAttributes.PublicSingleton)]
|
66
134
|
public static object dosearch(RubyModule/*!*/ self, [NotNull]RubyArray/*!*/ arSourcesR, [NotNull]String/*!*/ from, [NotNull]String/*!*/ strParams,
|
67
135
|
[NotNull]bool/*!*/ bSearchSyncChanges, [NotNull]int/*!*/ nProgressStep, String/*!*/ strCallback, String/*!*/ strCallbackParams)
|
68
136
|
{
|
69
|
-
|
137
|
+
object res = null;
|
138
|
+
try
|
139
|
+
{
|
140
|
+
SyncThread.stopSync();
|
70
141
|
|
71
|
-
|
72
|
-
|
142
|
+
if (strCallback != null && strCallback.Length > 0)
|
143
|
+
SyncThread.getSyncEngine().getNotify().setSearchNotification(strCallback, strCallbackParams);
|
73
144
|
|
74
|
-
|
145
|
+
Vector<String> arSources = RhoRuby.makeVectorStringFromArray(arSourcesR);
|
75
146
|
|
76
|
-
|
147
|
+
SyncThread.getInstance().addQueueCommand(new SyncThread.SyncSearchCommand(from, strParams, arSources, bSearchSyncChanges, nProgressStep));
|
148
|
+
|
149
|
+
res = SyncThread.getInstance().getRetValue();
|
150
|
+
}
|
151
|
+
catch (Exception ex)
|
152
|
+
{
|
153
|
+
Exception rubyEx = self.Context.CurrentException;
|
154
|
+
if (rubyEx == null)
|
155
|
+
{
|
156
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
157
|
+
}
|
158
|
+
LOG.ERROR("dosearch", ex);
|
159
|
+
throw rubyEx;
|
160
|
+
}
|
77
161
|
|
78
|
-
return
|
162
|
+
return res;
|
79
163
|
}
|
80
164
|
|
81
165
|
[RubyMethod("logged_in", RubyMethodAttributes.PublicSingleton)]
|
82
166
|
public static int logged_in(RubyModule/*!*/ self)
|
83
167
|
{
|
84
|
-
|
168
|
+
int res = 0;
|
169
|
+
try
|
170
|
+
{
|
171
|
+
res = SyncThread.getSyncEngine().isLoggedIn() ? 1 : 0;
|
172
|
+
}
|
173
|
+
catch (Exception ex)
|
174
|
+
{
|
175
|
+
Exception rubyEx = self.Context.CurrentException;
|
176
|
+
if (rubyEx == null)
|
177
|
+
{
|
178
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
179
|
+
}
|
180
|
+
LOG.ERROR("logged_in", ex);
|
181
|
+
throw rubyEx;
|
182
|
+
}
|
183
|
+
|
184
|
+
return res;
|
85
185
|
}
|
86
186
|
|
87
187
|
[RubyMethod("login", RubyMethodAttributes.PublicSingleton)]
|
@@ -106,94 +206,269 @@ namespace rho.rubyext
|
|
106
206
|
[RubyMethod("set_notification", RubyMethodAttributes.PublicSingleton)]
|
107
207
|
public static void set_notification(RubyModule/*!*/ self, [NotNull]int/*!*/ nSrcID, [NotNull]String/*!*/ url, string/*!*/ callback_param)
|
108
208
|
{
|
109
|
-
|
110
|
-
|
209
|
+
try
|
210
|
+
{
|
211
|
+
SyncThread.getSyncEngine().getNotify().setSyncNotification(nSrcID,
|
212
|
+
new SyncNotify.SyncNotification(url, callback_param != null ? callback_param : "", nSrcID != -1));
|
213
|
+
}
|
214
|
+
catch (Exception ex)
|
215
|
+
{
|
216
|
+
Exception rubyEx = self.Context.CurrentException;
|
217
|
+
if (rubyEx == null)
|
218
|
+
{
|
219
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
220
|
+
}
|
221
|
+
LOG.ERROR("set_notification", ex);
|
222
|
+
throw rubyEx;
|
223
|
+
}
|
111
224
|
}
|
112
225
|
|
113
226
|
[RubyMethod("enable_status_popup", RubyMethodAttributes.PublicSingleton)]
|
114
227
|
public static void enable_status_popup(RubyModule/*!*/ self, bool/*!*/ bEnable)
|
115
228
|
{
|
116
|
-
|
229
|
+
try
|
230
|
+
{
|
231
|
+
SyncThread.getSyncEngine().getNotify().enableStatusPopup(bEnable);
|
232
|
+
}
|
233
|
+
catch (Exception ex)
|
234
|
+
{
|
235
|
+
Exception rubyEx = self.Context.CurrentException;
|
236
|
+
if (rubyEx == null)
|
237
|
+
{
|
238
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
239
|
+
}
|
240
|
+
LOG.ERROR("enable_status_popup", ex);
|
241
|
+
throw rubyEx;
|
242
|
+
}
|
117
243
|
}
|
118
244
|
|
119
245
|
[RubyMethod("is_blob_attr", RubyMethodAttributes.PublicSingleton)]
|
120
246
|
public static bool is_blob_attr(RubyModule/*!*/ self, [NotNull]String/*!*/ strPartition, [NotNull]int/*!*/ nSrcID, [NotNull]String/*!*/ strAttrName)
|
121
247
|
{
|
122
|
-
|
248
|
+
bool res = false;
|
249
|
+
try
|
250
|
+
{
|
251
|
+
res = DBAdapter.getDB(strPartition).getAttrMgr().isBlobAttr(nSrcID, strAttrName);
|
252
|
+
}
|
253
|
+
catch (Exception ex)
|
254
|
+
{
|
255
|
+
Exception rubyEx = self.Context.CurrentException;
|
256
|
+
if (rubyEx == null)
|
257
|
+
{
|
258
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
259
|
+
}
|
260
|
+
LOG.ERROR("is_blob_attr", ex);
|
261
|
+
throw rubyEx;
|
262
|
+
}
|
263
|
+
|
264
|
+
return res;
|
123
265
|
}
|
124
266
|
|
125
267
|
[RubyMethod("update_blob_attribs", RubyMethodAttributes.PublicSingleton)]
|
126
268
|
public static void update_blob_attribs(RubyModule/*!*/ self, [NotNull]String/*!*/ strPartition, [NotNull]int/*!*/ srcID)
|
127
269
|
{
|
128
|
-
|
129
|
-
|
270
|
+
try
|
271
|
+
{
|
272
|
+
DBAdapter db = DBAdapter.getDB(strPartition);
|
273
|
+
db.getAttrMgr().loadBlobAttrs(db);
|
274
|
+
}
|
275
|
+
catch (Exception ex)
|
276
|
+
{
|
277
|
+
Exception rubyEx = self.Context.CurrentException;
|
278
|
+
if (rubyEx == null)
|
279
|
+
{
|
280
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
281
|
+
}
|
282
|
+
LOG.ERROR("update_blob_attribs", ex);
|
283
|
+
throw rubyEx;
|
284
|
+
}
|
130
285
|
}
|
131
286
|
|
132
287
|
[RubyMethod("set_threaded_mode", RubyMethodAttributes.PublicSingleton)]
|
133
288
|
public static void set_threaded_mode(RubyModule/*!*/ self, [NotNull]bool/*!*/ bThreadMode)
|
134
289
|
{
|
135
|
-
|
136
|
-
|
290
|
+
try
|
291
|
+
{
|
292
|
+
SyncThread.getInstance().setNonThreadedMode(!bThreadMode);
|
293
|
+
SyncThread.getSyncEngine().setNonThreadedMode(!bThreadMode);
|
294
|
+
}
|
295
|
+
catch (Exception ex)
|
296
|
+
{
|
297
|
+
Exception rubyEx = self.Context.CurrentException;
|
298
|
+
if (rubyEx == null)
|
299
|
+
{
|
300
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
301
|
+
}
|
302
|
+
LOG.ERROR("set_threaded_mode", ex);
|
303
|
+
throw rubyEx;
|
304
|
+
}
|
137
305
|
}
|
138
306
|
|
139
307
|
[RubyMethod("logout", RubyMethodAttributes.PublicSingleton)]
|
140
308
|
public static void logout(RubyModule/*!*/ self)
|
141
309
|
{
|
142
|
-
|
143
|
-
|
144
|
-
|
310
|
+
try
|
311
|
+
{
|
312
|
+
SyncThread.stopSync();
|
313
|
+
SyncThread.getSyncEngine().stopSyncByUser();
|
314
|
+
SyncThread.getSyncEngine().logout();
|
315
|
+
}
|
316
|
+
catch (Exception ex)
|
317
|
+
{
|
318
|
+
Exception rubyEx = self.Context.CurrentException;
|
319
|
+
if (rubyEx == null)
|
320
|
+
{
|
321
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
322
|
+
}
|
323
|
+
LOG.ERROR("logout", ex);
|
324
|
+
throw rubyEx;
|
325
|
+
}
|
145
326
|
}
|
146
327
|
|
147
328
|
[RubyMethod("set_syncserver", RubyMethodAttributes.PublicSingleton)]
|
148
329
|
public static void set_syncserver(RubyModule/*!*/ self, [NotNull]String/*!*/ syncserver)
|
149
330
|
{
|
150
|
-
SyncThread.stopSync();
|
151
|
-
SyncThread.getSyncEngine().setSyncServer(syncserver);
|
152
331
|
|
153
|
-
|
332
|
+
try
|
154
333
|
{
|
155
|
-
SyncThread.
|
156
|
-
|
157
|
-
|
334
|
+
SyncThread.stopSync();
|
335
|
+
SyncThread.getSyncEngine().setSyncServer(syncserver);
|
336
|
+
|
337
|
+
if (syncserver != null && syncserver.length() > 0)
|
338
|
+
{
|
339
|
+
SyncThread.getInstance().start(SyncThread.epLow);
|
340
|
+
if (ClientRegister.getInstance() != null)
|
341
|
+
ClientRegister.getInstance().startUp();
|
342
|
+
}
|
343
|
+
}
|
344
|
+
catch (Exception ex)
|
345
|
+
{
|
346
|
+
Exception rubyEx = self.Context.CurrentException;
|
347
|
+
if (rubyEx == null)
|
348
|
+
{
|
349
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
350
|
+
}
|
351
|
+
LOG.ERROR("set_syncserver", ex);
|
352
|
+
throw rubyEx;
|
158
353
|
}
|
159
354
|
}
|
160
355
|
|
161
356
|
[RubyMethod("set_pollinterval", RubyMethodAttributes.PublicSingleton)]
|
162
357
|
public static int set_pollinterval(RubyModule/*!*/ self, [NotNull]int/*!*/ nInterval)
|
163
358
|
{
|
164
|
-
int nOldInterval =
|
165
|
-
|
359
|
+
int nOldInterval = 0;
|
360
|
+
try
|
361
|
+
{
|
362
|
+
nOldInterval = SyncThread.getInstance().getPollInterval();
|
363
|
+
SyncThread.getInstance().setPollInterval(nInterval);
|
364
|
+
}
|
365
|
+
catch (Exception ex)
|
366
|
+
{
|
367
|
+
Exception rubyEx = self.Context.CurrentException;
|
368
|
+
if (rubyEx == null)
|
369
|
+
{
|
370
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
371
|
+
}
|
372
|
+
LOG.ERROR("set_pollinterval", ex);
|
373
|
+
throw rubyEx;
|
374
|
+
}
|
375
|
+
|
166
376
|
return nOldInterval;
|
167
377
|
}
|
168
378
|
|
169
379
|
[RubyMethod("stop_sync", RubyMethodAttributes.PublicSingleton)]
|
170
380
|
public static void set_pollinterval(RubyModule/*!*/ self)
|
171
381
|
{
|
172
|
-
|
382
|
+
try
|
383
|
+
{
|
384
|
+
SyncThread.stopSync();
|
385
|
+
}
|
386
|
+
catch (Exception ex)
|
387
|
+
{
|
388
|
+
Exception rubyEx = self.Context.CurrentException;
|
389
|
+
if (rubyEx == null)
|
390
|
+
{
|
391
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
392
|
+
}
|
393
|
+
LOG.ERROR("stop_sync", ex);
|
394
|
+
throw rubyEx;
|
395
|
+
}
|
173
396
|
}
|
174
397
|
|
175
398
|
[RubyMethod("set_source_property", RubyMethodAttributes.PublicSingleton)]
|
176
399
|
public static void set_source_property(RubyModule/*!*/ self, [NotNull]int/*!*/ nSrcID, [NotNull]String/*!*/ strPropName, [NotNull]String/*!*/ strPropValue)
|
177
400
|
{
|
178
|
-
|
401
|
+
try
|
402
|
+
{
|
403
|
+
SyncEngine.getSourceOptions().setProperty(nSrcID, strPropName, strPropValue);
|
404
|
+
}
|
405
|
+
catch (Exception ex)
|
406
|
+
{
|
407
|
+
Exception rubyEx = self.Context.CurrentException;
|
408
|
+
if (rubyEx == null)
|
409
|
+
{
|
410
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
411
|
+
}
|
412
|
+
LOG.ERROR("set_source_property", ex);
|
413
|
+
throw rubyEx;
|
414
|
+
}
|
179
415
|
}
|
180
416
|
|
181
417
|
[RubyMethod("set_objectnotify_url", RubyMethodAttributes.PublicSingleton)]
|
182
418
|
public static void set_objectnotify_url(RubyModule/*!*/ self, [DefaultProtocol, NotNull]string/*!*/ url)
|
183
419
|
{
|
184
|
-
|
420
|
+
try
|
421
|
+
{
|
422
|
+
SyncNotify.setObjectNotifyUrl(url);
|
423
|
+
}
|
424
|
+
catch (Exception ex)
|
425
|
+
{
|
426
|
+
Exception rubyEx = self.Context.CurrentException;
|
427
|
+
if (rubyEx == null)
|
428
|
+
{
|
429
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
430
|
+
}
|
431
|
+
LOG.ERROR("set_objectnotify_url", ex);
|
432
|
+
throw rubyEx;
|
433
|
+
}
|
185
434
|
}
|
186
435
|
|
187
436
|
[RubyMethod("add_objectnotify", RubyMethodAttributes.PublicSingleton)]
|
188
437
|
public static void add_objectnotify(RubyModule/*!*/ self, [NotNull]int/*!*/ nSrcID, [NotNull]string/*!*/ strObject)
|
189
438
|
{
|
190
|
-
|
439
|
+
try
|
440
|
+
{
|
441
|
+
SyncThread.getSyncEngine().getNotify().addObjectNotify(nSrcID, strObject);
|
442
|
+
}
|
443
|
+
catch (Exception ex)
|
444
|
+
{
|
445
|
+
Exception rubyEx = self.Context.CurrentException;
|
446
|
+
if (rubyEx == null)
|
447
|
+
{
|
448
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
449
|
+
}
|
450
|
+
LOG.ERROR("add_objectnotify", ex);
|
451
|
+
throw rubyEx;
|
452
|
+
}
|
191
453
|
}
|
192
454
|
|
193
455
|
[RubyMethod("clean_objectnotify", RubyMethodAttributes.PublicSingleton)]
|
194
456
|
public static void clean_objectnotify(RubyModule/*!*/ self)
|
195
457
|
{
|
196
|
-
|
458
|
+
try
|
459
|
+
{
|
460
|
+
SyncThread.getSyncEngine().getNotify().cleanObjectNotifications();
|
461
|
+
}
|
462
|
+
catch (Exception ex)
|
463
|
+
{
|
464
|
+
Exception rubyEx = self.Context.CurrentException;
|
465
|
+
if (rubyEx == null)
|
466
|
+
{
|
467
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
468
|
+
}
|
469
|
+
LOG.ERROR("clean_objectnotify", ex);
|
470
|
+
throw rubyEx;
|
471
|
+
}
|
197
472
|
}
|
198
473
|
}
|
199
474
|
}
|