rboss 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -1,58 +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 "../file_processor"
|
24
|
-
require_relative "../jboss_path"
|
25
|
-
require_relative "../utils"
|
26
|
-
|
27
|
-
require 'yaml'
|
28
|
-
|
29
|
-
module RBoss
|
30
|
-
|
31
|
-
# A base helper module for JBoss Components
|
32
|
-
#
|
33
|
-
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
34
|
-
module Component
|
35
|
-
|
36
|
-
def initialize jboss, logger, config
|
37
|
-
@jboss = jboss
|
38
|
-
@logger = logger
|
39
|
-
config = defaults.merge! config if self.respond_to? :defaults
|
40
|
-
configure(config)
|
41
|
-
end
|
42
|
-
|
43
|
-
def configure config
|
44
|
-
@config = config
|
45
|
-
end
|
46
|
-
|
47
|
-
# Creates a FileProcessor using the same logger and
|
48
|
-
# jboss path as the variable
|
49
|
-
def new_file_processor
|
50
|
-
RBoss::FileProcessor::new :logger => @logger, :var => @jboss
|
51
|
-
end
|
52
|
-
|
53
|
-
def load_yaml resource
|
54
|
-
YAML::load_file File::join(File.dirname(__FILE__), "#{resource}.yaml")
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|
@@ -1,179 +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 "logger"
|
26
|
-
require "rexml/document"
|
27
|
-
|
28
|
-
include REXML
|
29
|
-
|
30
|
-
module RBoss
|
31
|
-
|
32
|
-
# A class to configure a JBoss Datasource.
|
33
|
-
#
|
34
|
-
# For converting the property (if it is a Symbol), the above rules are used taking by example a
|
35
|
-
# value ":database_url":
|
36
|
-
# a. The value "database_url"
|
37
|
-
# b. The value "database-url"
|
38
|
-
# c. The value "DatabaseUrl"
|
39
|
-
# d. The value "DATABASE_URL"
|
40
|
-
#
|
41
|
-
# The key for finding the correct datasource is the configuration attribute :type, which is used
|
42
|
-
# to search in $JBOSS_HOME/docs/examples/jca for the file.
|
43
|
-
#
|
44
|
-
# Any key that is not found in the datasource template will be added. If it is a Symbol, the underlines will be
|
45
|
-
# converted to hyphens.
|
46
|
-
#
|
47
|
-
# For saving the file, the configuration :name will be used in the form "${name}-ds.xml".
|
48
|
-
#
|
49
|
-
# Configuration:
|
50
|
-
#
|
51
|
-
# :folder => a folder where this datasource will be saved (default: $JBOSS_HOME/server/$CONFIG/deploy)
|
52
|
-
# if a relative path is given, it will be appended to default value
|
53
|
-
# :encrypt => a flag to indicate if the password should be encrypted (default: false)
|
54
|
-
# :type => the type of the datasource
|
55
|
-
# :name => a name for saving the file (default: :type)
|
56
|
-
# :attributes => a Hash with the attributes that will be changed in template (the only required is :jndi_name)
|
57
|
-
# Any attribute that is not present in datasource xml will be created using this template: <key>value</key>.
|
58
|
-
#
|
59
|
-
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
60
|
-
class Datasource
|
61
|
-
include Component
|
62
|
-
|
63
|
-
attr_accessor :jndi_name, :attributes, :type, :name
|
64
|
-
|
65
|
-
def defaults
|
66
|
-
{
|
67
|
-
:folder => "#{@jboss.profile}/deploy",
|
68
|
-
:encrypt => false,
|
69
|
-
:attributes => {}
|
70
|
-
}
|
71
|
-
end
|
72
|
-
|
73
|
-
def configure config
|
74
|
-
config[:type] = :mssql if config[:type].to_s == "sqlserver"
|
75
|
-
@type = config[:type].to_s.gsub /_/, '-'
|
76
|
-
@name = config[:name]
|
77
|
-
@name ||= @type.to_s
|
78
|
-
@folder = config[:folder].to_s
|
79
|
-
@folder = "#{@jboss.profile}/#{@folder}" unless @folder.start_with? '/'
|
80
|
-
@attributes = config[:attributes]
|
81
|
-
@encrypt = config[:encrypt]
|
82
|
-
@jndi_name = @attributes.delete :jndi_name
|
83
|
-
end
|
84
|
-
|
85
|
-
def process
|
86
|
-
if @encrypt
|
87
|
-
@user = @attributes.delete :user
|
88
|
-
@user = @attributes.delete :user_name unless @user
|
89
|
-
@password = @jboss.encrypt @attributes.delete(:password)
|
90
|
-
end
|
91
|
-
processor = new_file_processor
|
92
|
-
processor.with "#{@jboss.home}/docs/examples/jca/#{@type}-ds.xml", :xml do |action|
|
93
|
-
action.to_process do |xml, jboss|
|
94
|
-
element = XPath.first xml, "//jndi-name"
|
95
|
-
element.text = @jndi_name
|
96
|
-
configure_datasource xml
|
97
|
-
|
98
|
-
if @encrypt
|
99
|
-
security_domain = Element::new "security-domain"
|
100
|
-
security_domain.text = @name
|
101
|
-
|
102
|
-
xml.root.elements[1] << security_domain
|
103
|
-
end
|
104
|
-
action.copy_to "#{@folder}/#{@name}-ds.xml"
|
105
|
-
xml
|
106
|
-
end
|
107
|
-
end
|
108
|
-
@logger.info "Creating datasource #{@name}"
|
109
|
-
processor.process
|
110
|
-
if @encrypt
|
111
|
-
create_login_module
|
112
|
-
create_login_config
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def find xml, key
|
117
|
-
if key.is_a? Symbol
|
118
|
-
key = key.to_s
|
119
|
-
[key, key.gsub(/_/, '-'), key.camelize, key.upcase].each do |k|
|
120
|
-
element = XPath.first xml, yield(k)
|
121
|
-
return element if element
|
122
|
-
end
|
123
|
-
else
|
124
|
-
XPath.first xml, yield(key)
|
125
|
-
end
|
126
|
-
nil
|
127
|
-
end
|
128
|
-
|
129
|
-
def configure_datasource xml
|
130
|
-
if @encrypt
|
131
|
-
xml.root.delete_element "//user-name"
|
132
|
-
xml.root.delete_element "//password"
|
133
|
-
@service = "LocalTxCM"
|
134
|
-
end
|
135
|
-
@attributes.each do |key, value|
|
136
|
-
element = find(xml, key) { |k| "//#{k}" }
|
137
|
-
|
138
|
-
if element
|
139
|
-
element.text = value
|
140
|
-
else
|
141
|
-
insert_attribute xml, key, value
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
def insert_attribute xml, key, value
|
147
|
-
if key.is_a? Symbol
|
148
|
-
element = Element::new key.to_s.gsub /_/, '-'
|
149
|
-
else
|
150
|
-
element = Element::new key
|
151
|
-
end
|
152
|
-
element.text = value
|
153
|
-
xml.root.elements[1] << element
|
154
|
-
end
|
155
|
-
|
156
|
-
def create_login_config
|
157
|
-
File.open("#{@folder}/#{@name}.login-module.xml", 'w+') { |f| f.write @login_module }
|
158
|
-
end
|
159
|
-
|
160
|
-
def create_login_module
|
161
|
-
@login_module = Document::new <<XML
|
162
|
-
<policy>
|
163
|
-
<application-policy name='#{@name}'>
|
164
|
-
<authentication>
|
165
|
-
<login-module code='org.jboss.resource.security.SecureIdentityLoginModule' flag='required'>
|
166
|
-
<module-option name='username'>#{@user}</module-option>
|
167
|
-
<module-option name='password'>#{@password}</module-option>
|
168
|
-
<module-option name='managedConnectionFactoryName'>jboss.jca:name=#{@jndi_name},service=#{@service}</module-option>
|
169
|
-
</login-module>
|
170
|
-
</authentication>
|
171
|
-
</application-policy>
|
172
|
-
</policy>
|
173
|
-
XML
|
174
|
-
end
|
175
|
-
|
176
|
-
|
177
|
-
end
|
178
|
-
|
179
|
-
end
|
@@ -1,104 +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 "rexml/document"
|
26
|
-
|
27
|
-
include REXML
|
28
|
-
|
29
|
-
module RBoss
|
30
|
-
|
31
|
-
# A class to add deploy folders to a JBoss Profile.
|
32
|
-
#
|
33
|
-
#
|
34
|
-
# Note: there is a bug in JBoss (https://issues.jboss.org/browse/JBAS-9387) that affect
|
35
|
-
# this class if profile.xml needs to be changed (deploy folder outside
|
36
|
-
# $JBOSS_HOME/server/$PROFILE/deploy)
|
37
|
-
#
|
38
|
-
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
39
|
-
class DeployFolder
|
40
|
-
include Component, FileUtils
|
41
|
-
|
42
|
-
def configure folder
|
43
|
-
@folder = folder.to_s
|
44
|
-
|
45
|
-
@absolute_path = @folder.start_with? '/'
|
46
|
-
@outside_deploy = (!@folder.start_with?('deploy') and not @absolute_path)
|
47
|
-
|
48
|
-
@configure_vsf_and_profile = (@absolute_path or @outside_deploy)
|
49
|
-
|
50
|
-
@path = @absolute_path ? @folder : "#{@jboss.profile}/#{@folder}"
|
51
|
-
|
52
|
-
@folder = "${jboss.server.home.url}#{@folder}" if @outside_deploy
|
53
|
-
@folder = "file://#{@folder}" if @absolute_path
|
54
|
-
end
|
55
|
-
|
56
|
-
def process
|
57
|
-
@logger.info "Creating deploy folder: #{@path}"
|
58
|
-
mkdir_p @path
|
59
|
-
|
60
|
-
if @configure_vsf_and_profile
|
61
|
-
@logger.warn "Please change your profile.xml file according to this issue <https://issues.jboss.org/browse/JBAS-9387>"
|
62
|
-
configure_vfs
|
63
|
-
configure_profile
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def configure_profile
|
68
|
-
@logger.info "Updating profile.xml"
|
69
|
-
processor = new_file_processor
|
70
|
-
processor.with "#{@jboss.profile}/conf/bootstrap/profile.xml", :xml do |action|
|
71
|
-
action.to_process do |xml, jboss|
|
72
|
-
element = XPath.first xml, "//property[@name='applicationURIs']"
|
73
|
-
element = XPath.first element, "//list[@elementClass='java.net.URI']"
|
74
|
-
deploy = Element::new "value"
|
75
|
-
deploy.text = @folder
|
76
|
-
element << deploy
|
77
|
-
xml
|
78
|
-
end
|
79
|
-
end
|
80
|
-
processor.process
|
81
|
-
end
|
82
|
-
|
83
|
-
def configure_vfs
|
84
|
-
@logger.info "Updating vfs.xml"
|
85
|
-
processor = new_file_processor
|
86
|
-
processor.with "#{@jboss.profile}/conf/bootstrap/vfs.xml", :xml do |action|
|
87
|
-
action.to_process do |xml, jboss|
|
88
|
-
map = XPath.first xml, "//map[@keyClass='java.net.URL']"
|
89
|
-
entry = Document::new <<XML
|
90
|
-
<entry>
|
91
|
-
<key>#{@folder}</key>
|
92
|
-
<value><inject bean="VfsNamesExceptionHandler"/></value>
|
93
|
-
</entry>
|
94
|
-
XML
|
95
|
-
map << entry
|
96
|
-
xml
|
97
|
-
end
|
98
|
-
end
|
99
|
-
processor.process
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
@@ -1,58 +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 "datasource"
|
24
|
-
require_relative "component"
|
25
|
-
|
26
|
-
module RBoss
|
27
|
-
# A class to replace the shipped Hypersonic datasource for a JBoss profile.
|
28
|
-
#
|
29
|
-
# Configuration:
|
30
|
-
#
|
31
|
-
# The configuration can be a JBossDatasource or a Hash to configure a JBossDatasource.
|
32
|
-
#
|
33
|
-
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
34
|
-
class HypersonicReplacer
|
35
|
-
include Component, FileUtils
|
36
|
-
|
37
|
-
def configure config
|
38
|
-
@datasource = config if config.is_a? Datasource
|
39
|
-
@datasource ||= Datasource::new(@jboss, @logger, config)
|
40
|
-
@datasource.jndi_name = "DefaultDS"
|
41
|
-
end
|
42
|
-
|
43
|
-
def process
|
44
|
-
@logger.info "Removing Hypersonic..."
|
45
|
-
rm_f "#{@jboss.profile}/deploy/hsqldb-ds.xml"
|
46
|
-
rm_f "#{@jboss.profile}/deploy/messaging/hsqldb-persistence-service.xml"
|
47
|
-
|
48
|
-
@datasource.process
|
49
|
-
|
50
|
-
@logger.info "Copying persistence service template for #{@datasource.type}..."
|
51
|
-
# For postgres, the jms example filename differs from jca
|
52
|
-
@datasource.type = :postgresql if @datasource.type.to_s == "postgres"
|
53
|
-
cp "#{@jboss.home}/docs/examples/jms/#{@datasource.type}-persistence-service.xml", "#{@jboss.profile}/deploy/messaging"
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
@@ -1,119 +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 "rexml/document"
|
26
|
-
|
27
|
-
include REXML
|
28
|
-
|
29
|
-
module RBoss
|
30
|
-
class JBossWeb
|
31
|
-
include Component
|
32
|
-
|
33
|
-
def defaults
|
34
|
-
{
|
35
|
-
:connectors => [],
|
36
|
-
:jvm_route => nil
|
37
|
-
}
|
38
|
-
end
|
39
|
-
|
40
|
-
def connector_defaults
|
41
|
-
{
|
42
|
-
:http => {
|
43
|
-
:address => "${jboss.bind.address}",
|
44
|
-
:protocol => "HTTP/1.1",
|
45
|
-
:port => 8080
|
46
|
-
},
|
47
|
-
:ajp => {
|
48
|
-
:address => "${jboss.bind.address}",
|
49
|
-
:protocol => "AJP/1.3",
|
50
|
-
:port => 8009,
|
51
|
-
:redirect_port => 8443
|
52
|
-
},
|
53
|
-
:https => {
|
54
|
-
:addres => "${jboss.bind.address}",
|
55
|
-
:port => 8443,
|
56
|
-
:protocol => "HTTP/1.1",
|
57
|
-
:scheme => "https",
|
58
|
-
'SSLEnabled' => true,
|
59
|
-
:secure => true,
|
60
|
-
:ssl_protocol => "TLS",
|
61
|
-
:client_auth => false,
|
62
|
-
:keystore_file => '${jboss.server.home.dir}/conf/.keystore'
|
63
|
-
},
|
64
|
-
:other => {
|
65
|
-
:address => "${jboss.bind.address}",
|
66
|
-
:protocol => "HTTP/1.1"
|
67
|
-
}
|
68
|
-
}
|
69
|
-
end
|
70
|
-
|
71
|
-
def process
|
72
|
-
@processor = new_file_processor
|
73
|
-
@actions = []
|
74
|
-
configure_connectors
|
75
|
-
configure_engine if @config[:jvm_route]
|
76
|
-
@processor.with "#{@jboss.profile}/deploy/jbossweb.sar/server.xml", :xml do |action|
|
77
|
-
action.to_process do |xml, jboss|
|
78
|
-
@actions.each do |block|
|
79
|
-
xml = block.call(xml, jboss)
|
80
|
-
end
|
81
|
-
xml
|
82
|
-
end
|
83
|
-
end
|
84
|
-
@processor.process
|
85
|
-
end
|
86
|
-
|
87
|
-
def configure_connectors
|
88
|
-
@config[:connectors].each do |type, attributes|
|
89
|
-
defaults = connector_defaults[type.to_sym]
|
90
|
-
defaults ||= connector_defaults[:other]
|
91
|
-
attributes = defaults.merge attributes
|
92
|
-
configure_connector attributes, defaults
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def configure_connector attributes, defaults
|
97
|
-
@actions << lambda do |xml, jboss|
|
98
|
-
tag = XPath.first xml, "//Connector[@protocol='#{defaults[:protocol]}'][@port='#{defaults[:port]}']"
|
99
|
-
unless tag
|
100
|
-
tag = Element::new "Connector"
|
101
|
-
xml.insert_after "//Connector", tag
|
102
|
-
end
|
103
|
-
attributes.each do |key, value|
|
104
|
-
key = key.to_s.camelize.uncapitalize if key.is_a? Symbol
|
105
|
-
tag.attributes[key] = value.to_s
|
106
|
-
end
|
107
|
-
xml
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def configure_engine
|
112
|
-
@actions << lambda do |xml, jboss|
|
113
|
-
engine = XPath.first xml, "//Engine[@name='jboss.web']"
|
114
|
-
engine.attributes["jvmRoute"] = @config[:jvm_route]
|
115
|
-
xml
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|