Class: Invoracle::Cluster
- Inherits:
-
JsonDoc::Document
- Object
- JsonDoc::Document
- Invoracle::Cluster
- Defined in:
- lib/invoracle/cluster.rb
Instance Attribute Summary collapse
-
#dSystems ⇒ Object
Returns the value of attribute dSystems.
-
#sCluUid ⇒ Object
Returns the value of attribute sCluUid.
Instance Method Summary collapse
- #getDefaultSchema ⇒ Object
- #getOneSystem ⇒ Object
- #getOrCreateSystem(sSysUid = nil) ⇒ Object
- #getSystem(sSysUid = nil) ⇒ Object
- #getSystems(aSysRoles = nil) ⇒ Object
- #inflateSysRoles ⇒ Object
-
#initialize(sCluUid = '') ⇒ Cluster
constructor
A new instance of Cluster.
- #setSystem(oSystem = nil) ⇒ Object
Constructor Details
#initialize(sCluUid = '') ⇒ Cluster
Returns a new instance of Cluster.
9 10 11 12 13 14 15 |
# File 'lib/invoracle/cluster.rb', line 9 def initialize(sCluUid=nil,dSchema=nil,bDefaultifyDoc=true,bIsStrict=true) @dSchema = dSchema || self.getDefaultSchema() self.setAttr(:sCluUid,sCluUid) unless sCluUid.nil? @bDefaultifyDoc = bDefaultifyDoc ? true : false @bIsStrict = bIsStrict ? true : false @dDocument = self.getDefaultDocument() end |
Instance Attribute Details
#dSystems ⇒ Object
Returns the value of attribute dSystems.
7 8 9 |
# File 'lib/invoracle/cluster.rb', line 7 def dSystems @dSystems end |
#sCluUid ⇒ Object
Returns the value of attribute sCluUid.
6 7 8 |
# File 'lib/invoracle/cluster.rb', line 6 def sCluUid @sCluUid end |
Instance Method Details
#getDefaultSchema ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/invoracle/cluster.rb', line 17 def getDefaultSchema() dSchema = { :type => 'system', :properties => { :sCluUid => { :default => '', :type => 'string', :description => 'Cluster UID' } } } end |
#getOneSystem ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/invoracle/cluster.rb', line 57 def getOneSystem() oSystem = nil @dSystems.each do |sSysUid,oSystemThis| oSystem = oSystemThis end return oSystem end |
#getOrCreateSystem(sSysUid = nil) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/invoracle/cluster.rb', line 48 def getOrCreateSystem(sSysUid=nil) if ! sSysUid.nil? && sSysUid && @dSystems.has_key?( sSysUid ) return @dSystems[ sSysUid ] end oSystem = Invoracle::System.new() oSystem.setAttr(:sSysUid,sSysUid) return oSystem end |
#getSystem(sSysUid = nil) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/invoracle/cluster.rb', line 41 def getSystem(sSysUid=nil) if ! sSysUid.nil? && sSysUid && @dSystems.has_key?( sSysUid ) return @dSystems[ sSysUid ] end return nil end |
#getSystems(aSysRoles = nil) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/invoracle/cluster.rb', line 71 def getSystems(aSysRoles=nil) aSysRoles = nil unless aSysRoles.kind_of?(Array) aSystems = [] if aSysRoles.nil? @dSystems.each do |sSysUid,oSystem| aSystems.push(oSystem) end else @dSystems.each do |sSysUid,oSystem| aSysRoles.each do |sSysRole| if oSystem.hasSysRole(sSysRole) aSystems.push(oSystem) break end end end end return aSystems end |
#inflateSysRoles ⇒ Object
65 66 67 68 69 |
# File 'lib/invoracle/cluster.rb', line 65 def inflateSysRoles() @dSystems.each do |sSysUid,oSystem| oSystem.inflateSysRoles end end |
#setSystem(oSystem = nil) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/invoracle/cluster.rb', line 31 def setSystem(oSystem=nil) if ! oSystem.nil? && oSystem.is_a?( Invoracle::System ) sSysUid = oSystem.getAttr(:sSysUid) if sSysUid.nil? || ! sSysUid raise ArgumentError, "E_NO_SYSTEM_UID" end @dSystems[sSysUid] = oSystem end end |