pione 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +94 -0
- data/Rakefile +118 -0
- data/bin/pione-broker +5 -0
- data/bin/pione-clean +5 -0
- data/bin/pione-client +5 -0
- data/bin/pione-eval +111 -0
- data/bin/pione-relay +5 -0
- data/bin/pione-relay-account-db +5 -0
- data/bin/pione-relay-client-db +5 -0
- data/bin/pione-search-log +30 -0
- data/bin/pione-syntax-checker +5 -0
- data/bin/pione-task-worker +5 -0
- data/bin/pione-tuple-space-provider +5 -0
- data/bin/pione-tuple-space-receiver +5 -0
- data/bin/pione-tuple-space-viewer +5 -0
- data/demo/demo.rb +311 -0
- data/demo/public/base.css +94 -0
- data/demo/public/demo.js +107 -0
- data/demo/public/index.html +91 -0
- data/demo/public/jquery-1.8.3.min.js +2 -0
- data/example/CountChar/CountChar.pione +64 -0
- data/example/CountChar/misc/CountChar.rb +22 -0
- data/example/CountChar/text/aidokushono_insho.txt +32 -0
- data/example/CountChar/text/aikokuka_shokan.txt +108 -0
- data/example/CountChar/text/carlyle_hakubutsukan.txt +58 -0
- data/example/CountChar/text/dark_minister.txt +2440 -0
- data/example/CountChar/text/kaikano_otto.txt +61 -0
- data/example/CountChar/text/kaikon.txt +30 -0
- data/example/CountChar/text/nagashimano_shi.txt +45 -0
- data/example/CountChar/text/saikachibuchi.txt +80 -0
- data/example/CountChar/text/saikonihonno_josei.txt +91 -0
- data/example/CountChar/text/taishojugonenno_bundan.txt +21 -0
- data/example/FeatureExample/FeatureExample.pione +7 -0
- data/example/Fib/Fib.pione +56 -0
- data/example/Fib/FibBC.pione +56 -0
- data/example/HelloWorld/HelloWorld.pione +5 -0
- data/example/LucasNumber/LucasNumber.pione +64 -0
- data/example/MakePair/MakePair.pione +14 -0
- data/example/MakePair/data/1.i +0 -0
- data/example/MakePair/data/2.i +0 -0
- data/example/MakePair/data/3.i +0 -0
- data/example/MakePair/data/4.i +0 -0
- data/example/MakePair/data/5.i +0 -0
- data/example/SieveOfEratosthenes/SieveOfEratosthenes.pione +61 -0
- data/example/SingleParticlesWithRef/Makefile +289 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.Makefile +153 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.pione +116 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRefFull.pione +400 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift.pdb +3381 -0
- data/example/SingleParticlesWithRef/data/all.ref2d +0 -0
- data/example/SingleParticlesWithRef/data/all.ref3d +0 -0
- data/example/Sum/Sum.pione +52 -0
- data/example/SyntaxError/call_rule_error.pione +6 -0
- data/example/SyntaxError/feature_line_error.pione +7 -0
- data/example/SyntaxError/flow_block_error.pione +5 -0
- data/example/SyntaxError/input_line_error.pione +6 -0
- data/example/SyntaxError/invalid_rule_name.pione +6 -0
- data/example/SyntaxError/param_line_error.pione +7 -0
- data/example/SyntaxError/variable-binding-error.pione +11 -0
- data/lib/pione.rb +241 -0
- data/lib/pione/agent/basic-agent.rb +333 -0
- data/lib/pione/agent/broker.rb +274 -0
- data/lib/pione/agent/command-listener.rb +47 -0
- data/lib/pione/agent/input-generator.rb +194 -0
- data/lib/pione/agent/logger.rb +65 -0
- data/lib/pione/agent/process-manager.rb +38 -0
- data/lib/pione/agent/rule-provider.rb +64 -0
- data/lib/pione/agent/task-worker.rb +274 -0
- data/lib/pione/agent/trivial-routine-worker.rb +28 -0
- data/lib/pione/agent/tuple-space-client.rb +146 -0
- data/lib/pione/agent/tuple-space-server-client-life-checker.rb +29 -0
- data/lib/pione/command-option/basic-option.rb +42 -0
- data/lib/pione/command-option/child-process-option.rb +17 -0
- data/lib/pione/command-option/common-option.rb +29 -0
- data/lib/pione/command-option/daemon-option.rb +12 -0
- data/lib/pione/command-option/presence-notifier-option.rb +15 -0
- data/lib/pione/command-option/task-worker-owner-option.rb +17 -0
- data/lib/pione/command-option/tuple-space-provider-option.rb +26 -0
- data/lib/pione/command-option/tuple-space-provider-owner-option.rb +16 -0
- data/lib/pione/command-option/tuple-space-receiver-option.rb +12 -0
- data/lib/pione/command/basic-command.rb +126 -0
- data/lib/pione/command/child-process.rb +43 -0
- data/lib/pione/command/daemon-process.rb +18 -0
- data/lib/pione/command/front-owner-command.rb +37 -0
- data/lib/pione/command/pione-broker.rb +53 -0
- data/lib/pione/command/pione-clean.rb +16 -0
- data/lib/pione/command/pione-client.rb +273 -0
- data/lib/pione/command/pione-relay-account-db.rb +85 -0
- data/lib/pione/command/pione-relay-client-db.rb +80 -0
- data/lib/pione/command/pione-relay.rb +47 -0
- data/lib/pione/command/pione-syntax-checker.rb +103 -0
- data/lib/pione/command/pione-task-worker.rb +123 -0
- data/lib/pione/command/pione-tuple-space-provider.rb +87 -0
- data/lib/pione/command/pione-tuple-space-receiver.rb +55 -0
- data/lib/pione/command/pione-tuple-space-viewer.rb +151 -0
- data/lib/pione/command/tuple-space-provider-owner.rb +6 -0
- data/lib/pione/front/basic-front.rb +64 -0
- data/lib/pione/front/broker-front.rb +30 -0
- data/lib/pione/front/client-front.rb +28 -0
- data/lib/pione/front/relay-front.rb +19 -0
- data/lib/pione/front/task-worker-front.rb +16 -0
- data/lib/pione/front/task-worker-owner.rb +42 -0
- data/lib/pione/front/tuple-space-provider-front.rb +22 -0
- data/lib/pione/front/tuple-space-provider-owner.rb +11 -0
- data/lib/pione/front/tuple-space-receiver-front.rb +18 -0
- data/lib/pione/model/assignment.rb +89 -0
- data/lib/pione/model/basic-model.rb +395 -0
- data/lib/pione/model/binary-operator.rb +80 -0
- data/lib/pione/model/block.rb +233 -0
- data/lib/pione/model/boolean.rb +138 -0
- data/lib/pione/model/call-rule.rb +69 -0
- data/lib/pione/model/data-expr.rb +360 -0
- data/lib/pione/model/feature-expr.rb +794 -0
- data/lib/pione/model/float.rb +107 -0
- data/lib/pione/model/integer.rb +140 -0
- data/lib/pione/model/list.rb +104 -0
- data/lib/pione/model/message.rb +80 -0
- data/lib/pione/model/package.rb +48 -0
- data/lib/pione/model/parameters.rb +282 -0
- data/lib/pione/model/rule-expr.rb +120 -0
- data/lib/pione/model/rule-io.rb +166 -0
- data/lib/pione/model/rule.rb +294 -0
- data/lib/pione/model/string.rb +111 -0
- data/lib/pione/model/undefined-value.rb +24 -0
- data/lib/pione/model/variable-table.rb +315 -0
- data/lib/pione/model/variable.rb +87 -0
- data/lib/pione/parser/block-parser.rb +83 -0
- data/lib/pione/parser/common-parser.rb +145 -0
- data/lib/pione/parser/document-parser.rb +58 -0
- data/lib/pione/parser/error-message.yml +4 -0
- data/lib/pione/parser/expr-parser.rb +266 -0
- data/lib/pione/parser/feature-expr-parser.rb +105 -0
- data/lib/pione/parser/flow-element-parser.rb +181 -0
- data/lib/pione/parser/literal-parser.rb +182 -0
- data/lib/pione/parser/rule-definition-parser.rb +163 -0
- data/lib/pione/parser/syntax-error.rb +61 -0
- data/lib/pione/patch/array-patch.rb +3 -0
- data/lib/pione/patch/drb-patch.rb +467 -0
- data/lib/pione/patch/monitor-patch.rb +16 -0
- data/lib/pione/patch/rinda-patch.rb +759 -0
- data/lib/pione/patch/uri-patch.rb +66 -0
- data/lib/pione/relay/receiver-socket.rb +69 -0
- data/lib/pione/relay/relay-account-db.rb +55 -0
- data/lib/pione/relay/relay-client-db.rb +53 -0
- data/lib/pione/relay/relay-socket.rb +215 -0
- data/lib/pione/relay/trampoline.rb +22 -0
- data/lib/pione/relay/transmitter-socket.rb +167 -0
- data/lib/pione/resource/basic-resource.rb +92 -0
- data/lib/pione/resource/dropbox-resource.rb +106 -0
- data/lib/pione/resource/ftp.rb +84 -0
- data/lib/pione/resource/local.rb +113 -0
- data/lib/pione/rule-handler/action-handler.rb +184 -0
- data/lib/pione/rule-handler/basic-handler.rb +217 -0
- data/lib/pione/rule-handler/flow-handler.rb +339 -0
- data/lib/pione/rule-handler/root-handler.rb +23 -0
- data/lib/pione/rule-handler/system-handler.rb +13 -0
- data/lib/pione/system/common.rb +22 -0
- data/lib/pione/system/config.rb +20 -0
- data/lib/pione/system/document.rb +81 -0
- data/lib/pione/system/file-cache.rb +150 -0
- data/lib/pione/system/global.rb +346 -0
- data/lib/pione/system/identifier.rb +61 -0
- data/lib/pione/system/init.rb +16 -0
- data/lib/pione/system/object.rb +35 -0
- data/lib/pione/transformer/block-transformer.rb +23 -0
- data/lib/pione/transformer/document-transformer.rb +36 -0
- data/lib/pione/transformer/expr-transformer.rb +89 -0
- data/lib/pione/transformer/feature-expr-transformer.rb +56 -0
- data/lib/pione/transformer/flow-element-transformer.rb +66 -0
- data/lib/pione/transformer/literal-transformer.rb +76 -0
- data/lib/pione/transformer/rule-definition-transformer.rb +62 -0
- data/lib/pione/transformer/transformer-module.rb +37 -0
- data/lib/pione/tuple-space/data-finder.rb +165 -0
- data/lib/pione/tuple-space/presence-notifier.rb +83 -0
- data/lib/pione/tuple-space/relay.rb +9 -0
- data/lib/pione/tuple-space/tuple-space-provider.rb +85 -0
- data/lib/pione/tuple-space/tuple-space-receiver.rb +140 -0
- data/lib/pione/tuple-space/tuple-space-server-interface.rb +60 -0
- data/lib/pione/tuple-space/tuple-space-server.rb +156 -0
- data/lib/pione/tuple-space/update-criteria.rb +96 -0
- data/lib/pione/tuple/agent-tuple.rb +10 -0
- data/lib/pione/tuple/attribute-tuple.rb +7 -0
- data/lib/pione/tuple/base-uri-tuple.rb +9 -0
- data/lib/pione/tuple/basic-tuple.rb +317 -0
- data/lib/pione/tuple/bye-tuple.rb +9 -0
- data/lib/pione/tuple/command-tuple.rb +9 -0
- data/lib/pione/tuple/data-tuple.rb +18 -0
- data/lib/pione/tuple/dry-run-tuple.rb +8 -0
- data/lib/pione/tuple/exception-tuple.rb +11 -0
- data/lib/pione/tuple/finished-tuple.rb +17 -0
- data/lib/pione/tuple/foreground-tuple.rb +7 -0
- data/lib/pione/tuple/log-tuple.rb +14 -0
- data/lib/pione/tuple/process-info-tuple.rb +9 -0
- data/lib/pione/tuple/request-rule-tuple.rb +9 -0
- data/lib/pione/tuple/rule-tuple.rb +10 -0
- data/lib/pione/tuple/shift-tuple.rb +13 -0
- data/lib/pione/tuple/task-tuple.rb +36 -0
- data/lib/pione/tuple/task-worker-resource-tuple.rb +9 -0
- data/lib/pione/tuple/working-tuple.rb +13 -0
- data/lib/pione/uri-scheme/basic-scheme.rb +40 -0
- data/lib/pione/uri-scheme/broadcast-scheme.rb +11 -0
- data/lib/pione/uri-scheme/dropbox-scheme.rb +9 -0
- data/lib/pione/uri-scheme/local-scheme.rb +28 -0
- data/lib/pione/util/error-report.rb +12 -0
- data/lib/pione/util/log.rb +79 -0
- data/lib/pione/util/message.rb +155 -0
- data/lib/pione/util/misc.rb +73 -0
- data/lib/pione/util/terminal.rb +78 -0
- data/lib/pione/util/waiter-table.rb +53 -0
- data/lib/pione/version.rb +3 -0
- data/misc/env.sh +2 -0
- data/misc/test-drb-stop-service.rb +34 -0
- data/misc/test-ensure-and-thread-kill.rb +40 -0
- data/misc/test-many-waiters-client.rb +56 -0
- data/misc/test-many-waiters-server.rb +14 -0
- data/misc/write_and_take_test.png +0 -0
- data/misc/write_and_take_test.rb +36 -0
- data/pione.gemspec +49 -0
- data/test/agent/spec_basic-agent.rb +170 -0
- data/test/agent/spec_broker.rb +36 -0
- data/test/agent/spec_command-listener.rb +30 -0
- data/test/agent/spec_input-generator.rb +123 -0
- data/test/agent/spec_logger.rb +71 -0
- data/test/agent/spec_rule-provider.rb +65 -0
- data/test/agent/spec_task-worker.rb +307 -0
- data/test/agent/spec_tuple-space-client.rb +30 -0
- data/test/model/spec_assignment.rb +51 -0
- data/test/model/spec_binary-operator.rb +39 -0
- data/test/model/spec_block.rb +154 -0
- data/test/model/spec_boolean.rb +115 -0
- data/test/model/spec_call-rule.rb +23 -0
- data/test/model/spec_data-expr.rb +312 -0
- data/test/model/spec_feature-expr.rb +359 -0
- data/test/model/spec_feature-expr.yml +16 -0
- data/test/model/spec_float.rb +141 -0
- data/test/model/spec_integer.rb +141 -0
- data/test/model/spec_list.rb +26 -0
- data/test/model/spec_message.rb +42 -0
- data/test/model/spec_package.rb +15 -0
- data/test/model/spec_parameters.rb +148 -0
- data/test/model/spec_rule-expr.rb +66 -0
- data/test/model/spec_rule-io.rb +32 -0
- data/test/model/spec_rule.rb +158 -0
- data/test/model/spec_string.rb +106 -0
- data/test/model/spec_variable-table.rb +117 -0
- data/test/model/spec_variable.rb +84 -0
- data/test/parser/spec_block-parser.rb +5 -0
- data/test/parser/spec_block-parser.yml +85 -0
- data/test/parser/spec_common-parser.rb +281 -0
- data/test/parser/spec_expr-parser.rb +6 -0
- data/test/parser/spec_expr-parser.yml +82 -0
- data/test/parser/spec_feature-expr-parser.rb +32 -0
- data/test/parser/spec_feature-expr-parser.yml +25 -0
- data/test/parser/spec_flow-element-parser.rb +5 -0
- data/test/parser/spec_flow-element-parser.yml +180 -0
- data/test/parser/spec_literal-parser.rb +5 -0
- data/test/parser/spec_literal-parser.yml +123 -0
- data/test/parser/spec_rule-definition-parser.rb +5 -0
- data/test/parser/spec_rule-definition-parser.yml +93 -0
- data/test/patch/spec_rinda-patch.rb +32 -0
- data/test/patch/spec_uri-patch.rb +23 -0
- data/test/rule-handler/spec_action-handler.rb +135 -0
- data/test/rule-handler/spec_flow-handler.rb +127 -0
- data/test/spec_common.rb +14 -0
- data/test/spec_data-finder.rb +88 -0
- data/test/spec_data-finder.yml +115 -0
- data/test/spec_document.rb +76 -0
- data/test/spec_identifier.rb +29 -0
- data/test/spec_log.rb +52 -0
- data/test/spec_object.rb +20 -0
- data/test/spec_resource.rb +73 -0
- data/test/spec_update-criteria.rb +83 -0
- data/test/test-util.rb +223 -0
- data/test/transformer/spec_block-transformer.rb +26 -0
- data/test/transformer/spec_expr-transformer.rb +106 -0
- data/test/transformer/spec_feature-expr-transformer.rb +21 -0
- data/test/transformer/spec_flow-element-transformer.rb +154 -0
- data/test/transformer/spec_literal-transformer.rb +58 -0
- data/test/transformer/spec_rule-definition-transformer.rb +168 -0
- data/test/tuple-space/spec_tuple-space-provider.rb +36 -0
- data/test/tuple-space/spec_tuple-space-receiver.rb +32 -0
- data/test/tuple-space/spec_tuple-space-server.rb +49 -0
- data/test/tuple/spec_basic-tuple.rb +87 -0
- data/test/tuple/spec_data-tuple.rb +85 -0
- data/test/tuple/spec_finished-tuple.rb +61 -0
- data/test/tuple/spec_task-tuple.rb +127 -0
- data/test/tuple/spec_working-tuple.rb +58 -0
- data/test/uri-scheme/spec_broadcast-scheme.rb +40 -0
- data/test/uri-scheme/spec_dropbox-scheme.rb +31 -0
- data/test/uri-scheme/spec_local-scheme.rb +69 -0
- metadata +660 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
module Pione
|
2
|
+
module Command
|
3
|
+
class PioneRelayClientDB < BasicCommand
|
4
|
+
set_program_name("pione-relay-client-db")
|
5
|
+
|
6
|
+
set_program_message <<TXT
|
7
|
+
Add, delete, or show clients in this relay server.
|
8
|
+
TXT
|
9
|
+
|
10
|
+
define_option("-a", "--add", "add a client") do
|
11
|
+
@action = :add
|
12
|
+
end
|
13
|
+
|
14
|
+
define_option("-d", "--delete", "delete a client") do
|
15
|
+
@action = :delete
|
16
|
+
end
|
17
|
+
|
18
|
+
define_option("-l", "--list", "list clients") do
|
19
|
+
@action = :list
|
20
|
+
end
|
21
|
+
|
22
|
+
define_option("-u name", "--user name", "user name") do |name|
|
23
|
+
@name = name
|
24
|
+
end
|
25
|
+
|
26
|
+
define_option("-p password", "--password password", "password") do |password|
|
27
|
+
@password = password
|
28
|
+
end
|
29
|
+
|
30
|
+
define_option("-f path", "--file path", "client db path") do |path|
|
31
|
+
Global.relay_client_db_path = path
|
32
|
+
end
|
33
|
+
|
34
|
+
def initialize
|
35
|
+
@action = nil
|
36
|
+
@name = nil
|
37
|
+
@password = nil
|
38
|
+
end
|
39
|
+
|
40
|
+
def validate_options
|
41
|
+
abort("error: -a, -d, or -l") unless @action
|
42
|
+
end
|
43
|
+
|
44
|
+
def prepare
|
45
|
+
# set client db
|
46
|
+
Global.relay_client_db = RelayClientDB.new(Global.relay_client_db_path)
|
47
|
+
|
48
|
+
# set name
|
49
|
+
if [:add, :delete].include?(@action)
|
50
|
+
@name = HighLine.new.ask("Name: ") unless @name
|
51
|
+
end
|
52
|
+
|
53
|
+
# set password
|
54
|
+
if @action == :add
|
55
|
+
unless @password
|
56
|
+
@password = HighLine.new.ask("Password: "){|q| q.echo = "*"}
|
57
|
+
password = HighLine.new.ask("Re-enter password: "){|q| q.echo = "*"}
|
58
|
+
abort("error: password mismatch") unless @password == password
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def start
|
64
|
+
case @action
|
65
|
+
when :add
|
66
|
+
Global.relay_client_db.add(@name, @password)
|
67
|
+
Global.relay_client_db.save
|
68
|
+
when :delete
|
69
|
+
Global.relay_client_db.delete(@name)
|
70
|
+
Global.relay_client_db.save
|
71
|
+
when :list
|
72
|
+
names = Global.relay_client_db.names
|
73
|
+
puts "%s clients in %s" % [names.size, Global.relay_client_db_path]
|
74
|
+
names.each {|user| puts user}
|
75
|
+
end
|
76
|
+
terminate
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Pione
|
2
|
+
module Command
|
3
|
+
class PioneRelay < FrontOwnerCommand
|
4
|
+
set_program_name("pione-relay") do
|
5
|
+
"--relay-port %s" % [@relay_port]
|
6
|
+
end
|
7
|
+
|
8
|
+
set_program_message <<TXT
|
9
|
+
Runs relay process for connecting between clients and brokers.
|
10
|
+
TXT
|
11
|
+
|
12
|
+
define_option("--realm name", "set relay realm name for client authentification") do |name|
|
13
|
+
Global.relay_realm = name
|
14
|
+
end
|
15
|
+
|
16
|
+
define_option("--relay-port port", "set relay port") do |port|
|
17
|
+
@relay_port = port
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
@relay_port = Global.relay_port
|
22
|
+
end
|
23
|
+
|
24
|
+
def validate_options
|
25
|
+
abort("error: no realm name") if Global.relay_realm.nil? or Global.relay_realm.empty?
|
26
|
+
abort("error: no relay port") unless @relay_port
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_front
|
30
|
+
Front::RelayFront.new(self)
|
31
|
+
end
|
32
|
+
|
33
|
+
def start
|
34
|
+
# wake up tuple space provider process
|
35
|
+
Pione::TupleSpaceProvider.instance
|
36
|
+
|
37
|
+
puts DRb.front.uri
|
38
|
+
DRb::DRbServer.new(
|
39
|
+
"relay://:%s" % @relay_port,
|
40
|
+
nil,
|
41
|
+
{:SSLCertName => Global.relay_ssl_certname}
|
42
|
+
)
|
43
|
+
DRb.thread.join
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
module Pione
|
2
|
+
module Command
|
3
|
+
class PioneSyntaxChecker < BasicCommand
|
4
|
+
set_program_name("pione-syntax-checker")
|
5
|
+
|
6
|
+
set_program_message <<TXT
|
7
|
+
Prints syntax tree of PIONE notation.
|
8
|
+
TXT
|
9
|
+
|
10
|
+
define_option('-e', '--expr=expr', 'expression string') do |e|
|
11
|
+
@expr = e
|
12
|
+
@readline_mode = false
|
13
|
+
end
|
14
|
+
|
15
|
+
define_option('-t', '--transformer', 'show transformer result') do
|
16
|
+
@transform = true
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@readline_mode = true
|
21
|
+
end
|
22
|
+
|
23
|
+
def prepare
|
24
|
+
require 'pp'
|
25
|
+
@history = File.join(Global.dot_pione_dir, "pione-history")
|
26
|
+
trap_int
|
27
|
+
end
|
28
|
+
|
29
|
+
def start
|
30
|
+
if @readline_mode
|
31
|
+
require 'readline'
|
32
|
+
restore_history
|
33
|
+
|
34
|
+
# start loop
|
35
|
+
while buf = Readline.readline(Terminal.red("> "), true)
|
36
|
+
if /[^\s]/.match(buf)
|
37
|
+
# don't record if previous line is the same
|
38
|
+
if Readline::HISTORY.size > 1 && Readline::HISTORY[-2] == buf
|
39
|
+
Readline::HISTORY.pop
|
40
|
+
end
|
41
|
+
# print parsing result
|
42
|
+
print_result(buf)
|
43
|
+
else
|
44
|
+
# don't record if it is an empty line
|
45
|
+
Readline::HISTORY.pop
|
46
|
+
end
|
47
|
+
end
|
48
|
+
else
|
49
|
+
# print parsing result
|
50
|
+
print_result(@expr)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
# Prints parsing result of the string
|
57
|
+
def print_result(str)
|
58
|
+
begin
|
59
|
+
puts Terminal.green("syntax:")
|
60
|
+
stree = DocumentParser.new.parse(str).first
|
61
|
+
pp stree
|
62
|
+
if @transform
|
63
|
+
puts Terminal.green("model:")
|
64
|
+
pp DocumentTransformer.new.apply(stree)
|
65
|
+
end
|
66
|
+
rescue Pione::Parser::ParserError, Parslet::UnconsumedInput, Parslet::ParseFailed => e
|
67
|
+
msg = "Pione syntax error: %s (%s)" % [e.message, e.class.name]
|
68
|
+
@readline_mode ? puts(msg) : abort(msg)
|
69
|
+
rescue Pione::Model::PioneModelTypeError,
|
70
|
+
Pione::Model::VariableBindingError => e
|
71
|
+
msg = "Pione model error: %s (%s)" % [e.message, e.class.name]
|
72
|
+
@readline_mode ? puts(msg) : abort(msg)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Makes trap Ctr+C
|
77
|
+
def trap_int
|
78
|
+
trap("INT") do
|
79
|
+
save_history
|
80
|
+
exit
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Restores history.
|
85
|
+
def restore_history
|
86
|
+
if File.exist?(@history)
|
87
|
+
File.readlines(@history).reverse.each do |line|
|
88
|
+
Readline::HISTORY.push line.chomp
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Saves history.
|
94
|
+
def save_history
|
95
|
+
File.open(@history, "w+") do |file|
|
96
|
+
Readline::HISTORY.to_a.reverse[0..100].each do |line|
|
97
|
+
file.puts(line) if /\S/.match(line)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
module Pione
|
2
|
+
module Command
|
3
|
+
# This is a class for +pione-task-worker+ command. +pione-task-worker+
|
4
|
+
# starts a task worker agent with tuple space server.
|
5
|
+
class PioneTaskWorker < ChildProcess
|
6
|
+
set_program_name("pione-task-worker") do
|
7
|
+
parent_front = @no_parent_mode ? "nil" : @parent_front.uri
|
8
|
+
"<front=%s, parent-front=%s>" % [Global.front.uri, parent_front]
|
9
|
+
end
|
10
|
+
|
11
|
+
set_program_message <<TXT
|
12
|
+
Runs task worker process. This command is launched by other processes like
|
13
|
+
pione-client or pione-broker.
|
14
|
+
TXT
|
15
|
+
|
16
|
+
use_option_module CommandOption::ChildProcessOption
|
17
|
+
|
18
|
+
# --connection-id
|
19
|
+
define_option('--connection-id=ID', 'set connection id') do |id|
|
20
|
+
@connection_id = id
|
21
|
+
end
|
22
|
+
|
23
|
+
# --feature
|
24
|
+
define_option('--features="FEATURES"', 'set features') do |features|
|
25
|
+
begin
|
26
|
+
features = DocumentTransformer.new.apply(
|
27
|
+
DocumentParser.new.feature_expr.parse(features)
|
28
|
+
)
|
29
|
+
@features = features
|
30
|
+
rescue Parslet::ParseFailed => e
|
31
|
+
puts "invalid parameters: " + str
|
32
|
+
Util::ErrorReport.print(e)
|
33
|
+
abort
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
attr_reader :connection_id
|
38
|
+
attr_reader :agent
|
39
|
+
attr_reader :tuple_space_server
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def create_front
|
44
|
+
Pione::Front::TaskWorkerFront.new(self)
|
45
|
+
end
|
46
|
+
|
47
|
+
def validate_options
|
48
|
+
super
|
49
|
+
|
50
|
+
# check requisite options
|
51
|
+
if @connection_id.nil?
|
52
|
+
abort("error: no connection id")
|
53
|
+
end
|
54
|
+
|
55
|
+
# get the parent front server
|
56
|
+
begin
|
57
|
+
@parent_front.uuid
|
58
|
+
rescue => e
|
59
|
+
abort("pione-task-worker cannot get the parent front server: %s" % e)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def prepare
|
64
|
+
super
|
65
|
+
|
66
|
+
@tuple_space_server = @parent_front.get_tuple_space_server(@connection_id)
|
67
|
+
@features = Model::Feature::EmptyFeature.new unless @features
|
68
|
+
@agent = Pione::Agent[:task_worker].new(@tuple_space_server, @features)
|
69
|
+
@command_listener = Pione::Agent[:command_listener].new(@tuple_space_server, self)
|
70
|
+
|
71
|
+
# connect caller front
|
72
|
+
@parent_front.add_task_worker_front(Global.front, @connection_id)
|
73
|
+
|
74
|
+
abort("pione-task-worker error: no tuple space server") unless @tuple_space_server
|
75
|
+
|
76
|
+
# get base uri
|
77
|
+
if @tuple_space_server.base_uri.scheme == "dropbox"
|
78
|
+
Resource::Dropbox.init(@tuple_space_server)
|
79
|
+
unless Resource::Dropbox.ready?
|
80
|
+
abort("You aren't ready to access Dropbox.")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def start
|
86
|
+
super
|
87
|
+
|
88
|
+
# start task worker activity
|
89
|
+
@agent.start
|
90
|
+
@command_listener.start
|
91
|
+
|
92
|
+
# wait...
|
93
|
+
begin
|
94
|
+
@agent.running_thread.join
|
95
|
+
# terminate
|
96
|
+
terminate
|
97
|
+
rescue DRb::DRbConnError, DRb::ReplyReaderThreadError
|
98
|
+
terminate
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def terminate
|
103
|
+
return if @terminated
|
104
|
+
@agent.terminate
|
105
|
+
|
106
|
+
while true
|
107
|
+
break if @agent.terminated? and @agent.running_thread.stop?
|
108
|
+
sleep 1
|
109
|
+
end
|
110
|
+
|
111
|
+
# disconnect parent front
|
112
|
+
@parent_front.remove_task_worker_front(self, @connection_id)
|
113
|
+
|
114
|
+
# flag
|
115
|
+
@terminated = true
|
116
|
+
|
117
|
+
super
|
118
|
+
rescue DRb::DRbConnError, DRb::ReplyReaderThreadError
|
119
|
+
abort
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module Pione
|
2
|
+
module Command
|
3
|
+
# PioneTupleSpaceProvider is for +pione-tuple-space-provider+ command.
|
4
|
+
class PioneTupleSpaceProvider < ChildProcess
|
5
|
+
set_program_name("pione-tuple-space-provider") do
|
6
|
+
parent_front = @no_parent_mode ? "nil" : @parent_front.uri
|
7
|
+
"<front=%s, parent-front=%s>" % [Global.front.uri, parent_front]
|
8
|
+
end
|
9
|
+
|
10
|
+
set_program_message <<TXT
|
11
|
+
Runs tuple space provider process for sending tuple space presence
|
12
|
+
notifier. This command is launched by other processes like pione-client or
|
13
|
+
pione-relay normally, but you can force to start by calling with --no-parent
|
14
|
+
option.
|
15
|
+
TXT
|
16
|
+
|
17
|
+
use_option_module CommandOption::TupleSpaceProviderOption
|
18
|
+
|
19
|
+
attr_reader :tuple_space_provider
|
20
|
+
|
21
|
+
def initialize
|
22
|
+
super
|
23
|
+
@parent_front = nil
|
24
|
+
@notifier_addresses = []
|
25
|
+
end
|
26
|
+
|
27
|
+
# @api private
|
28
|
+
def validate_options
|
29
|
+
super
|
30
|
+
|
31
|
+
# broadcast addresses
|
32
|
+
@notifier_addresses.each do |uri|
|
33
|
+
unless uri.scheme == "broadcast"
|
34
|
+
abort("error: invalid broadcast address '%s'" % uri.to_s)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# @api private
|
40
|
+
def create_front
|
41
|
+
Pione::Front::TupleSpaceProviderFront.new(self)
|
42
|
+
end
|
43
|
+
|
44
|
+
# @api private
|
45
|
+
def prepare
|
46
|
+
super
|
47
|
+
|
48
|
+
# setup notifier addresses
|
49
|
+
unless @notifier_addresses.empty?
|
50
|
+
Global.tuple_space_provider_broadcast_addresses = @notifier_addresses
|
51
|
+
end
|
52
|
+
|
53
|
+
# make tuple space provider
|
54
|
+
@tuple_space_provider = TupleSpaceProvider.new
|
55
|
+
end
|
56
|
+
|
57
|
+
# @api private
|
58
|
+
def start
|
59
|
+
super
|
60
|
+
|
61
|
+
# start provider activity
|
62
|
+
@tuple_space_provider.start
|
63
|
+
|
64
|
+
# set my URI to caller front as its provider
|
65
|
+
unless @no_parent_mode
|
66
|
+
@parent_front.set_tuple_space_provider(Global.front.uri)
|
67
|
+
end
|
68
|
+
|
69
|
+
# wait
|
70
|
+
begin
|
71
|
+
DRb.thread.join
|
72
|
+
rescue DRb::DRbConnError, DRb::ReplyReaderThreadError
|
73
|
+
terminate
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# @api private
|
78
|
+
def terminate
|
79
|
+
puts "terminate %s" % program_name
|
80
|
+
@tuple_space_provider.terminate
|
81
|
+
super
|
82
|
+
rescue DRb::DRbConnError, DRb::ReplyReaderThreadError
|
83
|
+
abort
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Pione
|
2
|
+
module Command
|
3
|
+
class PioneTupleSpaceReceiver < ChildProcess
|
4
|
+
set_program_name("pione-tuple-space-receiver") do
|
5
|
+
parent_front = @no_parent_mode ? "nil" : @parent_front.uri
|
6
|
+
"<front=%s, parent=%s>" % [Global.front.uri, parent_front]
|
7
|
+
end
|
8
|
+
|
9
|
+
set_program_message <<TXT
|
10
|
+
Runs tuple space receiver process for receiving tuple space presence
|
11
|
+
notifier. This command is launched by other processes like pione-broker
|
12
|
+
normally, but you can force to start by calling with --no-parent option.
|
13
|
+
TXT
|
14
|
+
|
15
|
+
use_option_module CommandOption::TupleSpaceReceiverOption
|
16
|
+
|
17
|
+
attr_reader :tuple_space_receiver
|
18
|
+
|
19
|
+
def create_front
|
20
|
+
Front::TupleSpaceReceiverFront.new(self)
|
21
|
+
end
|
22
|
+
|
23
|
+
def prepare
|
24
|
+
super
|
25
|
+
@tuple_space_receiver = TupleSpaceReceiver.new
|
26
|
+
end
|
27
|
+
|
28
|
+
def start
|
29
|
+
super
|
30
|
+
|
31
|
+
# start provider activity
|
32
|
+
@tuple_space_receiver.start
|
33
|
+
|
34
|
+
# set my uri to parent front as its provider
|
35
|
+
unless @no_parent_mode
|
36
|
+
@parent_front.set_tuple_space_receiver(Global.front.uri)
|
37
|
+
end
|
38
|
+
|
39
|
+
# wait
|
40
|
+
DRb.thread.join
|
41
|
+
rescue DRb::ReplyReaderThreadError => e
|
42
|
+
# ignore reply reader error
|
43
|
+
end
|
44
|
+
|
45
|
+
def terminate
|
46
|
+
puts "terminate %s" % program_name
|
47
|
+
begin
|
48
|
+
@tuple_space_receiver.terminate
|
49
|
+
rescue DRb::DRbConnError
|
50
|
+
end
|
51
|
+
super
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|