Class: WlsDaemon

Inherits:
EasyType::Daemon
  • Object
show all
Includes:
EasyType::Template
Defined in:
lib/utils/wls_daemon.rb

Constant Summary collapse

DEFAULT_TIMEOUT =

2 minutes

120

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, domain, weblogicHomeDir, weblogicUser, weblogicPassword, weblogicConnectUrl, postClasspath, extraArguments, custom_trust, trust_keystore_file, trust_keystore_passphrase, use_default_value_when_empty, tmp_path) ⇒ WlsDaemon

Returns a new instance of WlsDaemon.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/utils/wls_daemon.rb', line 29

def initialize(user,
               domain,
               weblogicHomeDir,
               weblogicUser,
               weblogicPassword,
               weblogicConnectUrl,
               postClasspath,
               extraArguments,
               custom_trust,
               trust_keystore_file,
               trust_keystore_passphrase,
               use_default_value_when_empty,
               tmp_path)
  @user = user
  @domain = domain
  @weblogicHomeDir = weblogicHomeDir
  @weblogicUser = weblogicUser
  @weblogicPassword = weblogicPassword
  @weblogicConnectUrl = weblogicConnectUrl
  @postClasspath = postClasspath
  @extraArguments = extraArguments
  @custom_trust = custom_trust
  @trust_keystore_file = trust_keystore_file
  @trust_keystore_passphrase = trust_keystore_passphrase
  @use_default_value_when_empty = use_default_value_when_empty
  @tmp_path = tmp_path

  if @custom_trust.to_s == 'true'
    trust_parameters = "-Dweblogic.security.SSL.enableJSSE=true -Dweblogic.security.TrustKeyStore=CustomTrust -Dweblogic.security.CustomTrustKeyStoreFileName=#{@trust_keystore_file} -Dweblogic.security.CustomTrustKeystorePassPhrase=#{@trust_keystore_passphrase}"
    Puppet.debug "trust parameters #{trust_parameters}"
  else
    Puppet.debug 'no custom trust'
  end

  identity = "wls-#{domain}"
  Puppet.info "Starting the wls daemon for domain #{@domain}"
  command =  "export POST_CLASSPATH='#{@postClasspath}';. #{weblogicHomeDir}/server/bin/setWLSEnv.sh;java -Dweblogic.security.SSL.ignoreHostnameVerification=true #{trust_parameters} #{extraArguments} weblogic.WLST"
  super(identity, command, user)
  define_common_methods
end

Class Method Details

.run(user, domain, weblogicHomeDir, weblogicUser, weblogicPassword, weblogicConnectUrl, postClasspath, extraArguments, custom_trust, trust_keystore_file, trust_keystore_passphrase, use_default_value_when_empty, tmp_path) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/utils/wls_daemon.rb', line 6

def self.run(user,
             domain,
             weblogicHomeDir,
             weblogicUser,
             weblogicPassword,
             weblogicConnectUrl,
             postClasspath,
             extraArguments,
             custom_trust,
             trust_keystore_file,
             trust_keystore_passphrase,
             use_default_value_when_empty,
             tmp_path)
  daemon = super("wls-#{domain}")
  if daemon
    return daemon
  else
    new(user, domain, weblogicHomeDir, weblogicUser, weblogicPassword,
        weblogicConnectUrl, postClasspath, extraArguments, custom_trust, trust_keystore_file,
        trust_keystore_passphrase, use_default_value_when_empty, tmp_path)
  end
end

Instance Method Details

#disconnectObject



82
83
84
85
# File 'lib/utils/wls_daemon.rb', line 82

def disconnect
  Puppet.info "Disconnecting from wls on url #{@weblogicConnectUrl}"
  execute_command "disconnect()"
end

#execute_script(script, timeout = DEFAULT_TIMEOUT) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/utils/wls_daemon.rb', line 70

def execute_script(script, timeout = DEFAULT_TIMEOUT)
  Puppet.info "Executing wls-script #{script} with timeout = #{timeout}"
  pass_domain
  pass_tmp_script
  pass_use_default_value_when_empty
  pass_credentials
  connect_to_wls
  execute_command "execfile('#{script}')"
  sync(timeout)
  disconnect
end

#execute_script_simple(script) ⇒ Object



87
88
89
90
# File 'lib/utils/wls_daemon.rb', line 87

def execute_script_simple(script)
  Puppet.info "Executing wls-script #{script}"
  execute_command "execfile('#{script}')"
end