Class: RBoss::Path

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#homeObject (readonly)

Returns the value of attribute home.



32
33
34
# File 'lib/rboss/jboss_path.rb', line 32

def home
  @home
end

#profileObject (readonly)

Returns the value of attribute profile.



32
33
34
# File 'lib/rboss/jboss_path.rb', line 32

def profile
  @profile
end

#profile_nameObject (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

#typeObject (readonly)

Returns the value of attribute type.



32
33
34
# File 'lib/rboss/jboss_path.rb', line 32

def type
  @type
end

#versionObject (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_pathObject



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_pathObject



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_sObject



48
49
50
# File 'lib/rboss/jboss_path.rb', line 48

def to_s
  @home
end