jruby-jms 0.10.2 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/HISTORY.md +15 -0
  2. data/README.md +27 -28
  3. data/Rakefile +7 -1
  4. data/doc/classes/JMS.html +265 -0
  5. data/doc/classes/JMS/BytesMessage.html +215 -0
  6. data/doc/classes/JMS/Connection.html +1145 -0
  7. data/doc/classes/JMS/MapMessage.html +333 -0
  8. data/doc/classes/JMS/Message.html +1085 -0
  9. data/doc/classes/JMS/MessageConsumer.html +316 -0
  10. data/doc/classes/JMS/MessageListenerImpl.html +262 -0
  11. data/doc/classes/JMS/ObjectMessage.html +170 -0
  12. data/doc/classes/JMS/OracleAQConnectionFactory.html +184 -0
  13. data/doc/classes/JMS/QueueBrowser.html +155 -0
  14. data/doc/classes/JMS/Session.html +947 -0
  15. data/doc/classes/JMS/SessionPool.html +411 -0
  16. data/doc/classes/JMS/TextMessage.html +194 -0
  17. data/doc/created.rid +1 -0
  18. data/doc/files/README_md.html +440 -0
  19. data/doc/files/lib/jms/bytes_message_rb.html +122 -0
  20. data/doc/files/lib/jms/connection_rb.html +140 -0
  21. data/doc/files/lib/jms/imports_rb.html +108 -0
  22. data/doc/files/lib/jms/logging_rb.html +129 -0
  23. data/doc/files/lib/jms/map_message_rb.html +122 -0
  24. data/doc/files/lib/jms/message_consumer_rb.html +122 -0
  25. data/doc/files/lib/jms/message_listener_impl_rb.html +122 -0
  26. data/doc/files/lib/jms/message_rb.html +122 -0
  27. data/doc/files/lib/jms/object_message_rb.html +122 -0
  28. data/doc/files/lib/jms/oracle_a_q_connection_factory_rb.html +122 -0
  29. data/doc/files/lib/jms/queue_browser_rb.html +122 -0
  30. data/doc/files/lib/jms/session_pool_rb.html +108 -0
  31. data/doc/files/lib/jms/session_rb.html +164 -0
  32. data/doc/files/lib/jms/text_message_rb.html +122 -0
  33. data/doc/files/lib/jms_rb.html +131 -0
  34. data/doc/fr_class_index.html +39 -0
  35. data/doc/fr_file_index.html +42 -0
  36. data/doc/fr_method_index.html +120 -0
  37. data/doc/index.html +24 -0
  38. data/doc/rdoc-style.css +208 -0
  39. data/examples/advanced/session_pool.rb +37 -0
  40. data/examples/client-server/replier.rb +29 -0
  41. data/examples/client-server/requestor.rb +40 -0
  42. data/examples/jms.yml +85 -9
  43. data/examples/performance/consumer.rb +6 -8
  44. data/examples/performance/producer.rb +10 -10
  45. data/examples/producer-consumer/browser.rb +24 -0
  46. data/examples/{consumer.rb → producer-consumer/consumer.rb} +5 -4
  47. data/examples/producer-consumer/consumer_async.rb +30 -0
  48. data/examples/{producer.rb → producer-consumer/producer.rb} +5 -3
  49. data/examples/publish-subscribe/publish.rb +24 -0
  50. data/examples/publish-subscribe/subscribe.rb +31 -0
  51. data/lib/jms/bytes_message.rb +52 -0
  52. data/lib/jms/connection.rb +170 -162
  53. data/lib/jms/imports.rb +21 -0
  54. data/lib/jms/logging.rb +17 -1
  55. data/lib/jms/{javax_jms_map_message.rb → map_message.rb} +2 -2
  56. data/lib/jms/message.rb +285 -0
  57. data/lib/jms/{javax_jms_message_consumer.rb → message_consumer.rb} +6 -3
  58. data/lib/jms/{message_listener.rb → message_listener_impl.rb} +3 -3
  59. data/lib/jms/{javax_jms_object_message.rb → object_message.rb} +1 -1
  60. data/lib/jms/oracle_a_q_connection_factory.rb +35 -0
  61. data/lib/jms/{javax_jms_queue_browser.rb → queue_browser.rb} +5 -4
  62. data/lib/jms/{javax_jms_session.rb → session.rb} +23 -25
  63. data/lib/jms/session_pool.rb +148 -0
  64. data/lib/jms/{javax_jms_text_message.rb → text_message.rb} +1 -1
  65. data/test/connection_test.rb +31 -29
  66. data/test/jms.yml +8 -9
  67. data/test/message_test.rb +29 -29
  68. data/test/session_test.rb +39 -39
  69. metadata +62 -22
  70. data/lib/jms/javax_jms_message.rb +0 -264
