rbeai 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. data/lib/rbeai/GetLogic.rb +144 -0
  2. data/lib/rbeai/Main.rb +70 -0
  3. data/lib/rbeai/PipeTask.rb +216 -0
  4. data/lib/rbeai/PutLogic.rb +123 -0
  5. data/lib/rbeai/RouterLogic.rb +155 -0
  6. data/lib/rbeai/RouterPipeTask.rb +62 -0
  7. data/lib/rbeai/TasksLogic.rb +285 -0
  8. data/lib/rbeai/TransfLogic.rb +145 -0
  9. data/lib/rbeai/WorkerPool.rb +72 -0
  10. data/lib/rbeai/Workflow.rb +79 -0
  11. data/lib/rbeai/templates/csv2xml_nh.awk +14 -0
  12. data/lib/rbeai/templates/csv2xml_wh.awk +16 -0
  13. data/lib/rbeai.rb +13 -0
  14. data/rbeai-0.0.1.gem +0 -0
  15. data/rbeai.gemspec +20 -0
  16. data/test/config/conf.rb +2 -0
  17. data/test/test1.rb +4 -0
  18. data/test/test_files/empty_file.txt +0 -0
  19. data/test/test_files/empty_file.unused +0 -0
  20. data/test/test_files/test_router_1.txt +1 -0
  21. data/test/test_files/test_router_1.xml_91 +5 -0
  22. data/test/test_files/test_router_1.xml_92 +6 -0
  23. data/test/test_files/test_router_1.xml_fail +5 -0
  24. data/test/test_files/test_transf_1.xml +28 -0
  25. data/test/test_files/test_transf_2.txt +5 -0
  26. data/test/test_files/test_transf_3.xml +28 -0
  27. data/test/test_get_send_email.rb +11 -0
  28. data/test/test_get_send_file.rb +11 -0
  29. data/test/test_get_send_ftp.rb +11 -0
  30. data/test/test_router.rb +11 -0
  31. data/test/test_transf_1.rb +11 -0
  32. data/test/test_transf_2.awk +1 -0
  33. data/test/test_transf_2.rb +11 -0
  34. data/test/test_transf_3.rb +11 -0
  35. data/test/test_transf_3.xsl +10 -0
  36. data/test/tmp/test_get_send_file/1130328204.12500/getfile/empty_file.txt +0 -0
  37. data/test/tmp/test_get_send_ftp/1130328178.76500/getfile/empty_file.txt +0 -0
  38. data/test/workflows/test_get_send_email.wf +28 -0
  39. data/test/workflows/test_get_send_file.wf +21 -0
  40. data/test/workflows/test_get_send_ftp.wf +28 -0
  41. data/test/workflows/test_router_1.wf +35 -0
  42. data/test/workflows/test_start_end.wf +8 -0
  43. data/test/workflows/test_transf_1.wf +26 -0
  44. data/test/workflows/test_transf_2.wf +25 -0
  45. data/test/workflows/test_transf_3.wf +25 -0
  46. metadata +128 -0
