siffer 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.rdoc +65 -0
- data/Rakefile +64 -0
- data/bin/siffer +71 -0
- data/doc/SIF ImplementationSpecification.pdf +0 -0
- data/doc/rdoc/classes/Siffer.html +374 -0
- data/doc/rdoc/classes/Siffer/Agent.html +296 -0
- data/doc/rdoc/classes/Siffer/Container.html +286 -0
- data/doc/rdoc/classes/Siffer/Messages.html +141 -0
- data/doc/rdoc/classes/Siffer/Messages/Ack.html +216 -0
- data/doc/rdoc/classes/Siffer/Messages/Acl.html +160 -0
- data/doc/rdoc/classes/Siffer/Messages/Error.html +248 -0
- data/doc/rdoc/classes/Siffer/Messages/Message.html +359 -0
- data/doc/rdoc/classes/Siffer/Messages/Message/Header.html +181 -0
- data/doc/rdoc/classes/Siffer/Messages/Register.html +257 -0
- data/doc/rdoc/classes/Siffer/Messages/RequestBody.html +300 -0
- data/doc/rdoc/classes/Siffer/Messages/Status.html +269 -0
- data/doc/rdoc/classes/Siffer/Messaging.html +331 -0
- data/doc/rdoc/classes/Siffer/Protocol.html +388 -0
- data/doc/rdoc/classes/Siffer/Protocol/NonPostRequest.html +111 -0
- data/doc/rdoc/classes/Siffer/Protocol/UnknownPath.html +111 -0
- data/doc/rdoc/classes/Siffer/Registration.html +391 -0
- data/doc/rdoc/classes/Siffer/Request.html +209 -0
- data/doc/rdoc/classes/Siffer/RequestLogger.html +211 -0
- data/doc/rdoc/classes/Siffer/Response.html +182 -0
- data/doc/rdoc/classes/Siffer/Server.html +242 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/LICENSE.html +129 -0
- data/doc/rdoc/files/README_rdoc.html +184 -0
- data/doc/rdoc/files/lib/agent_rb.html +101 -0
- data/doc/rdoc/files/lib/container_rb.html +108 -0
- data/doc/rdoc/files/lib/messages/ack_rb.html +101 -0
- data/doc/rdoc/files/lib/messages/acl_rb.html +101 -0
- data/doc/rdoc/files/lib/messages/error_rb.html +101 -0
- data/doc/rdoc/files/lib/messages/message_rb.html +101 -0
- data/doc/rdoc/files/lib/messages/register_rb.html +101 -0
- data/doc/rdoc/files/lib/messages/request_body_rb.html +101 -0
- data/doc/rdoc/files/lib/messages/status_rb.html +101 -0
- data/doc/rdoc/files/lib/messages_rb.html +114 -0
- data/doc/rdoc/files/lib/messaging_rb.html +101 -0
- data/doc/rdoc/files/lib/protocol_rb.html +101 -0
- data/doc/rdoc/files/lib/registration_rb.html +101 -0
- data/doc/rdoc/files/lib/request_logger_rb.html +101 -0
- data/doc/rdoc/files/lib/request_rb.html +101 -0
- data/doc/rdoc/files/lib/response_rb.html +101 -0
- data/doc/rdoc/files/lib/server_rb.html +101 -0
- data/doc/rdoc/files/lib/siffer_rb.html +115 -0
- data/doc/rdoc/fr_class_index.html +47 -0
- data/doc/rdoc/fr_file_index.html +46 -0
- data/doc/rdoc/fr_method_index.html +96 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/lib/agent.rb +43 -0
- data/lib/container.rb +96 -0
- data/lib/messages.rb +7 -0
- data/lib/messages/ack.rb +43 -0
- data/lib/messages/acl.rb +25 -0
- data/lib/messages/error.rb +174 -0
- data/lib/messages/message.rb +71 -0
- data/lib/messages/register.rb +60 -0
- data/lib/messages/request_body.rb +66 -0
- data/lib/messages/status.rb +55 -0
- data/lib/messaging.rb +96 -0
- data/lib/protocol.rb +159 -0
- data/lib/registration.rb +87 -0
- data/lib/request.rb +25 -0
- data/lib/request_logger.rb +31 -0
- data/lib/response.rb +26 -0
- data/lib/server.rb +40 -0
- data/lib/siffer.rb +44 -0
- data/spec/agent_spec.rb +53 -0
- data/spec/cli_spec.rb +40 -0
- data/spec/container_spec.rb +103 -0
- data/spec/default_agent +6 -0
- data/spec/default_server +5 -0
- data/spec/message_specs/ack_spec.rb +28 -0
- data/spec/message_specs/error_spec.rb +24 -0
- data/spec/message_specs/header_spec.rb +25 -0
- data/spec/message_specs/message_spec.rb +57 -0
- data/spec/message_specs/register_spec.rb +86 -0
- data/spec/message_specs/request_body_spec.rb +58 -0
- data/spec/message_specs/status_spec.rb +25 -0
- data/spec/messaging_spec.rb +88 -0
- data/spec/protocol_spec.rb +49 -0
- data/spec/registration_spec.rb +33 -0
- data/spec/request_logger_spec.rb +15 -0
- data/spec/request_spec.rb +10 -0
- data/spec/response_spec.rb +24 -0
- data/spec/server_spec.rb +35 -0
- data/spec/spec_helper.rb +26 -0
- metadata +191 -0
@@ -0,0 +1,181 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Siffer::Messages::Message::Header</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Siffer::Messages::Message::Header</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../../files/lib/messages/message_rb.html">
|
59
|
+
lib/messages/message.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
Each <a href="../Message.html">Message</a> requires a <a
|
84
|
+
href="Header.html">Header</a> to identify the source. You shouldn‘t
|
85
|
+
need to initialize this by itself, it is used by <a
|
86
|
+
href="../Message.html">Message</a>.
|
87
|
+
</p>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<div id="method-list">
|
95
|
+
<h3 class="section-bar">Methods</h3>
|
96
|
+
|
97
|
+
<div class="name-list">
|
98
|
+
<a href="#M000025">new</a>
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
|
105
|
+
<!-- if includes -->
|
106
|
+
|
107
|
+
<div id="section">
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<div id="attribute-list">
|
114
|
+
<h3 class="section-bar">Attributes</h3>
|
115
|
+
|
116
|
+
<div class="name-list">
|
117
|
+
<table>
|
118
|
+
<tr class="top-aligned-row context-row">
|
119
|
+
<td class="context-item-name">msg_id</td>
|
120
|
+
<td class="context-item-value"> [R] </td>
|
121
|
+
<td class="context-item-desc"></td>
|
122
|
+
</tr>
|
123
|
+
<tr class="top-aligned-row context-row">
|
124
|
+
<td class="context-item-name">source_id</td>
|
125
|
+
<td class="context-item-value"> [R] </td>
|
126
|
+
<td class="context-item-desc"></td>
|
127
|
+
</tr>
|
128
|
+
<tr class="top-aligned-row context-row">
|
129
|
+
<td class="context-item-name">timestamp</td>
|
130
|
+
<td class="context-item-value"> [R] </td>
|
131
|
+
<td class="context-item-desc"></td>
|
132
|
+
</tr>
|
133
|
+
</table>
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
<!-- if method_list -->
|
140
|
+
<div id="methods">
|
141
|
+
<h3 class="section-bar">Public Class methods</h3>
|
142
|
+
|
143
|
+
<div id="method-M000025" class="method-detail">
|
144
|
+
<a name="M000025"></a>
|
145
|
+
|
146
|
+
<div class="method-heading">
|
147
|
+
<a href="#M000025" class="method-signature">
|
148
|
+
<span class="method-name">new</span><span class="method-args">(source)</span>
|
149
|
+
</a>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
<div class="method-description">
|
153
|
+
<p><a class="source-toggle" href="#"
|
154
|
+
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
155
|
+
<div class="method-source-code" id="M000025-source">
|
156
|
+
<pre>
|
157
|
+
<span class="ruby-comment cmt"># File lib/messages/message.rb, line 60</span>
|
158
|
+
60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">source</span>)
|
159
|
+
61: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Source not provided."</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">source</span>.<span class="ruby-identifier">nil?</span>
|
160
|
+
62: <span class="ruby-ivar">@timestamp</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
161
|
+
63: <span class="ruby-ivar">@msg_id</span> = <span class="ruby-constant">UUID</span>.<span class="ruby-identifier">generate</span>(<span class="ruby-identifier">:compact</span>).<span class="ruby-identifier">upcase</span>
|
162
|
+
64: <span class="ruby-ivar">@source_id</span> = <span class="ruby-identifier">source</span>
|
163
|
+
65: <span class="ruby-keyword kw">end</span>
|
164
|
+
</pre>
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
|
169
|
+
|
170
|
+
</div>
|
171
|
+
|
172
|
+
|
173
|
+
</div>
|
174
|
+
|
175
|
+
|
176
|
+
<div id="validator-badges">
|
177
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
</body>
|
181
|
+
</html>
|
@@ -0,0 +1,257 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Siffer::Messages::Register</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Siffer::Messages::Register</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/messages/register_rb.html">
|
59
|
+
lib/messages/register.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="Message.html">
|
69
|
+
Message
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
<a href="Message.html">Message</a> used by Agents to register themselves
|
86
|
+
with the ZIS.
|
87
|
+
</p>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<div id="method-list">
|
95
|
+
<h3 class="section-bar">Methods</h3>
|
96
|
+
|
97
|
+
<div class="name-list">
|
98
|
+
<a href="#M000027">content</a>
|
99
|
+
<a href="#M000026">new</a>
|
100
|
+
<a href="#M000028">parse</a>
|
101
|
+
</div>
|
102
|
+
</div>
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
<!-- if includes -->
|
108
|
+
|
109
|
+
<div id="section">
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<div id="attribute-list">
|
116
|
+
<h3 class="section-bar">Attributes</h3>
|
117
|
+
|
118
|
+
<div class="name-list">
|
119
|
+
<table>
|
120
|
+
<tr class="top-aligned-row context-row">
|
121
|
+
<td class="context-item-name">max_buffer</td>
|
122
|
+
<td class="context-item-value"> [R] </td>
|
123
|
+
<td class="context-item-desc"></td>
|
124
|
+
</tr>
|
125
|
+
<tr class="top-aligned-row context-row">
|
126
|
+
<td class="context-item-name">mode</td>
|
127
|
+
<td class="context-item-value"> [R] </td>
|
128
|
+
<td class="context-item-desc"></td>
|
129
|
+
</tr>
|
130
|
+
<tr class="top-aligned-row context-row">
|
131
|
+
<td class="context-item-name">name</td>
|
132
|
+
<td class="context-item-value"> [R] </td>
|
133
|
+
<td class="context-item-desc"></td>
|
134
|
+
</tr>
|
135
|
+
<tr class="top-aligned-row context-row">
|
136
|
+
<td class="context-item-name">vendor</td>
|
137
|
+
<td class="context-item-value"> [R] </td>
|
138
|
+
<td class="context-item-desc"></td>
|
139
|
+
</tr>
|
140
|
+
<tr class="top-aligned-row context-row">
|
141
|
+
<td class="context-item-name">version</td>
|
142
|
+
<td class="context-item-value"> [R] </td>
|
143
|
+
<td class="context-item-desc"></td>
|
144
|
+
</tr>
|
145
|
+
</table>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
<!-- if method_list -->
|
152
|
+
<div id="methods">
|
153
|
+
<h3 class="section-bar">Public Class methods</h3>
|
154
|
+
|
155
|
+
<div id="method-M000026" class="method-detail">
|
156
|
+
<a name="M000026"></a>
|
157
|
+
|
158
|
+
<div class="method-heading">
|
159
|
+
<a href="#M000026" class="method-signature">
|
160
|
+
<span class="method-name">new</span><span class="method-args">(source, name, options = {})</span>
|
161
|
+
</a>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
<div class="method-description">
|
165
|
+
<p><a class="source-toggle" href="#"
|
166
|
+
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
167
|
+
<div class="method-source-code" id="M000026-source">
|
168
|
+
<pre>
|
169
|
+
<span class="ruby-comment cmt"># File lib/messages/register.rb, line 9</span>
|
170
|
+
9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = {})
|
171
|
+
10: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">options</span>)
|
172
|
+
11: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Agent name required"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">name</span>
|
173
|
+
12: <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
|
174
|
+
13: <span class="ruby-ivar">@version</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:version</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Siffer</span>.<span class="ruby-identifier">sif_version</span>
|
175
|
+
14: <span class="ruby-ivar">@max_buffer</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:max_buffer</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1024</span>
|
176
|
+
15: <span class="ruby-ivar">@mode</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:mode</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'Pull'</span>
|
177
|
+
16: <span class="ruby-ivar">@vendor</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:vendor</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Siffer</span>.<span class="ruby-identifier">vendor</span>
|
178
|
+
17: <span class="ruby-keyword kw">end</span>
|
179
|
+
</pre>
|
180
|
+
</div>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
|
184
|
+
<div id="method-M000028" class="method-detail">
|
185
|
+
<a name="M000028"></a>
|
186
|
+
|
187
|
+
<div class="method-heading">
|
188
|
+
<a href="#M000028" class="method-signature">
|
189
|
+
<span class="method-name">parse</span><span class="method-args">(body)</span>
|
190
|
+
</a>
|
191
|
+
</div>
|
192
|
+
|
193
|
+
<div class="method-description">
|
194
|
+
<p>
|
195
|
+
Parses the body passed as a <a href="Register.html">Register</a> message
|
196
|
+
and returns a <a href="RequestBody.html">RequestBody</a> that provides
|
197
|
+
access to <a href="Register.html">Register</a> properties.
|
198
|
+
</p>
|
199
|
+
<p><a class="source-toggle" href="#"
|
200
|
+
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
201
|
+
<div class="method-source-code" id="M000028-source">
|
202
|
+
<pre>
|
203
|
+
<span class="ruby-comment cmt"># File lib/messages/register.rb, line 33</span>
|
204
|
+
33: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">body</span>)
|
205
|
+
34: <span class="ruby-constant">RegisterBody</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">body</span>)
|
206
|
+
35: <span class="ruby-keyword kw">end</span>
|
207
|
+
</pre>
|
208
|
+
</div>
|
209
|
+
</div>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
213
|
+
|
214
|
+
<div id="method-M000027" class="method-detail">
|
215
|
+
<a name="M000027"></a>
|
216
|
+
|
217
|
+
<div class="method-heading">
|
218
|
+
<a href="#M000027" class="method-signature">
|
219
|
+
<span class="method-name">content</span><span class="method-args">()</span>
|
220
|
+
</a>
|
221
|
+
</div>
|
222
|
+
|
223
|
+
<div class="method-description">
|
224
|
+
<p><a class="source-toggle" href="#"
|
225
|
+
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
226
|
+
<div class="method-source-code" id="M000027-source">
|
227
|
+
<pre>
|
228
|
+
<span class="ruby-comment cmt"># File lib/messages/register.rb, line 19</span>
|
229
|
+
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">content</span>
|
230
|
+
20: <span class="ruby-identifier">body</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">reg</span><span class="ruby-operator">|</span>
|
231
|
+
21: <span class="ruby-identifier">reg</span>.<span class="ruby-constant">SIF_Register</span>() { <span class="ruby-operator">|</span><span class="ruby-identifier">xml</span><span class="ruby-operator">|</span>
|
232
|
+
22: <span class="ruby-identifier">put_header_into</span> <span class="ruby-identifier">xml</span>
|
233
|
+
23: <span class="ruby-identifier">reg</span>.<span class="ruby-constant">SIF_Name</span>(<span class="ruby-ivar">@name</span>)
|
234
|
+
24: <span class="ruby-identifier">reg</span>.<span class="ruby-constant">SIF_Version</span>(<span class="ruby-ivar">@version</span>)
|
235
|
+
25: <span class="ruby-identifier">reg</span>.<span class="ruby-constant">SIF_MaxBufferSize</span>(<span class="ruby-ivar">@max_buffer</span>)
|
236
|
+
26: <span class="ruby-identifier">reg</span>.<span class="ruby-constant">SIF_Mode</span>(<span class="ruby-ivar">@mode</span>)
|
237
|
+
27: }
|
238
|
+
28: <span class="ruby-keyword kw">end</span>
|
239
|
+
29: <span class="ruby-keyword kw">end</span>
|
240
|
+
</pre>
|
241
|
+
</div>
|
242
|
+
</div>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
|
246
|
+
</div>
|
247
|
+
|
248
|
+
|
249
|
+
</div>
|
250
|
+
|
251
|
+
|
252
|
+
<div id="validator-badges">
|
253
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
254
|
+
</div>
|
255
|
+
|
256
|
+
</body>
|
257
|
+
</html>
|
@@ -0,0 +1,300 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Siffer::Messages::RequestBody</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Siffer::Messages::RequestBody</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/messages/request_body_rb.html">
|
59
|
+
lib/messages/request_body.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
This class is used to <a href="RequestBody.html#M000038">parse</a> the SIF
|
84
|
+
<a href="Message.html">Message</a> information out of the <a
|
85
|
+
href="../Request.html">Request</a> Body. It parses enough information to
|
86
|
+
redirect to other processes. It does not <a
|
87
|
+
href="RequestBody.html#M000038">parse</a> details of the <a
|
88
|
+
href="Message.html">Message</a> such as <a
|
89
|
+
href="../Protocol.html">Protocol</a> if a <a
|
90
|
+
href="Register.html">Register</a> message, or <a
|
91
|
+
href="Error.html">Error</a> if an <a href="Ack.html">Ack</a> message. Each
|
92
|
+
message <a href="RequestBody.html#M000035">type</a> will inherit this class
|
93
|
+
in order to provide a <a href="RequestBody.html#M000038">parse</a> method
|
94
|
+
that will allow access to those specific attributes. It provides access to:
|
95
|
+
</p>
|
96
|
+
<ul>
|
97
|
+
<li><a href="RequestBody.html#M000036">source_id</a>
|
98
|
+
|
99
|
+
</li>
|
100
|
+
<li><a href="RequestBody.html#M000037">msg_id</a>
|
101
|
+
|
102
|
+
</li>
|
103
|
+
<li><a href="RequestBody.html#M000035">type</a>
|
104
|
+
|
105
|
+
</li>
|
106
|
+
</ul>
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
<div id="method-list">
|
114
|
+
<h3 class="section-bar">Methods</h3>
|
115
|
+
|
116
|
+
<div class="name-list">
|
117
|
+
<a href="#M000037">msg_id</a>
|
118
|
+
<a href="#M000034">new</a>
|
119
|
+
<a href="#M000038">parse</a>
|
120
|
+
<a href="#M000036">source_id</a>
|
121
|
+
<a href="#M000035">type</a>
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
|
125
|
+
</div>
|
126
|
+
|
127
|
+
|
128
|
+
<!-- if includes -->
|
129
|
+
|
130
|
+
<div id="section">
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
<!-- if method_list -->
|
140
|
+
<div id="methods">
|
141
|
+
<h3 class="section-bar">Public Class methods</h3>
|
142
|
+
|
143
|
+
<div id="method-M000034" class="method-detail">
|
144
|
+
<a name="M000034"></a>
|
145
|
+
|
146
|
+
<div class="method-heading">
|
147
|
+
<a href="#M000034" class="method-signature">
|
148
|
+
<span class="method-name">new</span><span class="method-args">(xml_string)</span>
|
149
|
+
</a>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
<div class="method-description">
|
153
|
+
<p><a class="source-toggle" href="#"
|
154
|
+
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
155
|
+
<div class="method-source-code" id="M000034-source">
|
156
|
+
<pre>
|
157
|
+
<span class="ruby-comment cmt"># File lib/messages/request_body.rb, line 17</span>
|
158
|
+
17: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">xml_string</span>)
|
159
|
+
18: <span class="ruby-ivar">@xml</span> = <span class="ruby-identifier">xml_string</span>
|
160
|
+
19: <span class="ruby-ivar">@doc</span> = <span class="ruby-constant">Hpricot</span>(<span class="ruby-ivar">@xml</span>, <span class="ruby-identifier">:xml</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">true</span>)
|
161
|
+
20: <span class="ruby-keyword kw">end</span>
|
162
|
+
</pre>
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
<div id="method-M000038" class="method-detail">
|
168
|
+
<a name="M000038"></a>
|
169
|
+
|
170
|
+
<div class="method-heading">
|
171
|
+
<a href="#M000038" class="method-signature">
|
172
|
+
<span class="method-name">parse</span><span class="method-args">(xml)</span>
|
173
|
+
</a>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
<div class="method-description">
|
177
|
+
<p>
|
178
|
+
Parses the xml provided and returns a <a
|
179
|
+
href="RequestBody.html">RequestBody</a>. Xml must respond to read or be a
|
180
|
+
String.
|
181
|
+
</p>
|
182
|
+
<p><a class="source-toggle" href="#"
|
183
|
+
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
184
|
+
<div class="method-source-code" id="M000038-source">
|
185
|
+
<pre>
|
186
|
+
<span class="ruby-comment cmt"># File lib/messages/request_body.rb, line 48</span>
|
187
|
+
48: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">xml</span>)
|
188
|
+
49: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">"read"</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
|
189
|
+
50: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Unable to read Xml"</span>
|
190
|
+
51: <span class="ruby-keyword kw">end</span>
|
191
|
+
52: <span class="ruby-identifier">xml</span> = <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">read</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value str">"read"</span>)
|
192
|
+
53: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">xml</span>) <span class="ruby-comment cmt"># use self because we are going to inherit this class</span>
|
193
|
+
54: <span class="ruby-keyword kw">end</span>
|
194
|
+
</pre>
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
</div>
|
198
|
+
|
199
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
200
|
+
|
201
|
+
<div id="method-M000037" class="method-detail">
|
202
|
+
<a name="M000037"></a>
|
203
|
+
|
204
|
+
<div class="method-heading">
|
205
|
+
<a href="#M000037" class="method-signature">
|
206
|
+
<span class="method-name">msg_id</span><span class="method-args">()</span>
|
207
|
+
</a>
|
208
|
+
</div>
|
209
|
+
|
210
|
+
<div class="method-description">
|
211
|
+
<p>
|
212
|
+
The SIF_MsgId from the SIF_Header
|
213
|
+
</p>
|
214
|
+
<p><a class="source-toggle" href="#"
|
215
|
+
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
216
|
+
<div class="method-source-code" id="M000037-source">
|
217
|
+
<pre>
|
218
|
+
<span class="ruby-comment cmt"># File lib/messages/request_body.rb, line 42</span>
|
219
|
+
42: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">msg_id</span>
|
220
|
+
43: (<span class="ruby-ivar">@doc</span><span class="ruby-operator">/</span><span class="ruby-value str">"//SIF_Header/SIF_MsgId/"</span>).<span class="ruby-identifier">text</span>
|
221
|
+
44: <span class="ruby-keyword kw">end</span>
|
222
|
+
</pre>
|
223
|
+
</div>
|
224
|
+
</div>
|
225
|
+
</div>
|
226
|
+
|
227
|
+
<div id="method-M000036" class="method-detail">
|
228
|
+
<a name="M000036"></a>
|
229
|
+
|
230
|
+
<div class="method-heading">
|
231
|
+
<a href="#M000036" class="method-signature">
|
232
|
+
<span class="method-name">source_id</span><span class="method-args">()</span>
|
233
|
+
</a>
|
234
|
+
</div>
|
235
|
+
|
236
|
+
<div class="method-description">
|
237
|
+
<p>
|
238
|
+
The SIF_SourceId from the SIF_Header
|
239
|
+
</p>
|
240
|
+
<p><a class="source-toggle" href="#"
|
241
|
+
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
242
|
+
<div class="method-source-code" id="M000036-source">
|
243
|
+
<pre>
|
244
|
+
<span class="ruby-comment cmt"># File lib/messages/request_body.rb, line 37</span>
|
245
|
+
37: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">source_id</span>
|
246
|
+
38: (<span class="ruby-ivar">@doc</span><span class="ruby-operator">/</span><span class="ruby-value str">"//SIF_Header/SIF_SourceId/"</span>).<span class="ruby-identifier">text</span>
|
247
|
+
39: <span class="ruby-keyword kw">end</span>
|
248
|
+
</pre>
|
249
|
+
</div>
|
250
|
+
</div>
|
251
|
+
</div>
|
252
|
+
|
253
|
+
<div id="method-M000035" class="method-detail">
|
254
|
+
<a name="M000035"></a>
|
255
|
+
|
256
|
+
<div class="method-heading">
|
257
|
+
<a href="#M000035" class="method-signature">
|
258
|
+
<span class="method-name">type</span><span class="method-args">()</span>
|
259
|
+
</a>
|
260
|
+
</div>
|
261
|
+
|
262
|
+
<div class="method-description">
|
263
|
+
<p>
|
264
|
+
Will return the name of the element found just inside the root or just
|
265
|
+
inside SIF_SystemControl if present.
|
266
|
+
</p>
|
267
|
+
<p><a class="source-toggle" href="#"
|
268
|
+
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
269
|
+
<div class="method-source-code" id="M000035-source">
|
270
|
+
<pre>
|
271
|
+
<span class="ruby-comment cmt"># File lib/messages/request_body.rb, line 24</span>
|
272
|
+
24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type</span>
|
273
|
+
25: <span class="ruby-keyword kw">begin</span>
|
274
|
+
26: <span class="ruby-identifier">msg_type</span> = (<span class="ruby-ivar">@doc</span><span class="ruby-operator">/</span><span class="ruby-identifier">:SIF_Message</span>).<span class="ruby-identifier">first</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">name</span>
|
275
|
+
27: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">msg_type</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"SIF_SystemControl"</span>
|
276
|
+
28: <span class="ruby-identifier">msg_type</span> = (<span class="ruby-ivar">@doc</span><span class="ruby-operator">/</span><span class="ruby-identifier">:SIF_Message</span><span class="ruby-operator">/</span><span class="ruby-identifier">:SIF_SystemControl</span>).<span class="ruby-identifier">first</span>.<span class="ruby-identifier">children</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">name</span>
|
277
|
+
29: <span class="ruby-keyword kw">end</span>
|
278
|
+
30: <span class="ruby-identifier">drop_sif</span> <span class="ruby-identifier">msg_type</span>
|
279
|
+
31: <span class="ruby-keyword kw">rescue</span>
|
280
|
+
32: <span class="ruby-identifier">raise</span> <span class="ruby-node">"Failed to parse #{@xml} for SIF Type"</span>
|
281
|
+
33: <span class="ruby-keyword kw">end</span>
|
282
|
+
34: <span class="ruby-keyword kw">end</span>
|
283
|
+
</pre>
|
284
|
+
</div>
|
285
|
+
</div>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
|
289
|
+
</div>
|
290
|
+
|
291
|
+
|
292
|
+
</div>
|
293
|
+
|
294
|
+
|
295
|
+
<div id="validator-badges">
|
296
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
297
|
+
</div>
|
298
|
+
|
299
|
+
</body>
|
300
|
+
</html>
|