qpid_proton 0.9.0 → 0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/lib/codec/data.rb +912 -0
  3. data/lib/codec/mapping.rb +169 -0
  4. data/lib/{qpid_proton/tracker.rb → core/base_handler.rb} +4 -15
  5. data/lib/core/connection.rb +328 -0
  6. data/lib/core/delivery.rb +271 -0
  7. data/lib/core/disposition.rb +158 -0
  8. data/lib/core/endpoint.rb +140 -0
  9. data/lib/{qpid_proton → core}/exceptions.rb +43 -2
  10. data/lib/core/link.rb +387 -0
  11. data/lib/core/message.rb +633 -0
  12. data/lib/core/receiver.rb +95 -0
  13. data/lib/core/sasl.rb +94 -0
  14. data/lib/core/selectable.rb +130 -0
  15. data/lib/core/sender.rb +76 -0
  16. data/lib/core/session.rb +163 -0
  17. data/lib/core/ssl.rb +164 -0
  18. data/lib/{qpid_proton/version.rb → core/ssl_details.rb} +7 -6
  19. data/lib/core/ssl_domain.rb +156 -0
  20. data/lib/core/terminus.rb +218 -0
  21. data/lib/core/transport.rb +411 -0
  22. data/lib/core/url.rb +77 -0
  23. data/lib/event/collector.rb +148 -0
  24. data/lib/event/event.rb +318 -0
  25. data/lib/event/event_base.rb +91 -0
  26. data/lib/event/event_type.rb +71 -0
  27. data/lib/handler/acking.rb +70 -0
  28. data/lib/handler/c_adaptor.rb +47 -0
  29. data/lib/handler/c_flow_controller.rb +33 -0
  30. data/lib/handler/endpoint_state_handler.rb +217 -0
  31. data/lib/handler/incoming_message_handler.rb +74 -0
  32. data/lib/handler/messaging_handler.rb +218 -0
  33. data/lib/handler/outgoing_message_handler.rb +98 -0
  34. data/lib/handler/wrapped_handler.rb +76 -0
  35. data/lib/messenger/messenger.rb +702 -0
  36. data/lib/messenger/subscription.rb +37 -0
  37. data/lib/messenger/tracker.rb +38 -0
  38. data/lib/messenger/tracker_status.rb +69 -0
  39. data/lib/qpid_proton.rb +106 -16
  40. data/lib/reactor/acceptor.rb +41 -0
  41. data/lib/reactor/backoff.rb +41 -0
  42. data/lib/reactor/connector.rb +98 -0
  43. data/lib/reactor/container.rb +272 -0
  44. data/lib/reactor/global_overrides.rb +44 -0
  45. data/lib/reactor/link_option.rb +90 -0
  46. data/lib/reactor/reactor.rb +198 -0
  47. data/lib/reactor/session_per_connection.rb +45 -0
  48. data/lib/reactor/ssl_config.rb +41 -0
  49. data/lib/reactor/task.rb +39 -0
  50. data/lib/{qpid_proton/subscription.rb → reactor/urls.rb} +12 -13
  51. data/lib/{qpid_proton → types}/array.rb +28 -29
  52. data/lib/types/described.rb +63 -0
  53. data/lib/{qpid_proton → types}/hash.rb +4 -3
  54. data/lib/types/strings.rb +62 -0
  55. data/lib/util/class_wrapper.rb +54 -0
  56. data/lib/util/condition.rb +45 -0
  57. data/lib/util/constants.rb +85 -0
  58. data/lib/util/engine.rb +82 -0
  59. data/lib/util/error_handler.rb +127 -0
  60. data/lib/util/handler.rb +41 -0
  61. data/lib/util/reactor.rb +32 -0
  62. data/lib/util/swig_helper.rb +114 -0
  63. data/lib/util/timeout.rb +50 -0
  64. data/lib/util/uuid.rb +32 -0
  65. data/lib/util/version.rb +30 -0
  66. data/lib/util/wrapper.rb +124 -0
  67. metadata +67 -21
  68. data/ext/cproton/cproton.c +0 -22196
  69. data/lib/qpid_proton/data.rb +0 -788
  70. data/lib/qpid_proton/described.rb +0 -66
  71. data/lib/qpid_proton/exception_handling.rb +0 -127
  72. data/lib/qpid_proton/filters.rb +0 -67
  73. data/lib/qpid_proton/mapping.rb +0 -170
  74. data/lib/qpid_proton/message.rb +0 -621
  75. data/lib/qpid_proton/messenger.rb +0 -702
  76. data/lib/qpid_proton/selectable.rb +0 -126
  77. data/lib/qpid_proton/strings.rb +0 -65
  78. data/lib/qpid_proton/tracker_status.rb +0 -73
