Module: Puppet_X::Coi::Jboss::Provider::Datasource::Static

Defined in:
lib/puppet_x/coi/jboss/provider/datasource/static.rb

Overview

A module that holds JBoss datasource provider static metod

Instance Method Summary collapse

Instance Method Details

#create_rubyobject(name, xa, runasdomain, profile, controller) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/puppet_x/coi/jboss/provider/datasource/static.rb', line 29

def create_rubyobject(name, xa, runasdomain, profile, controller)
  props = {
    :name        => name,
    :ensure      => :present,
    :provider    => :jbosscli,
    :xa          => xa,
    :runasdomain => runasdomain,
    :profile     => profile,
    :controller  => controller
  }
  obj = new(props)
  return obj
end

#datasource_type(xa) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/puppet_x/coi/jboss/provider/datasource/static.rb', line 43

def datasource_type(xa)
  if xa
    "xa-data-source"
  else
    "data-source"
  end
end

#instancesObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/puppet_x/coi/jboss/provider/datasource/static.rb', line 4

def instances
  runasdomain = self.config_runasdomain
  profile = self.config_profile
  controller = self.config_controller
  ctrlconfig = self.controllerConfig({ :controller  => controller })
  list = []
  cmd = self.compilecmd runasdomain, profile, "/subsystem=datasources:read-children-names(child-type=#{self.datasource_type true})"
  res = self.executeAndGet cmd, runasdomain, ctrlconfig, 0, 0
  if res[:result]
    res[:data].each do |name|
      inst = self.create_rubyobject name, true, runasdomain, profile, controller
      list.push inst
    end
  end
  cmd = self.compilecmd runasdomain, profile, "/subsystem=datasources:read-children-names(child-type=#{self.datasource_type false})"
  res = self.executeAndGet cmd, runasdomain, ctrlconfig, 0, 0
  if res[:result]
    res[:data].each do |name|
      inst = self.create_rubyobject name, false, runasdomain, profile, controller
      list.push inst
    end
  end
  return list
end