torquebox-core 2.1.2-java → 2.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
Binary file
@@ -1,6 +1,6 @@
1
1
  module TorqueboxCore
2
- VERSION = '2.1.2'
3
- MAVEN_VERSION = '2.1.2'
2
+ VERSION = '2.2.0'
3
+ MAVEN_VERSION = '2.2.0'
4
4
  end
5
5
  begin
6
6
  require 'java'
@@ -23,4 +23,7 @@ require 'torquebox/service_registry'
23
23
  require 'torquebox/component_manager'
24
24
  require 'torquebox/injectors'
25
25
  require 'torquebox/logger'
26
+ require 'torquebox/msc'
27
+ require 'torquebox/scheduled_job'
28
+ require 'torquebox/service'
26
29
 
@@ -82,6 +82,12 @@ module TorqueBox
82
82
  self.send(method, *args, &block)
83
83
  end
84
84
 
85
+ # Make the Logger compatible with Rack::CommonLogger
86
+ #
87
+ def write(message)
88
+ info message.strip
89
+ end
90
+
85
91
  private
86
92
 
87
93
  def params_for_logger(args, block)
@@ -0,0 +1,40 @@
1
+ # Copyright 2008-2012 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
+ class MSC
20
+ class << self
21
+ include TorqueBox::Injectors
22
+
23
+ def service_registry
24
+ fetch('service-registry')
25
+ end
26
+
27
+ def deployment_unit
28
+ fetch('deployment-unit')
29
+ end
30
+
31
+ def service_names
32
+ service_registry.service_names
33
+ end
34
+
35
+ def get_service(service_name)
36
+ service_registry.get_service(service_name)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,76 @@
1
+ # Copyright 2008-2012 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
+ # List all scheduled jobs of this application.
24
+ #
25
+ # @return [Array<org.torquebox.jobs.ScheduledJob>] the list of
26
+ # ScheduledJob instances - see
27
+ # {TorqueBox::ScheduledJob.lookup} for more details on these
28
+ # instances
29
+ def list
30
+ prefix = job_prefix.canonical_name
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?('mbean')
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 scheduled job of this application by name.
41
+ #
42
+ # @param [String] name the scheduled job's name (as given in
43
+ # torquebox.rb or torquebox.yml)
44
+ #
45
+ # @return [org.torquebox.jobs.ScheduledJob] The ScheduledJob instance.
46
+ #
47
+ # @note The ScheduledJob instances returned by this and the
48
+ # {TorqueBox::ScheduledJob.list} methods are not instances of
49
+ # this class but are instead Java objects of type
50
+ # org.torquebox.jobs.ScheduledJob. There are more methods
51
+ # available on these instances than what's shown in the
52
+ # example here, but only the methods shown are part of our
53
+ # documented API.
54
+ #
55
+ # @example Stop a scheduled job
56
+ # job = TorqueBox::ScheduledJob.lookup('my_job')
57
+ # job.name => 'my_job'
58
+ # job.started? => true
59
+ # job.status => 'STARTED'
60
+ # job.stop
61
+ # job.status => 'STOPPED'
62
+ def lookup(name)
63
+ service_name = job_prefix.append(name)
64
+ service = TorqueBox::MSC.get_service(service_name)
65
+ service.nil? ? nil : service.value
66
+ end
67
+
68
+ private
69
+
70
+ def job_prefix
71
+ TorqueBox::MSC.deployment_unit.service_name.append('scheduled_job')
72
+ end
73
+
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,77 @@
1
+ # Copyright 2008-2012 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
metadata CHANGED
@@ -1,82 +1,86 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: torquebox-core
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 2.1.2
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 2.2.0
6
6
  platform: java
7
- authors:
8
- - The TorqueBox Team
9
- autorequire:
7
+ authors:
8
+ - The TorqueBox Team
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-09-24 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rspec
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - "="
22
- - !ruby/object:Gem::Version
23
- version: 2.7.0
24
- type: :development
25
- version_requirements: *id001
26
- description: ""
27
- email:
28
- - torquebox-dev@torquebox.org
12
+ date: 2012-12-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '='
19
+ - !ruby/object:Gem::Version
20
+ version: 2.7.0
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 2.7.0
27
+ none: false
28
+ prerelease: false
29
+ type: :development
30
+ description: ''
31
+ email:
32
+ - torquebox-dev@torquebox.org
29
33
  executables: []
30
-
31
34
  extensions: []
32
-
33
35
  extra_rdoc_files: []
34
-
35
- files:
36
- - licenses/lgpl-2.1.txt
37
- - lib/torquebox-core.jar
38
- - lib/torquebox-core.rb
39
- - lib/gem_hook.rb
40
- - lib/torquebox/registry.rb
41
- - lib/torquebox/component_manager.rb
42
- - lib/torquebox/injectors.rb
43
- - lib/torquebox/core.rb
44
- - lib/torquebox/kernel.rb
45
- - lib/torquebox/logger.rb
46
- - lib/torquebox/service_registry.rb
47
- - spec/kernel_spec.rb
48
- - spec/injectors_spec.rb
49
- - spec/logger_spec.rb
50
- - spec/service_registry_spec.rb
36
+ files:
37
+ - licenses/lgpl-2.1.txt
38
+ - lib/torquebox-core.jar
39
+ - lib/torquebox-core.rb
40
+ - lib/gem_hook.rb
41
+ - lib/torquebox/service_registry.rb
42
+ - lib/torquebox/kernel.rb
43
+ - lib/torquebox/component_manager.rb
44
+ - lib/torquebox/injectors.rb
45
+ - lib/torquebox/scheduled_job.rb
46
+ - lib/torquebox/msc.rb
47
+ - lib/torquebox/service.rb
48
+ - lib/torquebox/registry.rb
49
+ - lib/torquebox/logger.rb
50
+ - lib/torquebox/core.rb
51
+ - spec/logger_spec.rb
52
+ - spec/service_registry_spec.rb
53
+ - spec/kernel_spec.rb
54
+ - spec/injectors_spec.rb
51
55
  homepage: http://torquebox.org/
52
- licenses:
53
- - lgpl
54
- post_install_message:
56
+ licenses:
57
+ - lgpl
58
+ post_install_message:
55
59
  rdoc_options: []
56
-
57
- require_paths:
58
- - lib
59
- required_ruby_version: !ruby/object:Gem::Requirement
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: !binary |-
67
+ MA==
60
68
  none: false
61
- requirements:
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: "0"
65
- required_rubygems_version: !ruby/object:Gem::Requirement
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: !binary |-
74
+ MA==
66
75
  none: false
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: "0"
71
76
  requirements: []
72
-
73
- rubyforge_project:
77
+ rubyforge_project:
74
78
  rubygems_version: 1.8.24
75
- signing_key:
79
+ signing_key:
76
80
  specification_version: 3
77
81
  summary: TorqueBox Core Gem
78
- test_files:
79
- - spec/kernel_spec.rb
80
- - spec/injectors_spec.rb
81
- - spec/logger_spec.rb
82
- - spec/service_registry_spec.rb
82
+ test_files:
83
+ - spec/logger_spec.rb
84
+ - spec/service_registry_spec.rb
85
+ - spec/kernel_spec.rb
86
+ - spec/injectors_spec.rb