torquebox-core 3.2.0-java → 4.0.0.alpha1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/torquebox +20 -0
- data/lib/resources/logback-cli.xml +12 -0
- data/lib/torquebox-core.jar +0 -0
- data/lib/torquebox-core.rb +51 -10
- data/lib/torquebox/cli.rb +129 -0
- data/lib/torquebox/cli/jar.rb +336 -0
- data/lib/torquebox/cli/war.rb +140 -0
- data/lib/torquebox/codecs.rb +35 -36
- data/lib/torquebox/codecs/edn.rb +39 -24
- data/lib/torquebox/codecs/json.rb +45 -44
- data/lib/torquebox/codecs/marshal.rb +25 -25
- data/lib/torquebox/codecs/marshal_base64.rb +26 -25
- data/lib/torquebox/codecs/marshal_smart.rb +34 -33
- data/lib/torquebox/codecs/text.rb +35 -0
- data/lib/torquebox/logger.rb +19 -129
- data/lib/torquebox/option_utils.rb +72 -0
- data/lib/torquebox/spec_helpers.rb +48 -0
- data/lib/torquebox/version.rb +20 -0
- data/lib/wunderboss-jars/jboss-logging-3.1.4.GA.jar +0 -0
- data/lib/wunderboss-jars/logback-classic-1.1.2.jar +0 -0
- data/lib/wunderboss-jars/logback-core-1.1.2.jar +0 -0
- data/lib/wunderboss-jars/slf4j-api-1.7.5.jar +0 -0
- data/lib/wunderboss-jars/wunderboss-core-1.x.incremental.174.jar +0 -0
- data/lib/wunderboss-jars/wunderboss-ruby-1.x.incremental.174.jar +0 -0
- data/lib/wunderboss-jars/wunderboss-wildfly-1.x.incremental.174.jar +0 -0
- metadata +71 -61
- data/lib/gem_hook.rb +0 -18
- data/lib/torquebox/component_manager.rb +0 -32
- data/lib/torquebox/core.rb +0 -29
- data/lib/torquebox/injectors.rb +0 -81
- data/lib/torquebox/kernel.rb +0 -47
- data/lib/torquebox/msc.rb +0 -98
- data/lib/torquebox/registry.rb +0 -52
- data/lib/torquebox/scheduled_job.rb +0 -245
- data/lib/torquebox/service.rb +0 -77
- data/lib/torquebox/service_registry.rb +0 -68
- data/licenses/cc0-1.0.txt +0 -121
- data/spec/codecs_spec.rb +0 -87
- data/spec/injectors_spec.rb +0 -28
- data/spec/kernel_spec.rb +0 -47
- data/spec/logger_spec.rb +0 -103
- data/spec/scheduled_job_spec.rb +0 -57
- data/spec/service_registry_spec.rb +0 -52
data/lib/torquebox/registry.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
# Copyright 2008-2013 Red Hat, Inc, and individual contributors.
|
2
|
-
#
|
3
|
-
# This is free software; you can redistribute it and/or modify it
|
4
|
-
# under the terms of the GNU Lesser General Public License as
|
5
|
-
# published by the Free Software Foundation; either version 2.1 of
|
6
|
-
# the License, or (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This software is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
-
# Lesser General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU Lesser General Public
|
14
|
-
# License along with this software; if not, write to the Free
|
15
|
-
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
16
|
-
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
17
|
-
|
18
|
-
require 'thread'
|
19
|
-
|
20
|
-
module TorqueBox
|
21
|
-
class Registry
|
22
|
-
# @api private
|
23
|
-
MUTEX = Mutex.new
|
24
|
-
|
25
|
-
class << self
|
26
|
-
def merge!(hash)
|
27
|
-
MUTEX.synchronize do
|
28
|
-
registry.merge!(hash)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def [](key)
|
33
|
-
value = nil
|
34
|
-
MUTEX.synchronize do
|
35
|
-
value = registry[key]
|
36
|
-
end
|
37
|
-
value
|
38
|
-
end
|
39
|
-
|
40
|
-
def has_key?(key)
|
41
|
-
MUTEX.synchronize do
|
42
|
-
registry.has_key?(key)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def registry
|
47
|
-
@registry ||= {}
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
@@ -1,245 +0,0 @@
|
|
1
|
-
# Copyright 2008-2013 Red Hat, Inc, and individual contributors.
|
2
|
-
#
|
3
|
-
# This is free software; you can redistribute it and/or modify it
|
4
|
-
# under the terms of the GNU Lesser General Public License as
|
5
|
-
# published by the Free Software Foundation; either version 2.1 of
|
6
|
-
# the License, or (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This software is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
-
# Lesser General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU Lesser General Public
|
14
|
-
# License along with this software; if not, write to the Free
|
15
|
-
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
16
|
-
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
17
|
-
|
18
|
-
module TorqueBox
|
19
|
-
# This class is a Ruby API to manipulating TorqueBox scheduled jobs.
|
20
|
-
class ScheduledJob
|
21
|
-
class << self
|
22
|
-
|
23
|
-
# Creates a new scheduled job.
|
24
|
-
#
|
25
|
-
# @note This is an asynchronous method.
|
26
|
-
# @param class_name The scheduled job implementation
|
27
|
-
# class name
|
28
|
-
# @param cron The cron expression defining when the job
|
29
|
-
# should run
|
30
|
-
# @param options Optional parameters (a Hash), including:
|
31
|
-
# @option options [String] :name The job name unique across the application, if not provided set to the class name
|
32
|
-
# @option options [String] :description Job description
|
33
|
-
# @option options [String] :timeout The time after the job execution should be interrupted. By default it'll never interrupt the job execution. Example: '2s', '1m'
|
34
|
-
# @option options [Hash] :config Data that should be injected to the job constructor
|
35
|
-
# @option options [Boolean] :stopped If the job should be stopped after installation (default: false)
|
36
|
-
# @option options [Boolean] :singleton Flag to determine if the job should be executed on every node (set to true, default) in the cluster or only on one node (set to false).
|
37
|
-
# @return [java.util.concurrent.CountDownLatch] The latch to wait for the task completion
|
38
|
-
# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CountDownLatch.html
|
39
|
-
#
|
40
|
-
# @example A simple job
|
41
|
-
# TorqueBox::ScheduledJob.schedule('SimpleJob', "*/10 * * * * ?")
|
42
|
-
#
|
43
|
-
# @example A simple job with custom name
|
44
|
-
# TorqueBox::ScheduledJob.schedule('SimpleJob', "*/10 * * * * ?", :name => "simple.job")
|
45
|
-
#
|
46
|
-
# @example Schedule a job with data to be injected to the job constructor
|
47
|
-
# ScheduledJob.schedule('SimpleJob', "*/10 * * * * ?", :name => "simple.config.job", :config => {:text => "text", :hash => {:a => 2}})
|
48
|
-
#
|
49
|
-
# @example Schedule a job stopped after creation
|
50
|
-
# TorqueBox::ScheduledJob.schedule('SimpleJob', "*/10 * * * * ?", :stopped => true)
|
51
|
-
def schedule(class_name, cron, options = {})
|
52
|
-
raise "No job class name provided" if class_name.nil?
|
53
|
-
raise "No cron expression provided" if cron.nil?
|
54
|
-
|
55
|
-
options = {
|
56
|
-
:name => class_name.to_s,
|
57
|
-
:singleton => true,
|
58
|
-
:stopped => false,
|
59
|
-
:timeout => "0s"
|
60
|
-
}.merge(options)
|
61
|
-
|
62
|
-
with_schedulizer do |schedulizer|
|
63
|
-
schedulizer.create_job(class_name.to_s, cron, options[:timeout], options[:name], options[:description], options[:config], options[:singleton], options[:stopped])
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
# Creates a new scheduled job.
|
68
|
-
#
|
69
|
-
# @note This is a synchronous method.
|
70
|
-
# @note This method accepts the same parameters as available in the schedule method.
|
71
|
-
# @return [Boolean] true if the job was successfully created, false otherwise
|
72
|
-
# @see TorqueBox::ScheduledJob.schedule
|
73
|
-
def schedule_sync(class_name, cron, options = {})
|
74
|
-
latch = schedule(class_name, cron, options)
|
75
|
-
wait_for_latch(latch)
|
76
|
-
end
|
77
|
-
|
78
|
-
# Creates new 'at' job.
|
79
|
-
#
|
80
|
-
# @note This is an asynchronous method.
|
81
|
-
# @param class_name [String] The class name of the scheduled job to be executed
|
82
|
-
# @param options [Hash] A hash containing the at job options:
|
83
|
-
# @option options [Time] :at [Time] The start time of the job
|
84
|
-
# @option options [Fixnum] :in Specifies when the job execution should start, in ms
|
85
|
-
# @option options [Fixnum] :repeat Specifies the number of times to execute the job
|
86
|
-
# @option options [Fixnum] :every Specifies the delay (in ms) between job executions
|
87
|
-
# @option options [Time] :until The stop time of job execution
|
88
|
-
# @option options [String] :name The job name unique across the application, by default set to the job class name
|
89
|
-
# @option options [String] :description Job description
|
90
|
-
# @option options [String] :timeout The time after the job execution should be interrupted. By default it'll never interrupt the job execution. Example: '2s', '1m'
|
91
|
-
# @option options [Hash] :config Data that should be injected to the job constructor
|
92
|
-
# @option options [Boolean] :singleton Flag to determine if the job should be executed on every node (set to true) in the cluster or only on one node (set to false, default).
|
93
|
-
# @return [java.util.concurrent.CountDownLatch] The latch to wait for the task completion
|
94
|
-
# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CountDownLatch.html
|
95
|
-
#
|
96
|
-
# @example Run a job every 200 ms for over 5 seconds, from now
|
97
|
-
# TorqueBox::ScheduledJob.at('SimpleJob', :every => 200, :until => Time.now + 5)
|
98
|
-
#
|
99
|
-
# @example Start in 1 second, then every 200 ms for over 4 seconds (5 seconds from now, but start is delayed):
|
100
|
-
# TorqueBox::ScheduledJob.at('SimpleJob', :at => Time.now + 1, :every => 200, :until => Time.now + 5)
|
101
|
-
#
|
102
|
-
# @example Start in 1 second, then every 200 ms for over 4 seconds (5 seconds from now, but start is delayed):
|
103
|
-
# TorqueBox::ScheduledJob.at('SimpleJob', :in => 1_000, :every => 200, :until => Time.now + 5)
|
104
|
-
#
|
105
|
-
# @example Start in 1 second, then repeat te job 10 times, every 200 ms
|
106
|
-
# TorqueBox::ScheduledJob.at('SimpleJob', :in => 1_000, :repeat => 10, :every => 200)
|
107
|
-
def at(class_name, options = {})
|
108
|
-
raise "No job class name provided" if class_name.nil?
|
109
|
-
raise "Invalid options for scheduling the job" if options.nil? or !options.is_a?(Hash)
|
110
|
-
raise "Invalid type for :in, should be a Fixnum" if !options[:in].nil? and !options[:in].is_a?(Fixnum)
|
111
|
-
raise "You can't specify both :at and :in" if options.has_key?(:at) and options.has_key?(:in)
|
112
|
-
raise "You can't specify :repeat without :every" if options.has_key?(:repeat) and !options.has_key?(:every)
|
113
|
-
raise "You can't specify :until without :every" if options.has_key?(:until) and !options.has_key?(:every)
|
114
|
-
|
115
|
-
options = {
|
116
|
-
:singleton => false,
|
117
|
-
:name => class_name,
|
118
|
-
:timeout => "0s",
|
119
|
-
:repeat => 0,
|
120
|
-
:every => 0,
|
121
|
-
:at => Time.now,
|
122
|
-
:async => true
|
123
|
-
}.merge(options)
|
124
|
-
|
125
|
-
if options.has_key?(:in)
|
126
|
-
start = Time.now + options[:in] / 1000.0
|
127
|
-
else
|
128
|
-
start = options[:at]
|
129
|
-
end
|
130
|
-
|
131
|
-
with_schedulizer do |schedulizer|
|
132
|
-
schedulizer.create_at_job(class_name.to_s, start, options[:until], options[:every], options[:repeat], options[:timeout], options[:name], options[:description], options[:config], options[:singleton])
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
# Creates new 'at' job.
|
137
|
-
#
|
138
|
-
# @note This is a synchronous method.
|
139
|
-
# @note This method accepts the same parameters as available in the at method.
|
140
|
-
# @return [Boolean] true if the job was successfully created, false otherwise
|
141
|
-
# @see TorqueBox::ScheduledJob.at
|
142
|
-
def at_sync(class_name, options = {})
|
143
|
-
latch = at(class_name, options)
|
144
|
-
wait_for_latch(latch)
|
145
|
-
end
|
146
|
-
|
147
|
-
# Removes a scheduled job.
|
148
|
-
#
|
149
|
-
# This method removes the job asynchronously.
|
150
|
-
#
|
151
|
-
# @param name [String] The job name.
|
152
|
-
# @return [java.util.concurrent.CountDownLatch] The latch to wait for the task completion
|
153
|
-
# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CountDownLatch.html
|
154
|
-
def remove(name)
|
155
|
-
raise "No job name provided" if name.nil?
|
156
|
-
raise "Couldn't find a job with name '#{name}''" if TorqueBox::ScheduledJob.lookup(name).nil?
|
157
|
-
|
158
|
-
with_schedulizer do |schedulizer|
|
159
|
-
schedulizer.remove_job(name)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
# Removes a scheduled job.
|
164
|
-
#
|
165
|
-
# @note This is a synchronous method.
|
166
|
-
# @note This method accepts the same parameters as available in the remove method.
|
167
|
-
# @return [Boolean] true if the job was successfully removed, false otherwise
|
168
|
-
# @see TorqueBox::ScheduledJob.remove
|
169
|
-
def remove_sync(name)
|
170
|
-
latch = remove(name)
|
171
|
-
wait_for_latch(latch)
|
172
|
-
end
|
173
|
-
|
174
|
-
# List all scheduled jobs of this application.
|
175
|
-
#
|
176
|
-
# @return [Array<org.torquebox.jobs.ScheduledJob>] the list of
|
177
|
-
# ScheduledJob instances - see
|
178
|
-
# {TorqueBox::ScheduledJob.lookup} for more details on these
|
179
|
-
# instances
|
180
|
-
def list
|
181
|
-
prefix = job_service_name.canonical_name
|
182
|
-
service_names = TorqueBox::MSC.service_names.select do |service_name|
|
183
|
-
name = service_name.canonical_name
|
184
|
-
name.start_with?(prefix) && !name.end_with?('mbean')
|
185
|
-
end
|
186
|
-
service_names.map do |service_name|
|
187
|
-
service = TorqueBox::MSC.get_service(service_name)
|
188
|
-
service.nil? ? nil : service.value
|
189
|
-
end.select { |v| !v.nil? }
|
190
|
-
end
|
191
|
-
|
192
|
-
# Lookup a scheduled job of this application by name.
|
193
|
-
#
|
194
|
-
# @param [String] name the scheduled job's name (as given in
|
195
|
-
# torquebox.rb or torquebox.yml)
|
196
|
-
#
|
197
|
-
# @return [org.torquebox.jobs.ScheduledJob] The ScheduledJob instance.
|
198
|
-
#
|
199
|
-
# @note The ScheduledJob instances returned by this and the
|
200
|
-
# {TorqueBox::ScheduledJob.list} methods are not instances of
|
201
|
-
# this class but are instead Java objects of type
|
202
|
-
# org.torquebox.jobs.ScheduledJob. There are more methods
|
203
|
-
# available on these instances than what's shown in the
|
204
|
-
# example here, but only the methods shown are part of our
|
205
|
-
# documented API.
|
206
|
-
#
|
207
|
-
# @example Stop a scheduled job
|
208
|
-
# job = TorqueBox::ScheduledJob.lookup('my_job')
|
209
|
-
# job.name => 'my_job'
|
210
|
-
# job.started? => true
|
211
|
-
# job.status => 'STARTED'
|
212
|
-
# job.stop
|
213
|
-
# job.status => 'STOPPED'
|
214
|
-
def lookup(name)
|
215
|
-
service_name = job_service_name.append(name)
|
216
|
-
service = TorqueBox::MSC.get_service(service_name)
|
217
|
-
service.nil? ? nil : service.value
|
218
|
-
end
|
219
|
-
|
220
|
-
private
|
221
|
-
|
222
|
-
# @api private
|
223
|
-
def job_service_name
|
224
|
-
TorqueBox::MSC.deployment_unit.service_name.append('scheduled_job')
|
225
|
-
end
|
226
|
-
|
227
|
-
# @api private
|
228
|
-
def with_schedulizer
|
229
|
-
yield TorqueBox::ServiceRegistry.lookup(TorqueBox::MSC.deployment_unit.service_name.append('job_schedulizer'))
|
230
|
-
end
|
231
|
-
|
232
|
-
# @api private
|
233
|
-
def wait_for_latch(latch)
|
234
|
-
begin
|
235
|
-
# Wait for the services to come up for up to 30 seconds
|
236
|
-
latch.await(30, java.util.concurrent.TimeUnit::SECONDS)
|
237
|
-
rescue
|
238
|
-
return false
|
239
|
-
end
|
240
|
-
|
241
|
-
true
|
242
|
-
end
|
243
|
-
end
|
244
|
-
end
|
245
|
-
end
|
data/lib/torquebox/service.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
# Copyright 2008-2013 Red Hat, Inc, and individual contributors.
|
2
|
-
#
|
3
|
-
# This is free software; you can redistribute it and/or modify it
|
4
|
-
# under the terms of the GNU Lesser General Public License as
|
5
|
-
# published by the Free Software Foundation; either version 2.1 of
|
6
|
-
# the License, or (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This software is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
-
# Lesser General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU Lesser General Public
|
14
|
-
# License along with this software; if not, write to the Free
|
15
|
-
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
16
|
-
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
17
|
-
|
18
|
-
module TorqueBox
|
19
|
-
# This class is a Ruby API to manipulating TorqueBox services (daemons).
|
20
|
-
class Service
|
21
|
-
class << self
|
22
|
-
|
23
|
-
# List all services of this application.
|
24
|
-
#
|
25
|
-
# @return [Array<org.torquebox.services.RubyService>] the list
|
26
|
-
# of RubyService instances - see {TorqueBox::Service.lookup}
|
27
|
-
# for more details on these instances
|
28
|
-
def list
|
29
|
-
prefix = service_prefix.canonical_name
|
30
|
-
suffix = '.create'
|
31
|
-
service_names = TorqueBox::MSC.service_names.select do |service_name|
|
32
|
-
name = service_name.canonical_name
|
33
|
-
name.start_with?(prefix) && name.end_with?(suffix)
|
34
|
-
end
|
35
|
-
service_names.map do |service_name|
|
36
|
-
TorqueBox::MSC.get_service(service_name).value
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# Lookup a service of this application by name.
|
41
|
-
#
|
42
|
-
# @param [String] name the service's name (as given in
|
43
|
-
# torquebox.rb or torquebox.yml)
|
44
|
-
#
|
45
|
-
# @return [org.torquebox.services.RubyService] The RubyService
|
46
|
-
# instance.
|
47
|
-
#
|
48
|
-
# @note The RubyService instances returned by this and the
|
49
|
-
# {TorqueBox::Service.list} methods are not instances of this
|
50
|
-
# class but are instead Java objects of type
|
51
|
-
# org.torquebox.services.RubyService. There are more methods
|
52
|
-
# available on these instances than what's shown in the
|
53
|
-
# example here, but only the methods shown are part of our
|
54
|
-
# documented API.
|
55
|
-
#
|
56
|
-
# @example Stop a running service
|
57
|
-
# service = TorqueBox::Service.lookup('my_service')
|
58
|
-
# service.name => 'my_service'
|
59
|
-
# service.started? => true
|
60
|
-
# service.status => 'STARTED'
|
61
|
-
# service.stop
|
62
|
-
# service.status => 'STOPPED'
|
63
|
-
def lookup(name)
|
64
|
-
service_name = service_prefix.append(name).append('create')
|
65
|
-
service = TorqueBox::MSC.get_service(service_name)
|
66
|
-
service.nil? ? nil : service.value
|
67
|
-
end
|
68
|
-
|
69
|
-
private
|
70
|
-
|
71
|
-
def service_prefix
|
72
|
-
TorqueBox::MSC.deployment_unit.service_name.append('service')
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# Copyright 2008-2013 Red Hat, Inc, and individual contributors.
|
2
|
-
#
|
3
|
-
# This is free software; you can redistribute it and/or modify it
|
4
|
-
# under the terms of the GNU Lesser General Public License as
|
5
|
-
# published by the Free Software Foundation; either version 2.1 of
|
6
|
-
# the License, or (at your option) any later version.
|
7
|
-
#
|
8
|
-
# This software is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
-
# Lesser General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU Lesser General Public
|
14
|
-
# License along with this software; if not, write to the Free
|
15
|
-
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
16
|
-
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
17
|
-
|
18
|
-
require 'java'
|
19
|
-
module TorqueBox
|
20
|
-
class ServiceRegistry
|
21
|
-
|
22
|
-
def self.service_registry=(service_registry)
|
23
|
-
@service_registry = service_registry
|
24
|
-
blocks.keys.each do |name|
|
25
|
-
blocks.delete(name).each do |block|
|
26
|
-
lookup name, &block
|
27
|
-
end
|
28
|
-
end
|
29
|
-
registry
|
30
|
-
end
|
31
|
-
|
32
|
-
# blocks are not allowed on the method named :[]
|
33
|
-
def self.[](name)
|
34
|
-
self.lookup(name)
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.lookup(name, &block)
|
38
|
-
if registry.nil?
|
39
|
-
self.blocks[name] << block
|
40
|
-
nil
|
41
|
-
else
|
42
|
-
name = TorqueBox::ServiceRegistry.service_name_for( name ) if name.is_a? String
|
43
|
-
entry = registry.getService( name )
|
44
|
-
return nil unless entry
|
45
|
-
if block_given?
|
46
|
-
yield entry.getValue()
|
47
|
-
else
|
48
|
-
entry.getValue()
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def self.blocks
|
54
|
-
@blocks ||= Hash.new{|h, k| h[k] = []}
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.service_name_for( name )
|
58
|
-
Java::org.jboss.msc.service.ServiceName.parse( name )
|
59
|
-
end
|
60
|
-
|
61
|
-
def self.registry
|
62
|
-
@service_registry
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
data/licenses/cc0-1.0.txt
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
Creative Commons Legal Code
|
2
|
-
|
3
|
-
CC0 1.0 Universal
|
4
|
-
|
5
|
-
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
6
|
-
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
7
|
-
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
8
|
-
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
9
|
-
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
10
|
-
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
11
|
-
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
12
|
-
HEREUNDER.
|
13
|
-
|
14
|
-
Statement of Purpose
|
15
|
-
|
16
|
-
The laws of most jurisdictions throughout the world automatically confer
|
17
|
-
exclusive Copyright and Related Rights (defined below) upon the creator
|
18
|
-
and subsequent owner(s) (each and all, an "owner") of an original work of
|
19
|
-
authorship and/or a database (each, a "Work").
|
20
|
-
|
21
|
-
Certain owners wish to permanently relinquish those rights to a Work for
|
22
|
-
the purpose of contributing to a commons of creative, cultural and
|
23
|
-
scientific works ("Commons") that the public can reliably and without fear
|
24
|
-
of later claims of infringement build upon, modify, incorporate in other
|
25
|
-
works, reuse and redistribute as freely as possible in any form whatsoever
|
26
|
-
and for any purposes, including without limitation commercial purposes.
|
27
|
-
These owners may contribute to the Commons to promote the ideal of a free
|
28
|
-
culture and the further production of creative, cultural and scientific
|
29
|
-
works, or to gain reputation or greater distribution for their Work in
|
30
|
-
part through the use and efforts of others.
|
31
|
-
|
32
|
-
For these and/or other purposes and motivations, and without any
|
33
|
-
expectation of additional consideration or compensation, the person
|
34
|
-
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
35
|
-
is an owner of Copyright and Related Rights in the Work, voluntarily
|
36
|
-
elects to apply CC0 to the Work and publicly distribute the Work under its
|
37
|
-
terms, with knowledge of his or her Copyright and Related Rights in the
|
38
|
-
Work and the meaning and intended legal effect of CC0 on those rights.
|
39
|
-
|
40
|
-
1. Copyright and Related Rights. A Work made available under CC0 may be
|
41
|
-
protected by copyright and related or neighboring rights ("Copyright and
|
42
|
-
Related Rights"). Copyright and Related Rights include, but are not
|
43
|
-
limited to, the following:
|
44
|
-
|
45
|
-
i. the right to reproduce, adapt, distribute, perform, display,
|
46
|
-
communicate, and translate a Work;
|
47
|
-
ii. moral rights retained by the original author(s) and/or performer(s);
|
48
|
-
iii. publicity and privacy rights pertaining to a person's image or
|
49
|
-
likeness depicted in a Work;
|
50
|
-
iv. rights protecting against unfair competition in regards to a Work,
|
51
|
-
subject to the limitations in paragraph 4(a), below;
|
52
|
-
v. rights protecting the extraction, dissemination, use and reuse of data
|
53
|
-
in a Work;
|
54
|
-
vi. database rights (such as those arising under Directive 96/9/EC of the
|
55
|
-
European Parliament and of the Council of 11 March 1996 on the legal
|
56
|
-
protection of databases, and under any national implementation
|
57
|
-
thereof, including any amended or successor version of such
|
58
|
-
directive); and
|
59
|
-
vii. other similar, equivalent or corresponding rights throughout the
|
60
|
-
world based on applicable law or treaty, and any national
|
61
|
-
implementations thereof.
|
62
|
-
|
63
|
-
2. Waiver. To the greatest extent permitted by, but not in contravention
|
64
|
-
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
65
|
-
irrevocably and unconditionally waives, abandons, and surrenders all of
|
66
|
-
Affirmer's Copyright and Related Rights and associated claims and causes
|
67
|
-
of action, whether now known or unknown (including existing as well as
|
68
|
-
future claims and causes of action), in the Work (i) in all territories
|
69
|
-
worldwide, (ii) for the maximum duration provided by applicable law or
|
70
|
-
treaty (including future time extensions), (iii) in any current or future
|
71
|
-
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
72
|
-
including without limitation commercial, advertising or promotional
|
73
|
-
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
74
|
-
member of the public at large and to the detriment of Affirmer's heirs and
|
75
|
-
successors, fully intending that such Waiver shall not be subject to
|
76
|
-
revocation, rescission, cancellation, termination, or any other legal or
|
77
|
-
equitable action to disrupt the quiet enjoyment of the Work by the public
|
78
|
-
as contemplated by Affirmer's express Statement of Purpose.
|
79
|
-
|
80
|
-
3. Public License Fallback. Should any part of the Waiver for any reason
|
81
|
-
be judged legally invalid or ineffective under applicable law, then the
|
82
|
-
Waiver shall be preserved to the maximum extent permitted taking into
|
83
|
-
account Affirmer's express Statement of Purpose. In addition, to the
|
84
|
-
extent the Waiver is so judged Affirmer hereby grants to each affected
|
85
|
-
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
86
|
-
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
87
|
-
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
88
|
-
maximum duration provided by applicable law or treaty (including future
|
89
|
-
time extensions), (iii) in any current or future medium and for any number
|
90
|
-
of copies, and (iv) for any purpose whatsoever, including without
|
91
|
-
limitation commercial, advertising or promotional purposes (the
|
92
|
-
"License"). The License shall be deemed effective as of the date CC0 was
|
93
|
-
applied by Affirmer to the Work. Should any part of the License for any
|
94
|
-
reason be judged legally invalid or ineffective under applicable law, such
|
95
|
-
partial invalidity or ineffectiveness shall not invalidate the remainder
|
96
|
-
of the License, and in such case Affirmer hereby affirms that he or she
|
97
|
-
will not (i) exercise any of his or her remaining Copyright and Related
|
98
|
-
Rights in the Work or (ii) assert any associated claims and causes of
|
99
|
-
action with respect to the Work, in either case contrary to Affirmer's
|
100
|
-
express Statement of Purpose.
|
101
|
-
|
102
|
-
4. Limitations and Disclaimers.
|
103
|
-
|
104
|
-
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
105
|
-
surrendered, licensed or otherwise affected by this document.
|
106
|
-
b. Affirmer offers the Work as-is and makes no representations or
|
107
|
-
warranties of any kind concerning the Work, express, implied,
|
108
|
-
statutory or otherwise, including without limitation warranties of
|
109
|
-
title, merchantability, fitness for a particular purpose, non
|
110
|
-
infringement, or the absence of latent or other defects, accuracy, or
|
111
|
-
the present or absence of errors, whether or not discoverable, all to
|
112
|
-
the greatest extent permissible under applicable law.
|
113
|
-
c. Affirmer disclaims responsibility for clearing rights of other persons
|
114
|
-
that may apply to the Work or any use thereof, including without
|
115
|
-
limitation any person's Copyright and Related Rights in the Work.
|
116
|
-
Further, Affirmer disclaims responsibility for obtaining any necessary
|
117
|
-
consents, permissions or other rights required for any use of the
|
118
|
-
Work.
|
119
|
-
d. Affirmer understands and acknowledges that Creative Commons is not a
|
120
|
-
party to this document and has no duty or obligation with respect to
|
121
|
-
this CC0 or use of the Work.
|