data/HISTORY.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## 0.11.0 (2011-04-18)
2
+
3
+ * Compatibility with JRuby 1.6
4
+ * I hate doing this, but unfortunately there is a small breaking change in this release:
5
+ ** We can no longer pass symbols into the following methods:
6
+ *** jms_delivery_mode
7
+ *** jms_delivery_mode=
8
+ ** Just rename existing uses of the above methods to:
9
+ *** jms_delivery_mode_sym
10
+ *** jms_delivery_mode_sym=
11
+ * Added Session Pool - requires GenePool as a dependency if used
12
+ * Generate warning log entry for any parameters not known to the ConnectionFactory
13
+ * Use java_import for all javax.jms classes
14
+ ** Rename all Java source files to match new names
15
+
1
16
  ## 0.10.1 (2011-02-21)
2
17
 
3
18
  * Fix persistence typo and add message test cases
data/README.md CHANGED
@@ -4,30 +4,20 @@
4
4
 
5
5
  ### Current Activities & Backward Compatibility
6
6
 
7
- Please read the documentation in the source files for now. Currently looking
8
- into the rdoc doc generation issue for JRuby extended Java interfaces and classes.
7
+ The API is relatively stable at this point and I do not expect any breaking
8
+ changes at this point.
9
9
 
10
- There may still be some changes to the API to make things better and/or simpler.
11
- Once the code goes to V1.0.0 I will make every effort to not break the
10
+ There may still be some minor changes to the API to make things better and/or simpler.
11
+ Once the code goes to V1.0.0 I will make every effort to not break the
12
12
  existing interface in any way.
13
13
 
14
14
  ### Feedback is welcome and appreciated :)
15
15
 
16
- ### Todo
17
-
18
- * Need to get rdoc working
19
- * More tests, especially pub/sub
20
-
21
16
  ### Introduction
22
17
 
23
- jruby-jms has been around in my toolbox since 2008. Since I was not an expert
24
- in JMS I have held off releasing to the wild. I believe it is now of sufficient
25
- quality and usefulness to release into the wild. In fact it has been used
26
- in production at an enterprise site for 2 years now.
27
-
28
- jruby-jms attempts to "rubify" the Java JMS API without
18
+ jruby-jms attempts to "rubify" the Java JMS API without
29
19
  compromising performance. It does this by sprinkling "Ruby-goodness" into the
30
- existing JMS Java interfaces, I.e. By adding Ruby methods to the existing
20
+ existing JMS Java interfaces, I.e. By adding Ruby methods to the existing
31
21
  classes and interfaces. Since jruby-jms exposes the JMS
32
22
  Java classes directly there is no performance impact that would have been
33
23
  introduced had the entire API been wrapped in a Ruby layer.
@@ -37,6 +27,9 @@ interact with JMS in a highly performant way. Also, in this way you are not
37
27
  limited to whatever the Ruby wrapper would have exposed, since the entire JMS
38
28
  API is available to you at any time.
39
29
 