@@ -1,126 +0,0 @@
1
- #--
2
- # Licensed to the Apache Software Foundation (ASF) under one
3
- # or more contributor license agreements. See the NOTICE file
4
- # distributed with this work for additional information
5
- # regarding copyright ownership. The ASF licenses this file
6
- # to you under the Apache License, Version 2.0 (the
7
- # "License"); you may not use this file except in compliance
8
- # with the License. You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing,
13
- # software distributed under the License is distributed on an
14
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- # KIND, either express or implied. See the License for the
16
- # specific language governing permissions and limitations
17
- # under the License.
18
- #++
19
-
20
- module Qpid # :nodoc:
21
-
22
- module Proton # :nodoc:
23
-
24
- # Selectable enables accessing the underlying file descriptors
25
- # for Messenger.
26
- class Selectable
27
-
28
- include Qpid::Proton::Filters
29
-
30
- call_before :check_is_initialized,
31
- :fileno, :capacity, :pending, :deadline,
32
- :readable, :writable, :expired,
33
- :registered=, :registered?
34
-
35
- def initialize(messenger, impl) # :nodoc:
36
- @messenger = messenger
37
- @impl = impl
38
- @io = nil
39
- @freed = false
40
- end
41
-
42
- # Returns the underlying file descriptor.
43
- #
44
- # This can be used in conjunction with the IO class.
45
- #
46
- def fileno
47
- Cproton.pn_selectable_fd(@impl)
48
- end
49
-
50
- def to_io
51
- @io ||= IO.new(fileno)
52
- end
53
-
54
- # The number of bytes the selectable is capable of consuming.
55
- #
56
- def capacity
57
- Cproton.pn_selectable_capacity(@impl)
58
- end
59
-
60
- # The number of bytes waiting to be written to the file descriptor.
61
- #
62
- def pending
63
- Cproton.pn_selectable_pending(@impl)
64
- end
65
-
66
- # The future expiry time at which control will be returned to the
67
- # selectable.
68
- #
69
- def deadline
70
- tstamp = Cproton.pn_selectable_deadline(@impl)
71
- tstamp.nil? ? nil : tstamp / 1000
72
- end
73
-
74
- def readable
75
- Cproton.pn_selectable_readable(@impl)
76
- end
77
-
78
- def writable
79
- Cproton.pn_selectable_writable(@impl)
80
- end
81
-
82
- def expired?
83
- Cproton.pn_selectable_expired(@impl)
84
- end
85
-
86
- def registered=(registered)
87
- Cproton.pn_selectable_set_registered(@impl, registered)
88
- end
89
-
90
- def registered?
91
- Cproton.pn_selectable_is_registered(@impl)
92
- end
93
-
94
- def terminal?
95
- return true if @impl.nil?
96
- Cproton.pn_selectable_is_terminal(@impl)
97
- end
98
-
99
- def to_s
100
- "fileno=#{self.fileno} registered=#{self.registered?} terminal=#{self.terminal?}"
101
- end
102
-
103
- def free
104
- return if @freed
105
- @freed = true
106
- @messenger.unregister_selectable(fileno)
107
- @io.close unless @io.nil?
108
- Cproton.pn_selectable_free(@impl)
109
- @impl = nil
110
- end
111
-
112
- def freed? # :nodoc:
113
- @freed
114
- end
115
-
116
- private
117
-
118
- def check_is_initialized
119
- raise RuntimeError.new("selectable freed") if @impl.nil?
120
- end
121
-
122
- end
123
-
124
- end
125
-
126
- end
@@ -1,65 +0,0 @@
1
- #--
2
- # Licensed to the Apache Software Foundation (ASF) under one
3
- # or more contributor license agreements. See the NOTICE file
4
- # distributed with this work for additional information
5
- # regarding copyright ownership. The ASF licenses this file
6
- # to you under the Apache License, Version 2.0 (the
7
- # "License"); you may not use this file except in compliance
8
- # with the License. You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing,
13
- # software distributed under the License is distributed on an
14
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- # KIND, either express or implied. See the License for the
16
- # specific language governing permissions and limitations
17
- # under the License.
18
- #++
19
-
20
- module Qpid # :nodoc:
21
-
22
- module Proton # :nodoc:
23
-
24
- def self.is_valid_utf?(value)
25
- # In Ruby 1.9+ we have encoding methods that can check the content of
26
- # the string, so use them to see if what we have is unicode. If so,
27
- # good! If not, then just treat is as binary.
28
- #
29
- # No such thing in Ruby 1.8. So there we need to use Iconv to try and
30
- # convert it to unicode. If it works, good! But if it raises an
31
- # exception then we'll treat it as binary.
32
- if RUBY_VERSION < "1.9"
33
- return true if value.isutf8
34
- return false
35
- else
36
- return true if (value.encoding == "UTF-8" ||
37
- value.encode("UTF-8").valid_encoding?)
38
-
39
- return false
40
- end
41
- end
42
-
43
- # UTFString lets an application explicitly state that a
44
- # string of characters is to be UTF-8 encoded.
45
- #
46
- class UTFString < ::String
47
-
48
- def initialize(value)
49
- if !Qpid::Proton.is_valid_utf?(value)
50
- raise RuntimeError.new("invalid UTF string")
51
- end
52
-
53
- super(value)
54
- end
55
-
56
- end
57
-
58
- # BinaryString lets an application explicitly declare that
59
- # a string value represents arbitrary data.
60
- #
61
- class BinaryString < ::String; end
62
-
63
- end
64
-
65
- end
@@ -1,73 +0,0 @@
1
- #--
2
- # Licensed to the Apache Software Foundation (ASF) under one
3
- # or more contributor license agreements. See the NOTICE file
4
- # distributed with this work for additional information
5
- # regarding copyright ownership. The ASF licenses this file
6
- # to you under the Apache License, Version 2.0 (the
7
- # "License"); you may not use this file except in compliance
8
- # with the License. You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing,
13
- # software distributed under the License is distributed on an
14
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- # KIND, either express or implied. See the License for the
16
- # specific language governing permissions and limitations
17
- # under the License.
18
- #++
19
-
20
- module Qpid # :nodoc:
21
-
22
- module Proton # :nodoc:
23
-
24
- # TrackerStatus contains symbols that represent the status value for a
25
- # Tracker.
26
- #
27
- class TrackerStatus
28
-
29
- def initialize value, name # :nodoc:
30
- @value = value
31
- @name = name
32
- end
33
-
34
- def value # :nodoc:
35
- @value
36
- end
37
-
38
- def to_s # :nodoc:
39
- @name.to_s
40
- end
41
-
42
- def self.by_name(name) # :nodoc:
43
- @by_name[name.to_sym] unless name.nil?
44
- end
45
-
46
- def self.by_value(value) # :nodoc:
47
- @by_value[value] unless value.nil?
48
- end
49
-
50
- private
51
-
52
- def self.add_item(key, value) # :nodoc:
53
- @by_name ||= {}
54
- @by_name[key] = TrackerStatus.new value, key
55
- @by_value ||= {}
56
- @by_value[value] = @by_name[key]
57
- end
58
-
59
- def self.const_missing(key) # :nodoc:
60
- @by_name[key]
61
- end
62
-
63
- self.add_item :UNKNOWN, Cproton::PN_STATUS_UNKNOWN
64
- self.add_item :PENDING, Cproton::PN_STATUS_PENDING
65
- self.add_item :ACCEPTED, Cproton::PN_STATUS_ACCEPTED
66
- self.add_item :REJECTED, Cproton::PN_STATUS_REJECTED
67
- self.add_item :SETTLED, Cproton::PN_STATUS_SETTLED
68
-
69
- end
70
-
71
- end
72
-
73
- end