siffer 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/LICENSE +1 -1
  2. data/README +93 -0
  3. data/lib/siffer.rb +13 -16
  4. data/lib/siffer/agent.rb +39 -31
  5. data/lib/siffer/core_ext/hash.rb +15 -0
  6. data/lib/siffer/messages.rb +38 -4
  7. data/lib/siffer/messages/ack.rb +160 -35
  8. data/lib/siffer/messages/event.rb +20 -0
  9. data/lib/siffer/messages/message.rb +47 -58
  10. data/lib/siffer/messages/provide.rb +25 -0
  11. data/lib/siffer/messages/provision.rb +17 -0
  12. data/lib/siffer/messages/register.rb +42 -52
  13. data/lib/siffer/messages/request.rb +138 -0
  14. data/lib/siffer/messages/response.rb +48 -0
  15. data/lib/siffer/messages/subscribe.rb +17 -0
  16. data/lib/siffer/messages/system_control.rb +94 -0
  17. data/lib/siffer/models.rb +1 -0
  18. data/lib/siffer/models/address.rb +39 -0
  19. metadata +25 -146
  20. data/README.rdoc +0 -65
  21. data/Rakefile +0 -64
  22. data/bin/siffer +0 -71
  23. data/doc/SIF ImplementationSpecification.pdf +0 -0
  24. data/doc/rdoc/classes/Siffer.html +0 -259
  25. data/doc/rdoc/classes/Siffer/Agent.html +0 -177
  26. data/doc/rdoc/classes/Siffer/Container.html +0 -165
  27. data/doc/rdoc/classes/Siffer/Messages.html +0 -81
  28. data/doc/rdoc/classes/Siffer/Messages/Ack.html +0 -115
  29. data/doc/rdoc/classes/Siffer/Messages/Acl.html +0 -83
  30. data/doc/rdoc/classes/Siffer/Messages/Error.html +0 -157
  31. data/doc/rdoc/classes/Siffer/Messages/Message.html +0 -235
  32. data/doc/rdoc/classes/Siffer/Messages/Message/Header.html +0 -107
  33. data/doc/rdoc/classes/Siffer/Messages/Register.html +0 -154
  34. data/doc/rdoc/classes/Siffer/Messages/RequestBody.html +0 -185
  35. data/doc/rdoc/classes/Siffer/Messages/Status.html +0 -156
  36. data/doc/rdoc/classes/Siffer/Messaging.html +0 -212
  37. data/doc/rdoc/classes/Siffer/Protocol.html +0 -254
  38. data/doc/rdoc/classes/Siffer/Protocol/NonPostRequest.html +0 -54
  39. data/doc/rdoc/classes/Siffer/Protocol/UnknownPath.html +0 -54
  40. data/doc/rdoc/classes/Siffer/Registration.html +0 -251
  41. data/doc/rdoc/classes/Siffer/Request.html +0 -103
  42. data/doc/rdoc/classes/Siffer/RequestLogger.html +0 -109
  43. data/doc/rdoc/classes/Siffer/Response.html +0 -91
  44. data/doc/rdoc/classes/Siffer/Server.html +0 -156
  45. data/doc/rdoc/created.rid +0 -1
  46. data/doc/rdoc/files/LICENSE.html +0 -76
  47. data/doc/rdoc/files/README_rdoc.html +0 -131
  48. data/doc/rdoc/files/lib/siffer/agent_rb.html +0 -49
  49. data/doc/rdoc/files/lib/siffer/container_rb.html +0 -57
  50. data/doc/rdoc/files/lib/siffer/messages/ack_rb.html +0 -49
  51. data/doc/rdoc/files/lib/siffer/messages/acl_rb.html +0 -49
  52. data/doc/rdoc/files/lib/siffer/messages/error_rb.html +0 -49
  53. data/doc/rdoc/files/lib/siffer/messages/message_rb.html +0 -49
  54. data/doc/rdoc/files/lib/siffer/messages/register_rb.html +0 -49
  55. data/doc/rdoc/files/lib/siffer/messages/request_body_rb.html +0 -49
  56. data/doc/rdoc/files/lib/siffer/messages/status_rb.html +0 -49
  57. data/doc/rdoc/files/lib/siffer/messages_rb.html +0 -63
  58. data/doc/rdoc/files/lib/siffer/messaging_rb.html +0 -49
  59. data/doc/rdoc/files/lib/siffer/protocol_rb.html +0 -49
  60. data/doc/rdoc/files/lib/siffer/registration_rb.html +0 -49
  61. data/doc/rdoc/files/lib/siffer/request_logger_rb.html +0 -49
  62. data/doc/rdoc/files/lib/siffer/request_rb.html +0 -49
  63. data/doc/rdoc/files/lib/siffer/response_rb.html +0 -49
  64. data/doc/rdoc/files/lib/siffer/server_rb.html +0 -49
  65. data/doc/rdoc/files/lib/siffer_rb.html +0 -64
  66. data/doc/rdoc/fr_class_index.html +0 -25
  67. data/doc/rdoc/fr_file_index.html +0 -39
  68. data/doc/rdoc/fr_method_index.html +0 -4539
  69. data/doc/rdoc/index.html +0 -15
  70. data/doc/rdoc/rdoc-style.css +0 -319
  71. data/lib/siffer/container.rb +0 -94
  72. data/lib/siffer/messages/acl.rb +0 -25
  73. data/lib/siffer/messages/error.rb +0 -174
  74. data/lib/siffer/messages/request_body.rb +0 -66
  75. data/lib/siffer/messages/status.rb +0 -55
  76. data/lib/siffer/messaging.rb +0 -99
  77. data/lib/siffer/protocol.rb +0 -164
  78. data/lib/siffer/registration.rb +0 -87
  79. data/lib/siffer/request.rb +0 -28
  80. data/lib/siffer/request_logger.rb +0 -32
  81. data/lib/siffer/response.rb +0 -26
  82. data/lib/siffer/server.rb +0 -42
  83. data/spec/agent_spec.rb +0 -48
  84. data/spec/cli_spec.rb +0 -40
  85. data/spec/container_spec.rb +0 -103
  86. data/spec/default_agent +0 -6
  87. data/spec/default_server +0 -5
  88. data/spec/message_specs/ack_spec.rb +0 -28
  89. data/spec/message_specs/error_spec.rb +0 -24
  90. data/spec/message_specs/header_spec.rb +0 -25
  91. data/spec/message_specs/message_spec.rb +0 -57
  92. data/spec/message_specs/register_spec.rb +0 -86
  93. data/spec/message_specs/request_body_spec.rb +0 -58
  94. data/spec/message_specs/status_spec.rb +0 -25
  95. data/spec/messaging_spec.rb +0 -85
  96. data/spec/protocol_spec.rb +0 -50
  97. data/spec/registration_spec.rb +0 -33
  98. data/spec/request_logger_spec.rb +0 -28
  99. data/spec/request_spec.rb +0 -25
  100. data/spec/response_spec.rb +0 -24
  101. data/spec/server_spec.rb +0 -30
  102. data/spec/spec_helper.rb +0 -35