30
+ The initial internal use version of JRuby-JMS was created in 2008. It has been
31
+ in use in production since 2009.
32
+
40
33
  ### Install
41
34
 
42
35
  jgem install jruby-jms
@@ -44,7 +37,7 @@ API is available to you at any time.
44
37
  ### Simplification
45
38
 
46
39
  One of the difficulties with the regular JMS API is that it use completely
47
- separate classes for Topics and Queues in JMS 1.1. This means that once a
40
+ separate classes for Topics and Queues in JMS 1.1. This means that once a
48
41
  program writes to a Queue for example, that without changing the program it
49
42
  could not be changed to write to a topic. Also a consumer on a topic or a queue
50
43
  are identical. jruby-jms fixes this issue by allowing you to have a Consumer
@@ -68,7 +61,7 @@ server as either a Broker or Queue Manager. The Broker or Queue Manager is the
68
61
  centralized "server" through which all messages pass through.
69
62
 
70
63
  Some Brokers support an in-vm broker instance so that messages can be passed
71
- between producers and consumers within the same Java Virtual Machine (JVM)
64
+ between producers and consumers within the same Java Virtual Machine (JVM)
72
65
  instance. This removes the need to make any network calls. Highly recommended
73
66
  for passing messages between threads in the same JVM.
74
67
 
@@ -82,7 +75,7 @@ takes care of the rest.
82
75
 
83
76
  ### Queue
84
77
 
85
- A queue used for holding messages.
78
+ A queue used for holding messages.
86
79
  The queue is defined prior to the message being sent and is used to hold the
87
80
  messages. The consumer does not have to be running in order to receive messages.
88
81
 
@@ -97,14 +90,19 @@ topic they are interested in
97
90
  Producers write messages to queues or topics
98
91
 
99
92
  ActiveMQ Example:
93
+
100
94
  require 'rubygems'
101
95
  require 'jms'
102
-
96
+
103
97
  # Connect to ActiveMQ
104
98
  config = {
105
99
  :factory => 'org.apache.activemq.ActiveMQConnectionFactory',
106
100
  :broker_url => 'tcp://localhost:61616',
107
- :require_jars => ["~/Applications/apache-activemq-5.4.2/activemq-all-5.4.2.jar"]
101
+ :require_jars => [
102
+ "~/Applications/apache-activemq-5.5.0/activemq-all-5.5.0.jar",
103
+ "~/Applications/apache-activemq-5.5.0/lib/optional/slf4j-log4j12-1.5.11.jar",
104
+ "~/Applications/apache-activemq-5.5.0/lib/optional/log4j-1.2.14.jar"
105
+ ]
108
106
  }
109
107
 
110
108
  JMS::Connection.session(config) do |session|
@@ -118,16 +116,17 @@ ActiveMQ Example:
118
116
  Consumers read message from a queue or topic
119
117
 
120
118
  ActiveMQ Example:
119
+
121
120
  require 'rubygems'
122
121
  require 'jms'
123
-
122
+
124
123
  # Connect to ActiveMQ
125
124
  config = {
126
125
  :factory => 'org.apache.activemq.ActiveMQConnectionFactory',
127
126
  :broker_url => 'tcp://localhost:61616',
128
127
  :require_jars => ["~/Applications/apache-activemq-5.4.2/activemq-all-5.4.2.jar"]
129
128
  }
130
-
129
+
131
130
  JMS::Connection.session(config) do |session|
132
131
  session.consume(:queue_name => 'ExampleQueue', :timeout=>1000) do |message|
133
132
  p message
@@ -136,13 +135,13 @@ ActiveMQ Example:
136
135
 
137
136
  ## Overview
138
137
 
139
- jruby-jms is a complete JRuby API into the Java Messaging Specification (JMS)
140
- followed by many JMS Providers.
138
+ jruby-jms is a complete JRuby API into the Java Messaging Specification (JMS) V1.1
139
+ followed by several JMS Providers.
141
140
 
