Module: Cmpi

Defined in:
lib/cmpi.rb,
lib/cmpi/provider.rb,
ext/cmpi-bindings/cmpi_wrap.c

Overview

Cmpi is the module namespace for cmpi-bindings.

cmpi-bindings implements a CMPI providers in any target language by using the SWIG bindings generator.

Defined Under Namespace

Modules: AssociationProviderIF, IndicationProviderIF, InstanceProviderIF, MethodProviderIF, ProviderIF Classes: AssociationProvider, CMPIArgs, CMPIArray, CMPIBroker, CMPIContext, CMPIData, CMPIDateTime, CMPIEnumeration, CMPIError, CMPIException, CMPIInstance, CMPIMsgFileHandle, CMPIObjectPath, CMPIPredicate, CMPIResult, CMPISelectCond, CMPISelectExp, CMPIStatus, CMPIString, CMPISubCond, CMPIValue, CMPIValuePtr, IndicationProvider, InstanceProvider, MethodProvider, ValueMap

Constant Summary collapse

CMPI_ARRAY =
((1)<<13)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.argsObject



84
85
86
# File 'lib/cmpi.rb', line 84

def self.args
  ((16+2)<<8)
end

.argsAObject



164
165
166
# File 'lib/cmpi.rb', line 164

def self.argsA
  CMPI_ARRAY | self.args
end

.booleanObject



40
41
42
# File 'lib/cmpi.rb', line 40

def self.boolean
  (2+0)
end

.booleanAObject



120
121
122
# File 'lib/cmpi.rb', line 120

def self.booleanA
  CMPI_ARRAY | self.boolean
end

.brokerObject



20
21
22
# File 'lib/cmpi/provider.rb', line 20

def self.broker
  @@broker
end

.char16Object



43
44
45
# File 'lib/cmpi.rb', line 43

def self.char16
  (2+1)
end

.char16AObject



123
124
125
# File 'lib/cmpi.rb', line 123

def self.char16A
  CMPI_ARRAY | self.char16
end

.charsObject



96
97
98
# File 'lib/cmpi.rb', line 96

def self.chars
  ((16+7)<<8)
end

.charsAObject



176
177
178
# File 'lib/cmpi.rb', line 176

def self.charsA
  CMPI_ARRAY | self.chars
end

.charsptrObject



105
106
107
# File 'lib/cmpi.rb', line 105

def self.charsptr
  ((16+10)<<8)
end

.charsptrAObject



185
186
187
# File 'lib/cmpi.rb', line 185

def self.charsptrA
  CMPI_ARRAY | self.charsptrA
end

.cimdatetime_to_ruby(str) ⇒ Object

Convert CIM DateTime string representation (see DSP0004, 2.2.1) to Ruby Time (timestamp) or Float (interval, as seconds with fraction)

00000000001111111111222222
01234567890123456789012345

East: yyyymmddhhmmss.mmmmmm+utc -> Time (utc = offset in minutes) West: yyyymmddhhmmss.mmmmmm-utc -> Time Interval: ddddddddhhmmss.mmmmmm:000 -> Float (interval in seconds, with fraction)



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/cmpi.rb', line 204

def self.cimdatetime_to_ruby str
#    puts "Cmpi.cimdatetime_to_ruby(#{str})"
  case str[21,1]
  when '+', '-'
    # create Time from yyyymmddhhmmss and utc
    t = Time.new(str[0,4].to_i, str[4,2].to_i, str[6,2].to_i, str[8,2].to_i, str[10,2].to_i, str[12,2].to_i, str[22,3].to_i * ((str[21,1]=='+')?60:-60))
    off = str[15,6].to_i / 1000
    # Add fractional part
    return t + off
  when ':'
    # time offset
    off = str[0,8].to_i * 24 * 60 * 60
    off += str[8,2].to_i * 60 * 60 + str[10,2].to_i * 60 + str[12,2].to_i
    off += str[15,6].to_i / 1000
    return off
  else
    raise "Invalid CIM DateTime '#{str}'"
  end
end

.dateTimeObject



99
100
101
# File 'lib/cmpi.rb', line 99

def self.dateTime
  ((16+8)<<8)
end

.dateTimeAObject



179
180
181
# File 'lib/cmpi.rb', line 179

def self.dateTimeA
  CMPI_ARRAY | self.dateTime
end

.embedded_instanceObject



111
112
113
# File 'lib/cmpi.rb', line 111

def self.embedded_instance
  ((1)<<15)
end

.embedded_instanceAObject



191
192
193
# File 'lib/cmpi.rb', line 191

def self.embedded_instanceA
  CMPI_ARRAY | self.embedded_instance
end

.embedded_objectObject



108
109
110
# File 'lib/cmpi.rb', line 108

def self.embedded_object
  ((1)<<14)
end

.embedded_objectAObject



188
189
190
# File 'lib/cmpi.rb', line 188

def self.embedded_objectA
  CMPI_ARRAY | self.embedded_object
end

.enumerationObject



90
91
92
# File 'lib/cmpi.rb', line 90

def self.enumeration
  ((16+5)<<8)
end

.enumerationAObject



170
171
172
# File 'lib/cmpi.rb', line 170

def self.enumerationA
  CMPI_ARRAY | self.enumeration
end

.filterObject



87
88
89
# File 'lib/cmpi.rb', line 87

def self.filter
  ((16+4)<<8)
end

.filterAObject



167
168
169
# File 'lib/cmpi.rb', line 167

def self.filterA
  CMPI_ARRAY | self.filter
end

.instanceObject



78
79
80
# File 'lib/cmpi.rb', line 78

def self.instance
  ((16+0)<<8)
end

.instanceAObject



158
159
160
# File 'lib/cmpi.rb', line 158

def self.instanceA
  CMPI_ARRAY | self.instance
end

.nullObject



37
38
39
# File 'lib/cmpi.rb', line 37

def self.null
  0
end

.ptrObject



102
103
104
# File 'lib/cmpi.rb', line 102

def self.ptr
  ((16+9)<<8)
end

.ptrAObject



182
183
184
# File 'lib/cmpi.rb', line 182

def self.ptrA
  CMPI_ARRAY | self.ptr
end

.real32Object



47
48
49
# File 'lib/cmpi.rb', line 47

def self.real32
  ((2+0)<<2)
end

.real32AObject



127
128
129
# File 'lib/cmpi.rb', line 127

def self.real32A
  CMPI_ARRAY | self.real32
end

.real64Object



50
51
52
# File 'lib/cmpi.rb', line 50

def self.real64
  ((2+1)<<2)
end

.real64AObject



130
131
132
# File 'lib/cmpi.rb', line 130

def self.real64A
  CMPI_ARRAY | self.real64
end

.refObject



81
82
83
# File 'lib/cmpi.rb', line 81

def self.ref
  ((16+1)<<8)
end

.refAObject



161
162
163
# File 'lib/cmpi.rb', line 161

def self.refA
  CMPI_ARRAY | self.ref
end

.ruby_to_cimdatetime(val) ⇒ Object

Convert Ruby value to CIM DateTime string representation (see DSP0004, 2.2.1)

00000000001111111111222222
01234567890123456789012345

East: yyyymmddhhmmss.mmmmmm+utc -> Time (utc = offset in minutes, mmmmmm is the microsecond within the second West: yyyymmddhhmmss.mmmmmm-utc -> Time Interval: ddddddddhhmmss.mmmmmm:000 -> Float (interval in seconds, with fraction)



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/cmpi.rb', line 232

def self.ruby_to_cimdatetime val
  require 'date'
#    puts "Cmpi.ruby_to_cimdatetime(#{val}[#{val.class}])"
  t = nil
  case val
  when Time
    s = val.strftime "%Y%m%d%H%M%S.%6N"
    utc = val.utc_offset # offset in seconds
    if utc < 0
      s << "-"
      utc = -utc
    else
      s << "+"
    end
    val = s + ("%03d" % (utc/60))
  when Numeric
    if val < 0
      # treat it as seconds before epoch
      val = self.ruby_to_cimdatetime( Time.at(val) )
    else
      # treat as interval in microseconds
      secs = (val / 1000000).to_i
      usecs = (val % 1000000).to_i
      days = secs / (24 * 60 * 60)
      secs = secs % (24 * 60 * 60) # seconds within the day
      hours = (secs / (60 * 60)).to_i
      secs = secs % (60 * 60)
      mins = (secs / 60).to_i
      secs = secs % 60
      val = "%08d%02d%02d%02d.%06d:000" % [ days, hours, mins, secs, usecs ]
    end
  when /^\d{14}\.\d{6}[-+:]\d{3}$/
    # fallthru
  when String
    val = self.ruby_to_cimdatetime val.to_f # retry as Numeric
  else
    val = self.ruby_to_cimdatetime val.to_s # retry as string
  end
  val
end

.sint16Object



69
70
71
# File 'lib/cmpi.rb', line 69

def self.sint16
  ((8+5)<<4)
end

.sint16AObject



149
150
151
# File 'lib/cmpi.rb', line 149

def self.sint16A
  CMPI_ARRAY | self.sint16
end

.sint32Object



72
73
74
# File 'lib/cmpi.rb', line 72

def self.sint32
  ((8+6)<<4)
end

.sint32AObject



152
153
154
# File 'lib/cmpi.rb', line 152

def self.sint32A
  CMPI_ARRAY | self.sint32
end

.sint64Object



75
76
77
# File 'lib/cmpi.rb', line 75

def self.sint64
  ((8+7)<<4)
end

.sint64AObject



155
156
157
# File 'lib/cmpi.rb', line 155

def self.sint64A
  CMPI_ARRAY | self.sint64
end

.sint8Object



66
67
68
# File 'lib/cmpi.rb', line 66

def self.sint8
  ((8+4)<<4)
end

.sint8AObject



146
147
148
# File 'lib/cmpi.rb', line 146

def self.sint8A
  CMPI_ARRAY | self.sint8
end

.stringObject



93
94
95
# File 'lib/cmpi.rb', line 93

def self.string
  ((16+6)<<8)
end

.stringAObject



173
174
175
# File 'lib/cmpi.rb', line 173

def self.stringA
  CMPI_ARRAY | self.string
end

.uint16Object



57
58
59
# File 'lib/cmpi.rb', line 57

def self.uint16
  ((8+1)<<4)
end

.uint16AObject



137
138
139
# File 'lib/cmpi.rb', line 137

def self.uint16A
  CMPI_ARRAY | self.uint16
end

.uint32Object



60
61
62
# File 'lib/cmpi.rb', line 60

def self.uint32
  ((8+2)<<4)
end

.uint32AObject



140
141
142
# File 'lib/cmpi.rb', line 140

def self.uint32A
  CMPI_ARRAY | self.uint32
end

.uint64Object



63
64
65
# File 'lib/cmpi.rb', line 63

def self.uint64
  ((8+3)<<4)
end

.uint64AObject



143
144
145
# File 'lib/cmpi.rb', line 143

def self.uint64A
  CMPI_ARRAY | self.uint64
end

.uint8Object



54
55
56
# File 'lib/cmpi.rb', line 54

def self.uint8
  ((8+0)<<4)
end

.uint8AObject



134
135
136
# File 'lib/cmpi.rb', line 134

def self.uint8A
  CMPI_ARRAY | self.uint8
end

Instance Method Details

#not_implemented(klass, name) ⇒ Object



23
24
25
26
# File 'lib/cmpi/provider.rb', line 23

def not_implemented klass, name
  STDERR.puts "#{klass}.#{name}: not implemented"
  nil
end