data/doc/rdoc/index.html DELETED
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
2
- <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
- <head>
4
- <title>Siffer == h3o(software) SIF</title>
5
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
6
- </head>
7
- <frameset border='1' bordercolor='gray' cols='20%, *' frameborder='1'>
8
- <frameset rows='15%, 35%, 50%'>
9
- <frame name='Files' src='fr_file_index.html' title='Files'></frame>
10
- <frame name='Classes' src='fr_class_index.html'></frame>
11
- <frame name='Methods' src='fr_method_index.html'></frame>
12
- </frameset>
13
- <frame name='docwin' src='files/README_rdoc.html'></frame>
14
- </frameset>
15
- </html>
@@ -1,319 +0,0 @@
1
- html, body {
2
- height: 100%; }
3
-
4
- body {
5
- font-family: Lucida Grande , Verdana, Arial, Helvetica, sans-serif;
6
- font-size: 90%;
7
- margin: 0;
8
- padding: 0;
9
- background: white;
10
- color: black; }
11
-
12
- #wrapper {
13
- min-height: 100%;
14
- height: auto !important;
15
- height: 100%;
16
- margin: 0 auto -43px; }
17
-
18
- #footer-push {
19
- height: 43px; }
20
-
21
- div.header, #footer {
22
- background: #eee; }
23
-
24
- #footer {
25
- border-top: 1px solid silver;
26
- margin-top: 12px;
27
- padding: 0 2em;
28
- line-height: 30px;
29
- text-align: center;
30
- font-variant: small-caps;
31
- font-size: 95%; }
32
-
33
- .clearing:after {
34
- content: ".";
35
- visibility: hidden;
36
- height: 0;
37
- display: block;
38
- clear: both; }
39
- * html .clearing {
40
- height: 1px; }
41
- .clearing *:first-child + html {
42
- overflow: hidden; }
43
-
44
- h1, h2, h3, h4, h5, h6 {
45
- margin: 0;
46
- font-weight: normal; }
47
-
48
- a {
49
- color: #0b3e71; }
50
- a:hover {
51
- background: #336699;
52
- text-decoration: none;
53
- color: #eef; }
54
-
55
- #diagram img {
56
- border: 0; }
57
-
58
- #description a, .method .description a, .header a {
59
- color: #336699; }
60
- #description a:hover, .method .description a:hover, .header a:hover {
61
- color: #eee; }
62
- #description h1 a, #description h2 a, #description h3 a, #description h4 a, #description h5 a, #description h6 a, .method .description h1 a, .method .description h2 a, .method .description h3 a, .method .description h4 a, .method .description h5 a, .method .description h6 a, .header h1 a, .header h2 a, .header h3 a, .header h4 a, .header h5 a, .header h6 a {
63
- color: #0b3e71; }
64
-
65
- ol {
66
- margin: 0;
67
- padding: 0;
68
- list-style: none; }
69
- ol li {
70
- margin-left: 0;
71
- white-space: nowrap; }
72
- ol li.other {
73
- display: none; }
74
-
75
- ol.expanded li.other {
76
- display: list-item; }
77
-
78
- table {
79
- margin-bottom: 1em;
80
- font-size: 1em;
81
- border-collapse: collapse; }
82
- table td, table th {
83
- padding: .4em .8em; }
84
- table thead {
85
- background-color: #e8e8e8; }
86
- table thead th {
87
- font-variant: small-caps;
88
- color: #666666; }
89
- table tr {
90
- border-bottom: 1px solid silver; }
91
-
92
- #index a.show, div.header a.show {
93
- text-decoration: underline;
94
- font-style: italic;
95
- color: #666666; }
96
- #index a.show:after, div.header a.show:after {
97
- content: " ..."; }
98
- #index a.show:hover, div.header a.show:hover {
99
- color: black;
100
- background: #ffe; }
101
-
102
- #index {
103
- font: 85%/1.2 Arial, Helvetica, sans-serif; }
104
- #index a {
105
- text-decoration: none; }
106
- #index h1 {
107
- padding: .2em .5em .1em;
108
- background: #ccc;
109
- font: small-caps 1.2em Georgia, serif;
110
- color: #333;
111
- border-bottom: 1px solid gray; }
112
- #index form {
113
- margin: 0;
114
- padding: 0; }
115
- #index form input {
116
- margin: .4em;
117
- margin-bottom: 0;
118
- width: 90%; }
119
- #index form #search.untouched {
120
- color: #777777; }
121
- #index ol {
122
- padding: .4em .5em; }
123
- #index ol li {
124
- white-space: nowrap; }
125
- #index #index-entries li a {
126
- padding: 1px 2px; }
127
- #index #index-entries.classes {
128
- font-size: 1.1em; }
129
- #index #index-entries.classes ol {
130
- padding: 0; }
131
- #index #index-entries.classes span.nodoc {
132
- display: none; }
133
- #index #index-entries.classes span.nodoc, #index #index-entries.classes a {
134
- font-weight: bold; }
135
- #index #index-entries.classes .parent {
136
- font-weight: normal; }
137
- #index #index-entries.methods li, #index #search-results.methods li {
138
- margin-bottom: 0.2em; }
139
- #index #index-entries.methods li a .method_name, #index #search-results.methods li a .method_name {
140
- margin-right: 0.25em; }
141
- #index #index-entries.methods li a .module_name, #index #search-results.methods li a .module_name {
142
- color: #666666; }
143
- #index #index-entries.methods li a:hover .module_name, #index #search-results.methods li a:hover .module_name {
144
- color: #ddd; }
145
-
146
- div.header {
147
- font-size: 80%;
148
- padding: .5em 2%;
149
- font-family: Arial, Helvetica, sans-serif;
150
- border-bottom: 1px solid silver; }
151
- div.header .name {
152
- font-size: 1.6em;
153
- font-family: Georgia, serif; }
154
- div.header .name .type {
155
- color: #666666;
156
- font-size: 80%;
157
- font-variant: small-caps; }
158
- div.header h1.name {
159
- font-size: 2.2em; }
160
- div.header .paths, div.header .last-update, div.header .parent {
161
- color: #666666; }
162
- div.header .last-update .datetime {
163
- color: #484848; }
164
- div.header .parent {
165
- margin-top: .3em; }
166
- div.header .parent strong {
167
- font-weight: normal;
168
- color: #484848; }
169
-
170
- #content {
171
- padding: 12px 2%; }
172
- div.class #content {
173
- position: relative;
174
- width: 72%; }
175
- #content pre, #content .method .synopsis {
176
- font: 14px Monaco, DejaVu Sans Mono , Bitstream Vera Sans Mono , Courier New , monospace; }
177
- #content pre {
178
- color: black;
179
- background: #eee;
180
- border: 1px solid silver;
181
- padding: .5em .8em;
182
- overflow: auto; }
183
- #content p code, #content p tt, #content li code, #content li tt, #content dl code, #content dl tt {
184
- font: 14px Monaco, DejaVu Sans Mono , Bitstream Vera Sans Mono , Courier New , monospace;
185
- background: #ffffe3;
186
- padding: 2px 3px;
187
- line-height: 1.4; }
188
- #content h1 code, #content h1 tt, #content h2 code, #content h2 tt, #content h3 code, #content h3 tt, #content h4 code, #content h4 tt, #content h5 code, #content h5 tt, #content h6 code, #content h6 tt {
189
- font-size: 1.1em; }
190
- #content #text {
191
- position: relative; }
192
- #content #description p {
193
- margin-top: .5em; }
194
- #content #description h1, #content #description h2, #content #description h3, #content #description h4, #content #description h5, #content #description h6 {
195
- font-family: Georgia, serif; }
196
- #content #description h1 {
197
- font-size: 2.2em;
198
- margin-bottom: .2em;
199
- border-bottom: 3px double #d8d8d8;
200
- padding-bottom: .1em; }
201
- #content #description h2 {
202
- font-size: 1.8em;
203
- color: #0e3062;
204
- margin: .8em 0 .3em 0; }
205
- #content #description h3 {
206
- font-size: 1.6em;
207
- margin: .8em 0 .3em 0;
208
- color: #666666; }
209
- #content #description h4 {
210
- font-size: 1.4em;
211
- margin: .8em 0 .3em 0; }
212
- #content #description h5 {
213
- font-size: 1.2em;
214
- margin: .8em 0 .3em 0;
215
- color: #0e3062; }
216
- #content #description h6 {
217
- font-size: 1.0em;
218
- margin: .8em 0 .3em 0;
219
- color: #666666; }
220
- #content #description ul, #content #description ol, #content .method .description ul, #content .method .description ol {
221
- margin: .8em 0;
222
- padding-left: 1.5em; }
223
- #content #description ol, #content .method .description ol {
224
- list-style: decimal; }
225
- #content #description ol li, #content .method .description ol li {
226
- white-space: normal; }
227
-
228
- #method-list {
229
- position: absolute;
230
- top: 0px;
231
- right: -33%;
232
- width: 28%;
233
- background: #eee;
234
- border: 1px solid silver;
235
- padding: .4em 1%;
236
- overflow: hidden; }
237
- #method-list h2 {
238
- font-size: 1.3em; }
239
- #method-list h3 {
240
- font-variant: small-caps;
241
- text-transform: capitalize;
242
- font-family: Georgia, serif;
243
- color: #666;
244
- font-size: 1.1em; }
245
- #method-list ol {
246
- padding: 0 0 .5em .5em; }
247
-
248
- #context {
249
- border-top: 1px dashed silver;
250
- margin-top: 1em;
251
- margin-bottom: 1em; }
252
-
253
- #context h2, #section h2 {
254
- font: small-caps 1.2em Georgia, serif;
255
- color: #444;
256
- margin: 1em 0 .2em 0; }
257
-
258
- #methods .method {
259
- border: 1px solid silver;
260
- margin-top: .5em;
261
- background: #eee; }
262
- #methods .method .synopsis {
263
- color: black;
264
- background: silver;
265
- padding: .2em 1em; }
266
- #methods .method .synopsis .name {
267
- font-weight: bold; }
268
- #methods .method .synopsis a {
269
- text-decoration: none; }
270
- #methods .method .description {
271
- padding: 0 1em; }
272
- #methods .method .description pre {
273
- background: #f8f8f8; }
274
- #methods .method .source {
275
- margin: .5em 0; }
276
- #methods .method .source-toggle {
277
- font-size: 85%;
278
- margin-left: 1em; }
279
- #methods .public-class {
280
- background: #ffffe4; }
281
- #methods .public-instance .synopsis {
282
- color: #eee;
283
- background: #336699; }
284
-
285
- #content .method .source pre {
286
- background: #262626;
287
- color: #ffdead;
288
- margin: 1em;
289
- padding: 0.5em;
290
- border: 1px dashed #999;
291
- overflow: auto; }
292
- #content .method .source pre .ruby-constant {
293
- color: #7fffd4;
294
- background: transparent; }
295
- #content .method .source pre .ruby-keyword {
296
- color: #00ffff;
297
- background: transparent; }
298
- #content .method .source pre .ruby-ivar {
299
- color: #eedd82;
300
- background: transparent; }
301
- #content .method .source pre .ruby-operator {
302
- color: #00ffee;
303
- background: transparent; }
304
- #content .method .source pre .ruby-identifier {
305
- color: #ffdead;
306
- background: transparent; }
307
- #content .method .source pre .ruby-node {
308
- color: #ffa07a;
309
- background: transparent; }
310
- #content .method .source pre .ruby-comment {
311
- color: #b22222;
312
- font-weight: bold;
313
- background: transparent; }
314
- #content .method .source pre .ruby-regexp {
315
- color: #ffa07a;
316
- background: transparent; }
317
- #content .method .source pre .ruby-value {
318
- color: #7fffd4;
319
- background: transparent; }
@@ -1,94 +0,0 @@
1
- module Siffer
2
-
3
- class Container
4
-
5
- attr_reader :environment, :component, :name, :host, :port, :log, :pid
6
-
7
- def initialize(options = {})
8
- raise "Component Configuration missing" if options[:config].nil?
9
- raise "Environment missing" if options[:environment].nil?
10
- @environment = options[:environment]
11
- config = options[:config]
12
- type = config.include?("agent") ? "agent" : "server"
13
- @component = (type == "agent") ?
14
- Siffer::Agent.new(config["agent"]) :
15
- Siffer::Server.new(config["server"])
16
- @name = config[type]["name"]
17
- uri = URI.parse(config[type]["host"])
18
- @host = uri.host.nil? ? uri.to_s : uri.host
19
- @port = config[type]["port"]
20
- @daemonize = options[:daemonize]
21
- @pid = options[:pid]
22
- @log = options[:log]
23
- end
24
-
25
- def daemonized?
26
- @daemonize
27
- end
28
-
29
- def run
30
- daemonize
31
- server = best_available_server
32
- options = { :Host => host, :Port => port }
33
- component.wake_up if component.respond_to?("wake_up")
34
- app = component_wrapped_in_environment
35
- server.run app, options
36
- end
37
-
38
- def stop
39
- pid_id = open("#{@pid}").read.to_i
40
- Process.kill(15,pid_id)
41
- File.delete(@pid) if File.exist?(@pid)
42
- end
43
-
44
- private
45
- def best_available_server
46
- begin
47
- server = Rack::Handler::Mongrel
48
- rescue
49
- server = Rack::Handler::WEBrick
50
- end
51
- end
52
-
53
- def component_wrapped_in_environment
54
- case environment
55
- when "development"
56
- builder = Rack::Builder.new
57
- builder.use(Siffer::RequestLogger)
58
- builder.use(Rack::CommonLogger)
59
- builder.run(@component)
60
- builder
61
- when "deployment"
62
- builder = Rack::Builder.new
63
- builder.use(Rack::CommonLogger)
64
- builder.run(@component)
65
- builder
66
- when "test": component
67
- when "none": component
68
- end
69
- end
70
-
71
- def daemonize
72
- if daemonized?
73
- if RUBY_PLATFORM !~ /mswin/
74
- require 'daemons/daemonize'
75
- Daemonize.daemonize(@log)
76
- else
77
- # How to tell about the problem of no Daemon on WINDOWS
78
- end
79
- write_pid_file
80
- end
81
- end
82
-
83
- def write_pid_file
84
- if RUBY_PLATFORM !~ /mswin/
85
- open(@pid,"w") do |f|
86
- f.write(Process.pid)
87
- File.chmod(0644, @pid)
88
- end
89
- end
90
- end
91
-
92
- end
93
-
94
- end
@@ -1,25 +0,0 @@
1
- module Siffer
2
- module Messages
3
- class Acl
4
-
5
- # This class roles through all the objects in all the contexts in
6
- # the zone to provide a list of allowed actions on each object per
7
- # registered agent
8
-
9
- def read
10
- xml = Builder::XmlMarkup.new
11
- xml.SIF_AgentAcl { |xml|
12
- # each one of these would collect all objects for each context
13
- xml.SIF_ProvideAccess
14
- xml.SIF_SubscribeAccess
15
- xml.SIF_PublishAddAccess
16
- xml.SIF_PublishChangeAccess
17
- xml.SIF_PublishDeleteAccess
18
- xml.SIF_RequestAccess
19
- xml.SIF_RespondAccess
20
- }
21
- end
22
-
23
- end
24
- end
25
- end