Class: WBEM::CIMObjectLocation

Inherits:
XMLObject show all
Includes:
Comparable
Defined in:
lib/wbem/cim_obj.rb

Overview

It turns out that most of the object location elements can be represented easily using one base class which roughly corresponds to the OBJECTPATH element.

Element Name (host, namespace, classname, instancename)


CLASSNAME (None, None, ‘CIM_Foo’, None) LOCALNAMESPACEPATH (None, ‘root/cimv2’, None, None) NAMESPACEPATH (‘leonardo’, ‘root/cimv2’, None, None) LOCALCLASSPATH (None, ‘root/cimv2’, ‘CIM_Foo’, None) CLASSPATH (‘leonardo’, ‘root/cimv2’, ‘CIM_Foo’, None) LOCALINSTANCEPATH (None, ‘root/cimv2’, None, InstanceName) INSTANCEPATH (‘leonardo’, ‘root/cimv2’, None, InstanceName)

These guys also have string representations similar to the output produced by the Pegasus::CIMObjectPath.toString() method:

Element Name Python Class String representation


CLASSNAME CIMClassName CIM_Foo LOCALNAMESPACEPATH String root/cimv2: NAMESPACEPATH CIMNamespacePath //leo/root/cimv2: LOCALCLASSPATH CIMLocalClassPath root/cimv2:CIM_Foo CLASSPATH CIMClassPath //leo/root/cimv2:CIM_Foo INSTANCENAME CIMInstanceName CIM_Foo.Foo=“Bar” LOCALINSTANCEPATH CIMLocalInstancePath root/cimv2:CIM_Foo.Foo=“Bar” INSTANCEPATH CIMInstancePath //leo/root/cimv2:CIM_Foo.Foo=“Bar”

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from XMLObject

#cmpname, #nilcmp, #toxml

Constructor Details

#initialize(host = nil, localnamespacepath = nil, classname = nil, instancename = nil) ⇒ CIMObjectLocation

Returns a new instance of CIMObjectLocation.



208
209
210
211
212
213
214
# File 'lib/wbem/cim_obj.rb', line 208

def initialize(host = nil, localnamespacepath = nil,
               classname = nil, instancename = nil)
    @host = host
    @localnamespacepath = localnamespacepath
    @classname = classname
    @instancename = instancename
end

Instance Attribute Details

#classnameObject

Returns the value of attribute classname.



206
207
208
# File 'lib/wbem/cim_obj.rb', line 206

def classname
  @classname
end

#hostObject

Returns the value of attribute host.



206
207
208
# File 'lib/wbem/cim_obj.rb', line 206

def host
  @host
end

#instancenameObject

Returns the value of attribute instancename.



206
207
208
# File 'lib/wbem/cim_obj.rb', line 206

def instancename
  @instancename
end

#localnamespacepathObject

Returns the value of attribute localnamespacepath.



206
207
208
# File 'lib/wbem/cim_obj.rb', line 206

def localnamespacepath
  @localnamespacepath
end

Instance Method Details

#<=>(other) ⇒ Object



239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/wbem/cim_obj.rb', line 239

def <=>(other)
    if equal?(other)
        return 0
    elsif (!other.kind_of?(CIMObjectLocation))
        return 1
    end
    ret_val = cmpname(self.host, other.host)
    ret_val = nilcmp(self.localnamespacepath, other.localnamespacepath) if (ret_val == 0)
    ret_val = cmpname(lclassname, lOclassname) if (ret_val == 0)
    ret_val = nilcmp(self.instancename, other.instancename) if (ret_val == 0)
    ret_val
end

#CLASSNAMEObject



220
221
222
# File 'lib/wbem/cim_obj.rb', line 220

def CLASSNAME
    CLASSNAME.new(@classname)
end

#eql?(other) ⇒ Boolean

Returns:



233
234
235
# File 'lib/wbem/cim_obj.rb', line 233

def eql?(other)
    (self <=> other) == 0
end

#hashObject



236
237
238
# File 'lib/wbem/cim_obj.rb', line 236

def hash
    self.host.hash + self.localnamespacepath.hash + self.classname.hash + self.instancename.hash
end

#HOSTObject



216
217
218
# File 'lib/wbem/cim_obj.rb', line 216

def HOST
    HOST.new(@host)
end

#LOCALNAMESPACEPATHObject



224
225
226
227
# File 'lib/wbem/cim_obj.rb', line 224

def LOCALNAMESPACEPATH
    nsArray = @localnamespacepath.split("/").collect { |name| NAMESPACE.new(name) }
    LOCALNAMESPACEPATH.new(nsArray)
end

#NAMESPACEPATHObject



229
230
231
# File 'lib/wbem/cim_obj.rb', line 229

def NAMESPACEPATH
    NAMESPACEPATH.new(self.HOST, self.LOCALNAMESPACEPATH)
end