Class: RBoss::Path
- Inherits:
-
Object
- Object
- RBoss::Path
- Defined in:
- lib/rboss/jboss_path.rb
Overview
A class that represents the JBoss structure.
author Marcelo Guimarães <[email protected]>
Instance Attribute Summary collapse
-
#home ⇒ Object
readonly
Returns the value of attribute home.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#profile_name ⇒ Object
readonly
Returns the value of attribute profile_name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#encrypt(password) ⇒ Object
Encrypts the given password using the SecureIdentityLoginModule.
-
#initialize(jboss_home, params = {}) ⇒ Path
constructor
A new instance of Path.
- #jboss_logging_lib_path ⇒ Object
- #jbosssx_lib_path ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(jboss_home, params = {}) ⇒ Path
Returns a new instance of Path.
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rboss/jboss_path.rb', line 34 def initialize jboss_home, params = {} params = { :profile => :custom, :type => :undefined, version => :undefined }.merge params @home = jboss_home @profile ="#{@home}/server/#{params[:profile]}" @profile_name = params[:profile].to_s @type = params[:type] @version = params[:version] @logger = params[:logger] end |
Instance Attribute Details
#home ⇒ Object (readonly)
Returns the value of attribute home.
32 33 34 |
# File 'lib/rboss/jboss_path.rb', line 32 def home @home end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
32 33 34 |
# File 'lib/rboss/jboss_path.rb', line 32 def profile @profile end |
#profile_name ⇒ Object (readonly)
Returns the value of attribute profile_name.
32 33 34 |
# File 'lib/rboss/jboss_path.rb', line 32 def profile_name @profile_name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
32 33 34 |
# File 'lib/rboss/jboss_path.rb', line 32 def type @type end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
32 33 34 |
# File 'lib/rboss/jboss_path.rb', line 32 def version @version end |
Instance Method Details
#encrypt(password) ⇒ Object
Encrypts the given password using the SecureIdentityLoginModule
65 66 67 68 69 70 |
# File 'lib/rboss/jboss_path.rb', line 65 def encrypt password command = "java -cp #{jboss_logging_lib_path}:#{jbosssx_lib_path} org.jboss.resource.security.SecureIdentityLoginModule #{password}" @logger.debug command if @logger encrypted = `#{command}` encrypted.chomp.split(/:/)[1].strip end |
#jboss_logging_lib_path ⇒ Object
52 53 54 55 56 |
# File 'lib/rboss/jboss_path.rb', line 52 def jboss_logging_lib_path %W{#{@home}/client/jboss-logging-spi.jar #{@home}/client/jboss-logging.jar}.each do |path| return path if File.exist? path end end |
#jbosssx_lib_path ⇒ Object
58 59 60 61 62 |
# File 'lib/rboss/jboss_path.rb', line 58 def jbosssx_lib_path %W{#{@home}/lib/jbosssx.jar #{@home}/common/lib/jbosssx.jar}.each do |path| return path if File.exist? path end end |
#to_s ⇒ Object
48 49 50 |
# File 'lib/rboss/jboss_path.rb', line 48 def to_s @home end |