rboss 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/bin/jboss-profile +90 -0
- data/bin/twiddle +230 -0
- data/examples/jboss_profile/jbb_profile_1.yaml +32 -0
- data/examples/jboss_profile/jbb_profile_2.yaml +32 -0
- data/examples/jboss_profile/jboss_profile.yaml +7 -0
- data/examples/monitor/simple_monitor.rb +61 -0
- data/lib/rboss.rb +25 -0
- data/lib/rboss/component_processor.rb +177 -0
- data/lib/rboss/components/component.rb +52 -0
- data/lib/rboss/components/datasource.rb +198 -0
- data/lib/rboss/components/deploy_folder.rb +104 -0
- data/lib/rboss/components/hypersonic_replacer.rb +58 -0
- data/lib/rboss/components/jbossweb.rb +117 -0
- data/lib/rboss/components/jmx.rb +88 -0
- data/lib/rboss/components/mod_cluster.rb +81 -0
- data/lib/rboss/components/org/6.0/deploy_folder.rb +33 -0
- data/lib/rboss/components/org/jmx.rb +59 -0
- data/lib/rboss/components/profile_folder.rb +44 -0
- data/lib/rboss/components/resource.rb +53 -0
- data/lib/rboss/components/run_conf.rb +90 -0
- data/lib/rboss/components/run_conf.yaml +22 -0
- data/lib/rboss/components/service_script.rb +55 -0
- data/lib/rboss/components/slimming.rb +124 -0
- data/lib/rboss/components/soa-p/hypersonic_replacer.rb +79 -0
- data/lib/rboss/components/soa-p/jmx.rb +47 -0
- data/lib/rboss/components/xadatasource.rb +67 -0
- data/lib/rboss/file_processor.rb +107 -0
- data/lib/rboss/jboss_path.rb +53 -0
- data/lib/rboss/jboss_profile.rb +344 -0
- data/lib/rboss/resources/jboss_init_redhat.sh.erb +140 -0
- data/lib/rboss/resources/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml +282 -0
- data/lib/rboss/resources/mod_cluster.sar/mod_cluster-1.1.2.Final.jar +0 -0
- data/lib/rboss/resources/run.conf.erb +62 -0
- data/lib/rboss/twiddle.rb +25 -0
- data/lib/rboss/twiddle/base_monitor.rb +57 -0
- data/lib/rboss/twiddle/mbean.rb +82 -0
- data/lib/rboss/twiddle/monitor.rb +144 -0
- data/lib/rboss/twiddle/scanner.rb +92 -0
- data/lib/rboss/twiddle/twiddle.rb +71 -0
- data/lib/rboss/utils.rb +33 -0
- data/lib/rboss/version.rb +25 -0
- data/rboss.gemspec +20 -0
- data/test/datasource_test.rb +211 -0
- data/test/deploy_folder_test.rb +126 -0
- data/test/mbean_test.rb +53 -0
- data/test/test_helper.rb +124 -0
- data/test/test_suite.rb +35 -0
- metadata +109 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Copyright (c) 2011 Marcelo Guimarães <ataxexe@gmail.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
module JBoss
|
24
|
+
|
25
|
+
class DeployFolder
|
26
|
+
|
27
|
+
def configure_vfs
|
28
|
+
# No VFS configuration
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Copyright (c) 2011 Marcelo Guimarães <ataxexe@gmail.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
module JBoss
|
24
|
+
|
25
|
+
# An extension to the base JXM class that secures the jmx-console
|
26
|
+
# for the JBoss.org servers.
|
27
|
+
#
|
28
|
+
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
29
|
+
class JMX
|
30
|
+
|
31
|
+
alias_method :base_process, :process
|
32
|
+
|
33
|
+
def process
|
34
|
+
base_process
|
35
|
+
secure_jmx_console
|
36
|
+
end
|
37
|
+
|
38
|
+
def secure_jmx_console
|
39
|
+
processor = new_file_processor
|
40
|
+
processor.with "#{@jboss.profile}/deploy/jmx-console.war/WEB-INF/jboss-web.xml", :xml do |action|
|
41
|
+
action.to_process do |xml, jboss|
|
42
|
+
xml.root << Document::new("<security-domain>java:/jaas/jmx-console</security-domain>")
|
43
|
+
xml
|
44
|
+
end
|
45
|
+
end
|
46
|
+
processor.with "#{@jboss.profile}/deploy/jmx-console.war/WEB-INF/web.xml" do |action|
|
47
|
+
action.to_process do |content, jboss|
|
48
|
+
content.gsub! /<security-constraint>/, "--> <security-constraint>"
|
49
|
+
content.gsub! /<\/security-constraint>/, "</security-constraint><!--"
|
50
|
+
content
|
51
|
+
end
|
52
|
+
end
|
53
|
+
processor.process
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Copyright (c) 2011 Marcelo Guimarães <ataxexe@gmail.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require_relative "component"
|
24
|
+
|
25
|
+
module JBoss
|
26
|
+
class ProfileFolder
|
27
|
+
include Component, FileUtils
|
28
|
+
|
29
|
+
def process
|
30
|
+
if File.exists? @jboss.profile
|
31
|
+
remove_profile_folder
|
32
|
+
end
|
33
|
+
@logger.info "Copying profile #{@config} to #{@jboss.profile_name}..."
|
34
|
+
cp_r "#{@jboss}/server/#{@config}", "#{@jboss.profile}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def remove_profile_folder
|
38
|
+
@logger.info "Removing installed profile #{@jboss.profile_name}"
|
39
|
+
rm_rf @jboss.profile
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Copyright (c) 2011 Marcelo Guimarães <ataxexe@gmail.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require_relative "component"
|
24
|
+
|
25
|
+
module JBoss
|
26
|
+
|
27
|
+
# A class to add resources to a JBoss Profile
|
28
|
+
#
|
29
|
+
# Any resource can be added using the following structure:
|
30
|
+
#
|
31
|
+
# absolute_path => [resource_a_path, resource_b_path, ...],
|
32
|
+
# relative_path => resource_c_path
|
33
|
+
#
|
34
|
+
# Relative paths are based on the profile path (example: "lib" is $JBOSS_HOME/server/$JBOSS_PROFILE/lib)
|
35
|
+
#
|
36
|
+
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
37
|
+
class Resource
|
38
|
+
include Component, FileUtils
|
39
|
+
|
40
|
+
def process
|
41
|
+
@logger.info "Including resources..."
|
42
|
+
@config.each do |to_path, resources|
|
43
|
+
resources = [resources] unless resources.is_a? Array
|
44
|
+
resources.each do |resource|
|
45
|
+
to_path = "#{@jboss.profile}/#{to_path}" unless to_path.to_s.start_with? '/'
|
46
|
+
cp_r File.expand_path(resource), to_path
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Copyright (c) 2011 Marcelo Guimarães <ataxexe@gmail.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require_relative "component"
|
24
|
+
|
25
|
+
require 'yaml'
|
26
|
+
require 'erb'
|
27
|
+
|
28
|
+
module JBoss
|
29
|
+
# A class to create a custom run.conf file to a JBoss Profile
|
30
|
+
#
|
31
|
+
# The configuration is based on a erb template, variables and jvm args:
|
32
|
+
#
|
33
|
+
# :template_path => an absolute path to the template
|
34
|
+
# :template => the template string
|
35
|
+
# :jvm_args => array with the jvm args to use in JAVA_OPTS, stored in @jvm_args
|
36
|
+
# any other key will be stored in a @config variable
|
37
|
+
#
|
38
|
+
# This class is used as the binding for erb processor.
|
39
|
+
#
|
40
|
+
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
41
|
+
class RunConf
|
42
|
+
include Component
|
43
|
+
|
44
|
+
def defaults
|
45
|
+
{:jvm_args => []}
|
46
|
+
end
|
47
|
+
|
48
|
+
def configure config
|
49
|
+
@template_path = config.delete :template_path
|
50
|
+
@template = config.delete :template
|
51
|
+
@jvm_args = config.delete :jvm_args
|
52
|
+
@config = config
|
53
|
+
parse_config
|
54
|
+
end
|
55
|
+
|
56
|
+
def process
|
57
|
+
@logger.info "Creating and configuring run.conf"
|
58
|
+
if @template_path
|
59
|
+
processor = new_file_processor
|
60
|
+
processor.with @template_path do |action|
|
61
|
+
action.to_process do |content|
|
62
|
+
process_template content
|
63
|
+
end
|
64
|
+
processor.copy_to "#{@jboss.profile}/run.conf"
|
65
|
+
end
|
66
|
+
processor.process
|
67
|
+
else
|
68
|
+
File.open("#{@jboss.profile}/run.conf", "w+") { |f| f.write process_template @template }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def process_template content
|
75
|
+
erb = ERB::new(content, 0, "%<>")
|
76
|
+
erb.result binding
|
77
|
+
end
|
78
|
+
|
79
|
+
def parse_config
|
80
|
+
map = YAML::load File.open(File::join(File.dirname(__FILE__), "run_conf.yaml"))
|
81
|
+
|
82
|
+
(@config.find_all { |key, value| map.has_key? key.to_s }).each do |key, value|
|
83
|
+
@jvm_args << "-D#{map[key.to_s]}=#{value}"
|
84
|
+
@config.delete key.to_sym
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# These entries can be passed to RunConf component. They will be replaced by -D{value}
|
2
|
+
#general
|
3
|
+
log_dir : jboss.server.log.dir
|
4
|
+
# Cluster
|
5
|
+
partition_name : jboss.partition.name
|
6
|
+
multicast_ip : jboss.partition.udpGroup
|
7
|
+
# mod_cluster
|
8
|
+
advertise : jboss.mod_cluster.advertise
|
9
|
+
advertise_group_address : jboss.mod_cluster.advertise.address
|
10
|
+
advertise_port : jboss.mod_cluster.advertise.port
|
11
|
+
proxy_list : jboss.mod_cluster.proxyList
|
12
|
+
excluded_contexts : jboss.mod_cluster.excludedContexts
|
13
|
+
auto_enable_contexts : jboss.mod_cluster.autoEnableContexts
|
14
|
+
# Messaging
|
15
|
+
peer_id : jboss.messaging.ServerPeerID
|
16
|
+
# Service Binding
|
17
|
+
service_binding : jboss.service.binding.set
|
18
|
+
# jbossweb engine
|
19
|
+
jvm_route : jboss.jbossweb.jvmRoute
|
20
|
+
# JGroups
|
21
|
+
jgroups_stack : jboss.default.jgroups.stack
|
22
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Copyright (c) 2011 Marcelo Guimarães <ataxexe@gmail.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require_relative "component"
|
24
|
+
|
25
|
+
module JBoss
|
26
|
+
|
27
|
+
class ServiceScript
|
28
|
+
include Component
|
29
|
+
|
30
|
+
def initialize jboss, logger, config
|
31
|
+
@logger = logger
|
32
|
+
@jboss = jboss
|
33
|
+
@template_path = config.delete :path
|
34
|
+
@config = config
|
35
|
+
@config[:profile] = @jboss.profile_name
|
36
|
+
@config[:jboss_home] = @jboss.home
|
37
|
+
@name = @config[:name]
|
38
|
+
@name ||= "jboss_init_#{@jboss.profile_name}.sh"
|
39
|
+
end
|
40
|
+
|
41
|
+
def process
|
42
|
+
@logger.info "Configuring service script..."
|
43
|
+
processor = new_file_processor
|
44
|
+
processor.with @template_path do |action|
|
45
|
+
action.to_process do |content|
|
46
|
+
erb = ERB::new(content, 0, "%<>")
|
47
|
+
erb.result binding
|
48
|
+
end
|
49
|
+
processor.copy_to "#{@jboss}/bin/#{@name}"
|
50
|
+
end
|
51
|
+
processor.process
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# The MIT License
|
2
|
+
#
|
3
|
+
# Copyright (c) 2011 Marcelo Guimarães <ataxexe@gmail.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require_relative 'component'
|
24
|
+
|
25
|
+
module JBoss
|
26
|
+
# A class for slimming a JBoss profile
|
27
|
+
#
|
28
|
+
# Configuration:
|
29
|
+
#
|
30
|
+
# Pass an array with the services to remove, the current supported are:
|
31
|
+
#
|
32
|
+
# Admin Console => :admin_console
|
33
|
+
# Web Console => :web_console
|
34
|
+
# Mail Service => :mail
|
35
|
+
# Bsh Deployer => :bsh_deployer
|
36
|
+
# Hot Deploy => :hot_deploy
|
37
|
+
# JUDDI => :juddi
|
38
|
+
# UUID Key Generator => :key_generator
|
39
|
+
# Scheduling => :scheduling
|
40
|
+
# JMX Console => :jmx_console
|
41
|
+
# JBoss WS => :jboss_ws
|
42
|
+
# JMX Remoting => :jmx_remoting
|
43
|
+
# ROOT Page => :root_page
|
44
|
+
#
|
45
|
+
# Each service is binded to a remove_$SERVICE_ID method so you can easily add
|
46
|
+
# more services by modifying this class
|
47
|
+
#
|
48
|
+
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
49
|
+
class Slimming
|
50
|
+
include Component, FileUtils
|
51
|
+
|
52
|
+
def configure services_to_remove
|
53
|
+
@services_to_remove = services_to_remove
|
54
|
+
end
|
55
|
+
|
56
|
+
def process
|
57
|
+
@services_to_remove.each do |service|
|
58
|
+
message = "remove_#{service}".to_sym
|
59
|
+
@logger.info "Removing #{service}"
|
60
|
+
self.send message
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def remove_hot_deploy
|
65
|
+
reject("#{@jboss.profile}/deploy/hdscanner-jboss-beans.xml")
|
66
|
+
end
|
67
|
+
|
68
|
+
def remove_juddi
|
69
|
+
reject("#{@jboss.profile}/deploy/juddi-service.sar")
|
70
|
+
end
|
71
|
+
|
72
|
+
def remove_key_generator
|
73
|
+
reject("#{@jboss.profile}/deploy/uuid-key-generator.sar")
|
74
|
+
end
|
75
|
+
|
76
|
+
def remove_mail
|
77
|
+
reject("#{@jboss.profile}/deploy/mail-ra.rar")
|
78
|
+
reject("#{@jboss.profile}/deploy/mail-service.xml")
|
79
|
+
end
|
80
|
+
|
81
|
+
def remove_scheduling
|
82
|
+
reject("#{@jboss.profile}/deploy/scheduler-manager-service.xml")
|
83
|
+
reject("#{@jboss.profile}/deploy/scheduler-service.xml")
|
84
|
+
end
|
85
|
+
|
86
|
+
def remove_bsh_deployer
|
87
|
+
reject("#{@jboss.profile}/deployers/bsh.deployer")
|
88
|
+
end
|
89
|
+
|
90
|
+
def remove_jboss_ws
|
91
|
+
reject("#{@jboss.profile}/conf/jax-ws-catalog.xml")
|
92
|
+
reject("#{@jboss.profile}/conf/props/jbossws-users.properties")
|
93
|
+
reject("#{@jboss.profile}/conf/props/jbossws-roles.properties")
|
94
|
+
reject("#{@jboss.profile}/deploy/jbossws.sar")
|
95
|
+
reject("#{@jboss.profile}/deployers/jbossws.deployer")
|
96
|
+
end
|
97
|
+
|
98
|
+
def remove_jmx_console
|
99
|
+
reject("#{@jboss.profile}/deploy/jmx-console.war")
|
100
|
+
end
|
101
|
+
|
102
|
+
def remove_admin_console
|
103
|
+
reject("#{@jboss.profile}/deploy/admin-console.war")
|
104
|
+
end
|
105
|
+
|
106
|
+
def remove_web_console
|
107
|
+
reject("#{@jboss.profile}/deploy/management")
|
108
|
+
end
|
109
|
+
|
110
|
+
def remove_jmx_remoting
|
111
|
+
reject("#{@jboss.profile}/deploy/jmx-remoting.sar")
|
112
|
+
end
|
113
|
+
|
114
|
+
def remove_root_page
|
115
|
+
reject("#{@jboss.profile}/deploy/ROOT.war")
|
116
|
+
end
|
117
|
+
|
118
|
+
def reject file
|
119
|
+
mv(file, file + ".rej")
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|