rboss 0.9.1 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/rboss.iml +65 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/Gemfile +2 -2
- data/README.md +34 -397
- data/bin/rboss-cli +77 -28
- data/lib/rboss.rb +10 -12
- data/lib/rboss/cli/invoker.rb +31 -18
- data/lib/rboss/cli/mappings.rb +11 -10
- data/lib/rboss/cli/mappings/resources/connector.yaml +2 -2
- data/lib/rboss/cli/mappings/resources/datasource.yaml +5 -5
- data/lib/rboss/cli/mappings/resources/deployment-scanner.yaml +3 -3
- data/lib/rboss/cli/mappings/resources/interface.yaml +2 -2
- data/lib/rboss/cli/mappings/resources/jdbc-driver.yaml +12 -0
- data/lib/rboss/cli/mappings/resources/jms-queue.yaml +44 -0
- data/lib/rboss/cli/mappings/resources/runtime.yaml +34 -0
- data/lib/rboss/cli/mappings/resources/server.yaml +8 -8
- data/lib/rboss/cli/resource.rb +60 -37
- data/lib/rboss/cli/result_parser.rb +29 -5
- data/lib/rboss/plaftorm.rb +2 -25
- data/lib/rboss/utils.rb +2 -8
- data/lib/rboss/version.rb +1 -1
- data/lib/rboss/view/colorizers.rb +4 -2
- data/lib/rboss/view/formatters.rb +37 -0
- data/lib/rboss/view/table_builder.rb +2 -2
- data/rboss-cli-bash-completion +82 -0
- data/rboss.gemspec +12 -12
- data/rboss.iml +6 -7
- data/rboss.ipr +2 -11
- metadata +23 -53
- data/bin/rboss-profile +0 -125
- data/bin/rboss-twiddle +0 -204
- data/lib/rboss/bin/command_actions.rb +0 -125
- data/lib/rboss/cli/mappings/resources/jdbc_driver.yaml +0 -12
- data/lib/rboss/component_processor.rb +0 -179
- data/lib/rboss/components/component.rb +0 -58
- data/lib/rboss/components/datasource.rb +0 -179
- data/lib/rboss/components/deploy_folder.rb +0 -104
- data/lib/rboss/components/hypersonic_replacer.rb +0 -58
- data/lib/rboss/components/jbossweb.rb +0 -119
- data/lib/rboss/components/jmx.rb +0 -88
- data/lib/rboss/components/mod_cluster.rb +0 -81
- data/lib/rboss/components/org/6.0/deploy_folder.rb +0 -33
- data/lib/rboss/components/org/jmx.rb +0 -59
- data/lib/rboss/components/profile_folder.rb +0 -44
- data/lib/rboss/components/resource.rb +0 -52
- data/lib/rboss/components/restore_slimming.rb +0 -46
- data/lib/rboss/components/run_conf.rb +0 -90
- data/lib/rboss/components/run_conf.yaml +0 -22
- data/lib/rboss/components/service_script.rb +0 -55
- data/lib/rboss/components/slimming.rb +0 -107
- data/lib/rboss/components/slimming.yaml +0 -110
- data/lib/rboss/components/soa-p/hypersonic_replacer.rb +0 -79
- data/lib/rboss/components/soa-p/jmx.rb +0 -47
- data/lib/rboss/components/xadatasource.rb +0 -67
- data/lib/rboss/file_processor.rb +0 -111
- data/lib/rboss/jboss_path.rb +0 -74
- data/lib/rboss/jboss_profile.rb +0 -350
- data/lib/rboss/resources/jboss_init_redhat.sh.erb +0 -140
- data/lib/rboss/resources/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml +0 -282
- data/lib/rboss/resources/mod_cluster.sar/mod_cluster-1.1.2.Final.jar +0 -0
- data/lib/rboss/resources/run.conf.bat.erb +0 -60
- data/lib/rboss/resources/run.conf.erb +0 -62
- data/lib/rboss/twiddle.rb +0 -25
- data/lib/rboss/twiddle/base_monitor.rb +0 -88
- data/lib/rboss/twiddle/mbean.rb +0 -148
- data/lib/rboss/twiddle/monitor.rb +0 -222
- data/lib/rboss/twiddle/twiddle.rb +0 -87
data/lib/rboss/components/jmx.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
# The MIT License
|
2
|
-
#
|
3
|
-
# Copyright (c) 2011-2012 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 RBoss
|
26
|
-
# This class configures the JXM user for a JBoss profile.
|
27
|
-
#
|
28
|
-
# Configuration:
|
29
|
-
#
|
30
|
-
# :user => the jxm user (default: 'admin')
|
31
|
-
# :password => the jmx user password (default: 'admin')
|
32
|
-
# :roles => the roles mapped for the user (default: 'JBossAdmin,HttpInvoker')
|
33
|
-
#
|
34
|
-
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
35
|
-
class JMX
|
36
|
-
include Component
|
37
|
-
|
38
|
-
def configure config
|
39
|
-
@config = config
|
40
|
-
@password = config[:password]
|
41
|
-
@user = config[:user]
|
42
|
-
@roles = config[:roles]
|
43
|
-
end
|
44
|
-
|
45
|
-
def defaults
|
46
|
-
{
|
47
|
-
:user => "admin",
|
48
|
-
:password => "admin",
|
49
|
-
:roles => "JBossAdmin,HttpInvoker"
|
50
|
-
}
|
51
|
-
end
|
52
|
-
|
53
|
-
def process
|
54
|
-
configure_users
|
55
|
-
configure_roles
|
56
|
-
end
|
57
|
-
|
58
|
-
def configure_users
|
59
|
-
processor = new_file_processor
|
60
|
-
processor.with "#{@jboss.profile}/conf/props/#{users_properties_file}" do |action|
|
61
|
-
action.to_process do |content, jboss|
|
62
|
-
[@user, @password].join '='
|
63
|
-
end
|
64
|
-
end
|
65
|
-
processor.process
|
66
|
-
end
|
67
|
-
|
68
|
-
def configure_roles
|
69
|
-
processor = new_file_processor
|
70
|
-
processor.with "#{@jboss.profile}/conf/props/#{roles_properties_file}" do |action|
|
71
|
-
action.to_process do |content, jboss|
|
72
|
-
[@user, @roles].join '='
|
73
|
-
end
|
74
|
-
end
|
75
|
-
processor.process
|
76
|
-
end
|
77
|
-
|
78
|
-
def users_properties_file
|
79
|
-
"jmx-console-users.properties"
|
80
|
-
end
|
81
|
-
|
82
|
-
def roles_properties_file
|
83
|
-
"jmx-console-roles.properties"
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
# The MIT License
|
2
|
-
#
|
3
|
-
# Copyright (c) 2011-2012 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
|
-
require_relative "../jboss_path"
|
25
|
-
|
26
|
-
require "logger"
|
27
|
-
require "rexml/document"
|
28
|
-
|
29
|
-
include REXML
|
30
|
-
|
31
|
-
module RBoss
|
32
|
-
# A class to install and configure a mod_cluster service in a JBoss profile
|
33
|
-
#
|
34
|
-
# Configuration:
|
35
|
-
#
|
36
|
-
# :path => where the mod_cluster.sar is located
|
37
|
-
# :folder => where the mod_cluster.sar should be installed (default: $JBOSS_HOME/server/$CONFIG/deploy)
|
38
|
-
#
|
39
|
-
# The additional configurations are the entries in the bean ModClusterConfig (mod_cluster-jboss-beans.xml)
|
40
|
-
# and can be in a String form (using the entry name) or in a Symbol form (using ruby nomenclature - :sticky_session)
|
41
|
-
#
|
42
|
-
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
43
|
-
class ModCluster
|
44
|
-
include Component, FileUtils
|
45
|
-
|
46
|
-
def defaults
|
47
|
-
{:folder => "#{@jboss.profile}/deploy"}
|
48
|
-
end
|
49
|
-
|
50
|
-
def configure config
|
51
|
-
@path = config.delete :path
|
52
|
-
@folder = config.delete :folder
|
53
|
-
@config = config
|
54
|
-
end
|
55
|
-
|
56
|
-
def process
|
57
|
-
@logger.info "Installing mod_cluster.sar"
|
58
|
-
cp_r @path, @folder
|
59
|
-
|
60
|
-
return if @config.empty?
|
61
|
-
|
62
|
-
@logger.info "Configuring mod_cluster.sar"
|
63
|
-
processor = new_file_processor
|
64
|
-
processor.with "#{@folder}/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml", :xml do |action|
|
65
|
-
action.to_process do |xml, jboss|
|
66
|
-
config = XPath.first(xml, "//bean[@name='ModClusterConfig']")
|
67
|
-
@config.each do |property, value|
|
68
|
-
element = XPath.first config, "property[@name='#{property.to_s.camelize.uncapitalize}']"
|
69
|
-
if element
|
70
|
-
@logger.debug "Configuring #{element.attribute('name').value} to \"#{value}\""
|
71
|
-
element.text = value
|
72
|
-
end
|
73
|
-
end
|
74
|
-
xml
|
75
|
-
end
|
76
|
-
end
|
77
|
-
processor.process
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# The MIT License
|
2
|
-
#
|
3
|
-
# Copyright (c) 2011-2012 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 RBoss
|
24
|
-
|
25
|
-
class DeployFolder
|
26
|
-
|
27
|
-
def configure_vfs
|
28
|
-
# No VFS configuration
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# The MIT License
|
2
|
-
#
|
3
|
-
# Copyright (c) 2011-2012 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 RBoss
|
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
|
-
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# The MIT License
|
2
|
-
#
|
3
|
-
# Copyright (c) 2011-2012 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 RBoss
|
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
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# The MIT License
|
2
|
-
#
|
3
|
-
# Copyright (c) 2011-2012 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 RBoss
|
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].each do |resource|
|
44
|
-
to_path = "#{@jboss.profile}/#{to_path}" unless to_path.to_s.start_with? '/'
|
45
|
-
cp_r File.expand_path(resource), to_path
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# The MIT License
|
2
|
-
#
|
3
|
-
# Copyright (c) 2011-2012 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 'slimming'
|
24
|
-
|
25
|
-
module RBoss
|
26
|
-
# A class for restore slimmed services in a JBoss profile
|
27
|
-
#
|
28
|
-
# Configuration:
|
29
|
-
#
|
30
|
-
# See the RBoss::Slimming class for supported services
|
31
|
-
#
|
32
|
-
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
33
|
-
class Restore < RBoss::Slimming
|
34
|
-
|
35
|
-
def log service
|
36
|
-
@logger.info "Enabling #{service}"
|
37
|
-
end
|
38
|
-
|
39
|
-
def handle file
|
40
|
-
file = "#{@jboss.profile}/" + file unless file.start_with? '/'
|
41
|
-
mv(file + ".rej", file) if File.exist?(file + ".rej")
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
# The MIT License
|
2
|
-
#
|
3
|
-
# Copyright (c) 2011-2012 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 RBoss
|
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, RBoss::Platform
|
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 run_conf
|
65
|
-
end
|
66
|
-
processor.process
|
67
|
-
else
|
68
|
-
File.open(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 = load_yaml "run_conf"
|
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
|