data/rbeai.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ #!/bin/env ruby
2
+ require 'rubygems'
3
+
4
+ spec = Gem::Specification.new do |s|
5
+ s.name = "rbeai"
6
+ s.add_dependency('extensions', '>= 0.6.0')
7
+ s.add_dependency('rio', '= 0.3.1')
8
+ s.add_dependency('rmail', '>= 0.17')
9
+ s.required_ruby_version = Gem::Version::Requirement.new(">= 1.6.7")
10
+ s.version = "0.0.1"
11
+ s.date = "2005-09-29"
12
+ s.summary = "Simple EAI Engine."
13
+ s.require_paths = ["lib"]
14
+ s.autorequire = %q{rmail}
15
+ s.email = "xinizul@gmail.com"
16
+ s.homepage = "http://xinizul.sytes.net/"
17
+ s.rubyforge_project = "rbeai"
18
+ s.description = "RbEAI is a simple EAI Engine."
19
+ s.files = Dir.glob("**/*")
20
+ end
@@ -0,0 +1,2 @@
1
+ @@server_port = 8888
2
+ @@server_log = true
data/test/test1.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'rbeai/MAIN'
2
+ eai = RbEAI::MAIN.new()
3
+ eai.start
4
+ eai.join
File without changes
File without changes
@@ -0,0 +1 @@
1
+ hello world
@@ -0,0 +1,5 @@
1
+ <test>
2
+ <status>50</status>
3
+ <status>91</status>
4
+ <status>150</status>
5
+ </test>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1"?>
2
+ <test>
3
+ <status>50</status>
4
+ <status>92</status>
5
+ <status>150</status>
6
+ </test>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1"?>
2
+ <test>
3
+ <status>50</status>
4
+ <status>150</status>
5
+ </test>
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1"?>
2
+ <all>
3
+ <doc>
4
+ <data>1</data>
5
+ <data>2</data>
6
+ <data>3</data>
7
+ </doc>
8
+ <doc>
9
+ <data>a</data>
10
+ <data>b</data>
11
+ <data>c</data>
12
+ </doc>
13
+ <doc>
14
+ <data>4</data>
15
+ <data>5</data>
16
+ <data>6</data>
17
+ </doc>
18
+ <doc>
19
+ <data>a</data>
20
+ <data>d</data>
21
+ <data>e</data>
22
+ </doc>
23
+ <doc>
24
+ <data>5</data>
25
+ <data>6</data>
26
+ <data>7</data>
27
+ </doc>
28
+ </all>
@@ -0,0 +1,5 @@
1
+ 1 2 3
2
+ a b c
3
+ 4 5 6
4
+ a d e
5
+ 5 6 7
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1"?>
2
+ <all>
3
+ <doc>
4
+ <data>1</data>
5
+ <data>2</data>
6
+ <data>3</data>
7
+ </doc>
8
+ <doc>
9
+ <data>a</data>
10
+ <data>b</data>
11
+ <data>c</data>
12
+ </doc>
13
+ <doc>
14
+ <data>4</data>
15
+ <data>5</data>
16
+ <data>6</data>
17
+ </doc>
18
+ <doc>
19
+ <data>a</data>
20
+ <data>d</data>
21
+ <data>e</data>
22
+ </doc>
23
+ <doc>
24
+ <data>5</data>
25
+ <data>6</data>
26
+ <data>7</data>
27
+ </doc>
28
+ </all>
@@ -0,0 +1,11 @@
1
+ require 'rio'
2
+ require 'rbeai/MAIN'
3
+ require 'rbeai/Workflow'
4
+
5
+ wfstr = ""
6
+ rio("./workflows/test_get_send_email.wf") > wfstr
7
+
8
+ wf = RbEAI::Workflow.new(wfstr)
9
+ wf.run()
10
+ sleep(10)
11
+ wf.finish()
@@ -0,0 +1,11 @@
1
+ require 'rio'
2
+ require 'rbeai/MAIN'
3
+ require 'rbeai/Workflow'
4
+
5
+ wfstr = ""
6
+ rio("./workflows/test_get_send_file.wf") > wfstr
7
+
8
+ wf = RbEAI::Workflow.new(wfstr)
9
+ wf.run()
10
+ sleep(10)
11
+ wf.finish()
@@ -0,0 +1,11 @@
1
+ require 'rio'
2
+ require 'rbeai/MAIN'
3
+ require 'rbeai/Workflow'
4
+
5
+ wfstr = ""
6
+ rio("./workflows/test_get_send_ftp.wf") > wfstr
7
+
8
+ wf = RbEAI::Workflow.new(wfstr)
9
+ wf.run()
10
+ sleep(10)
11
+ wf.finish()
@@ -0,0 +1,11 @@
1
+ require 'rio'
2
+ require 'rbeai/MAIN'
3
+ require 'rbeai/Workflow'
4
+
5
+ wfstr = ""
6
+ rio("./workflows/test_router_1.wf") > wfstr
7
+
8
+ wf = RbEAI::Workflow.new(wfstr)
9
+ wf.run()
10
+ sleep(10)
11
+ wf.finish()
@@ -0,0 +1,11 @@
1
+ require 'rio'
2
+ require 'rbeai/MAIN'
3
+ require 'rbeai/Workflow'
4
+
5
+ wfstr = ""
6
+ rio("./workflows/test_transf_1.wf") > wfstr
7
+
8
+ wf = RbEAI::Workflow.new(wfstr)
9
+ wf.run()
10
+ sleep(10)
11
+ wf.finish()
@@ -0,0 +1 @@
1
+ $1 ~ /a/ {print $0}
@@ -0,0 +1,11 @@
1
+ require 'rio'
2
+ require 'rbeai/MAIN'
3
+ require 'rbeai/Workflow'
4
+
5
+ wfstr = ""
6
+ rio("./workflows/test_transf_2.wf") > wfstr
7
+
8
+ wf = RbEAI::Workflow.new(wfstr)
9
+ wf.run()
10
+ sleep(10)
11
+ wf.finish()
@@ -0,0 +1,11 @@
1
+ require 'rio'
2
+ require 'rbeai/MAIN'
3
+ require 'rbeai/Workflow'
4
+
5
+ wfstr = ""
6
+ rio("./workflows/test_transf_3.wf") > wfstr
7
+
8
+ wf = RbEAI::Workflow.new(wfstr)
9
+ wf.run()
10
+ sleep(10)
11
+ wf.finish()
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" ?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+ <xsl:output method="text"/>
4
+ <xsl:template match="/">
5
+ <xsl:for-each select="/all/doc">
6
+ <xsl:for-each select="./data"><xsl:value-of select="text()"/>|</xsl:for-each>
7
+ ----------------
8
+ </xsl:for-each>
9
+ </xsl:template>
10
+ </xsl:stylesheet>
@@ -0,0 +1,28 @@
1
+ <workflow name="test_get_send_email" rate="50m">
2
+ <task name="init" type="Start">
3
+ <next>getfile</next>
4
+ </task>
5
+ <task name="getfile" type="Get" rate="1s" pool="1">
6
+ <next>sendemail</next>
7
+ <protocol def="email">
8
+ <location address="pop3.terra.es" port="110"/>
9
+ <account name="xxx" pwd="yyy"/>
10
+ <pattern>andy</pattern>
11
+ </protocol>
12
+ </task>
13
+ <task name="sendemail" type="Put" rate="0s" pool="1">
14
+ <next>final</next>
15
+ <protocol def="email">
16
+ <location address="smtp.mail.yahoo.com" port="25"/>
17
+ <account name="xxx" pwd="zzz"/>
18
+ <from>pp@gmail.com</from>
19
+ <to>qq@yahoo.es</to>
20
+ <cc></cc>
21
+ <bcc></bcc>
22
+ <subject>Hello</subject>
23
+ </protocol>
24
+ </task>
25
+ <task name="final" type="End">
26
+ <next/>
27
+ </task>
28
+ </workflow>
@@ -0,0 +1,21 @@
1
+ <workflow name="test_get_send_file" rate="50m">
2
+ <task name="init" type="Start">
3
+ <next>getfile</next>
4
+ </task>
5
+ <task name="getfile" type="Get" rate="1s" pool="1">
6
+ <next>sendfile</next>
7
+ <protocol def="file">
8
+ <location>./test_files</location>
9
+ <pattern>empty*.txt</pattern>
10
+ </protocol>
11
+ </task>
12
+ <task name="sendfile" type="Put" rate="0s" pool="1">
13
+ <next>final</next>
14
+ <protocol def="file">
15
+ <location>./test_target_folder</location>
16
+ </protocol>
17
+ </task>
18
+ <task name="final" type="End">
19
+ <next/>
20
+ </task>
21
+ </workflow>
@@ -0,0 +1,28 @@
1
+ <workflow name="test_get_send_ftp" rate="50m">
2
+ <task name="init" type="Start">
3
+ <next>getfile</next>
4
+ </task>
5
+ <task name="getfile" type="Get" rate="1s" pool="1">
6
+ <next>sendfile</next>
7
+ <protocol def="file">
8
+ <location>./test_files</location>
9
+ <pattern>empty*.txt</pattern>
10
+ </protocol>
11
+
12
+ <!-- Currently no working: due to RIO perhaps
13
+ <protocol def="ftp">
14
+ <location>ftp://test:testpw@127.0.0.1/</location>
15
+ <pattern>ftpfile.txt</pattern>
16
+ </protocol>
17
+ -->
18
+ </task>
19
+ <task name="sendfile" type="Put" rate="0s" pool="1">
20
+ <next>final</next>
21
+ <protocol def="ftp">
22
+ <location>ftp://test:testpw@localhost</location>
23
+ </protocol>
24
+ </task>
25
+ <task name="final" type="End">
26
+ <next/>
27
+ </task>
28
+ </workflow>
@@ -0,0 +1,35 @@
1
+ <workflow name="test_router_1" rate="50m">
2
+ <task name="inicio" type="Start">
3
+ <next>getfile</next>
4
+ </task>
5
+ <task name="getfile" type="Get" rate="1s" pool="1">
6
+ <next>router</next>
7
+ <protocol def="file">
8
+ <location>./test_files</location>
9
+ <pattern>test_router_1.*</pattern>
10
+ </protocol>
11
+ </task>
12
+ <task name="router" type="Router" pool="2">
13
+ <next>
14
+ <goto task="sendfile">
15
+ <when filter="sax:status">91</when>
16
+ </goto>
17
+ <goto task="sendfile">
18
+ <when filter="xpath:/test/status">92</when>
19
+ </goto>
20
+ <goto task="sendfile">
21
+ <when filter="name:test_router_1.txt"/>
22
+ </goto>
23
+ <goto task="final"/>
24
+ </next>
25
+ </task>
26
+ <task name="sendfile" type="Put" rate="0s" pool="1">
27
+ <next>final</next>
28
+ <protocol def="file">
29
+ <location>./test_target_folder</location>
30
+ </protocol>
31
+ </task>
32
+ <task name="final" type="End">
33
+ <next/>
34
+ </task>
35
+ </workflow>
@@ -0,0 +1,8 @@
1
+ <workflow name="test_start_end" rate="1m">
2
+ <task name="start" type="Start">
3
+ <next>final</next>
4
+ </task>
5
+ <task name="final" type="End">
6
+ <next/>
7
+ </task>
8
+ </workflow>
@@ -0,0 +1,26 @@
1
+ <workflow name="test_transf_1" rate="50m">
2
+ <task name="inicio" type="Start">
3
+ <next>getfile</next>
4
+ </task>
5
+ <task name="getfile" type="Get" rate="1s" pool="1">
6
+ <next>transf</next>
7
+ <protocol def="file">
8
+ <location>./test_files</location>
9
+ <pattern>test_transf_1.xml</pattern>
10
+ </protocol>
11
+ </task>
12
+ <task name="transf" type="Transf" pool="3">
13
+ <next>sendfile</next>
14
+ <transf ord="2" type="csv2xml_nh"/><!-- also available: csv2xml_wh -->
15
+ <transf ord="1" xprow="/all/doc" xpitem="./data/text()" type="xml2csv"/>
16
+ </task>
17
+ <task name="sendfile" type="Put" rate="0s" pool="1">
18
+ <next>final</next>
19
+ <protocol def="file">
20
+ <location>./test_target_folder</location>
21
+ </protocol>
22
+ </task>
23
+ <task name="final" type="End">
24
+ <next/>
25
+ </task>
26
+ </workflow>
@@ -0,0 +1,25 @@
1
+ <workflow name="test_transf_2" rate="50m">
2
+ <task name="inicio" type="Start">
3
+ <next>getfile</next>
4
+ </task>
5
+ <task name="getfile" type="Get" rate="1s" pool="1">
6
+ <next>transf</next>
7
+ <protocol def="file">
8
+ <location>./test_files</location>
9
+ <pattern>test_transf_2.txt</pattern>
10
+ </protocol>
11
+ </task>
12
+ <task name="transf" type="Transf" pool="3">
13
+ <next>sendfile</next>
14
+ <transf type="awk" script="test_transf_2.awk"/>
15
+ </task>
16
+ <task name="sendfile" type="Put" rate="0s" pool="1">
17
+ <next>final</next>
18
+ <protocol def="file">
19
+ <location>./test_target_folder</location>
20
+ </protocol>
21
+ </task>
22
+ <task name="final" type="End">
23
+ <next/>
24
+ </task>
25
+ </workflow>
@@ -0,0 +1,25 @@
1
+ <workflow name="test_transf_3" rate="50m">
2
+ <task name="inicio" type="Start">
3
+ <next>getfile</next>
4
+ </task>
5
+ <task name="getfile" type="Get" rate="1s" pool="1">
6
+ <next>transf</next>
7
+ <protocol def="file">
8
+ <location>./test_files</location>
9
+ <pattern>test_transf_3.xml</pattern>
10
+ </protocol>
11
+ </task>
12
+ <task name="transf" type="Transf" pool="3">
13
+ <next>sendfile</next>
14
+ <transf type="xsl" script="test_transf_3.xsl"/>
15
+ </task>
16
+ <task name="sendfile" type="Put" rate="0s" pool="1">
17
+ <next>final</next>
18
+ <protocol def="file">
19
+ <location>./test_target_folder</location>
20
+ </protocol>
21
+ </task>
22
+ <task name="final" type="End">
23
+ <next/>
24
+ </task>
25
+ </workflow>
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.10
3
+ specification_version: 1
4
+ name: rbeai
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.1
7
+ date: 2005-09-29
8
+ summary: Simple EAI Engine.
9
+ require_paths:
10
+ - lib
11
+ email: xinizul@gmail.com
12
+ homepage: http://xinizul.sytes.net/
13
+ rubyforge_project: rbeai
14
+ description: RbEAI is a simple EAI Engine.
15
+ autorequire: rmail
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ -
22
+ - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 1.6.7
25
+ version:
26
+ platform: ruby
27
+ authors: []
28
+ files:
29
+ - lib
30
+ - test
31
+ - rbeai.gemspec
32
+ - rbeai-0.0.1.gem
33
+ - lib/rbeai.rb
34
+ - lib/rbeai
35
+ - lib/rbeai/GetLogic.rb
36
+ - lib/rbeai/Main.rb
37
+ - lib/rbeai/PipeTask.rb
38
+ - lib/rbeai/PutLogic.rb
39
+ - lib/rbeai/RouterLogic.rb
40
+ - lib/rbeai/RouterPipeTask.rb
41
+ - lib/rbeai/TasksLogic.rb
42
+ - lib/rbeai/TransfLogic.rb
43
+ - lib/rbeai/WorkerPool.rb
44
+ - lib/rbeai/Workflow.rb
45
+ - lib/rbeai/templates
46
+ - lib/rbeai/templates/csv2xml_nh.awk
47
+ - lib/rbeai/templates/csv2xml_wh.awk
48
+ - test/test1.rb
49
+ - test/config
50
+ - test/workflows
51
+ - test/test_files
52
+ - test/test_target_folder
53
+ - test/test_get_send_file.rb
54
+ - test/test_transf_1.rb
55
+ - test/test_transf_2.awk
56
+ - test/test_transf_2.rb
57
+ - test/test_transf_3.xsl
58
+ - test/test_transf_3.rb
59
+ - test/test_router.rb
60
+ - test/test_get_send_ftp.rb
61
+ - test/test_get_send_email.rb
62
+ - test/tmp
63
+ - test/config/conf.rb
64
+ - test/workflows/test_get_send_ftp.wf
65
+ - test/workflows/test_get_send_email.wf
66
+ - test/workflows/test_start_end.wf
67
+ - test/workflows/test_transf_2.wf
68
+ - test/workflows/test_transf_1.wf
69
+ - test/workflows/test_transf_3.wf
70
+ - test/workflows/test_router_1.wf
71
+ - test/workflows/test_get_send_file.wf
72
+ - test/test_files/empty_file.txt
73
+ - test/test_files/empty_file.unused
74
+ - test/test_files/test_transf_1.xml
75
+ - test/test_files/test_transf_2.txt
76
+ - test/test_files/test_transf_3.xml
77
+ - test/test_files/test_router_1.xml_fail
78
+ - test/test_files/test_router_1.xml_92
79
+ - test/test_files/test_router_1.txt
80
+ - test/test_files/test_router_1.xml_91
81
+ - test/tmp/test_get_send_email
82
+ - test/tmp/test_get_send_ftp
83
+ - test/tmp/test_get_send_file
84
+ - test/tmp/test_get_send_email/1130328109.15600
85
+ - test/tmp/test_get_send_ftp/1130328154.51500
86
+ - test/tmp/test_get_send_ftp/1130328178.76500
87
+ - test/tmp/test_get_send_ftp/1130328178.76500/getfile
88
+ - test/tmp/test_get_send_ftp/1130328178.76500/getfile/empty_file.txt
89
+ - test/tmp/test_get_send_file/1130328204.12500
90
+ - test/tmp/test_get_send_file/1130328204.12500/getfile
91
+ - test/tmp/test_get_send_file/1130328204.12500/getfile/empty_file.txt
92
+ test_files: []
93
+ rdoc_options: []
94
+ extra_rdoc_files: []
95
+ executables: []
96
+ extensions: []
97
+ requirements: []
98
+ dependencies:
99
+ - !ruby/object:Gem::Dependency
100
+ name: extensions
101
+ version_requirement:
102
+ version_requirements: !ruby/object:Gem::Version::Requirement
103
+ requirements:
104
+ -
105
+ - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: 0.6.0
108
+ version:
109
+ - !ruby/object:Gem::Dependency
110
+ name: rio
111
+ version_requirement:
112
+ version_requirements: !ruby/object:Gem::Version::Requirement
113
+ requirements:
114
+ -
115
+ - "="
116
+ - !ruby/object:Gem::Version
117
+ version: 0.3.1
118
+ version:
119
+ - !ruby/object:Gem::Dependency
120
+ name: rmail
121
+ version_requirement:
122
+ version_requirements: !ruby/object:Gem::Version::Requirement
123
+ requirements:
124
+ -
125
+ - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: "0.17"
128
+ version: