rubywbem 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,195 @@
1
+ #
2
+ # Copyright 2006, Red Hat, Inc
3
+ # Scott Seago <sseago@redhat.com>
4
+ #
5
+ # derived from pywbem, written by Tim Potter <tpot@hp.com>, Martin Pool <mbp@hp.com>
6
+ #
7
+ # This program is free software; you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation; either version 2 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # You should have received a copy of the GNU General Public License
13
+ # along with this program; if not, write to the Free Software
14
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15
+ #
16
+
17
+ #"""
18
+ #Subclasses of builtin Python types to remember CIM types. This is
19
+ #necessary as we need to remember whether an integer property is a
20
+ #uint8, uint16, uint32 etc, while still being able to treat it as a
21
+ #integer.
22
+ #"""
23
+
24
+ #from datetime import datetime, timedelta
25
+
26
+ module WBEM
27
+
28
+ class CIMType
29
+ include Comparable
30
+ #"""Base type for all CIM types."""
31
+ attr_reader :cimtype, :value
32
+ attr_writer :cimtype, :value
33
+ def initialize(cimtype, value)
34
+ @cimtype = cimtype
35
+ @value = value
36
+ end
37
+ def to_s
38
+ @value.to_s
39
+ end
40
+ def <=>(obj)
41
+ if obj.is_a?(CIMType)
42
+ @value <=> obj.value
43
+ else
44
+ @value <=> obj
45
+ end
46
+ end
47
+ end
48
+
49
+ # CIM integer types
50
+ class CIMInt < CIMType
51
+ def initialize(arg, base, cimtype)
52
+ super(cimtype, arg.is_a?(String) ? arg.to_i(base) : arg.to_i)
53
+ end
54
+ end
55
+
56
+ class Uint8 < CIMInt
57
+ def initialize(arg, base = 0)
58
+ super(arg, base, "uint8")
59
+ end
60
+ end
61
+ class Sint8 < CIMInt
62
+ def initialize(arg, base = 0)
63
+ super(arg, base, "sint8")
64
+ end
65
+ end
66
+ class Uint16 < CIMInt
67
+ def initialize(arg, base = 0)
68
+ super(arg, base, "uint16")
69
+ end
70
+ end
71
+ class Sint16 < CIMInt
72
+ def initialize(arg, base = 0)
73
+ super(arg, base, "sint16")
74
+ end
75
+ end
76
+ class Uint32 < CIMInt
77
+ def initialize(arg, base = 0)
78
+ super(arg, base, "uint32")
79
+ end
80
+ end
81
+ class Sint32 < CIMInt
82
+ def initialize(arg, base = 0)
83
+ super(arg, base, "sint32")
84
+ end
85
+ end
86
+ class Uint64 < CIMInt
87
+ def initialize(arg, base = 0)
88
+ super(arg, base, "uint64")
89
+ end
90
+ end
91
+ class Sint64 < CIMInt
92
+ def initialize(arg, base = 0)
93
+ super(arg, base, "sint64")
94
+ end
95
+ end
96
+
97
+ # CIM float types
98
+
99
+ class CIMFloat < CIMType
100
+ def initialize(arg, cimtype)
101
+ super(cimtype, Float(arg))
102
+ end
103
+ end
104
+
105
+ class Real32 < CIMFloat
106
+ def initialize(arg)
107
+ super(arg, "real32")
108
+ end
109
+ end
110
+ class Real64 < CIMFloat
111
+ def initialize(arg)
112
+ super(arg, "real64")
113
+ end
114
+ end
115
+
116
+ class Boolean < CIMType
117
+ def initialize(arg)
118
+ arg = arg.downcase if arg.is_a?(String)
119
+ if [:true, true, "true"].include?(arg)
120
+ value = true
121
+ elsif [:false, false, "false"].include?(arg)
122
+ value = false
123
+ else
124
+ raise TypeError, "Invalid boolean value #{arg}"
125
+ end
126
+ super("boolean", value)
127
+ end
128
+ def <=>(obj)
129
+ if obj.is_a?(Boolean)
130
+ (self.value ^ obj.value) ? 1 : 0
131
+ elsif obj == true || obj == false
132
+ (self.value ^ obj) ? 1 : 0
133
+ elsif obj.nil?
134
+ self.value ? 1 : 0
135
+ else
136
+ 1
137
+ end
138
+ end
139
+
140
+ end
141
+
142
+ def WBEM.cimtype(obj)
143
+ #"""Return the CIM type name of an object as a string. For a list, the
144
+ #type is the type of the first element as CIM arrays must be
145
+ #homogeneous."""
146
+
147
+ if (obj.is_a?(CIMType))
148
+ return obj.cimtype
149
+ elsif (obj == true or obj == false)
150
+ return 'boolean'
151
+ elsif (obj.is_a?(String)) # unicode?
152
+ return 'string'
153
+ elsif (obj.is_a?(CIMClassName) || obj.is_a?(CIMLocalClassPath) || obj.is_a?(CIMInstanceName))
154
+ return 'reference'
155
+ elsif (obj.is_a?(DateTime) or obj.is_a?(TimeDelta))
156
+ return 'datetime'
157
+ elsif (obj.is_a?(Array))
158
+ return WBEM.cimtype(obj[0])
159
+ else
160
+ raise TypeError, "Invalid CIM type for #{obj} (#{obj.class})"
161
+ end
162
+ end
163
+ def WBEM.valid_cimtype?(obj)
164
+ begin
165
+ WBEM.cimtype(obj)
166
+ rescue TypeError
167
+ false
168
+ else
169
+ true
170
+ end
171
+ end
172
+
173
+ def WBEM.atomic_to_cim_xml(obj)
174
+ #"""Convert an atomic type to CIM external form"""
175
+ if (obj == true or (obj.is_a?(Boolean) and obj.value==true))
176
+ return "TRUE"
177
+ elsif (obj == false or (obj.is_a?(Boolean) and obj.value==false))
178
+ return "FALSE"
179
+ elsif (obj.is_a?(DateTime))
180
+ # TODO: Figure out UTC offset stuff
181
+ return sprintf("%d%02d%02d%02d%02d%02d.%06d+000",
182
+ obj.year, obj.month, obj.day, obj.hour,
183
+ obj.min, obj.sec, obj.sec_fraction.to_f)
184
+ elsif (obj.is_a?(TimeDelta))
185
+ return sprintf("%08d%02d%02d%02d.%06d:000",
186
+ obj.days, obj.hours, obj.minutes, obj.seconds, obj.microseconds)
187
+ elsif (obj.methods.include?("tocimxml"))
188
+ return obj.tocimxml
189
+ elsif obj.nil?
190
+ return obj
191
+ else
192
+ return obj.to_s # unicode?
193
+ end
194
+ end
195
+ end
@@ -0,0 +1,1428 @@
1
+ #
2
+ # Copyright 2006, Red Hat, Inc
3
+ # Scott Seago <sseago@redhat.com>
4
+ #
5
+ # derived from pywbem, written by Tim Potter <tpot@hp.com>, Martin Pool <mbp@hp.com>
6
+ #
7
+ # This program is free software; you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation; either version 2 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # You should have received a copy of the GNU General Public License
13
+ # along with this program; if not, write to the Free Software
14
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15
+ #
16
+
17
+ #"""
18
+ #
19
+ #Functions to create XML documens and elements conforming to the DMTF
20
+ #standard DSP0201, Representation of CIM in XML, v2.2.
21
+ #
22
+ # http://www.dmtf.org/standards/wbem/DSP201.html
23
+ # http://www.dmtf.org/standards/published_documents/DSP201.pdf
24
+ #
25
+ #Elements generated by this module should conform to version 2.2 of the
26
+ #DTD:
27
+ #
28
+ # http://www.dmtf.org/standards/wbem/CIM_DTD_V22.dtd
29
+ #
30
+ #There should be one class for each element described in the DTD. The
31
+ #constructors take builtin Python types, or other cim_xml classes where
32
+ #child elements are required.
33
+ #
34
+ #Every class is a subclass of the Element class and so shares the same
35
+ #attributes and methods, and can be used with the built-in Python XML
36
+ #handling routines. In particular you can call the toxml() and
37
+ #toprettyxml() methods to generate XML.
38
+ #
39
+ #Note that converting using toprettyxml() inserts whitespace which may
40
+ #corrupt the data in the XML (!!) so you should only do this when
41
+ #displaying to humans who can ignore it, and never for computers. XML
42
+ #always passes through all non-markup whitespace.
43
+ #
44
+ #"""
45
+
46
+ require "rexml/document"
47
+
48
+ module WBEM
49
+
50
+ class CIMElement < REXML::Element
51
+ #"""A base class that has a few bonus helper methods."""
52
+
53
+ def initialize(arg)
54
+ super(arg)
55
+ end
56
+
57
+ def setName(name)
58
+ #"""Set the NAME attribute of the element."""
59
+ self.add_attribute("NAME", name)
60
+ end
61
+
62
+ def add_optional_attribute(name, value)
63
+ #"""Set an attribute if the value is not nil."""
64
+ self.add_attribute(name, value) unless value.nil?
65
+ end
66
+
67
+ def add_optional_element(child)
68
+ #"""Append a child element which can be nil."""
69
+ self.add_element(child) unless child.nil?
70
+ end
71
+
72
+ def add_elements(children)
73
+ #"""Append a list or tuple of children."""
74
+ unless children.is_a?(Array) or children.is_a?(Hash)
75
+ children = [children]
76
+ end
77
+ children.each { |child| self.add_element(child) }
78
+ end
79
+ def toxml()
80
+ outstr = ""
81
+ self.write(outstr)
82
+ outstr
83
+ end
84
+ end
85
+
86
+ # Root element
87
+
88
+ class CIM < CIMElement
89
+ #"""
90
+ #The CIM element is the root element of every XML Document that is
91
+ #valid with respect to this schema.
92
+
93
+ #Each document takes one of two forms; it either contains a single
94
+ #MESSAGE element defining a CIM message (to be used in the HTTP
95
+ #mapping), or it contains a DECLARATION element used to declare a
96
+ #set of CIM objects.
97
+
98
+ #<!ELEMENT CIM (MESSAGE | DECLARATION)>
99
+ #<!ATTLIST CIM
100
+ # CIMVERSION CDATA #REQUIRED
101
+ # DTDVERSION CDATA #REQUIRED>
102
+ #"""
103
+
104
+ def initialize(data, cim_version, dtd_version)
105
+ super("CIM")
106
+ self.add_attribute("CIMVERSION", cim_version)
107
+ self.add_attribute("DTDVERSION", dtd_version)
108
+ self.add_element(data)
109
+ end
110
+ end
111
+
112
+ # Object declaration elements
113
+
114
+ class DECLARATION < CIMElement
115
+ # """
116
+ # The DECLARATION element defines a set of one or more declarations
117
+ # of CIM objects. These are partitioned into logical declaration
118
+ # subsets.
119
+
120
+ # <!ELEMENT DECLARATION (DECLGROUP|DECLGROUP.WITHNAME|DECLGROUP.WITHPATH)+>
121
+ # """
122
+
123
+ def initialize(data)
124
+ super("DECLARATION")
125
+ self.add_elements(data)
126
+ end
127
+ end
128
+
129
+ class DECLGROUP < CIMElement
130
+ # """
131
+ # The DECLGROUP element defines a logical set of CIM Class, Instance
132
+ # and Qualifier declarations. It MAY optionally include a
133
+ # NAMESPACEPATH or LOCALNAMESPACEPATH element which, if present,
134
+ # defines the common namespace in which all objects within the group
135
+ # are declared.
136
+
137
+ # <!ELEMENT DECLGROUP ((LOCALNAMESPACEPATH|NAMESPACEPATH)?,
138
+ # QUALIFIER.DECLARATION*,VALUE.OBJECT*)>
139
+ # """
140
+
141
+ def initialize(data)
142
+ super("DECLGROUP")
143
+ self.add_elements(data)
144
+ end
145
+ end
146
+
147
+ class DECLGROUP_WITHNAME < CIMElement
148
+ # """
149
+ # The DECLGROUP.WITHNAME element defines a logical set of CIM Class,
150
+ # Instance and Qualifier declarations. It MAY optionally include a
151
+ # NAMESPACEPATH or LOCALNAMESPACEPATH element which, if present,
152
+ # defines the common namespace in which all objects within the group
153
+ # are declared.
154
+
155
+ # <!ELEMENT DECLGROUP.WITHNAME ((LOCALNAMESPACEPATH|NAMESPACEPATH)?,
156
+ # QUALIFIER.DECLARATION*,VALUE.NAMEDOBJECT*)>
157
+ # """
158
+
159
+ def initialize(data)
160
+ super("DECLGROUP.WITHNAME")
161
+ self.add_elements(data)
162
+ end
163
+ end
164
+
165
+ class DECLGROUP_WITHPATH < CIMElement
166
+ # """
167
+ # The DECLGROUP.WITHPATH element defines a logical set of CIM Class
168
+ # and Instance declarations. Each object is declared with its own
169
+ # independent naming and location information.
170
+
171
+ # <!ELEMENT DECLGROUP.WITHPATH (VALUE.OBJECTWITHPATH |
172
+ # VALUE.OBJECTWITHLOCALPATH)*>
173
+ # """
174
+
175
+ def initialize(data)
176
+ super("DECLGROUP.WITHPATH")
177
+ self.add_elements(data)
178
+ end
179
+ end
180
+
181
+ class QUALIFIER_DECLARATION < CIMElement
182
+ # """
183
+ # The QUALIFIER.DECLARATION element defines a single CIM Qualifier
184
+ # declaration.
185
+
186
+ # <!ELEMENT QUALIFIER.DECLARATION (SCOPE?, (VALUE | VALUE.ARRAY)?)>
187
+ # <!ATTLIST QUALIFIER.DECLARATION
188
+ # %CIMName;
189
+ # %CIMType; #REQUIRED
190
+ # ISARRAY (true|false) #IMPLIED
191
+ # %ArraySize;
192
+ # %QualifierFlavor;>
193
+ # """
194
+
195
+ def initialize(name, type, data, is_array = nil,
196
+ array_size = nil, qualifier_flavor = nil)
197
+ super("QUALIFIER.DECLARATION")
198
+ self.setName(name)
199
+ self.add_attribute("TYPE", type)
200
+ self.add_optional_attribute(is_array)
201
+ self.add_optional_attribute(array_size)
202
+ self.add_optional_attribute(qualifier_flavor)
203
+ self.add_elements(data)
204
+ end
205
+ end
206
+
207
+ class SCOPE < CIMElement
208
+ # """
209
+ # The SCOPE element defines the scope of a QUALIFIER.DECLARATION in
210
+ # the case that there are restrictions on the scope of the Qualifier
211
+ # declaration.
212
+
213
+ # <!ELEMENT SCOPE EMPTY>
214
+ # <!ATTLIST SCOPE
215
+ # CLASS (true|false) 'false'
216
+ # ASSOCIATION (true|false) 'false'
217
+ # REFERENCE (true|false) 'false'
218
+ # PROPERTY (true|false) 'false'
219
+ # METHOD (true|false) 'false'
220
+ # PARAMETER (true|false) 'false'
221
+ # INDICATION (true|false) 'false'>
222
+ # """
223
+
224
+ def initialize(class_ = false, association = false,
225
+ reference = false, property = false, method = false,
226
+ parameter = false, indication = false)
227
+ super("SCOPE")
228
+ self.add_attribute("CLASS", class_.to_s)
229
+ self.add_attribute("ASSOCIATION", association.to_s)
230
+ self.add_attribute("REFERENCE", reference.to_s)
231
+ self.add_attribute("PROPERTY", property.to_s)
232
+ self.add_attribute("METHOD", method.to_s)
233
+ self.add_attribute("PARAMETER", parameter.to_s)
234
+ self.add_attribute("INDICATION", indication.to_s)
235
+ end
236
+ end
237
+
238
+ # Object value elements
239
+
240
+ class VALUE < CIMElement
241
+ # """
242
+ # The VALUE element is used to define a single (non-array and
243
+ # non-reference) CIM Property value, CIM Qualifier value, or a CIM
244
+ # Method Parameter value.
245
+
246
+ # <!ELEMENT VALUE (#PCDATA)>
247
+ # """
248
+
249
+ def initialize(pcdata)
250
+ super("VALUE")
251
+ self.add_text(pcdata) unless pcdata.nil?
252
+ end
253
+ end
254
+
255
+ class VALUE_ARRAY < CIMElement
256
+ # """
257
+ # The VALUE.ARRAY element is used to represent the value of a CIM
258
+ # Property or Qualifier that has an array type.
259
+
260
+ # <!ELEMENT VALUE.ARRAY (VALUE*)>
261
+ # """
262
+
263
+ def initialize(values)
264
+ super("VALUE.ARRAY")
265
+ self.add_elements(values)
266
+ end
267
+ end
268
+
269
+ class VALUE_REFERENCE < CIMElement
270
+ # """
271
+ # The VALUE.REFERENCE element is used to define a single CIM
272
+ # reference Property value.
273
+
274
+ # <!ELEMENT VALUE.REFERENCE (CLASSPATH | LOCALCLASSPATH | CLASSNAME |
275
+ # INSTANCEPATH | LOCALINSTANCEPATH |
276
+ # INSTANCENAME)>
277
+ # """
278
+
279
+ def initialize(data)
280
+ super("VALUE.REFERENCE")
281
+ self.add_element(data)
282
+ end
283
+ end
284
+
285
+ class VALUE_REFARRAY < CIMElement
286
+ # """
287
+ # The VALUE.REFARRAY element is used to represent the value of an
288
+ # array of CIM references.
289
+
290
+ # <!ELEMENT VALUE.REFARRAY (VALUE.REFERENCE*)>
291
+ # """
292
+
293
+ def initialize(data)
294
+ super("VALUE.REFARRAY")
295
+ self.add_elements(data)
296
+ end
297
+ end
298
+
299
+ class VALUE_OBJECT < CIMElement
300
+ # """
301
+ # The VALUE.OBJECT element is used to define a value which is
302
+ # comprised of a single CIM Class or Instance definition.
303
+
304
+ # <!ELEMENT VALUE.OBJECT (CLASS | INSTANCE)>
305
+ # """
306
+
307
+ def initialize(data)
308
+ super("VALUE.OBJECT")
309
+ self.add_element(data)
310
+ end
311
+ end
312
+
313
+ class VALUE_NAMEDINSTANCE < CIMElement
314
+ # """
315
+ # The VALUE.NAMEDINSTANCE element is used to define a value which
316
+ # is comprised of a single named CIM Instance definition.
317
+
318
+ # <!ELEMENT VALUE.NAMEDINSTANCE (INSTANCENAME, INSTANCE)>
319
+ # """
320
+
321
+ def initialize(instancename, instance)
322
+ super("VALUE.NAMEDINSTANCE")
323
+ self.add_element(instancename)
324
+ self.add_element(instance)
325
+ end
326
+ end
327
+
328
+ class VALUE_NAMEDOBJECT < CIMElement
329
+ # """
330
+ # The VALUE.NAMEDOBJECT element is used to define a value which
331
+ # is comprised of a single named CIM Class or Instance definition.
332
+
333
+ # <!ELEMENT VALUE.NAMEDOBJECT (CLASS | (INSTANCENAME, INSTANCE))>
334
+ # """
335
+
336
+ def initialize(data)
337
+ super("VALUE.NAMEDOBJECT")
338
+ self.add_elements(data)
339
+ end
340
+ end
341
+
342
+ class VALUE_OBJECTWITHLOCALPATH < CIMElement
343
+ # """
344
+ # The VALUE.OBJECTWITHLOCALPATH element is used to define a value
345
+ # which is comprised of a single CIM Object (Class or Instance)
346
+ # definition with additional information that defines the local path
347
+ # to that Object.
348
+ #
349
+ # <!ELEMENT VALUE.OBJECTWITHLOCALPATH ((LOCALCLASSPATH, CLASS) |
350
+ # (LOCALINSTANCEPATH, INSTANCE))>
351
+ # """
352
+
353
+ def initialize(data1, data2)
354
+ super("VALUE.OBJECTWITHLOCALPATH")
355
+ self.add_element(data1)
356
+ self.add_element(data2)
357
+ end
358
+ end
359
+
360
+ class VALUE_OBJECTWITHPATH < CIMElement
361
+ # """
362
+ # The VALUE.OBJECTWITHPATH element is used to define a value
363
+ # which is comprised of a single CIM Object (Class or Instance)
364
+ # definition with additional information that defines the absolute
365
+ # path to that Object.
366
+
367
+ # <!ELEMENT VALUE.OBJECTWITHPATH ((CLASSPATH, CLASS) |
368
+ # (INSTANCEPATH, INSTANCE))>
369
+ # """
370
+
371
+ def initialize(data1, data2)
372
+ super("VALUE.OBJECTWITHPATH")
373
+ self.add_element(data1)
374
+ self.add_element(data2)
375
+ end
376
+ end
377
+
378
+ class VALUE_NULL < CIMElement
379
+ # """
380
+ # The VALUE.NULL element is used to represent a TABLECELL that has
381
+ # no assigned value.
382
+
383
+ # <!ELEMENT VALUE.NULL EMPTY>
384
+ # """
385
+
386
+ def initialize
387
+ super("VALUE.NULL")
388
+ end
389
+ end
390
+
391
+ # Object naming and location elements
392
+
393
+ class NAMESPACEPATH < CIMElement
394
+ # """
395
+ # The NAMESPACEPATH element is used to define a Namespace Path. It
396
+ # consists of a HOST element and a LOCALNAMESPACE element.
397
+
398
+ # <!ELEMENT NAMESPACEPATH (HOST, LOCALNAMESPACEPATH)>
399
+ # """
400
+
401
+ def initialize(host, localnamespacepath)
402
+ super("NAMESPACEPATH")
403
+ self.add_element(host)
404
+ self.add_element(localnamespacepath)
405
+ end
406
+ end
407
+
408
+ class LOCALNAMESPACEPATH < CIMElement
409
+ # """
410
+ # The LOCALNAMESPACEPATH element is used to define a local Namespace
411
+ # path (one without a Host component). It consists of one or more
412
+ # NAMESPACE elements (one for each namespace in the path).
413
+
414
+ # <!ELEMENT LOCALNAMESPACEPATH (NAMESPACE+)>
415
+ # """
416
+
417
+ def initialize(namespaces)
418
+ super("LOCALNAMESPACEPATH")
419
+ self.add_elements(namespaces)
420
+ end
421
+ end
422
+
423
+ class HOST < CIMElement
424
+ # """
425
+ # The HOST element is used to define a single Host. The element
426
+ # content MUST specify a legal value for a hostname in accordance
427
+ # with the CIM specification.
428
+
429
+ # <!ELEMENT HOST (#PCDATA)>
430
+ # """
431
+
432
+ def initialize(pcdata)
433
+ super("HOST")
434
+ unless pcdata.kind_of?(String) # unicode?
435
+ raise TypeError, "value argument must be a string"
436
+ end
437
+ self.add_text(pcdata)
438
+ end
439
+ end
440
+
441
+ class NAMESPACE < CIMElement
442
+ # """
443
+ # The NAMESPACE element is used to define a single Namespace
444
+ # component of a Namespace path.
445
+
446
+ # <!ELEMENT NAMESPACE EMPTY>
447
+ # <!ATTLIST NAMESPACE
448
+ # %CIMName;>
449
+ # """
450
+
451
+ def initialize(name)
452
+ super("NAMESPACE")
453
+ self.setName(name)
454
+ end
455
+ end
456
+
457
+ class CLASSPATH < CIMElement
458
+ # """
459
+ # The CLASSPATH element defines the absolute path to a CIM Class. It
460
+ # is formed from a namespace path and Class name.
461
+
462
+ # <!ELEMENT CLASSPATH (NAMESPACEPATH, CLASSNAME)>
463
+ # """
464
+
465
+ def initialize(namespacepath, classname)
466
+ super("CLASSPATH")
467
+ self.add_element(namespacepath)
468
+ self.add_element(classname)
469
+ end
470
+ end
471
+
472
+ class LOCALCLASSPATH < CIMElement
473
+ # """
474
+ # The LOCALCLASSPATH element defines the a local path to a CIM
475
+ # Class. It is formed from a local namespace path and Class name.
476
+
477
+ # <!ELEMENT LOCALCLASSPATH (LOCALNAMESPACEPATH, CLASSNAME)>
478
+ # """
479
+
480
+ def initialize(localnamespacepath, classname)
481
+ super("LOCALCLASSPATH")
482
+ self.add_element(localnamespacepath)
483
+ self.add_element(classname)
484
+ end
485
+ end
486
+
487
+ class CLASSNAME < CIMElement
488
+ # """
489
+ # The CLASSNAME element defines the qualifying name of a CIM Class.
490
+
491
+ # <!ELEMENT CLASSNAME EMPTY>
492
+ # <!ATTLIST CLASSNAME
493
+ # %CIMName;>
494
+ # """
495
+
496
+ def initialize(classname)
497
+ super("CLASSNAME")
498
+ self.setName(classname)
499
+ end
500
+ end
501
+
502
+ class INSTANCEPATH < CIMElement
503
+ # """
504
+ # The INSTANCEPATH element defines the absolute path to a CIM
505
+ # Instance. It is comprised of a Namespace path and an Instance Name
506
+ # (model path).
507
+
508
+ # <!ELEMENT INSTANCEPATH (NAMESPACEPATH, INSTANCENAME)>
509
+ # """
510
+
511
+ def initialize(namespacepath, instancename)
512
+ super("INSTANCEPATH")
513
+ self.add_element(namespacepath)
514
+ self.add_element(instancename)
515
+ end
516
+ end
517
+
518
+ class LOCALINSTANCEPATH < CIMElement
519
+ # """
520
+ # The LOCALINSTANCEPATH element defines the local path to a CIM
521
+ # Instance. It is comprised of a local Namespace path and an
522
+ # Instance Name (model path).
523
+
524
+ # <!ELEMENT LOCALINSTANCEPATH (LOCALNAMESPACEPATH,INSTANCENAME)>
525
+ # """
526
+
527
+ def initialize(localpath, instancename)
528
+ super("LOCALINSTANCEPATH")
529
+ self.add_element(localpath)
530
+ self.add_element(instancename)
531
+ end
532
+ end
533
+
534
+ class INSTANCENAME < CIMElement
535
+ # """
536
+ # The INSTANCENAME element defines the location of a CIM Instance
537
+ # within a Namespace (it is referred to in the CIM Specification
538
+ # as a Model Path). It is comprised of a class name and a key
539
+ # binding information.
540
+
541
+ # If the Class has a single key property, then a single KEYVALUE or
542
+ # VALUE.REFERENCE subelement may be used to describe the
543
+ # (necessarily) unique key value without a key name. Alternatively a
544
+ # single KEYBINDING subelement may be used instead.
545
+
546
+ # If the Class has more than one key property, then a KEYBINDING
547
+ # subelement MUST appear for each key.
548
+
549
+ # If there are no key-bindings specified, the instance is assumed to
550
+ # be a singleton instance of a keyless Class.
551
+
552
+ # <!ELEMENT INSTANCENAME (KEYBINDING* | KEYVALUE? | VALUE.REFERENCE?)>
553
+ # <!ATTLIST INSTANCENAME
554
+ # %ClassName;>
555
+ # """
556
+
557
+ def initialize(classname, data)
558
+ super("INSTANCENAME")
559
+ self.add_attribute("CLASSNAME", classname)
560
+ unless data.nil?
561
+ self.add_elements(data)
562
+ end
563
+ end
564
+ end
565
+
566
+ class OBJECTPATH < CIMElement
567
+ # """
568
+ # The OBJECTPATH element is used to define a full path to a single
569
+ # CIM Object (Class or Instance).
570
+
571
+ # <!ELEMENT OBJECTPATH (INSTANCEPATH | CLASSPATH)>
572
+ # """
573
+
574
+ def initialize(data)
575
+ super("OBJECTPATH")
576
+ self.add_element(data)
577
+ end
578
+ end
579
+
580
+ class KEYBINDING < CIMElement
581
+ # """
582
+ # The KEYBINDING element defines a single key property value binding.
583
+
584
+ # <!ELEMENT KEYBINDING (KEYVALUE | VALUE.REFERENCE)>
585
+ # <!ATTLIST KEYBINDING
586
+ # %CIMName;>
587
+ # """
588
+
589
+ def initialize(name, data)
590
+ super("KEYBINDING")
591
+ self.setName(name)
592
+ self.add_element(data)
593
+ end
594
+ end
595
+
596
+ class KEYVALUE < CIMElement
597
+ # """
598
+ # The KEYVALUE element defines a single property key value when the
599
+ # key property is a non-reference type.
600
+
601
+ # <!ELEMENT KEYVALUE (#PCDATA)>
602
+ # <!ATTLIST KEYVALUE
603
+ # VALUETYPE (string|boolean|numeric) 'string'
604
+ # %CIMType; #IMPLIED>
605
+ # """
606
+
607
+ def initialize(data, value_type = nil, cim_type = nil)
608
+ super("KEYVALUE")
609
+ if (value_type.nil?)
610
+ self.add_attribute("VALUETYPE", "string")
611
+ else
612
+ self.add_attribute("VALUETYPE", value_type)
613
+ end
614
+ self.add_optional_attribute("TYPE", cim_type)
615
+ unless data.nil?
616
+ self.add_text(data)
617
+ end
618
+ end
619
+ end
620
+
621
+ # Object definition elements
622
+
623
+ class CLASS < CIMElement
624
+ # """
625
+ # The CLASS element defines a single CIM Class.
626
+
627
+ # <!ELEMENT CLASS (QUALIFIER*,(PROPERTY|PROPERTY.ARRAY|PROPERTY.REFERENCE)*,
628
+ # METHOD*)>
629
+ # <!ATTLIST CLASS
630
+ # %CIMName;
631
+ # %SuperClass;>
632
+ # """
633
+
634
+ def initialize(classname, properties = [], methods = [],
635
+ qualifiers = [], superclass = nil)
636
+ super("CLASS")
637
+ self.setName(classname)
638
+ self.add_optional_attribute("SUPERCLASS", superclass)
639
+ self.add_elements(qualifiers)
640
+ self.add_elements(properties)
641
+ self.add_elements(methods)
642
+ end
643
+ end
644
+
645
+ class INSTANCE < CIMElement
646
+ # """
647
+ # The INSTANCE element defines a single CIM Instance of a CIM Class.
648
+
649
+ # <!ELEMENT INSTANCE (QUALIFIER*,(PROPERTY | PROPERTY.ARRAY |
650
+ # PROPERTY.REFERENCE)*)>
651
+ # <!ATTLIST INSTANCE
652
+ # %ClassName;
653
+ # xml:lang NMTOKEN #IMPLIED>
654
+ # """
655
+ def initialize(classname, properties = [], qualifiers = [],
656
+ xml_lang = nil)
657
+ super("INSTANCE")
658
+ self.add_attribute("CLASSNAME", classname)
659
+ self.add_optional_attribute("xml:lang", xml_lang)
660
+ self.add_elements(qualifiers)
661
+ self.add_elements(properties)
662
+ end
663
+ end
664
+
665
+ class QUALIFIER < CIMElement
666
+ # """
667
+ # The QUALIFIER element defines a single CIM Qualifier. If the
668
+ # Qualifier has a non-array type, it contains a single VALUE element
669
+ # representing the value of the Qualifier. If the Qualifier has an
670
+ # array type, it contains a single VALUE.ARRAY element to represent
671
+ # the value.
672
+
673
+ # If the Qualifier has no assigned value then the VALUE element MUST
674
+ # be absent.
675
+
676
+ # <!ELEMENT QUALIFIER ((VALUE | VALUE.ARRAY)?)>
677
+ # <!ATTLIST QUALIFIER
678
+ # %CIMName;
679
+ # %CIMType; #REQUIRED
680
+ # %Propagated;
681
+ # %QualifierFlavor;
682
+ # xml:lang NMTOKEN #IMPLIED>
683
+ # """
684
+
685
+ def initialize(name, type, data, propagated = nil,
686
+ overridable = nil, tosubclass = nil, toinstance = nil,
687
+ translatable = nil, xml_lang = nil)
688
+ super("QUALIFIER")
689
+ self.setName(name)
690
+ self.add_attribute("TYPE", type)
691
+ unless propagated.nil?
692
+ self.add_attribute("PROPAGATED", propagated.to_s.downcase)
693
+ end
694
+ unless overridable.nil?
695
+ self.add_attribute("OVERRIDABLE", overridable.to_s.downcase)
696
+ end
697
+ unless tosubclass.nil?
698
+ self.add_attribute("TOSUBCLASS", tosubclass.to_s.downcase)
699
+ end
700
+ unless toinstance.nil?
701
+ self.add_attribute("TOINSTANCE", toinstance.to_s.downcase)
702
+ end
703
+ unless translatable.nil?
704
+ self.add_attribute("TRANSLATABLE", translatable.to_s.downcase)
705
+ end
706
+ self.add_optional_attribute("xml:lang", xml_lang)
707
+
708
+ self.add_element(data)
709
+
710
+ end
711
+ end
712
+
713
+ class PROPERTY < CIMElement
714
+ # """
715
+ # The PROPERTY element defines a single (non-array) CIM Property
716
+ # that is not a reference. It contains a single VALUE element
717
+ # representing the value of the Property.
718
+
719
+ # If the Property has no assigned value then the VALUE element MUST be
720
+ # absent.
721
+
722
+ # CIM Reference Properties are described using the
723
+ # PROPERTY.REFERENCE element.
724
+
725
+ # <!ELEMENT PROPERTY (QUALIFIER*, VALUE?)>
726
+ # <!ATTLIST PROPERTY
727
+ # %CIMName;
728
+ # %ClassOrigin;
729
+ # %Propagated;
730
+ # %CIMType; #REQUIRED
731
+ # xml:lang NMTOKEN #IMPLIED>
732
+ # """
733
+
734
+ def initialize(name, type, value = nil, class_origin = nil,
735
+ propagated = nil, qualifiers = [], xml_lang = nil)
736
+ super("PROPERTY")
737
+ self.setName(name)
738
+ self.add_attribute("TYPE", type)
739
+ self.add_optional_attribute("CLASSORIGIN", class_origin)
740
+ unless propagated.nil?
741
+ self.add_attribute("PROPAGATED", propagated.to_s.downcase)
742
+ end
743
+ self.add_optional_attribute("xml:lang", xml_lang)
744
+ self.add_elements(qualifiers)
745
+ self.add_optional_element(value)
746
+ end
747
+ end
748
+
749
+ class PROPERTY_ARRAY < CIMElement
750
+ # """
751
+ # The PROPERTY.ARRAY element defines a single CIM Property with an
752
+ # array type. It contains a single VALUE.ARRAY element representing
753
+ # the value of the Property.
754
+
755
+ # If the Property has no assigned value then the VALUE.ARRAY element
756
+ # MUST be absent.
757
+
758
+ # There is no element to model a Property that contains an array of
759
+ # references as this is not a valid Property type according to CIM.
760
+
761
+ # <!ELEMENT PROPERTY.ARRAY (QUALIFIER*,VALUE.ARRAY?)>
762
+ # <!ATTLIST PROPERTY.ARRAY
763
+ # %CIMName;
764
+ # %ArraySize;
765
+ # %ClassOrigin;
766
+ # %Propagated;
767
+ # %CIMType; #REQUIRED
768
+ # xml:lang NMTOKEN #IMPLIED>
769
+ # """
770
+
771
+ def initialize(name, type, value_array = nil,
772
+ array_size = nil, class_origin = nil,
773
+ propagated = nil, qualifiers = [],
774
+ xml_lang = nil)
775
+ super("PROPERTY.ARRAY")
776
+ self.setName(name)
777
+ self.add_attribute("TYPE", type)
778
+ self.add_optional_attribute("ARRAYSIZE", array_size)
779
+ self.add_optional_attribute("CLASSORIGIN", class_origin)
780
+ unless propagated.nil?
781
+ self.add_attribute("PROPAGATED", propagated.to_s.downcase)
782
+ end
783
+ self.add_optional_attribute("xml:lang", xml_lang)
784
+ self.add_elements(qualifiers)
785
+ self.add_optional_element(value_array)
786
+ end
787
+ end
788
+
789
+ class PROPERTY_REFERENCE < CIMElement
790
+ # """
791
+ # The PROPERTY.REFERENCE element models a single CIM Property with
792
+ # reference semantics. In future the features of XML Linking may
793
+ # be used to identify linking elements within the XML Document; as
794
+ # XML Linking is currently only at Working Draft status no explicit
795
+ # dependencies have been made at this point.
796
+
797
+ # <!ELEMENT PROPERTY.REFERENCE (QUALIFIER*, VALUE.REFERENCE?)>
798
+ # <!ATTLIST PROPERTY.REFERENCE
799
+ # %CIMName;
800
+ # %ReferenceClass;
801
+ # %ClassOrigin;
802
+ # %Propagated;>
803
+ # """
804
+
805
+ def initialize(name, value_reference = nil,
806
+ reference_class = nil, class_origin = nil,
807
+ propagated = nil, qualifiers = [],
808
+ xml_lang = nil)
809
+ super("PROPERTY.REFERENCE")
810
+ self.setName(name)
811
+ self.add_optional_attribute("REFERENCECLASS", reference_class)
812
+ self.add_optional_attribute("CLASSORIGIN", class_origin)
813
+ unless propagated.nil?
814
+ self.add_attribute("PROPAGATED", propagated.to_s.downcase)
815
+ end
816
+ self.add_optional_attribute("xml:lang", xml_lang)
817
+ self.add_elements(qualifiers)
818
+ self.add_optional_element(value_reference)
819
+ end
820
+ end
821
+
822
+ class METHOD < CIMElement
823
+ # """
824
+ # The METHOD element defines a single CIM Method. It may have
825
+ # Qualifiers, and zero or more parameters.
826
+
827
+ # The order of the PARAMETER, PARAMETER.REFERENCE, PARAMETER.ARRAY
828
+ # and PARAMETER.REFARRAY subelements is not significant.
829
+
830
+ # <!ELEMENT METHOD (QUALIFIER*, (PARAMETER | PARAMETER.REFERENCE|
831
+ # PARAMETER.ARRAY | PARAMETER.REFARRAY)*)>
832
+ # <!ATTLIST METHOD
833
+ # %CIMName;
834
+ # %CIMType; #IMPLIED
835
+ # %ClassOrigin;
836
+ # %Propagated;>
837
+ # """
838
+
839
+ def initialize(name, parameters = [],
840
+ return_type = nil, class_origin = nil, propagated = nil, qualifiers = [])
841
+ super("METHOD")
842
+ self.setName(name)
843
+ self.add_optional_attribute("TYPE", return_type)
844
+ self.add_optional_attribute("CLASSORIGIN", class_origin)
845
+ unless propagated.nil?
846
+ self.add_attribute("PROPAGATED", propagated.to_s.downcase)
847
+ end
848
+ self.add_elements(qualifiers)
849
+ self.add_elements(parameters)
850
+ end
851
+ end
852
+
853
+ class PARAMETER < CIMElement
854
+ # """
855
+ # The PARAMETER element defines a single (non-array, non-reference)
856
+ # Parameter to a CIM Method. The parameter MAY have zero or more
857
+ # Qualifiers.
858
+
859
+ # <!ELEMENT PARAMETER (QUALIFIER*)>
860
+ # <!ATTLIST PARAMETER
861
+ # %CIMName;
862
+ # %CIMType; #REQUIRED>
863
+ # """
864
+
865
+ def initialize(name, type, qualifiers = [])
866
+ super("PARAMETER")
867
+ self.setName(name)
868
+ self.add_attribute("TYPE", type)
869
+ self.add_elements(qualifiers)
870
+ end
871
+ end
872
+
873
+ class PARAMETER_REFERENCE < CIMElement
874
+ # """
875
+ # The PARAMETER.REFERENCE element defines a single reference
876
+ # Parameter to a CIM Method. The parameter MAY have zero or more
877
+ # Qualifiers.
878
+
879
+ # <!ELEMENT PARAMETER.REFERENCE (QUALIFIER*)>
880
+ # <!ATTLIST PARAMETER.REFERENCE
881
+ # %CIMName;
882
+ # %ReferenceClass;>
883
+ # """
884
+
885
+ def initialize(name, reference_class = nil, qualifiers = [])
886
+ super("PARAMETER.REFERENCE")
887
+ self.setName(name)
888
+ self.add_optional_attribute("REFERENCECLASS", reference_class)
889
+ self.add_elements(qualifiers)
890
+ end
891
+ end
892
+
893
+ class PARAMETER_ARRAY < CIMElement
894
+ # """
895
+ # The PARAMETER.ARRAY element defines a single Parameter to a CIM
896
+ # Method that has an array type. The parameter MAY have zero or more
897
+ # Qualifiers.
898
+
899
+ # <!ELEMENT PARAMETER.ARRAY (QUALIFIER*)>
900
+ # <!ATTLIST PARAMETER.ARRAY
901
+ # %CIMName;
902
+ # %CIMType; #REQUIRED
903
+ # %ArraySize;>
904
+ # """
905
+
906
+ def initialize(name, type, array_size = nil, qualifiers = [])
907
+ super("PARAMETER.ARRAY")
908
+ self.setName(name)
909
+ self.add_attribute("TYPE", type)
910
+ self.add_optional_attribute("ARRAYSIZE", array_size)
911
+ self.add_elements(qualifiers)
912
+ end
913
+ end
914
+
915
+ class PARAMETER_REFARRAY < CIMElement
916
+ # """
917
+ # The PARAMETER.REFARRAY element defines a single Parameter to a CIM
918
+ # Method that has an array of references type. The parameter MAY
919
+ # have zero or more Qualifiers.
920
+
921
+ # <!ELEMENT PARAMETER.REFARRAY (QUALIFIER*)>
922
+ # <!ATTLIST PARAMETER.REFARRAY
923
+ # %CIMName;
924
+ # %ReferenceClass;
925
+ # %ArraySize;>
926
+ # """
927
+
928
+ def initialize(name, reference_class = nil, array_size = nil,
929
+ qualifiers = [])
930
+ super("PARAMETER.REFARRAY")
931
+ self.setName(name)
932
+ self.add_optional_attribute("REFERENCECLASS", reference_class)
933
+ self.add_optional_attribute("ARRAYSIZE", array_size)
934
+ self.add_elements(qualifiers)
935
+ end
936
+ end
937
+
938
+
939
+ class TABLECELL_DECLARATION < CIMElement
940
+ # """
941
+ # The TABLECELL.DECLARATION element describes a TABLECELL that is
942
+ # not a reference or an array of references.
943
+
944
+
945
+ # <!ELEMENT TABLECELL.DECLARATION EMPTY>
946
+ # <!ATTLIST TABLECELL.DECLARATION
947
+ # %CIMName;
948
+ # %CIMType; #REQUIRED
949
+ # ISARRAY (true|false) "false"
950
+ # %ARRAYSIZE;
951
+ # CELLPOS CDATA #REQUIRED
952
+ # SORTPOS CDATA #IMPLIED
953
+ # SORTDIR (ASC|DESC) #IMPLIED>
954
+ # """
955
+ end
956
+
957
+ class TABLECELL_REFERENCE < CIMElement
958
+ # """
959
+
960
+ # The TABLECELL.REFERENCE element defines a TABLECELL that contains
961
+ # reference or reference array values.
962
+
963
+ # <!ELEMENT TABLECELL.REFERENCE EMPTY>
964
+ # <!ATTLIST TABLECELL.REFERENCE
965
+ # %CIMName;
966
+ # %ReferenceClass; #REQUIRED
967
+ # ISARRAY (true|false) "false"
968
+ # %ARRAYSIZE;
969
+ # CELLPOS CDATA #REQUIRED
970
+ # SORTPOS CDATA #IMPLIED
971
+ # SORTDIR (ASC|DESC) #IMPLIED>
972
+ # """
973
+ end
974
+
975
+ class TABLEROW_DECLARATION <CIMElement
976
+ # """
977
+
978
+ # The TABLEROW.DECLARATION element contains a definition for each
979
+ # TABLECELL in the TABLEROW.
980
+
981
+ # <!ELEMENT TABLEROW.DECLARATION (TABLECELL.DECLARATION
982
+ # | TABLECELL.REFERENCE)*>
983
+ # """
984
+ end
985
+
986
+ class TABLE < CIMElement
987
+ # """
988
+ # The TABLE element defines the result of a CIM Query. A TABLE
989
+ # element consists of a TABLEROW.DECLARATION followed by 0 or more
990
+ # rows.
991
+
992
+ # <!ELEMENT TABLE(TABLEROW.DECLARATION,(TABLEROW)*)>
993
+ # """
994
+ end
995
+
996
+ class TABLEROW < CIMElement
997
+ # """
998
+ #
999
+ # The TABLEROW element defines the values for a single row of a
1000
+ # table. A value for each cell of the row MUST be specified. If a
1001
+ # value has no assigned value, the VALUE.NULL element MUST be used.
1002
+ #
1003
+ # <!ELEMENT TABLEROW (VALUE | VALUE.ARRAY | VALUE.REFERENCE |
1004
+ # VALUE.REFARRAY | VALUE.NULL)*>
1005
+ # """
1006
+ end
1007
+
1008
+ # Message elements
1009
+
1010
+ class MESSAGE < CIMElement
1011
+ # """
1012
+ # The MESSAGE element models a single CIM message. This element is
1013
+ # used as the basis for CIM Operation Messages and CIM Export
1014
+ # Messages.
1015
+
1016
+ # <!ELEMENT MESSAGE (SIMPLEREQ | MULTIREQ | SIMPLERSP | MULTIRSP) |
1017
+ # MULTIEXPRSP)>
1018
+ # <!ATTLIST MESSAGE
1019
+ # ID CDATA #REQUIRED
1020
+ # PROTOCOLVERSION CDATA #REQUIRED>
1021
+ # """
1022
+
1023
+ def initialize(data, message_id, protocol_version)
1024
+ super("MESSAGE")
1025
+ self.add_attribute("ID", message_id)
1026
+ self.add_attribute("PROTOCOLVERSION", protocol_version)
1027
+ self.add_element(data)
1028
+ end
1029
+ end
1030
+
1031
+ class MULTIREQ < CIMElement
1032
+ # """
1033
+ # The MULTIREQ element defines a Multiple CIM Operation request. It
1034
+ # contains two or more subelements defining the SIMPLEREQ elements
1035
+ # that make up this multiple request.
1036
+
1037
+ # <!ELEMENT MULTIREQ (SIMPLEREQ, SIMPLEREQ+)>
1038
+ # """
1039
+
1040
+ def initialize(data)
1041
+ super("MULTIREQ")
1042
+ self.add_elements(data)
1043
+ end
1044
+ end
1045
+
1046
+ class MULTIEXPREQ < CIMElement
1047
+ # """
1048
+ # The MULTIEXPREQ element defines a Multiple CIM Export request. It
1049
+ # contains two or more subelements defining the SIMPLEEXPREQ
1050
+ # elements that make up this multiple request.
1051
+
1052
+ # <!ELEMENT MULTIEXPREQ (SIMPLEEXPREQ, SIMPLEEXPREQ+)>
1053
+ # """
1054
+
1055
+ def initialize(data)
1056
+ super("MULTIEXPREQ")
1057
+ self.add_elements(data)
1058
+ end
1059
+ end
1060
+
1061
+ class SIMPLEREQ < CIMElement
1062
+ # """
1063
+ # The SIMPLEREQ element defines a Simple CIM Operation request. It
1064
+ # contains either a METHODCALL (extrinsic method) element or an
1065
+ # IMETHODCALL (intrinsic method) element.
1066
+
1067
+ # <!ELEMENT SIMPLEREQ (IMETHODCALL | METHODCALL)>
1068
+ # """
1069
+
1070
+ def initialize(data)
1071
+ super("SIMPLEREQ")
1072
+ self.add_element(data)
1073
+ end
1074
+ end
1075
+
1076
+ class SIMPLEEXPREQ < CIMElement
1077
+ # """
1078
+ # The SIMPLEEXPREQ element defines a Simple CIM Export request. It
1079
+ # contains an EXPMETHODCALL (export method).
1080
+
1081
+ # <!ELEMENT SIMPLEEXPREQ (EXPMETHODCALL)>
1082
+ # """
1083
+
1084
+ def initialize(data)
1085
+ super("SIMPLEEXPREQ")
1086
+ self.add_element(data)
1087
+ end
1088
+ end
1089
+
1090
+ class IMETHODCALL < CIMElement
1091
+ # """
1092
+ # The IMETHODCALL element defines a single intrinsic method
1093
+ # invocation. It specifies the target local namespace, followed by
1094
+ # zero or more IPARAMVALUE subelements as the parameter values to be
1095
+ # passed to the method. If the RESPONSEDESTINATION element is
1096
+ # specified, the intrinsic method call MUST be interpreted as an
1097
+ # asynchronous method call.
1098
+
1099
+ # <!ELEMENT IMETHODCALL (LOCALNAMESPACEPATH, IPARAMVALUE*),
1100
+ # RESPONSEDESTINATION?)>
1101
+ # <!ATTLIST IMETHODCALL
1102
+ # %CIMName;>
1103
+ # """
1104
+
1105
+ def initialize(name, localnamespacepath, iparamvalues = [],
1106
+ responsedestination = nil)
1107
+ super("IMETHODCALL")
1108
+ self.setName(name)
1109
+ self.add_element(localnamespacepath)
1110
+ self.add_elements(iparamvalues)
1111
+ self.add_optional_element(responsedestination)
1112
+ end
1113
+ end
1114
+
1115
+ class METHODCALL < CIMElement
1116
+ # """
1117
+ # The METHODCALL element defines a single method invocation on a
1118
+ # Class or Instance. It specifies the local path of the target
1119
+ # Class or Instance, followed by zero or more PARAMVALUE subelements
1120
+ # as the parameter values to be passed to the method. If the
1121
+ # RESPONSEDESTINATION element is specified, the method call MUST be
1122
+ # interpreted as an asynchronous method call.
1123
+
1124
+ # <!ELEMENT METHODCALL ((LOCALINSTANCEPATH | LOCALCLASSPATH), PARAMVALUE*)>
1125
+ # <!ATTLIST METHODCALL
1126
+ # %CIMName;>
1127
+ # """
1128
+
1129
+ def initialize(name, localpath, paramvalues = [],
1130
+ responsedestination = nil)
1131
+ super("METHODCALL")
1132
+ self.setName(name)
1133
+ self.add_element(localpath)
1134
+ self.add_elements(paramvalues)
1135
+ self.add_optional_element(responsedestination)
1136
+ end
1137
+ end
1138
+
1139
+ class EXPMETHODCALL < CIMElement
1140
+ # """
1141
+ # The EXPMETHODCALL element defines a single export method
1142
+ # invocation. It specifies zero or more <EXPPARAMVALUE>
1143
+ # subelements as the parameter values to be passed to the method.
1144
+
1145
+ # <!ELEMENT EXPMETHODCALL (EXPPARAMVALUE*)>
1146
+ # <!ATTLIST EXPMETHODCALL
1147
+ # %CIMName;>
1148
+ # """
1149
+
1150
+ def initialize(name, params = [])
1151
+ super("EXPMETHODCALL")
1152
+ self.setName(name)
1153
+ self.add_elements(params)
1154
+ end
1155
+ end
1156
+
1157
+ class PARAMVALUE < CIMElement
1158
+ # """
1159
+ # The PARAMVALUE element defines a single extrinsic method named
1160
+ # parameter value. If no subelement is present this indicates that
1161
+ # no value has been supplied for this parameter.
1162
+
1163
+ # <!ELEMENT PARAMVALUE (VALUE | VALUE.REFERENCE | VALUE.ARRAY |
1164
+ # VALUE.REFARRAY)?>
1165
+ # <!ATTLIST PARAMVALUE
1166
+ # %CIMName;
1167
+ # %ParamType; #IMPLIED>
1168
+ # """
1169
+
1170
+ def initialize(name, data = nil, param_type = nil)
1171
+ super("PARAMVALUE")
1172
+ self.setName(name)
1173
+ self.add_optional_attribute("PARAMTYPE", param_type)
1174
+ self.add_optional_element(data)
1175
+ end
1176
+ end
1177
+
1178
+ class IPARAMVALUE < CIMElement
1179
+ # """
1180
+ # The IPARAMVALUE element defines a single intrinsic method named
1181
+ # parameter value. If no subelement is present this indicates that
1182
+ # no value has been supplied for this parameter.
1183
+
1184
+ # <!ELEMENT IPARAMVALUE (VALUE | VALUE.ARRAY | VALUE.REFERENCE |
1185
+ # INSTANCENAME | CLASSNAME | QUALIFIER.DECLARATION |
1186
+ # CLASS | INSTANCE | VALUE.NAMEDINSTANCE)?>
1187
+ # <!ATTLIST IPARAMVALUE
1188
+ # %CIMName;
1189
+ # %ParamType; #IMPLIED>
1190
+ # """
1191
+
1192
+ def initialize(name, data = nil, param_type = nil)
1193
+ super("IPARAMVALUE")
1194
+ self.setName(name)
1195
+ self.add_optional_attribute("PARAMTYPE", param_type)
1196
+ self.add_optional_element(data)
1197
+ end
1198
+ end
1199
+
1200
+ class EXPPARAMVALUE < CIMElement
1201
+ # """
1202
+ # The EXPPARAMVALUE element defines a single export method named
1203
+ # parameter value. If no subelement is present this indicates that
1204
+ # no value has been supplied for this parameter.
1205
+
1206
+ # <!ELEMENT EXPPARAMVALUE (INSTANCE)?>
1207
+ # <!ATTLIST EXPPARAMVALUE
1208
+ # %CIMName;>
1209
+ # """
1210
+
1211
+ def initialize(name, data = nil)
1212
+ super("EXPPARAMVALUE")
1213
+ self.setName(name)
1214
+ self.add_optional_element(data)
1215
+ end
1216
+ end
1217
+
1218
+ class MULTIRSP < CIMElement
1219
+ # """
1220
+ # The MULTIRSP element defines a Multiple CIM Operation response.
1221
+ # It contains two or more subelements defining the SIMPLERSP
1222
+ # elements that make up this multiple response.
1223
+
1224
+ # <!ELEMENT MULTIRSP (SIMPLERSP, SIMPLERSP+)>
1225
+ # """
1226
+
1227
+ def initialize(data)
1228
+ super("MULTIRSP")
1229
+ self.add_elements(data)
1230
+ end
1231
+ end
1232
+
1233
+ class MULTIEXPRSP < CIMElement
1234
+ # """
1235
+ # The MULTIEXPRSP element defines a Multiple CIM Export response.
1236
+ # It contains two or more subelements defining the SIMPLEEXPRSP
1237
+ # elements that make up this multiple response.
1238
+
1239
+ # <!ELEMENT MULTIEXPRSP (SIMPLEEXPRSP, SIMPLEEXPRSP+)>
1240
+ # """
1241
+
1242
+ def initialize(data)
1243
+ super("MULTIEXPRSP")
1244
+ self.add_elements(data)
1245
+ end
1246
+ end
1247
+
1248
+ class SIMPLERSP < CIMElement
1249
+ # """
1250
+ # The SIMPLERSP element defines a Simple CIM Operation response. It
1251
+ # contains either a METHODRESPONSE (for extrinsic methods),
1252
+ # IMETHODRESPONSE (for intrinsic methods) or a SIMPLEREQACK
1253
+ # subelement.
1254
+
1255
+ # <!ELEMENT SIMPLERSP (METHODRESPONSE | IMETHODRESPONSE | SIMPLEREQACK)>
1256
+ # """
1257
+
1258
+ def initialize(data)
1259
+ super("SIMPLERSP")
1260
+ self.add_element(data)
1261
+ end
1262
+ end
1263
+
1264
+ class SIMPLEEXPRSP < CIMElement
1265
+ # """
1266
+ # The SIMPLEEXPRSP element defines a Simple CIM Export response. It
1267
+ # contains either a EXPMETHODRESPONSE (for export methods)
1268
+ # subelement.
1269
+
1270
+ # <!ELEMENT SIMPLEEXPRSP (EXPMETHODRESPONSE)>
1271
+ # """
1272
+
1273
+ def initialize(data)
1274
+ super("SIMPLEEXPRSP")
1275
+ self.add_element(data)
1276
+ end
1277
+ end
1278
+
1279
+ class METHODRESPONSE < CIMElement
1280
+ # """
1281
+ # The METHODRESPONSE defines the response to a single CIM extrinsic
1282
+ # method invocation. It contains either an ERROR subelement (to
1283
+ # report a fundamental error which prevented the method from
1284
+ # executing), or a combination of an optional return value and zero
1285
+ # or more out parameter values.
1286
+
1287
+ # <!ELEMENT METHODRESPONSE (ERROR | (RETURNVALUE?, PARAMVALUE*))>
1288
+ # <!ATTLIST METHODRESPONSE
1289
+ # %CIMName;>
1290
+ # """
1291
+
1292
+ def initialize(name, data = nil)
1293
+ super("METHODRESPONSE")
1294
+ self.setName(name)
1295
+ unless data.nil?
1296
+ self.add_elements(data)
1297
+ end
1298
+ end
1299
+ end
1300
+
1301
+ class EXPMETHODRESPONSE < CIMElement
1302
+ # """
1303
+ # The EXPMETHODRESPONSE defines the response to a single export
1304
+ # method invocation. It contains either an ERROR subelement (to
1305
+ # report a fundamental error which prevented the method from
1306
+ # executing), or an optional return value.
1307
+
1308
+ # <!ELEMENT EXPMETHODRESPONSE (ERROR | IRETURNVALUE?)>
1309
+ # <!ATTLIST EXPMETHODRESPONSE
1310
+ # %CIMName;>
1311
+ # """
1312
+
1313
+ def initialize(name, data = nil)
1314
+ super("EXPMETHODRESPONSE")
1315
+ self.setName(name)
1316
+ self.add_optional_element(data)
1317
+ end
1318
+ end
1319
+
1320
+ class IMETHODRESPONSE < CIMElement
1321
+ # """
1322
+ # The IMETHODRESPONSE defines the response to a single intrinsic CIM
1323
+ # method invocation. It contains either an ERROR subelement (to
1324
+ # report a fundamental error which prevented the method from
1325
+ # executing), or an optional return value.
1326
+
1327
+ # <!ELEMENT IMETHODRESPONSE (ERROR | IRETURNVALUE?)>
1328
+ # <!ATTLIST IMETHODRESPONSE
1329
+ # %CIMName;>
1330
+ # """
1331
+
1332
+ def initialize(name, data = nil)
1333
+ super("IMETHODRESPONSE")
1334
+ self.setName(name)
1335
+ self.add_optional_element(data)
1336
+ end
1337
+ end
1338
+
1339
+ class ERROR < CIMElement
1340
+ # """
1341
+ # The ERROR element is used to define a fundamental error which
1342
+ # prevented a method from executing normally. It consists of a
1343
+ # status code, an optional description and zero or more instances
1344
+ # containing detailed information about the error.
1345
+
1346
+ # <!ELEMENT ERROR (INSTANCE*)>
1347
+ # <!ATTLIST ERROR
1348
+ # CODE CDATA #REQUIRED
1349
+ # DESCRIPTION CDATA #IMPLIED>
1350
+ # """
1351
+
1352
+ def initialize(code, description = nil, instances = [])
1353
+ super("ERROR")
1354
+ self.add_attribute("CODE", code)
1355
+ self.add_optional_attribute("DESCRIPTION", description)
1356
+ self.add_elements(instances)
1357
+ end
1358
+ end
1359
+
1360
+ class RETURNVALUE < CIMElement
1361
+ # """
1362
+ # The RETURNVALUE element specifies the value returned from an
1363
+ # extrinsic method call.
1364
+
1365
+ # <!ELEMENT RETURNVALUE (VALUE | VALUE.REFERENCE)>
1366
+ # <!ATTLIST RETURNVALUE
1367
+ # %ParamType; #IMPLIED>
1368
+ # """
1369
+
1370
+ def initialize(data, param_type = nil)
1371
+ super("RETURNVALUE")
1372
+ self.add_optional_attribute("PARAMTYPE", param_type)
1373
+ self.add_element(data)
1374
+ end
1375
+ end
1376
+
1377
+ class IRETURNVALUE < CIMElement
1378
+ # """
1379
+ # The IRETURNVALUE element specifies the value returned from an
1380
+ # intrinsic method call.
1381
+
1382
+ # <!ELEMENT IRETURNVALUE (CLASSNAME* | INSTANCENAME* | VALUE* |
1383
+ # VALUE.OBJECTWITHPATH* |
1384
+ # VALUE.OBJECTWITHLOCALPATH* | VALUE.OBJECT* |
1385
+ # OBJECTPATH* | QUALIFIER.DECLARATION* |
1386
+ # VALUE.ARRAY? | VALUE.REFERENCE? | CLASS* |
1387
+ # INSTANCE* | VALUE.NAMEDINSTANCE*)>
1388
+ # """
1389
+
1390
+ def initialize(data)
1391
+ super("IRETURNVALUE")
1392
+ self.add_optional_element(data)
1393
+ end
1394
+ end
1395
+
1396
+ class RESPONSEDESTINATION < CIMElement
1397
+ # """
1398
+ # The RESPONSEDESTINATION element contains an instance that
1399
+ # describes the desired destination for the response.
1400
+
1401
+ # <!ELEMENT RESPONSEDESTINATON (INSTANCE)>
1402
+ # """
1403
+
1404
+ def initialize(data)
1405
+ super("RESPONSEDESTINATON")
1406
+ self.add_element(data);
1407
+ end
1408
+ end
1409
+
1410
+ class SIMPLEREQACK < CIMElement
1411
+ # """
1412
+ # The SIMPLEREQACK defines the acknowledgement response to a Simple
1413
+ # CIM Operation asynchronous request. The ERROR subelement is used
1414
+ # to report a fundamental error which prevented the asynchronous
1415
+ # request from being initiated.
1416
+
1417
+ # <!ELEMENT SIMPLEREQACK (ERROR?)>
1418
+ # <!ATTLIST SIMPLEREQACK
1419
+ # INSTANCEID CDATA #REQUIRED>
1420
+ # """
1421
+
1422
+ def initialize(instanceid, data)
1423
+ super("SIMPLEREQACK")
1424
+ self.add_optional_attribute("INSTANCEID", instanceid)
1425
+ self.add_optional_element(data)
1426
+ end
1427
+ end
1428
+ end