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
@@ -0,0 +1,20 @@
|
|
1
|
+
# Copyright 2014 Red Hat, Inc, and individual contributors.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
module TorqueBox
|
17
|
+
VERSION = '4.0.0.alpha1'
|
18
|
+
WUNDERBOSS_VERSION = '1.x.incremental.174'
|
19
|
+
WILDFLY_VERSION = '8.2.0.Final'
|
20
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,93 +1,106 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torquebox-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0.alpha1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- The TorqueBox Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
-
|
14
|
+
name: jbundler
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - '
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
|
19
|
+
version: '0'
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
|
-
- - '
|
22
|
+
- - '>='
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version:
|
24
|
+
version: '0'
|
25
25
|
prerelease: false
|
26
|
-
type: :
|
26
|
+
type: :development
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
29
34
|
requirement: !ruby/object:Gem::Requirement
|
30
35
|
requirements:
|
31
|
-
- - '
|
36
|
+
- - '>='
|
32
37
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
38
|
+
version: '0'
|
39
|
+
prerelease: false
|
40
|
+
type: :development
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake-compiler
|
34
43
|
version_requirements: !ruby/object:Gem::Requirement
|
35
44
|
requirements:
|
36
|
-
- - '
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
37
51
|
- !ruby/object:Gem::Version
|
38
|
-
version:
|
52
|
+
version: '0'
|
39
53
|
prerelease: false
|
40
54
|
type: :development
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rspec
|
43
|
-
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ~>
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.14
|
48
|
-
|
61
|
+
version: '2.14'
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
49
63
|
requirements:
|
50
|
-
- -
|
64
|
+
- - ~>
|
51
65
|
- !ruby/object:Gem::Version
|
52
|
-
version: 2.14
|
66
|
+
version: '2.14'
|
53
67
|
prerelease: false
|
54
68
|
type: :development
|
55
|
-
description:
|
56
|
-
email:
|
57
|
-
|
58
|
-
|
69
|
+
description:
|
70
|
+
email: torquebox-dev@torquebox.org
|
71
|
+
executables:
|
72
|
+
- torquebox
|
59
73
|
extensions: []
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
62
|
-
-
|
76
|
+
- bin/torquebox
|
63
77
|
- lib/torquebox-core.jar
|
64
78
|
- lib/torquebox-core.rb
|
79
|
+
- lib/resources/logback-cli.xml
|
80
|
+
- lib/wunderboss-jars/slf4j-api-1.7.5.jar
|
81
|
+
- lib/wunderboss-jars/logback-core-1.1.2.jar
|
82
|
+
- lib/wunderboss-jars/wunderboss-core-1.x.incremental.174.jar
|
83
|
+
- lib/wunderboss-jars/wunderboss-wildfly-1.x.incremental.174.jar
|
84
|
+
- lib/wunderboss-jars/logback-classic-1.1.2.jar
|
85
|
+
- lib/wunderboss-jars/jboss-logging-3.1.4.GA.jar
|
86
|
+
- lib/wunderboss-jars/wunderboss-ruby-1.x.incremental.174.jar
|
87
|
+
- lib/torquebox/logger.rb
|
88
|
+
- lib/torquebox/option_utils.rb
|
89
|
+
- lib/torquebox/cli.rb
|
65
90
|
- lib/torquebox/codecs.rb
|
66
|
-
- lib/torquebox/
|
67
|
-
- lib/torquebox/
|
91
|
+
- lib/torquebox/version.rb
|
92
|
+
- lib/torquebox/spec_helpers.rb
|
93
|
+
- lib/torquebox/cli/jar.rb
|
94
|
+
- lib/torquebox/cli/war.rb
|
68
95
|
- lib/torquebox/codecs/marshal.rb
|
96
|
+
- lib/torquebox/codecs/edn.rb
|
69
97
|
- lib/torquebox/codecs/marshal_base64.rb
|
70
98
|
- lib/torquebox/codecs/marshal_smart.rb
|
71
|
-
- lib/torquebox/
|
72
|
-
- lib/torquebox/
|
73
|
-
|
74
|
-
- lib/torquebox/kernel.rb
|
75
|
-
- lib/torquebox/logger.rb
|
76
|
-
- lib/torquebox/msc.rb
|
77
|
-
- lib/torquebox/registry.rb
|
78
|
-
- lib/torquebox/scheduled_job.rb
|
79
|
-
- lib/torquebox/service.rb
|
80
|
-
- lib/torquebox/service_registry.rb
|
81
|
-
- licenses/cc0-1.0.txt
|
82
|
-
- spec/codecs_spec.rb
|
83
|
-
- spec/injectors_spec.rb
|
84
|
-
- spec/kernel_spec.rb
|
85
|
-
- spec/logger_spec.rb
|
86
|
-
- spec/scheduled_job_spec.rb
|
87
|
-
- spec/service_registry_spec.rb
|
88
|
-
homepage: http://torquebox.org/
|
99
|
+
- lib/torquebox/codecs/text.rb
|
100
|
+
- lib/torquebox/codecs/json.rb
|
101
|
+
homepage: http://torquebox.org/torqbox
|
89
102
|
licenses:
|
90
|
-
-
|
103
|
+
- Apache-2.0
|
91
104
|
metadata: {}
|
92
105
|
post_install_message:
|
93
106
|
rdoc_options: []
|
@@ -95,24 +108,21 @@ require_paths:
|
|
95
108
|
- lib
|
96
109
|
required_ruby_version: !ruby/object:Gem::Requirement
|
97
110
|
requirements:
|
98
|
-
- -
|
111
|
+
- - '>='
|
99
112
|
- !ruby/object:Gem::Version
|
100
|
-
version:
|
113
|
+
version: 1.9.3
|
101
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
115
|
requirements:
|
103
|
-
- -
|
116
|
+
- - '>'
|
104
117
|
- !ruby/object:Gem::Version
|
105
|
-
version:
|
106
|
-
requirements:
|
118
|
+
version: 1.3.1
|
119
|
+
requirements:
|
120
|
+
- jar org.projectodd.wunderboss:wunderboss-ruby, 1.x.incremental.174
|
121
|
+
- jar org.projectodd.wunderboss:wunderboss-wildfly, 1.x.incremental.174
|
107
122
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.1.9
|
109
124
|
signing_key:
|
110
125
|
specification_version: 4
|
111
|
-
summary: TorqueBox
|
112
|
-
test_files:
|
113
|
-
|
114
|
-
- spec/service_registry_spec.rb
|
115
|
-
- spec/logger_spec.rb
|
116
|
-
- spec/codecs_spec.rb
|
117
|
-
- spec/injectors_spec.rb
|
118
|
-
- spec/kernel_spec.rb
|
126
|
+
summary: TorqueBox Next Generation
|
127
|
+
test_files: []
|
128
|
+
has_rdoc:
|
data/lib/gem_hook.rb
DELETED
@@ -1,18 +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 'torquebox/core'
|
@@ -1,32 +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
|
-
class ComponentManager
|
20
|
-
class << self
|
21
|
-
def lookup_component(name)
|
22
|
-
@components ||= {}
|
23
|
-
@components[name]
|
24
|
-
end
|
25
|
-
|
26
|
-
def register_component(name, component)
|
27
|
-
@components ||= {}
|
28
|
-
@components[name] = component
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
data/lib/torquebox/core.rb
DELETED
@@ -1,29 +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
|
-
end
|
20
|
-
|
21
|
-
#require 'torquebox/kernel'
|
22
|
-
require 'torquebox/service_registry'
|
23
|
-
require 'torquebox/component_manager'
|
24
|
-
require 'torquebox/injectors'
|
25
|
-
require 'torquebox/logger'
|
26
|
-
require 'torquebox/msc'
|
27
|
-
require 'torquebox/scheduled_job'
|
28
|
-
require 'torquebox/service'
|
29
|
-
|
data/lib/torquebox/injectors.rb
DELETED
@@ -1,81 +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 'torquebox/msc'
|
19
|
-
require 'torquebox/registry'
|
20
|
-
require 'torquebox/service_registry'
|
21
|
-
|
22
|
-
module TorqueBox
|
23
|
-
|
24
|
-
class InjectionError < StandardError
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.fetch(something,options={})
|
28
|
-
timeout = options[:timeout] || 45
|
29
|
-
unless TorqueBox::Registry.has_key?(something.to_s)
|
30
|
-
handler_registry = TorqueBox::ServiceRegistry['torquebox.core.injection.injectable-handler-registry']
|
31
|
-
# handler_registry should only be nil when running outside of
|
32
|
-
# TorqueBox so we just return the nil value and skip everything
|
33
|
-
# else to facilitate testing outside the container
|
34
|
-
return nil if handler_registry.nil?
|
35
|
-
handler = handler_registry.get_handler(something)
|
36
|
-
raise InjectionError.new("Invalid injection - #{something}") if handler.nil?
|
37
|
-
injectable = handler.handle(something, true)
|
38
|
-
service_name = injectable.get_service_name(TorqueBox::Registry['service-target'],
|
39
|
-
TorqueBox::Registry['deployment-unit'])
|
40
|
-
service = TorqueBox::ServiceRegistry.registry.getService(service_name)
|
41
|
-
raise InjectionError.new("Service not found for injection - #{something}") if service.nil?
|
42
|
-
state = TorqueBox::MSC.wait_for_service_to_start(service, timeout)
|
43
|
-
raise InjectionError.new("Injected service failed to start - #{service_name}") if state != 'UP'
|
44
|
-
value = service.value
|
45
|
-
raise InjectionError.new("Injected service had no value - #{service_name}") if value.nil?
|
46
|
-
value = value.convert(JRuby.runtime) if value.respond_to?(:convert)
|
47
|
-
if something.to_s.start_with?("service:")
|
48
|
-
# don't cache services to support zero-downtime deploys (TORQUE-1217)
|
49
|
-
return value
|
50
|
-
else
|
51
|
-
TorqueBox::Registry.merge!(something.to_s => value)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
TorqueBox::Registry[something.to_s]
|
55
|
-
end
|
56
|
-
|
57
|
-
module Injectors
|
58
|
-
|
59
|
-
def fetch(something,options={})
|
60
|
-
TorqueBox.fetch(something,options)
|
61
|
-
end
|
62
|
-
alias_method :__inject__, :fetch
|
63
|
-
|
64
|
-
%w{ msc service cdi jndi queue topic }.each do |type|
|
65
|
-
define_method("fetch_#{type}".to_sym) do |key|
|
66
|
-
fetch(key)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# Temporarily workaround TorqueSpec needing an inject(...) method
|
74
|
-
# @api private
|
75
|
-
module TorqueSpec
|
76
|
-
class Daemon
|
77
|
-
def inject(something)
|
78
|
-
TorqueBox.fetch(something)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
data/lib/torquebox/kernel.rb
DELETED
@@ -1,47 +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 'torquebox/service_registry'
|
19
|
-
|
20
|
-
module TorqueBox
|
21
|
-
# @api private
|
22
|
-
class Kernel
|
23
|
-
|
24
|
-
def self.kernel=(kernel)
|
25
|
-
$stderr.puts "[WARNING] >>> TorqueBox::Kernel is deprecated. Please begin using TorqueBox::ServiceRegistry instead."
|
26
|
-
# is this even reasonable?
|
27
|
-
TorqueBox::ServiceRegistry.service_registry = kernel
|
28
|
-
end
|
29
|
-
|
30
|
-
# blocks are not allowed on the method named :[]
|
31
|
-
def self.[](name)
|
32
|
-
$stderr.puts "[WARNING] >>> TorqueBox::Kernel is deprecated. Please begin using TorqueBox::ServiceRegistry instead."
|
33
|
-
self.lookup(name)
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.lookup(name, &block)
|
37
|
-
$stderr.puts "[WARNING] >>> TorqueBox::Kernel is deprecated. Please begin using TorqueBox::ServiceRegistry instead."
|
38
|
-
TorqueBox::ServiceRegistry.lookup(name, &block)
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.blocks
|
42
|
-
$stderr.puts "[WARNING] >>> TorqueBox::Kernel is deprecated. Please begin using TorqueBox::ServiceRegistry instead."
|
43
|
-
TorqueBox::ServiceRegistry.blocks
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
data/lib/torquebox/msc.rb
DELETED
@@ -1,98 +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
|
-
|
20
|
-
module TorqueBox
|
21
|
-
class MSC
|
22
|
-
class << self
|
23
|
-
|
24
|
-
def service_registry
|
25
|
-
TorqueBox::Registry['service-registry']
|
26
|
-
end
|
27
|
-
|
28
|
-
def deployment_unit
|
29
|
-
TorqueBox::Registry['deployment-unit']
|
30
|
-
end
|
31
|
-
|
32
|
-
def service_names
|
33
|
-
service_registry.service_names
|
34
|
-
end
|
35
|
-
|
36
|
-
def get_service(service_name)
|
37
|
-
service_registry.get_service(service_name)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Returns (or yields over the items) of list of
|
41
|
-
# services with (canonical) name matching provided
|
42
|
-
# regular expression.
|
43
|
-
#
|
44
|
-
# @param [Regexp] Regular expression to match the name
|
45
|
-
#
|
46
|
-
# @param Optional block. If block is provided it'll
|
47
|
-
# iterate over the values. If there is no block
|
48
|
-
# given this method returns list of services
|
49
|
-
def get_services(regexp, &block)
|
50
|
-
services = []
|
51
|
-
|
52
|
-
TorqueBox::MSC.service_names.each do |name|
|
53
|
-
if name.canonical_name =~ regexp
|
54
|
-
service = TorqueBox::MSC.get_service(name)
|
55
|
-
services << service unless service.nil?
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
if block
|
60
|
-
services.each do |s|
|
61
|
-
yield s
|
62
|
-
end
|
63
|
-
else
|
64
|
-
services
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def java_web_context
|
69
|
-
war_meta_data = deployment_unit.get_attachment(org.jboss.as.web.deployment.WarMetaData::ATTACHMENT_KEY)
|
70
|
-
return nil if war_meta_data.nil? # no web component in this application
|
71
|
-
jboss_web_meta_data = war_meta_data.getMergedJBossWebMetaData
|
72
|
-
virtual_host = jboss_web_meta_data.virtual_hosts.first || 'default-host'
|
73
|
-
context_path = jboss_web_meta_data.context_root
|
74
|
-
context_path = "/#{context_path}" unless context_path.start_with?('/')
|
75
|
-
deployment_service_name = org.jboss.msc.service.ServiceName.parse("jboss.web.deployment")
|
76
|
-
service_name = deployment_service_name.append(virtual_host).append(context_path)
|
77
|
-
get_service(service_name).value
|
78
|
-
end
|
79
|
-
|
80
|
-
# Wait for the given MSC service to start.
|
81
|
-
#
|
82
|
-
# @param [org.jboss.msc.service.Service] MSC service to wait on
|
83
|
-
#
|
84
|
-
# @return String the service state after waiting - one of DOWN,
|
85
|
-
# STARTING, START_FAILED, UP, STOPPING, or REMOVED. This should
|
86
|
-
# be UP unless something went wrong.
|
87
|
-
def wait_for_service_to_start(service, seconds_to_wait)
|
88
|
-
unless service.state.to_s == 'UP'
|
89
|
-
listener = org.torquebox.core.gem.MSCServiceListener.new(service)
|
90
|
-
service.add_listener(listener)
|
91
|
-
service.set_mode(org.jboss.msc.service.ServiceController::Mode::ACTIVE)
|
92
|
-
listener.wait_for_start_or_failure(seconds_to_wait)
|
93
|
-
end
|
94
|
-
service.state.to_s
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|