142
141
  ## Threading
143
142
 
144
- A JMS::Connection instance can be shared between threads, whereas a session,
145
- consumer, producer, and any artifacts created by the session should only be
143
+ A JMS::Connection instance can be shared between threads, whereas a session,
144
+ consumer, producer, and any artifacts created by the session should only be
146
145
  used by one thread at a time.
147
146
 
148
147
  For consumers, it is recommended to create a session for each thread and leave
@@ -168,7 +167,7 @@ required in the Ruby code:
168
167
 
169
168
  ### JRuby
170
169
 
171
- jruby-jms has been tested against JRuby 1.5.1 and 1.6, but should work with any
170
+ jruby-jms has been tested against JRuby 1.5.1 and 1.6.1, but should work with any
172
171
  current JRuby version.
173
172
 
174
173
  ## Development
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ desc "Build gem"
9
9
  task :gem do |t|
10
10
  gemspec = Gem::Specification.new do |s|
11
11
  s.name = 'jruby-jms'
12
- s.version = '0.10.2'
12
+ s.version = '0.11.0'
13
13
  s.author = 'Reid Morrison'
14
14
  s.email = 'rubywmq@gmail.com'
15
15
  s.homepage = 'https://github.com/reidmorrison/jruby-jms'
@@ -31,3 +31,9 @@ task :test do
31
31
 
32
32
  Rake::Task['functional'].invoke
33
33
  end
