From: <kk...@us...> - 2008-10-03 12:31:41
|
Revision: 1067 http://omc.svn.sourceforge.net/omc/?rev=1067&view=rev Author: kkaempf Date: 2008-10-03 12:31:35 +0000 (Fri, 03 Oct 2008) Log Message: ----------- small increments in Ruby instrumentation Modified Paths: -------------- cmpi-bindings/trunk/test/ruby/test_atom_provider.rb Added Paths: ----------- cmpi-bindings/trunk/test/ruby/Test_Atom.rb Added: cmpi-bindings/trunk/test/ruby/Test_Atom.rb =================================================================== --- cmpi-bindings/trunk/test/ruby/Test_Atom.rb (rev 0) +++ cmpi-bindings/trunk/test/ruby/Test_Atom.rb 2008-10-03 12:31:35 UTC (rev 1067) @@ -0,0 +1,44 @@ +# Model an atom, For use with CIMOM and Ruby provider +# +# INTRINSIC DATA TYPE INTERPRETATION +# uint8 Unsigned 8-bit integer +# sint8 Signed 8-bit integer +# uint16 Unsigned 16-bit integer +# sint16 Signed 16-bit integer +# uint32 Unsigned 32-bit integer +# sint32 Signed 32-bit integer +# uint64 Unsigned 64-bit integer +# sint64 Signed 64-bit integer +# string UCS-2 string +# boolean Boolean +# real32 IEEE 4-byte floating-point +# real64 IEEE 8-byte floating-point +# datetime A string containing a date-time +# <classname> ref Strongly typed reference +# char16 16-bit UCS-2 character +# + +class Test_Atom + attr_accessor :uint8Prop, :uint8Propa, :sint8prop, :sint8propa + attr_accessor :uint16Prop, :uint16Propa, :sint16prop, :sint16propa + attr_accessor :uint32Prop, :uint32Propa, :sint32prop, :sint32propa + attr_accessor :uint64Prop, :uint64Propa, :sint64prop, :sint64propa + attr_accessor :stringProp, :stringPropa + attr_accessor :real32Prop, :real32Propa, :real64Prop, :real64Propa + attr_accessor :dateProp, :boolProp + + def initialize name + @uint8Prop = @sint8prop = @uint16Prop = @sint16prop = 0 + @uint8Propa = @sint8propa = @uint16Propa = @sint16propa = [] + @uint32Prop = @sint32prop = @uint64Prop = @sint64prop = 0 + @uint32Propa = @sint32propa = @uint64Propa = @sint64propa = [] + @stringProp = "" + @stringPropa = [] + @real32prop = @real64prop = 0.0 + @real32propa = @real64Propa = [] + @dateProb = Time.new + @boolProb = false + @name = name + end + +end Modified: cmpi-bindings/trunk/test/ruby/test_atom_provider.rb =================================================================== --- cmpi-bindings/trunk/test/ruby/test_atom_provider.rb 2008-10-03 12:30:25 UTC (rev 1066) +++ cmpi-bindings/trunk/test/ruby/test_atom_provider.rb 2008-10-03 12:31:35 UTC (rev 1067) @@ -5,7 +5,7 @@ # module Cmpi - + STDERR.puts "This is test_atom_provider.rb" # Instrument the CIM class TestAtom # @@ -13,14 +13,22 @@ # class TestAtomProvider < InstanceProvider - # create new instance -> check with .mof file + require 'Test_Atom' + + # create new provider instance -> check with .mof file def initialize broker + @instances = {} super end # use i.e. 'include MethodProviderIF' to implement multiple MIs def create_instance context, result, reference, newinst STDERR.puts "TestAtomProvider.create_instance: #{reference}" + STDERR.puts "TestAtomProvider.create_instance: #{reference.key_count} keys" + reference.keys do |value,name| + STDERR.puts "Key #{name} = #{value}" + end + @instances[reference.to_s] = Test_Atom.new reference.get_key_at(0)[0]._value result.return_objectpath reference result.done end @@ -30,10 +38,14 @@ plist = plist.join(',') if plist.respond_to? :join STDERR.puts "TestAtomProvider.get_instance: #{objname}: #{plist}" + instance = @instances[objname] + result.return_instance instance if instance + result.done end def delete_instance context, result, objname STDERR.puts "TestAtomProvider.delete_instance: #{objname}" + @instances.delete objname end end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |