rhoconnect-client 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +9 -0
- data/CREDITS +0 -0
- data/LICENSE +9 -0
- data/README.md +47 -0
- data/ext/rhoconnect-client/RhoConnectClient.rb +190 -0
- data/ext/rhoconnect-client/ext/RhoConnectClient.xml +726 -0
- data/ext/rhoconnect-client/ext/build +26 -0
- data/ext/rhoconnect-client/ext/build.bat +30 -0
- data/ext/rhoconnect-client/ext/platform/android/ext_java.files +1 -0
- data/ext/rhoconnect-client/ext/platform/android/ext_native.files +14 -0
- data/ext/rhoconnect-client/ext/platform/android/src/com/rhoconnectclient/RhoconnectClient.java +1 -0
- data/ext/rhoconnect-client/ext/platform/iphone/.gitignore +1 -0
- data/ext/rhoconnect-client/ext/platform/iphone/Rakefile +74 -0
- data/ext/rhoconnect-client/ext/platform/iphone/RhoconnectClient.xcodeproj/project.pbxproj +390 -0
- data/ext/rhoconnect-client/ext/platform/iphone/RhoconnectClient_Prefix.pch +7 -0
- data/ext/rhoconnect-client/ext/platform/iphone/impl/readme.txt +7 -0
- data/ext/rhoconnect-client/ext/platform/qt/Rakefile +35 -0
- data/ext/rhoconnect-client/ext/platform/qt/rhoconnect-client.pro +88 -0
- data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.sln +36 -0
- data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.vcproj +774 -0
- data/ext/rhoconnect-client/ext/platform/wm/Rhoconnect-client.vsprops +15 -0
- data/ext/rhoconnect-client/ext/platform/wm/src/rhoconnectclient_wm.cpp +40 -0
- data/ext/rhoconnect-client/ext/platform/wm/src/rhoconnectclient_wm.h +2 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.props +22 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.sln +32 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.vcxproj +220 -0
- data/ext/rhoconnect-client/ext/platform/wp8/Rhoconnect-client.vcxproj.filters +103 -0
- data/ext/rhoconnect-client/ext/shared/RhoConnectClientImpl.cpp +273 -0
- data/ext/rhoconnect-client/ext/shared/RhoConnectClientImpl.h +60 -0
- data/ext/rhoconnect-client/ext/shared/RhoConnectClientSingletonImpl.h +53 -0
- data/ext/rhoconnect-client/ext/shared/initRhoconnectClient.cpp +207 -0
- data/ext/rhoconnect-client/ext/shared/rhoconnectclient.c +18 -0
- data/ext/rhoconnect-client/ext/shared/sync/ClientRegister.cpp +398 -0
- data/ext/rhoconnect-client/ext/shared/sync/ClientRegister.h +147 -0
- data/ext/rhoconnect-client/ext/shared/sync/ISyncProtocol.h +91 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncEngine.cpp +1245 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncEngine.h +213 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncNotify.cpp +737 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncNotify.h +209 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncProtocol_3.h +220 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncProtocol_4.h +259 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncSource.cpp +1694 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncSource.h +212 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncThread.cpp +583 -0
- data/ext/rhoconnect-client/ext/shared/sync/SyncThread.h +250 -0
- data/ext/rhoconnect-client/ext.yml +12 -0
- data/lib/build/run_rhoconnect_spec.rb +135 -0
- data/lib/rhoconnect-client.rb +3 -0
- data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +1673 -0
- data/platform/shared/RhoConnectClient/RhoConnectClient.h +181 -0
- data/platform/shared/RhoConnectClient/RhoError.h +77 -0
- data/rhoconnect-client/C++/Tests/RhoConnectClientTest.cpp +830 -0
- data/rhoconnect-client/C++/Tests/win32/.gitignore +3 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClient.sln +65 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClient.vcproj +634 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClientTest/RhoConnectClientTest.vcproj +222 -0
- data/rhoconnect-client/C++/Tests/win32/RhoConnectClientTest/stdafx.h +65 -0
- data/rhoconnect-client/C++/Tests/win32/stdafx.h +65 -0
- data/rhoconnect-client/CHANGELOG +18 -0
- data/rhoconnect-client/Java/Android/build/android.rake +387 -0
- data/rhoconnect-client/Java/Android/build/android_sdk.rb +582 -0
- data/rhoconnect-client/Java/Android/build/libcurl_build.files +73 -0
- data/rhoconnect-client/Java/Android/build/libjson_build.files +9 -0
- data/rhoconnect-client/Java/Android/build/librhocommon_build.files +14 -0
- data/rhoconnect-client/Java/Android/build/librhodb_build.files +5 -0
- data/rhoconnect-client/Java/Android/build/librhoimpl_build.files +13 -0
- data/rhoconnect-client/Java/Android/build/librholog_build.files +4 -0
- data/rhoconnect-client/Java/Android/build/libsqlite_build.files +1 -0
- data/rhoconnect-client/Java/Android/build/libsync_build.files +7 -0
- data/rhoconnect-client/Java/Android/build/libunzip_build.files +1 -0
- data/rhoconnect-client/Java/Android/build/rhoconnectclient_build.files +3 -0
- data/rhoconnect-client/Java/Android/build/rhoimpljava_build.files +21 -0
- data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/Capabilities.java +63 -0
- data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/MemoryInfoCollector.java +79 -0
- data/rhoconnect-client/Java/Android/src/com/rhomobile/rhodes/util/ContextFactory.java +63 -0
- data/rhoconnect-client/Java/Android/test/.classpath +9 -0
- data/rhoconnect-client/Java/Android/test/.project +33 -0
- data/rhoconnect-client/Java/Android/test/AndroidManifest.xml +14 -0
- data/rhoconnect-client/Java/Android/test/assets/apps/androidtest.png +0 -0
- data/rhoconnect-client/Java/Android/test/assets/apps/rhoconfig.txt +19 -0
- data/rhoconnect-client/Java/Android/test/assets/apps/rhoconfig.txt.timestamp +1 -0
- data/rhoconnect-client/Java/Android/test/assets/db/syncdb.schema +44 -0
- data/rhoconnect-client/Java/Android/test/assets/db/syncdb.triggers +10 -0
- data/rhoconnect-client/Java/Android/test/assets/db/syncdb_java.triggers +21 -0
- data/rhoconnect-client/Java/Android/test/assets/rho.dat +9 -0
- data/rhoconnect-client/Java/Android/test/proguard.cfg +36 -0
- data/rhoconnect-client/Java/Android/test/project.properties +11 -0
- data/rhoconnect-client/Java/Android/test/res/drawable-hdpi/icon.png +0 -0
- data/rhoconnect-client/Java/Android/test/res/drawable-ldpi/icon.png +0 -0
- data/rhoconnect-client/Java/Android/test/res/drawable-mdpi/icon.png +0 -0
- data/rhoconnect-client/Java/Android/test/res/layout/main.xml +12 -0
- data/rhoconnect-client/Java/Android/test/res/values/strings.xml +5 -0
- data/rhoconnect-client/Java/Android/test/rhoimpl.jar +0 -0
- data/rhoconnect-client/Java/Android/test/src/com/rhomobile/rhoconnect_client_test/TestRhoConnectClient.java +343 -0
- data/rhoconnect-client/Java/Android/test/src/com/rhomobile/rhoconnect_client_test/TestRhoConnectClientBlobs.java +219 -0
- data/rhoconnect-client/Java/RhoConnect/.classpath +6 -0
- data/rhoconnect-client/Java/RhoConnect/.project +93 -0
- data/rhoconnect-client/Java/RhoConnect/assets/apps/rhoconfig.txt +19 -0
- data/rhoconnect-client/Java/RhoConnect/assets/apps/rhoconfig.txt.timestamp +1 -0
- data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb.schema +44 -0
- data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb.triggers +10 -0
- data/rhoconnect-client/Java/RhoConnect/assets/db/syncdb_java.triggers +21 -0
- data/rhoconnect-client/Java/RhoConnect/assets/rho.dat +8 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/RhoConnectJniNotify.h +61 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectClient.h +181 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectNotify.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectNotify_IDelegate.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectObjectNotify.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhoConnectObjectNotify_IDelegate.h +13 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/com_rhomobile_rhoconnect_RhomModel.h +103 -0
- data/rhoconnect-client/Java/RhoConnect/jni/include/rhojava.inc +76 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniClient.cpp +401 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniModel.cpp +332 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectJniNotify.cpp +223 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhoConnectUtil.cpp +82 -0
- data/rhoconnect-client/Java/RhoConnect/jni/src/RhodesApp.cpp +114 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectClient.java +108 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectNotify.java +78 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhoConnectObjectNotify.java +71 -0
- data/rhoconnect-client/Java/RhoConnect/src/com/rhomobile/rhoconnect/RhomModel.java +195 -0
- data/rhoconnect-client/JavaScript/.classpath +10 -0
- data/rhoconnect-client/JavaScript/.gitignore +4 -0
- data/rhoconnect-client/JavaScript/.project +17 -0
- data/rhoconnect-client/JavaScript/README.textile +1 -0
- data/rhoconnect-client/JavaScript/build.xml +185 -0
- data/rhoconnect-client/JavaScript/doc/fsm-sample.js +44 -0
- data/rhoconnect-client/JavaScript/doc/fsm-sample.png +0 -0
- data/rhoconnect-client/JavaScript/src/RhoSyncJS.gwt.xml +21 -0
- data/rhoconnect-client/JavaScript/stubs/RhoSyncStubsJS.gwt.xml +21 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/Capabilities.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/IRhoRubyHelper.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/Mutex.java +5 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoAppAdapter.java +39 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoClassFactory.java +29 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoConf.java +100 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoEmptyLogger.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoEmptyProfiler.java +5 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoLogger.java +32 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhoProfiler.java +27 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/RhodesApp.java +25 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/TimeInterval.java +22 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/Tokenizer.java +23 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBAdapter.java +174 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBAttrManager.java +15 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/DBException.java +5 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/db/IDBResult.java +27 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/file/IFileAccess.java +7 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/file/SimpleFile.java +15 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/IHttpConnection.java +22 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/NetRequest.java +324 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/NetResponse.java +51 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/net/URI.java +64 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/ClientRegister.java +15 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONArrayIterator.java +37 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONEntry.java +48 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/JSONStructIterator.java +41 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/SyncNotify.java +98 -0
- data/rhoconnect-client/JavaScript/stubs/com/rho/sync/SyncThread.java +92 -0
- data/rhoconnect-client/JavaScript/war/WEB-INF/lib/gwt-servlet-deps.jar +0 -0
- data/rhoconnect-client/JavaScript/war/WEB-INF/lib/gwt-servlet.jar +0 -0
- data/rhoconnect-client/JavaScript/war/js/fsm-sample.js +54 -0
- data/rhoconnect-client/JavaScript/war/js/rhosync-api.js +237 -0
- data/rhoconnect-client/JavaScript/war/js/rhosync-fsm.js +307 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/4C71D69C9BBC9E6F05C6BA49B01BCBC1.cache.html +3122 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/5146F4FFF34511C8BB2661E920B49E3A.cache.html +3254 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/5248C67481D9D27AD0703D15CDBD2A1C.cache.html +3147 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/EE1DC2692C9C32367B53A39E2358AF23.cache.html +3195 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/clear.cache.gif +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/corner.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/corner_ie6.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/hborder.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/hborder_ie6.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/corner_dialog_topleft.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/corner_dialog_topright.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/hborder_blue_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/hborder_gray_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/vborder_blue_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/ie6/vborder_gray_shadow.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/splitPanelThumb.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/vborder.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/images/vborder_ie6.png +0 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/standard.css +1144 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/gwt/standard/standard_rtl.css +1145 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/hosted.html +350 -0
- data/rhoconnect-client/JavaScript/war/rhosyncjs/rhosyncjs.nocache.js +314 -0
- data/rhoconnect-client/JavaScript/war/test/SpecRunner.html +35 -0
- data/rhoconnect-client/JavaScript/war/test/dbtest.html +38 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/MIT.LICENSE +20 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine-html.js +188 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine.css +166 -0
- data/rhoconnect-client/JavaScript/war/test/lib/jasmine-1.0.1/jasmine.js +2421 -0
- data/rhoconnect-client/JavaScript/war/test/spec/SpecHelper.js +7 -0
- data/rhoconnect-client/JavaScript/war/test/spec/SyncApiSpec.js +573 -0
- data/rhoconnect-client/JavaScript/war/test/spec/samples/PlayerSpec.js +58 -0
- data/rhoconnect-client/JavaScript/war/test/worker-test.js +17 -0
- data/rhoconnect-client/LICENSE +41 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectClient.h +118 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectClient.m +641 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectClient.xcodeproj/project.pbxproj +1434 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectNotify.h +83 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectNotify.m +181 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectObjectNotify.h +65 -0
- data/rhoconnect-client/ObjectiveC/RhoConnectObjectNotify.m +73 -0
- data/rhoconnect-client/ObjectiveC/RhomModel.h +101 -0
- data/rhoconnect-client/ObjectiveC/RhomModel.m +320 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/MainWindow.xib +198 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest-Info.plist +30 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest.xcodeproj/project.pbxproj +373 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTestAppDelegate.h +58 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTestAppDelegate.m +84 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/RhoConnectClientTest_Prefix.pch +8 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/invalid_import_db.zip +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/main.m +1096 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/test.png +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/test2.png +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/RhoConnectClientTest/valid_import_db.zip +0 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsAppDelegate.h +62 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsAppDelegate.m +35 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsViewController.h +78 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/Classes/ptestsViewController.m +549 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/MainWindow.xib +227 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/main.m +17 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests-Info.plist +30 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests.xcodeproj/project.pbxproj +363 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptestsViewController.xib +641 -0
- data/rhoconnect-client/ObjectiveC/Tests/ptests/ptests_Prefix.pch +8 -0
- data/rhoconnect-client/README.textile +23 -0
- data/rhoconnect-client/Rakefile +20 -0
- data/rhoconnect-client/Samples/Java/android_store/.classpath +8 -0
- data/rhoconnect-client/Samples/Java/android_store/.project +33 -0
- data/rhoconnect-client/Samples/Java/android_store/AndroidManifest.xml +24 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/apps/rhoconfig.txt +19 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/apps/rhoconfig.txt.timestamp +1 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb.schema +44 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb.triggers +10 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/db/syncdb_java.triggers +21 -0
- data/rhoconnect-client/Samples/Java/android_store/assets/rho.dat +8 -0
- data/rhoconnect-client/Samples/Java/android_store/default.properties +11 -0
- data/rhoconnect-client/Samples/Java/android_store/project.properties +14 -0
- data/rhoconnect-client/Samples/Java/android_store/res/drawable-hdpi/icon.png +0 -0
- data/rhoconnect-client/Samples/Java/android_store/res/drawable-ldpi/icon.png +0 -0
- data/rhoconnect-client/Samples/Java/android_store/res/drawable-mdpi/icon.png +0 -0
- data/rhoconnect-client/Samples/Java/android_store/res/layout/main.xml +12 -0
- data/rhoconnect-client/Samples/Java/android_store/res/values/strings.xml +5 -0
- data/rhoconnect-client/Samples/Java/android_store/rhoimpl.jar +0 -0
- data/rhoconnect-client/Samples/Java/android_store/src/com/rhomobile/android_store/StoreActivity.java +68 -0
- data/rhoconnect-client/Samples/Java/android_store/src/com/rhomobile/android_store/StoreApplication.java +15 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/LoginViewController.h +70 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/LoginViewController.m +94 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RhoConnectEngine.h +82 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RhoConnectEngine.m +119 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RootViewController.h +63 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/RootViewController.m +314 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/WaitLoginController.h +65 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/WaitLoginController.m +110 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/storeAppDelegate.h +61 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/Classes/storeAppDelegate.m +171 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/LoginViewController.xib +779 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/MainWindow.xib +580 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/RootViewController.xib +384 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/WaitLoginController.xib +557 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/icon.png +0 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/main.m +22 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/store-Info.plist +30 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/store.xcodeproj/project.pbxproj +367 -0
- data/rhoconnect-client/Samples/ObjectiveC/store/store_Prefix.pch +14 -0
- data/rhoconnect-client/build.yml +3 -0
- data/rhoconnect-client/version +1 -0
- metadata +314 -0
@@ -0,0 +1,237 @@
|
|
1
|
+
Rhomobile = function() {
|
2
|
+
|
3
|
+
// === Storage ================================================
|
4
|
+
|
5
|
+
var syncDbSchemaSQL = ''
|
6
|
+
+'CREATE TABLE client_info ('
|
7
|
+
+' "client_id" VARCHAR(255) default NULL,'
|
8
|
+
+' "session" VARCHAR(255) default NULL,'
|
9
|
+
+' "token" VARCHAR(255) default NULL,'
|
10
|
+
+' "token_sent" BIGINT default 0,'
|
11
|
+
+' "reset" BIGINT default 0,'
|
12
|
+
+' "port" VARCHAR(10) default NULL,'
|
13
|
+
+' "last_sync_success" VARCHAR(100) default NULL);'
|
14
|
+
+'CREATE TABLE object_values ('
|
15
|
+
+' "source_id" BIGINT default NULL,'
|
16
|
+
+' "attrib" varchar(255) default NULL,'
|
17
|
+
+' "object" varchar(255) default NULL,'
|
18
|
+
+' "value" varchar default NULL);'
|
19
|
+
+'CREATE TABLE changed_values ('
|
20
|
+
+' "source_id" BIGINT default NULL,'
|
21
|
+
+' "attrib" varchar(255) default NULL,'
|
22
|
+
+' "object" varchar(255) default NULL,'
|
23
|
+
+' "value" varchar default NULL,'
|
24
|
+
+' "attrib_type" varchar(255) default NULL,'
|
25
|
+
+' "update_type" varchar(255) default NULL,'
|
26
|
+
+' "sent" BIGINT default 0);'
|
27
|
+
+'CREATE TABLE sources ('
|
28
|
+
+' "source_id" BIGINT PRIMARY KEY,'
|
29
|
+
+' "name" VARCHAR(255) default NULL,'
|
30
|
+
+' "token" BIGINT default NULL,'
|
31
|
+
+' "sync_priority" BIGINT,'
|
32
|
+
+' "partition" VARCHAR(255),'
|
33
|
+
+' "sync_type" VARCHAR(255),'
|
34
|
+
+' "metadata" varchar default NULL,'
|
35
|
+
+' "last_updated" BIGINT default 0,'
|
36
|
+
+' "last_inserted_size" BIGINT default 0,'
|
37
|
+
+' "last_deleted_size" BIGINT default 0,'
|
38
|
+
+' "last_sync_duration" BIGINT default 0,'
|
39
|
+
+' "last_sync_success" BIGINT default 0,'
|
40
|
+
+' "backend_refresh_time" BIGINT default 0,'
|
41
|
+
+' "source_attribs" varchar default NULL,'
|
42
|
+
+' "schema" varchar default NULL,'
|
43
|
+
+' "schema_version" varchar default NULL,'
|
44
|
+
+' "associations" varchar default NULL,'
|
45
|
+
+' "blob_attribs" varchar default NULL);'
|
46
|
+
+'CREATE INDEX by_src_id on object_values ("source_id");'
|
47
|
+
+'CREATE UNIQUE INDEX by_src_object ON object_values ("object", "attrib", "source_id");'
|
48
|
+
+'CREATE INDEX by_src_value ON object_values ("attrib", "source_id", "value");'
|
49
|
+
;
|
50
|
+
|
51
|
+
var _execInTx = function(db, sql, values, resultHdlr/*(tx,resultSet)*/, errHdlr/*(db|tx,err)*/) {
|
52
|
+
db.transaction(function (tx) {
|
53
|
+
tx.executeSql(sql, values, resultHdlr, errHdlr);
|
54
|
+
}, function(err){
|
55
|
+
if(errHdlr) errHdlr(db, err);
|
56
|
+
});
|
57
|
+
};
|
58
|
+
|
59
|
+
var klass_webSqlStorage = function(dbName) {
|
60
|
+
this.dbName = dbName;
|
61
|
+
};
|
62
|
+
|
63
|
+
klass_webSqlStorage.prototype.open = function(toExecute/*str|func*/, errHdlr/*(db|tx,err)*/)
|
64
|
+
{
|
65
|
+
try {
|
66
|
+
var db = openDatabase(this.dbName, '1.0', 'Rhodes sync database', 2 * 1024 * 1024);
|
67
|
+
if ("string" == typeof toExecute) {
|
68
|
+
_execInTx(db, toExecute, null, null, errHdlr);
|
69
|
+
} else if ("function" == typeof toExecute) {
|
70
|
+
toExecute(db);
|
71
|
+
}
|
72
|
+
} catch(ex) {
|
73
|
+
if(errHdlr) errHdlr(null, ex);
|
74
|
+
}
|
75
|
+
};
|
76
|
+
|
77
|
+
klass_webSqlStorage.prototype.close = function()/*throws DBException*/{};
|
78
|
+
|
79
|
+
klass_webSqlStorage.prototype.executeSQL = function(sql, values, resultHdlr/*(tx,resultSet)*/, errHdlr/*(db|tx,err)*/)
|
80
|
+
{
|
81
|
+
this.open(function(db){
|
82
|
+
_execInTx(db, sql, values, resultHdlr, errHdlr);
|
83
|
+
});
|
84
|
+
};
|
85
|
+
|
86
|
+
klass_webSqlStorage.prototype.executeBatchSQL = function(sql, errHdlr/*(db|tx,err)*/)
|
87
|
+
{
|
88
|
+
var statements = sql.split(";");
|
89
|
+
for(var i in statements) {
|
90
|
+
var stmt = statements[i];
|
91
|
+
if(stmt) { // means: it is defined and not null and not empty string
|
92
|
+
this.executeSQL(statements[i], null, null, errHdlr);
|
93
|
+
}
|
94
|
+
}
|
95
|
+
};
|
96
|
+
|
97
|
+
klass_webSqlStorage.prototype.initSchema = function(errHdlr/*(db|tx,err)*/)
|
98
|
+
{
|
99
|
+
this.executeBatchSQL(syncDbSchemaSQL, errHdlr);
|
100
|
+
};
|
101
|
+
|
102
|
+
klass_webSqlStorage.prototype.getAllTableNames = function(toWait, errHdlr/*(db|tx,err)*/)
|
103
|
+
{
|
104
|
+
var tableNames = [];
|
105
|
+
var done = !toWait;
|
106
|
+
|
107
|
+
this.executeSQL("SELECT name FROM sqlite_master WHERE type='table'", null, jQuery.proxy(function(tx,rs){
|
108
|
+
for(var i=0; i<rs.rows.length; i++) {
|
109
|
+
tableNames.push(rs.rows.item(i)['name']);
|
110
|
+
}
|
111
|
+
done = true;
|
112
|
+
}, this), function(obj,err){
|
113
|
+
done = true; errHdlr(obj,err);
|
114
|
+
}/*errHdlr*/);
|
115
|
+
|
116
|
+
// while(!done) {
|
117
|
+
// jQuery.get('')
|
118
|
+
// };
|
119
|
+
// there is an error: tableNames is empty at the moment of return!
|
120
|
+
return tableNames;
|
121
|
+
};
|
122
|
+
|
123
|
+
// /*IDBResult*/ createResult: function(){},
|
124
|
+
// /*void*/ deleteAllFiles: function(/*String*/ strPath)throws Exception{},
|
125
|
+
//
|
126
|
+
// /*void*/ startTransaction: function()/*throws DBException*/{},
|
127
|
+
// /*void*/ commit: function()/*throws DBException*/{},
|
128
|
+
// /*void*/ rollback: function()/*throws DBException*/{},
|
129
|
+
// /*void*/ onBeforeCommit: function() /*throws DBException*/{},
|
130
|
+
//
|
131
|
+
// /*boolean*/ isTableExists: function(/*String*/ strName)/*throws DBException*/{},
|
132
|
+
// /*boolean*/ isDbFileExists: function(/*String*/ strPath){},
|
133
|
+
//
|
134
|
+
// /*void*/ OnInsertObjectRecord(/*Object*/ NEW_source_id, /*Object*/ NEW_attrib ){},
|
135
|
+
//
|
136
|
+
// /*void*/ createTriggers: function() /*throws DBException*/{},
|
137
|
+
// /*void*/ setDbCallback: function(/*IDBCallback*/ callback){},
|
138
|
+
|
139
|
+
|
140
|
+
// === Model ==================================================
|
141
|
+
|
142
|
+
var klass_model = function(name, opts, props) {
|
143
|
+
this.name = name;
|
144
|
+
this.options = opts;
|
145
|
+
this.properties = props;
|
146
|
+
}
|
147
|
+
|
148
|
+
// === Source ==================================================
|
149
|
+
|
150
|
+
// add_source('Product', {'source_id'=> 1, 'sync_type' => 'incremental'} )
|
151
|
+
var klass_source = function(model, props) {
|
152
|
+
this.model = model;
|
153
|
+
this.properties = props;
|
154
|
+
this.id = this.properties['sourceId'];
|
155
|
+
this.name = this.model['name'];
|
156
|
+
}
|
157
|
+
|
158
|
+
// === Config ==================================================
|
159
|
+
|
160
|
+
var klass_config = function() {
|
161
|
+
this.sources = [];
|
162
|
+
}
|
163
|
+
|
164
|
+
klass_config.addSource = function(model, props) {
|
165
|
+
this.sources.push(new Rhomobile.sync.Source(model, props));
|
166
|
+
}
|
167
|
+
|
168
|
+
// === Engine ==================================================
|
169
|
+
|
170
|
+
var klass_engine = function() {
|
171
|
+
}
|
172
|
+
|
173
|
+
// === API load support =======================================
|
174
|
+
|
175
|
+
var _gwtClasses = ["com.rho.sync.SyncThread"];
|
176
|
+
|
177
|
+
// Function to report the exact GWT class is ready to use.
|
178
|
+
//
|
179
|
+
// GWT class definitions are bound to load event and number
|
180
|
+
// of them is unknown at the moment of this code runs.
|
181
|
+
//
|
182
|
+
// So we unable to rely on load event to have all GWT classes
|
183
|
+
// defined completely.
|
184
|
+
//
|
185
|
+
// We use this function to report each class is ready, and
|
186
|
+
// Rhomobile.event.apiReady event to fire an application
|
187
|
+
// when all of GWT classes is ready to use.
|
188
|
+
//
|
189
|
+
var _gwtClassReady = function(className){
|
190
|
+
for(var i in _gwtClasses) {
|
191
|
+
if(className == _gwtClasses[i]) {
|
192
|
+
_gwtClasses.splice(i, 1);
|
193
|
+
if(0 == _gwtClasses.length) {
|
194
|
+
jQuery(window).trigger(Rhomobile.event.apiReady);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}
|
198
|
+
};
|
199
|
+
var _loadModules = function (nameStr) {
|
200
|
+
var names = nameStr.split(' ');
|
201
|
+
|
202
|
+
var hdr = document.getElementsByTagName("head")[0];
|
203
|
+
var addModule = function(modFile) {
|
204
|
+
var tag = document.createElement("script");
|
205
|
+
tag.setAttribute("src", modFile);
|
206
|
+
tag.setAttribute("type", "text/javascript");
|
207
|
+
hdr.appendChild(tag);
|
208
|
+
};
|
209
|
+
|
210
|
+
for(var idx in names) {
|
211
|
+
var modname = names[idx].replace(/.js$/gi, '');
|
212
|
+
addModule(modname + '.js');
|
213
|
+
}
|
214
|
+
};
|
215
|
+
// === Public members =========================================
|
216
|
+
|
217
|
+
return {
|
218
|
+
loadModules: _loadModules,
|
219
|
+
internal: {
|
220
|
+
gwtClassReady: _gwtClassReady
|
221
|
+
},
|
222
|
+
event: {
|
223
|
+
apiReady: "Rhomobile.event.apiReady"
|
224
|
+
},
|
225
|
+
Config: klass_config,
|
226
|
+
data: {
|
227
|
+
Model: klass_model
|
228
|
+
},
|
229
|
+
sync: {
|
230
|
+
Source: klass_source,
|
231
|
+
Engine: klass_engine
|
232
|
+
},
|
233
|
+
db: {
|
234
|
+
DbStorage: klass_webSqlStorage
|
235
|
+
}
|
236
|
+
};
|
237
|
+
}();
|
@@ -0,0 +1,307 @@
|
|
1
|
+
/**
|
2
|
+
* Created by Rhomobile.com.
|
3
|
+
* User: dipspb@gmail.com
|
4
|
+
* Date: 03.02.2011
|
5
|
+
* Time: 12:37:39
|
6
|
+
*/
|
7
|
+
|
8
|
+
if (Rhomobile) { Rhomobile.fsm = function(){
|
9
|
+
|
10
|
+
var kls = null;
|
11
|
+
|
12
|
+
// === Machine =========================================
|
13
|
+
|
14
|
+
kls = function(name, definition){
|
15
|
+
this.name = name;
|
16
|
+
this.states = {};
|
17
|
+
this.currentState = null;
|
18
|
+
this.initialState = null;
|
19
|
+
this.define(definition);
|
20
|
+
};
|
21
|
+
|
22
|
+
kls.prototype.define = function(definition) {
|
23
|
+
if(definition) {
|
24
|
+
this.states = {};
|
25
|
+
this.currentState = null;
|
26
|
+
this.initialState = null;
|
27
|
+
definition(this);
|
28
|
+
}
|
29
|
+
return this;
|
30
|
+
};
|
31
|
+
|
32
|
+
kls.prototype.state = function(stateName) {
|
33
|
+
var state = null;
|
34
|
+
if(this.states[stateName]) {
|
35
|
+
throw('State \'' +stateName +'\' is already defined in Machine \''+ this.name +'\'.');
|
36
|
+
} else {
|
37
|
+
state = new klass_State(stateName);
|
38
|
+
this.states[stateName] = state;
|
39
|
+
}
|
40
|
+
if (! this.currentState) {
|
41
|
+
this.currentState = state;
|
42
|
+
}
|
43
|
+
if (! this.initialState) {
|
44
|
+
this.initialState = state;
|
45
|
+
}
|
46
|
+
state.fsm = this;
|
47
|
+
return state;
|
48
|
+
};
|
49
|
+
|
50
|
+
kls.prototype._lookForState = function(stateName) {
|
51
|
+
if(! this.states[stateName]) {
|
52
|
+
throw('State \'' +stateName +'\' is not defined in Machine \''+ this.name +'\'.');
|
53
|
+
}
|
54
|
+
return this.states[stateName];
|
55
|
+
};
|
56
|
+
|
57
|
+
kls.prototype._notifyStateChanged = function(stateName) {
|
58
|
+
// something to post as an event
|
59
|
+
};
|
60
|
+
|
61
|
+
kls.prototype._changeStateTo = function(nameOrState) {
|
62
|
+
var stateName = ('string' == typeof nameOrState) ? nameOrState : nameOrState.name;
|
63
|
+
|
64
|
+
this.currentState._fireExitActions();
|
65
|
+
this.currentState._fireTransitionActions(stateName);
|
66
|
+
this.currentState = this._lookForState(stateName);
|
67
|
+
this.currentState._fireEntryActions();
|
68
|
+
this._notifyStateChanged(stateName);
|
69
|
+
return this;
|
70
|
+
};
|
71
|
+
|
72
|
+
kls.prototype.withInitialState = function(stateName) {
|
73
|
+
this.initialState = this._lookForState(stateName);
|
74
|
+
return this;
|
75
|
+
};
|
76
|
+
|
77
|
+
kls.prototype.resetTo = function(stateName) {
|
78
|
+
this._changeStateTo(this._lookForState(stateName));
|
79
|
+
return this;
|
80
|
+
};
|
81
|
+
|
82
|
+
kls.prototype.reset = function() {
|
83
|
+
if(this.initialState) {
|
84
|
+
this._changeStateTo(this.initialState);
|
85
|
+
}
|
86
|
+
return this;
|
87
|
+
};
|
88
|
+
|
89
|
+
kls.prototype.inputWith = function(inputName, data) {
|
90
|
+
if(this.currentState) {
|
91
|
+
this.currentState.inputWith(inputName, data);
|
92
|
+
}
|
93
|
+
return this;
|
94
|
+
};
|
95
|
+
|
96
|
+
kls.prototype._renderStatesAsDot = function() {
|
97
|
+
var dot = "";
|
98
|
+
var states = this.states;
|
99
|
+
for(var name in states) {
|
100
|
+
if(states.hasOwnProperty(name)) {
|
101
|
+
dot += states[name]._renderAsDot(states[name] == this.initialState ? 'color=green' : null);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
return dot;
|
105
|
+
};
|
106
|
+
|
107
|
+
kls.prototype.renderAsDot = function() {
|
108
|
+
var dot = 'digraph fsm {\n'
|
109
|
+
+' label = "' +this.name +'";\n'
|
110
|
+
+' node [style=filled];\n'
|
111
|
+
+this._renderStatesAsDot()
|
112
|
+
+'}';
|
113
|
+
return dot;
|
114
|
+
};
|
115
|
+
|
116
|
+
var klass_Machine = kls;
|
117
|
+
|
118
|
+
// === State ===========================================
|
119
|
+
|
120
|
+
kls = function(name) {
|
121
|
+
this.name = name;
|
122
|
+
this.fsm = null;
|
123
|
+
this.immediateTransitionState = null;
|
124
|
+
this.inputs = {};
|
125
|
+
this.entryActions = [];
|
126
|
+
this.exitActions = [];
|
127
|
+
this.inputActions = {};
|
128
|
+
this.transitionActions = {};
|
129
|
+
};
|
130
|
+
|
131
|
+
kls.prototype._reportIntactInput = function(inputName) {
|
132
|
+
// some reporting goes here..
|
133
|
+
};
|
134
|
+
|
135
|
+
kls.prototype._lookForInput = function(inputName) {
|
136
|
+
if(! this.inputs[inputName]) {
|
137
|
+
// Input generation may be out of the system scope.
|
138
|
+
// So no exception needed, just some reporting maybe.
|
139
|
+
this._reportIntactInput(inputName);
|
140
|
+
}
|
141
|
+
return this.inputs[inputName];
|
142
|
+
};
|
143
|
+
|
144
|
+
|
145
|
+
kls.prototype._fireEntryActions = function() {
|
146
|
+
var actions = this.entryActions;
|
147
|
+
for(var i in actions) {
|
148
|
+
try {
|
149
|
+
actions[i]();
|
150
|
+
} catch(ex) {/*report action exception*/}
|
151
|
+
}
|
152
|
+
if(this.immediateTransitionState) {
|
153
|
+
this.fsm._changeStateTo(this.immediateTransitionState);
|
154
|
+
}
|
155
|
+
};
|
156
|
+
|
157
|
+
kls.prototype._fireExitActions = function() {
|
158
|
+
var actions = this.exitActions;
|
159
|
+
for(var i in actions) {
|
160
|
+
try {
|
161
|
+
actions[i]();
|
162
|
+
} catch(ex) {/*report action exception*/}
|
163
|
+
}
|
164
|
+
};
|
165
|
+
|
166
|
+
kls.prototype._fireInputActions = function(input, data) {
|
167
|
+
var actions = this.inputActions;
|
168
|
+
// currently just only action per input
|
169
|
+
if (actions[input]) {
|
170
|
+
try {
|
171
|
+
actions[input](data);
|
172
|
+
} catch(ex) {/*report action exception*/}
|
173
|
+
}
|
174
|
+
};
|
175
|
+
|
176
|
+
kls.prototype._fireTransitionActions = function(transition) {
|
177
|
+
var actions = this.transitionActions;
|
178
|
+
// currently just only action per transition
|
179
|
+
if (actions[transition]) {
|
180
|
+
try {
|
181
|
+
actions[transition]();
|
182
|
+
} catch(ex) {/*report action exception*/}
|
183
|
+
}
|
184
|
+
};
|
185
|
+
|
186
|
+
kls.prototype.inputWith = function(inputName, data) {
|
187
|
+
if(this == this.fsm.currentState) {
|
188
|
+
this._fireInputActions(inputName, data);
|
189
|
+
|
190
|
+
var input = this._lookForInput(inputName);
|
191
|
+
if (input) {
|
192
|
+
//this._fireExitActions();
|
193
|
+
//this._fireTransitionActions(input.transition);
|
194
|
+
this.fsm._changeStateTo(input.transition);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
};
|
198
|
+
|
199
|
+
kls.prototype.on = function(inputName) {
|
200
|
+
var input = null;
|
201
|
+
if(this.inputs[inputName]) {
|
202
|
+
throw('Input \'' +inputName +'\' is already defined for the State \''
|
203
|
+
+this.name +'\' of Machine \'' +this.fsm.name +'\'.');
|
204
|
+
} else {
|
205
|
+
input = new klass_Input(inputName);
|
206
|
+
this.inputs[inputName] = input;
|
207
|
+
}
|
208
|
+
input.state = this;
|
209
|
+
return input;
|
210
|
+
};
|
211
|
+
|
212
|
+
kls.prototype.withEntryAction = function(actionName, action) {
|
213
|
+
// actionName to be used just to render documentation
|
214
|
+
this.entryActions.push(action);
|
215
|
+
return this;
|
216
|
+
};
|
217
|
+
|
218
|
+
kls.prototype.withExitAction = function(actionName, action) {
|
219
|
+
// actionName to be used just to render documentation
|
220
|
+
this.exitActions.push(action);
|
221
|
+
return this;
|
222
|
+
};
|
223
|
+
|
224
|
+
kls.prototype.withActionOnInput = function(inputName, actionName, action) {
|
225
|
+
// actionName to be used just to render documentation
|
226
|
+
this.inputActions[inputName] = action;
|
227
|
+
return this;
|
228
|
+
};
|
229
|
+
|
230
|
+
kls.prototype.withActionOnTransitTo = function(stateName, actionName, action) {
|
231
|
+
// actionName to be used just to render documentation
|
232
|
+
this.transitionActions[stateName] = action;
|
233
|
+
return this;
|
234
|
+
};
|
235
|
+
|
236
|
+
kls.prototype.immediateTransitsTo = function(stateName) {
|
237
|
+
this.immediateTransitionState = stateName;
|
238
|
+
return this;
|
239
|
+
};
|
240
|
+
|
241
|
+
|
242
|
+
kls.prototype._renderInputsAsDot = function() {
|
243
|
+
var dot = "";
|
244
|
+
var inputs = this.inputs;
|
245
|
+
if(this.immediateTransitionState) {
|
246
|
+
dot += ' "' +this.name +'" -> "' +this.immediateTransitionState +'" [color=blue];\n';
|
247
|
+
}
|
248
|
+
for(var name in inputs) {
|
249
|
+
if(inputs.hasOwnProperty(name)) {
|
250
|
+
dot += inputs[name]._renderAsDot(this.name);
|
251
|
+
}
|
252
|
+
}
|
253
|
+
return dot;
|
254
|
+
};
|
255
|
+
|
256
|
+
kls.prototype._renderAsDot = function(addStyle) {
|
257
|
+
var dot = '\n';
|
258
|
+
var attrs = 'label="' +this.name +'"' +(addStyle ? ', ' +addStyle : '');
|
259
|
+
|
260
|
+
var noInputs = true;
|
261
|
+
for(var name in this.inputs) {
|
262
|
+
if(this.inputs.hasOwnProperty(name)) {
|
263
|
+
noInputs = false;
|
264
|
+
break;
|
265
|
+
}
|
266
|
+
}
|
267
|
+
attrs += (noInputs && !this.immediateTransitionState) ? ', color=red' : '';
|
268
|
+
attrs += this.immediateTransitionState ? ', color=blue, fillcolor=lightblue' : '';
|
269
|
+
|
270
|
+
dot += (' "' +this.name +'" [' +attrs +'];\n');
|
271
|
+
dot += this._renderInputsAsDot();
|
272
|
+
dot += '\n';
|
273
|
+
return dot;
|
274
|
+
};
|
275
|
+
|
276
|
+
var klass_State = kls;
|
277
|
+
|
278
|
+
// === Input ===========================================
|
279
|
+
|
280
|
+
kls = function(name) {
|
281
|
+
this.name = name;
|
282
|
+
this.transition = null;
|
283
|
+
this.state = null;
|
284
|
+
};
|
285
|
+
|
286
|
+
kls.prototype.transitsTo = function(stateName) {
|
287
|
+
this.transition = stateName;
|
288
|
+
return this.state;
|
289
|
+
};
|
290
|
+
|
291
|
+
kls.prototype._renderAsDot = function(stateName) {
|
292
|
+
return ' "' +stateName +'" -> "' +this.transition +'" [label="' +this.name +'"];\n';
|
293
|
+
};
|
294
|
+
var klass_Input = kls;
|
295
|
+
|
296
|
+
// === Public members ==================================
|
297
|
+
|
298
|
+
return {
|
299
|
+
define: (function(name, definition) {
|
300
|
+
return new klass_Machine(name, definition);
|
301
|
+
}),
|
302
|
+
Machine: klass_Machine,
|
303
|
+
State: klass_State,
|
304
|
+
Input: klass_Input
|
305
|
+
};
|
306
|
+
|
307
|
+
}();} // EOF
|