34
+
35
+ desc "Generate RDOC documentation"
36
+ task :doc do
37
+ system "rdoc --main README.md --inline-source --quiet README.md `find lib -name '*.rb'`"
38
+ end
39
+
@@ -0,0 +1,265 @@
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>Module: JMS</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>Module</strong></td>
53
+ <td class="class-name-in-header">JMS</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/jms/connection_rb.html">
59
+ lib/jms/connection.rb
60
+ </a>
61
+ <br />
62
+ <a href="../files/lib/jms/imports_rb.html">
63
+ lib/jms/imports.rb
64
+ </a>
65
+ <br />
66
+ <a href="../files/lib/jms/logging_rb.html">
67
+ lib/jms/logging.rb
68
+ </a>
69
+ <br />
70
+ <a href="../files/lib/jms/message_listener_impl_rb.html">
71
+ lib/jms/message_listener_impl.rb
72
+ </a>
73
+ <br />
74
+ <a href="../files/lib/jms/oracle_a_q_connection_factory_rb.html">
75
+ lib/jms/oracle_a_q_connection_factory.rb
76
+ </a>
77
+ <br />
78
+ <a href="../files/lib/jms/session_pool_rb.html">
79
+ lib/jms/session_pool.rb
80
+ </a>
81
+ <br />
82
+ </td>
83
+ </tr>
84
+
85
+ </table>
86
+ </div>
87
+ <!-- banner header -->
88
+
89
+ <div id="bodyContent">
90
+
91
+
92
+
93
+ <div id="contextContent">
94
+
95
+ <div id="description">
96
+ <p>
97
+ Copyright 2008, 2009, 2010, 2011 J. Reid Morrison
98
+ </p>
99
+ <p>
100
+ Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
101
+ you may not use this file except in compliance with the License. You may
102
+ obtain a copy of the License at
103
+ </p>
104
+ <pre>
105
+ http://www.apache.org/licenses/LICENSE-2.0
106
+ </pre>
107
+ <p>
108
+ Unless required by applicable law or agreed to in writing, software
109
+ distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
110
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
111
+ See the License for the specific language governing permissions and
112
+ limitations under the License.
113
+ </p>
114
+
115
+ </div>
116
+
117
+
118
+ </div>
119
+
120
+ <div id="method-list">
121
+ <h3 class="section-bar">Methods</h3>
122
+
123
+ <div class="name-list">
124
+ <a href="#M000002">logger</a>&nbsp;&nbsp;
125
+ <a href="#M000003">logger=</a>&nbsp;&nbsp;
126
+ <a href="#M000004">ruby_logger</a>&nbsp;&nbsp;
127
+ </div>
128
+ </div>
129
+
130
+ </div>
131
+
132
+
133
+ <!-- if includes -->
134
+
135
+ <div id="section">
136
+
137
+ <div id="class-list">
138
+ <h3 class="section-bar">Classes and Modules</h3>
139
+
140
+ Module <a href="JMS/BytesMessage.html" class="link">JMS::BytesMessage</a><br />
141
+ Module <a href="JMS/MapMessage.html" class="link">JMS::MapMessage</a><br />
142
+ Module <a href="JMS/Message.html" class="link">JMS::Message</a><br />
143
+ Module <a href="JMS/MessageConsumer.html" class="link">JMS::MessageConsumer</a><br />
144
+ Module <a href="JMS/ObjectMessage.html" class="link">JMS::ObjectMessage</a><br />
145
+ Module <a href="JMS/QueueBrowser.html" class="link">JMS::QueueBrowser</a><br />
146
+ Module <a href="JMS/Session.html" class="link">JMS::Session</a><br />
147
+ Module <a href="JMS/TextMessage.html" class="link">JMS::TextMessage</a><br />
148
+ Class <a href="JMS/Connection.html" class="link">JMS::Connection</a><br />
149
+ Class <a href="JMS/MessageListenerImpl.html" class="link">JMS::MessageListenerImpl</a><br />
150
+ Class <a href="JMS/OracleAQConnectionFactory.html" class="link">JMS::OracleAQConnectionFactory</a><br />
151
+ Class <a href="JMS/SessionPool.html" class="link">JMS::SessionPool</a><br />
152
+
153
+ </div>
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+ <!-- if method_list -->
162
+ <div id="methods">
163
+ <h3 class="section-bar">Public Class methods</h3>
164
+
165
+ <div id="method-M000002" class="method-detail">
166
+ <a name="M000002"></a>
167
+
168
+ <div class="method-heading">
169
+ <a href="#M000002" class="method-signature">
170
+ <span class="method-name">logger</span><span class="method-args">()</span>
171
+ </a>
172
+ </div>
173
+
174
+ <div class="method-description">
175
+ <p>
176
+ Returns the <a href="JMS.html#M000002">logger</a> being used by jruby-jms
177
+ Unless previously set, it will try to use the Rails <a
178
+ href="JMS.html#M000002">logger</a> and if it is not present, it will return
179
+ a new Ruby <a href="JMS.html#M000002">logger</a>
180
+ </p>
181
+ <p><a class="source-toggle" href="#"
182
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
183
+ <div class="method-source-code" id="M000002-source">
184
+ <pre>
185
+ <span class="ruby-comment cmt"># File lib/jms/logging.rb, line 23</span>
186
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">logger</span>
187
+ <span class="ruby-ivar">@logger</span> <span class="ruby-operator">||=</span> (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">rails_logger</span> <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ruby_logger</span>)
188
+ <span class="ruby-keyword kw">end</span>
189
+ </pre>
190
+ </div>
191
+ </div>
192
+ </div>
193
+
194
+ <div id="method-M000003" class="method-detail">
195
+ <a name="M000003"></a>
196
+
197
+ <div class="method-heading">
198
+ <a href="#M000003" class="method-signature">
199
+ <span class="method-name">logger=</span><span class="method-args">(logger)</span>
200
+ </a>
201
+ </div>
202
+
203
+ <div class="method-description">
204
+ <p>
205
+ Replace the <a href="JMS.html#M000002">logger</a> for jruby-jms
206
+ </p>
207
+ <p><a class="source-toggle" href="#"
208
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
209
+ <div class="method-source-code" id="M000003-source">
210
+ <pre>
211
+ <span class="ruby-comment cmt"># File lib/jms/logging.rb, line 28</span>
212
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">logger=</span>(<span class="ruby-identifier">logger</span>)
213
+ <span class="ruby-ivar">@logger</span> = <span class="ruby-identifier">logger</span>
214
+ <span class="ruby-keyword kw">end</span>
215
+ </pre>
216
+ </div>
217
+ </div>
218
+ </div>
219
+
220
+ <div id="method-M000004" class="method-detail">
221
+ <a name="M000004"></a>
222
+
223
+ <div class="method-heading">
224
+ <a href="#M000004" class="method-signature">
225
+ <span class="method-name">ruby_logger</span><span class="method-args">(level=nil, target=STDOUT)</span>
226
+ </a>
227
+ </div>
228
+
229
+ <div class="method-description">
230
+ <p>
231
+ Use the ruby <a href="JMS.html#M000002">logger</a>, but add needed trace
232
+ level logging which will result in debug log entries
233
+ </p>
234
+ <p><a class="source-toggle" href="#"
235
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
236
+ <div class="method-source-code" id="M000004-source">
237
+ <pre>
238
+ <span class="ruby-comment cmt"># File lib/jms/logging.rb, line 34</span>
239
+ <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">ruby_logger</span>(<span class="ruby-identifier">level</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">target</span>=<span class="ruby-constant">STDOUT</span>)
240
+ <span class="ruby-identifier">require</span> <span class="ruby-value str">'logger'</span>
241
+
242
+ <span class="ruby-identifier">l</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">target</span>)
243
+ <span class="ruby-identifier">l</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-value str">&quot;alias :trace :debug&quot;</span>
244
+ <span class="ruby-identifier">l</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-value str">&quot;alias :trace? :debug?&quot;</span>
245
+ <span class="ruby-identifier">l</span>.<span class="ruby-identifier">level</span> = <span class="ruby-identifier">level</span> <span class="ruby-operator">||</span> <span class="ruby-operator">::</span><span class="ruby-constant">Logger</span><span class="ruby-operator">::</span><span class="ruby-constant">INFO</span>
246
+ <span class="ruby-identifier">l</span>
247
+ <span class="ruby-keyword kw">end</span>
248
+ </pre>
249
+ </div>
250
+ </div>
251
+ </div>
252
+
253
+
254
+ </div>
255
+
256
+
257
+ </div>
258
+
259
+
260
+ <div id="validator-badges">
261
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
262
+ </div>
263
+
264
+ </body>
265
+ </html>
@@ -0,0 +1,215 @@
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>Module: JMS::BytesMessage</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>Module</strong></td>
53
+ <td class="class-name-in-header">JMS::BytesMessage</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/jms/bytes_message_rb.html">
59
+ lib/jms/bytes_message.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ Interface javax.jms.<a href="BytesMessage.html">BytesMessage</a>
78
+ </p>
79
+
80
+ </div>
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000005">data</a>&nbsp;&nbsp;
90
+ <a href="#M000006">data=</a>&nbsp;&nbsp;
91
+ <a href="#M000007">to_s</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+
100
+ <div id="section">
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <!-- if method_list -->
110
+ <div id="methods">
111
+ <h3 class="section-bar">Public Instance methods</h3>
112
+
113
+ <div id="method-M000005" class="method-detail">
114
+ <a name="M000005"></a>
115
+
116
+ <div class="method-heading">
117
+ <a href="#M000005" class="method-signature">
118
+ <span class="method-name">data</span><span class="method-args">()</span>
119
+ </a>
120
+ </div>
121
+
122
+ <div class="method-description">
123
+ <p><a class="source-toggle" href="#"
124
+ onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
125
+ <div class="method-source-code" id="M000005-source">
126
+ <pre>
127
+ <span class="ruby-comment cmt"># File lib/jms/bytes_message.rb, line 19</span>
128
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">data</span>
129
+ <span class="ruby-comment cmt"># Puts the message body in read-only mode and repositions the stream of</span>
130
+ <span class="ruby-comment cmt"># bytes to the beginning</span>
131
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">reset</span>
132
+
133
+ <span class="ruby-identifier">available</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">body_length</span>
134
+
135
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">available</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
136
+
137
+ <span class="ruby-identifier">result</span> = <span class="ruby-value str">&quot;&quot;</span>
138
+ <span class="ruby-identifier">bytes_size</span> = <span class="ruby-value">1024</span>
139
+ <span class="ruby-identifier">bytes</span> = <span class="ruby-constant">Java</span><span class="ruby-operator">::</span><span class="ruby-identifier">byte</span>[<span class="ruby-identifier">bytes_size</span>].<span class="ruby-identifier">new</span>
140
+
141
+ <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">n</span> = <span class="ruby-identifier">available</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">bytes_size</span> <span class="ruby-value">? </span><span class="ruby-identifier">available</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">bytes_size</span>) <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
142
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">read_bytes</span>(<span class="ruby-identifier">bytes</span>, <span class="ruby-identifier">n</span>)
143
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">bytes_size</span>
144
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">String</span>.<span class="ruby-identifier">from_java_bytes</span>(<span class="ruby-identifier">bytes</span>)
145
+ <span class="ruby-keyword kw">else</span>
146
+ <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">String</span>.<span class="ruby-identifier">from_java_bytes</span>(<span class="ruby-identifier">bytes</span>)[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">n</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>]
147
+ <span class="ruby-keyword kw">end</span>
148
+ <span class="ruby-identifier">available</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">n</span>
149
+ <span class="ruby-keyword kw">end</span>
150
+ <span class="ruby-identifier">result</span>
151
+ <span class="ruby-keyword kw">end</span>
152
+ </pre>
153
+ </div>
154
+ </div>
155
+ </div>
156
+
157
+ <div id="method-M000006" class="method-detail">
158
+ <a name="M000006"></a>
159
+
160
+ <div class="method-heading">
161
+ <a href="#M000006" class="method-signature">
162
+ <span class="method-name">data=</span><span class="method-args">(val)</span>
163
+ </a>
164
+ </div>
165
+
166
+ <div class="method-description">
167
+ <p><a class="source-toggle" href="#"
168
+ onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
169
+ <div class="method-source-code" id="M000006-source">
170
+ <pre>
171
+ <span class="ruby-comment cmt"># File lib/jms/bytes_message.rb, line 44</span>
172
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">data=</span>(<span class="ruby-identifier">val</span>)
173
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">write_bytes</span>(<span class="ruby-identifier">val</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_java_bytes</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">to_java_bytes</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">val</span>)
174
+ <span class="ruby-keyword kw">end</span>
175
+ </pre>
176
+ </div>
177
+ </div>
178
+ </div>
179
+
180
+ <div id="method-M000007" class="method-detail">
181
+ <a name="M000007"></a>
182
+
183
+ <div class="method-heading">
184
+ <a href="#M000007" class="method-signature">
185
+ <span class="method-name">to_s</span><span class="method-args">()</span>
186
+ </a>
187
+ </div>
188
+
189
+ <div class="method-description">
190
+ <p><a class="source-toggle" href="#"
191
+ onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
192
+ <div class="method-source-code" id="M000007-source">
193
+ <pre>
194
+ <span class="ruby-comment cmt"># File lib/jms/bytes_message.rb, line 48</span>
195
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
196
+ <span class="ruby-identifier">data</span>
197
+ <span class="ruby-keyword kw">end</span>
198
+ </pre>
199
+ </div>
200
+ </div>
201
+ </div>
202
+
203
+
204
+ </div>
205
+
206
+
207
+ </div>
208
+
209
+
210
+ <div id="validator-badges">
211
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
212
+ </div>
213
+
214
+ </body>
215
+ </html>