Class: Rays::Server::DatabaseServer

Inherits:
BaseServer show all
Defined in:
lib/rays/servers/database.rb

Instance Attribute Summary

Attributes inherited from BaseServer

#name

Instance Method Summary collapse

Methods inherited from BaseServer

#host, #java_cmd, #java_home, #remote, #remote?

Constructor Details

#initialize(name, host, remote, java_home, java_bin, port, db_name, username, password, type) ⇒ DatabaseServer

Returns a new instance of DatabaseServer.



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rays/servers/database.rb', line 28

def initialize(name, host, remote, java_home, java_bin, port, db_name, username, password, type)
  super(name, host, remote, java_home, java_bin)
  @port = port
  @db_name = db_name
  @username = username
  @password = password
  @type = type

  @instance = nil
  if 'mysql'.eql?(@type)
      @instance = Rays::Database::MySQL.new @host, @port, @username, @password
  end
end

Instance Method Details

#db_nameObject

Raises:



47
48
49
50
# File 'lib/rays/servers/database.rb', line 47

def db_name
  raise RaysException.new(missing_environment_option('Database server', 'database name')) if @db_name.nil?
  @db_name
end

#instanceObject

Raises:



67
68
69
70
# File 'lib/rays/servers/database.rb', line 67

def instance
  raise RaysException.new("Unknown database type #{@type}") if @instance.nil?
  @instance
end

#passwordObject

Raises:



57
58
59
60
# File 'lib/rays/servers/database.rb', line 57

def password
  raise RaysException.new(missing_environment_option('Database server', 'password')) if @password.nil?
  @password
end

#portObject

Raises:



42
43
44
45
# File 'lib/rays/servers/database.rb', line 42

def port
  raise RaysException.new(missing_environment_option('Database server', 'port')) if @port.nil?
  @port
end

#typeObject

Raises:



62
63
64
65
# File 'lib/rays/servers/database.rb', line 62

def type
  raise RaysException.new(missing_environment_option('Database server', 'type')) if @type.nil?
  @type
end

#usernameObject

Raises:



52
53
54
55
# File 'lib/rays/servers/database.rb', line 52

def username
  raise RaysException.new(missing_environment_option('Database server', 'username')) if @username.nil?
  @username
end