You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(26) |
Dec
(13) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(5) |
Feb
(16) |
Mar
(5) |
Apr
(5) |
May
(13) |
Jun
(12) |
Jul
(1) |
Aug
(2) |
Sep
(13) |
Oct
(6) |
Nov
(1) |
Dec
(29) |
2008 |
Jan
(2) |
Feb
(2) |
Mar
(2) |
Apr
(57) |
May
(35) |
Jun
(45) |
Jul
(132) |
Aug
(87) |
Sep
(141) |
Oct
(86) |
Nov
(17) |
Dec
(2) |
2009 |
Jan
(3) |
Feb
(2) |
Mar
(3) |
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2010 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <kk...@us...> - 2008-06-18 19:09:40
|
Revision: 657 http://omc.svn.sourceforge.net/omc/?rev=657&view=rev Author: kkaempf Date: 2008-06-18 12:07:56 -0700 (Wed, 18 Jun 2008) Log Message: ----------- fix Ruby compilation Modified Paths: -------------- cmpi-bindings/swig/cmpi_types.i Modified: cmpi-bindings/swig/cmpi_types.i =================================================================== --- cmpi-bindings/swig/cmpi_types.i 2008-06-18 16:33:19 UTC (rev 656) +++ cmpi-bindings/swig/cmpi_types.i 2008-06-18 19:07:56 UTC (rev 657) @@ -403,7 +403,7 @@ #if defined (SWIGRUBY) VALUE rbdata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 0); VALUE rl = rb_ary_new2(2); - return rb_ary_push( rb_ary_push( rl, rbdata ), rb_str_new2(CMGetCharPtr(s) ); + return rb_ary_push( rb_ary_push( rl, rbdata ), rb_str_new2(CMGetCharPtr(s) ) ); #endif #if defined (SWIGPYTHON) #TODO memory leak alert (clone_data) @@ -622,7 +622,7 @@ #if defined (SWIGRUBY) VALUE rbdata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 0); VALUE rl = rb_ary_new2(2); - return rb_ary_push( rb_ary_push( rl, rbdata ), rb_str_new2(CMGetCharPtr(s) ); + return rb_ary_push( rb_ary_push( rl, rbdata ), rb_str_new2(CMGetCharPtr(s) ) ); #endif #if defined (SWIGPYTHON) #TODO memory leak alert (clone_data) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mgf...@us...> - 2008-06-18 16:33:25
|
Revision: 656 http://omc.svn.sourceforge.net/omc/?rev=656&view=rev Author: mgfritch Date: 2008-06-18 09:33:19 -0700 (Wed, 18 Jun 2008) Log Message: ----------- - Use omcSafeSystem() / omcMilliSleep() instead of cmpiutilSafeSystem() / cmpiutilMilliSleep() Modified Paths: -------------- contrib/xen-vm-builder/tags/PRE-SFCB/src/providers/vm-builder/builder-job.c Modified: contrib/xen-vm-builder/tags/PRE-SFCB/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/tags/PRE-SFCB/src/providers/vm-builder/builder-job.c 2008-06-18 16:04:34 UTC (rev 655) +++ contrib/xen-vm-builder/tags/PRE-SFCB/src/providers/vm-builder/builder-job.c 2008-06-18 16:33:19 UTC (rev 656) @@ -215,7 +215,7 @@ NULL }; - if ((cc = cmpiutilSafeSystem((char* const*)cmd, NULL)) != 0) { + if ((cc = omcSafeSystem((char* const*)cmd, NULL)) != 0) { return cc; } @@ -226,7 +226,7 @@ || info.state == JOBSTATE_CANCELED) { break; } - cmpiutilMilliSleep(500); + omcMilliSleep(500); } return cc; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-06-18 16:04:33
|
Revision: 655 http://omc.svn.sourceforge.net/omc/?rev=655&view=rev Author: jcarey Date: 2008-06-18 09:04:34 -0700 (Wed, 18 Jun 2008) Log Message: ----------- added delay in cancel job. Waits until job status is canc/fin/fail Modified Paths: -------------- contrib/xen-vm-builder/tags/PRE-SFCB/src/providers/vm-builder/builder-job.c contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c Modified: contrib/xen-vm-builder/tags/PRE-SFCB/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/tags/PRE-SFCB/src/providers/vm-builder/builder-job.c 2008-06-17 16:35:54 UTC (rev 654) +++ contrib/xen-vm-builder/tags/PRE-SFCB/src/providers/vm-builder/builder-job.c 2008-06-18 16:04:34 UTC (rev 655) @@ -206,6 +206,8 @@ static int cancel_job(const char* id) { + int cc; + VMInstallInfo info; const char* cmd[] = { "/usr/bin/vm-install-jobs", "--cancel", @@ -213,7 +215,20 @@ NULL }; - return omcSafeSystem((char* const*)cmd, NULL); + if ((cc = cmpiutilSafeSystem((char* const*)cmd, NULL)) != 0) { + return cc; + } + + for (;;) { + if(get_job_info(id, &info) != 0 + || info.state == JOBSTATE_FINISHED + || info.state == JOBSTATE_FAILED + || info.state == JOBSTATE_CANCELED) { + break; + } + cmpiutilMilliSleep(500); + } + return cc; } /*****************************************************************************/ Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-06-17 16:35:54 UTC (rev 654) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/builder-job.c 2008-06-18 16:04:34 UTC (rev 655) @@ -206,6 +206,8 @@ static int cancel_job(const char* id) { + int cc; + VMInstallInfo info; const char* cmd[] = { "/usr/bin/vm-install-jobs", "--cancel", @@ -213,7 +215,20 @@ NULL }; - return cmpiutilSafeSystem((char* const*)cmd, NULL); + if ((cc = cmpiutilSafeSystem((char* const*)cmd, NULL)) != 0) { + return cc; + } + + for (;;) { + if(get_job_info(id, &info) != 0 + || info.state == JOBSTATE_FINISHED + || info.state == JOBSTATE_FAILED + || info.state == JOBSTATE_CANCELED) { + break; + } + cmpiutilMilliSleep(500); + } + return cc; } /*****************************************************************************/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-06-17 16:36:06
|
Revision: 654 http://omc.svn.sourceforge.net/omc/?rev=654&view=rev Author: kkaempf Date: 2008-06-17 09:35:54 -0700 (Tue, 17 Jun 2008) Log Message: ----------- fix the classname and namespace Modified Paths: -------------- cmpi-bindings/swig/python/pycmpi_provider.py Modified: cmpi-bindings/swig/python/pycmpi_provider.py =================================================================== --- cmpi-bindings/swig/python/pycmpi_provider.py 2008-06-17 16:35:05 UTC (rev 653) +++ cmpi-bindings/swig/python/pycmpi_provider.py 2008-06-17 16:35:54 UTC (rev 654) @@ -396,21 +396,21 @@ #print s == cmpi2pywbem_ - pcop = pywbem.CIMInstanceName('TestMe', namespace='root/test', + pcop = pywbem.CIMInstanceName('Cmpi_Swig', namespace='root/cimv2', keybindings={'k1':'A', 'k2':'B'}) ccop = pywbem2cmpi_instname(pcop) ncop = cmpi2pywbem_instname(ccop) - assert(ncop.classname == 'TestMe') - assert(ncop.namespace == 'root/test') + assert(ncop.classname == 'Cmpi_Swig') + assert(ncop.namespace == 'root/cimv2') assert(len(ncop.keybindings) == 2) assert(ncop['k1'] == 'A') assert(ncop['k2'] == 'B') cinst = cmpi.CMPIInstance(ccop) # Klaus, fix this. -# assert(cinst.objectpath() is not None) + assert(cinst.objectpath() is not None) - pinst = pywbem.CIMInstance('TestMe', path=pcop, + pinst = pywbem.CIMInstance('Cmpi_Swig', path=pcop, properties={'k1':'A', 'k2':'B', 'p3':'string prop', 'p4':pywbem.Uint32(47) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-06-17 16:35:26
|
Revision: 653 http://omc.svn.sourceforge.net/omc/?rev=653&view=rev Author: kkaempf Date: 2008-06-17 09:35:05 -0700 (Tue, 17 Jun 2008) Log Message: ----------- disable CMPIInstance destructor Modified Paths: -------------- cmpi-bindings/swig/cmpi_types.i Modified: cmpi-bindings/swig/cmpi_types.i =================================================================== --- cmpi-bindings/swig/cmpi_types.i 2008-06-17 10:33:07 UTC (rev 652) +++ cmpi-bindings/swig/cmpi_types.i 2008-06-17 16:35:05 UTC (rev 653) @@ -500,12 +500,17 @@ /* path: ObjectPath containing namespace and classname. */ CMPIInstance(CMPIObjectPath *path) { CMPIInstance *inst = CMNewInstance(_BROKER, path, NULL); -/* fprintf(stderr, "CMNewInstance( path %p ) -> %p\n", path, inst ); */ +#if 0 +fprintf(stderr, "CMNewInstance( path %p ) -> %p [%d:%s]\n", path, +inst, status.rc, status.msg?CMGetCharPtr(status.msg):"<NULL>" ); + CMPIString *s = CDToString(_BROKER, path, NULL); + fprintf(stderr, "path : %s\n", CMGetCharPtr(s)); +#endif return inst; } ~CMPIInstance() { -/* fprintf(stderr, "~CMPIInstance(%p)\n", $self ); */ - _BROKER->mft->freeInstance( _BROKER, $self ); +/* fprintf(stderr, "~CMPIInstance(%p)\n", $self ); + _BROKER->mft->freeInstance( _BROKER, $self ); */ } const char* to_s() { CMPIString *s = CDToString(_BROKER, $self, NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-06-17 10:33:02
|
Revision: 652 http://omc.svn.sourceforge.net/omc/?rev=652&view=rev Author: kkaempf Date: 2008-06-17 03:33:07 -0700 (Tue, 17 Jun 2008) Log Message: ----------- - dis-own pointers before passing them to results.return_xxx() Modified Paths: -------------- cmpi-bindings/swig/python/pycmpi_provider.py Modified: cmpi-bindings/swig/python/pycmpi_provider.py =================================================================== --- cmpi-bindings/swig/python/pycmpi_provider.py 2008-06-17 10:31:06 UTC (rev 651) +++ cmpi-bindings/swig/python/pycmpi_provider.py 2008-06-17 10:33:07 UTC (rev 652) @@ -53,9 +53,11 @@ cv = cmpi.CMPIValue() cv.string = cmpi.CMPIString('Hello') op.add_key('hello', cv, cmpi.CMPI_string) + op.thisown = 0 rslt.return_objectpath(op) cv.string = cmpi.CMPIString('World') op.add_key('hello', cv, cmpi.CMPI_string) + op.thisown = 0 rslt.return_objectpath(op) rslt.done() return (0, '') @@ -77,11 +79,13 @@ inst = cmpi.CMPIInstance(op) inst.set_property('hello', cv, cmpi.CMPI_string) + inst.thisown = 0 rslt.return_instance(inst) cv.string = cmpi.CMPIString('World') op.add_key('hello', cv, cmpi.CMPI_string) inst = cmpi.CMPIInstance(op) inst.set_property('hello', cv, cmpi.CMPI_string) + inst.thisown = 0 rslt.return_instance(inst) test_conversions() rslt.done() @@ -99,11 +103,13 @@ inst = cmpi.CMPIInstance(op) inst.set_property('hello', cv, cmpi.CMPI_string) + inst.thisown = 0 rslt.return_instance(inst) return (0, None) def create_instance(self, ctx, rslt, objname, newinst): inst = cmpi2pywbem_inst(newinst) + objname.thisown = 0 rslt.return_objectpath(objname) print inst return (0, '') @@ -402,7 +408,7 @@ cinst = cmpi.CMPIInstance(ccop) # Klaus, fix this. - assert(cinst.objectpath() is not None) +# assert(cinst.objectpath() is not None) pinst = pywbem.CIMInstance('TestMe', path=pcop, properties={'k1':'A', 'k2':'B', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-06-17 10:31:09
|
Revision: 651 http://omc.svn.sourceforge.net/omc/?rev=651&view=rev Author: kkaempf Date: 2008-06-17 03:31:06 -0700 (Tue, 17 Jun 2008) Log Message: ----------- - implement CPMIInstance.set_objectpath - some debug code Modified Paths: -------------- cmpi-bindings/swig/cmpi_types.i Modified: cmpi-bindings/swig/cmpi_types.i =================================================================== --- cmpi-bindings/swig/cmpi_types.i 2008-06-17 05:53:55 UTC (rev 650) +++ cmpi-bindings/swig/cmpi_types.i 2008-06-17 10:31:06 UTC (rev 651) @@ -282,7 +282,9 @@ CMPIStatus st = CMOpenMessageFile(_BROKER, msgFile, &handle); /* FIXME */ } - ~CMPIMsgFileHandle() { CMCloseMessageFile( _BROKER, $self ); } + ~CMPIMsgFileHandle() { + CMCloseMessageFile( _BROKER, $self ); + } } #----------------------------------------------------- @@ -293,11 +295,21 @@ %extend _CMPIObjectPath { /* nm: namespace */ CMPIObjectPath( const char *nm ) { - return CMNewObjectPath(_BROKER, nm, _CLASSNAME, NULL); + CMPIObjectPath *path = CMNewObjectPath(_BROKER, nm, _CLASSNAME, NULL); +/* fprintf( stderr, "CMNewObjectPath: %p\n", path ); */ + return path; } ~CMPIObjectPath() { - free( $self ); +/* fprintf( stderr, "~CMPIObjectPath %p\n", $self ); */ + $self->ft->release( $self ); } + /** + * Create an independent copy of this ObjectPath object. The resulting + * object must be released explicitly. + */ + CMPIObjectPath *clone() { + return $self->ft->clone( $self, NULL ); + } const char* to_s() { CMPIString *s = CDToString(_BROKER, $self, NULL); return CMGetCharPtr(s); @@ -487,9 +499,13 @@ %extend _CMPIInstance { /* path: ObjectPath containing namespace and classname. */ CMPIInstance(CMPIObjectPath *path) { - return CMNewInstance(_BROKER, path, NULL); + CMPIInstance *inst = CMNewInstance(_BROKER, path, NULL); +/* fprintf(stderr, "CMNewInstance( path %p ) -> %p\n", path, inst ); */ + return inst; } ~CMPIInstance() { +/* fprintf(stderr, "~CMPIInstance(%p)\n", $self ); */ + _BROKER->mft->freeInstance( _BROKER, $self ); } const char* to_s() { CMPIString *s = CDToString(_BROKER, $self, NULL); @@ -621,16 +637,27 @@ return CMGetPropertyCount( $self, NULL ); } /* Generates an ObjectPath out of the namespace, classname and - key propeties of this Instance. */ - + * key propeties of this Instance. + */ CMPIObjectPath *objectpath() { - return CMGetObjectPath( $self, NULL); + CMPIObjectPath *path = CMGetObjectPath( $self, NULL ); +/* fprintf(stderr, "<%p>.objectpath = %p\n", $self, path ); */ + return path; } + /* Replaces the ObjectPath of the instance. + * The passed objectpath shall contain the namespace, classname, + * as well as all keys for the specified instance. + */ +#if defined(SWIGRUBY) + %alias set_objectpath "objectpath="; +#endif + CMPIStatus set_objectpath(const CMPIObjectPath *path) { + return CMSetObjectPath( $self, path ); + } /* Directs CMPI to ignore any setProperty operations for this - instance for any properties not in this list. + * instance for any properties not in this list. * properties: If not NULL, the members of the array define one - or more Property names to be accepted by setProperty operations. - + * or more Property names to be accepted by setProperty operations. */ CMPIStatus set_property_filter( const char **properties ) { return CMSetPropertyFilter( $self, properties, NULL ); @@ -648,7 +675,6 @@ { return CMSetPropertyWithOrigin( $self, name, value, type, origin ); } - } #----------------------------------------------------- @@ -656,8 +682,12 @@ # CMPIArgs %extend _CMPIArgs { - CMPIArgs() { return CMNewArgs(_BROKER, NULL); } - ~CMPIArgs() { _BROKER->mft->freeArgs(_BROKER, $self); } + CMPIArgs() { + return CMNewArgs(_BROKER, NULL); + } + ~CMPIArgs() { + _BROKER->mft->freeArgs(_BROKER, $self); + } const char* to_s() { CMPIString *s = CDToString(_BROKER, $self, NULL); return CMGetCharPtr(s); @@ -714,7 +744,9 @@ %extend _CMPISelectCond { CMPISelectCond() { } - ~CMPISelectCond() { $self->ft->release($self); } + ~CMPISelectCond() { + $self->ft->release($self); + } const char* to_s() { CMPIString *s = CDToString(_BROKER, $self, NULL); return CMGetCharPtr(s); @@ -727,7 +759,9 @@ %extend _CMPISubCond { CMPISubCond() { } - ~CMPISubCond() { $self->ft->release($self); } + ~CMPISubCond() { + $self->ft->release($self); + } } #----------------------------------------------------- @@ -736,7 +770,9 @@ %extend _CMPIPredicate { CMPIPredicate() { } - ~CMPIPredicate() { $self->ft->release($self); } + ~CMPIPredicate() { + $self->ft->release($self); + } const char* to_s() { CMPIString *s = CDToString(_BROKER, $self, NULL); return CMGetCharPtr(s); @@ -749,7 +785,9 @@ %extend _CMPIEnumeration { CMPIEnumeration() { } - ~CMPIEnumeration() { $self->ft->release($self); } + ~CMPIEnumeration() { + $self->ft->release($self); + } const char* to_s() { CMPIString *s = CDToString(_BROKER, $self, NULL); return CMGetCharPtr(s); @@ -767,7 +805,9 @@ CMPIArray(int count, CMPIType type ) { return CMNewArray( _BROKER, count, type, NULL); } - ~CMPIArray() { _BROKER->mft->freeArray(_BROKER, $self); } + ~CMPIArray() { + _BROKER->mft->freeArray(_BROKER, $self); + } const char* to_s() { CMPIString *s = CDToString(_BROKER, $self, NULL); return CMGetCharPtr(s); @@ -804,7 +844,9 @@ CMPIString(const char *s) { return CMNewString(_BROKER, s, NULL); } - ~CMPIString() { _BROKER->mft->freeString(_BROKER, $self); } + ~CMPIString() { + _BROKER->mft->freeString(_BROKER, $self); + } const char* to_s() { return CMGetCharPtr($self); } @@ -816,7 +858,9 @@ %extend _CMPIContext { CMPIContext() { } - ~CMPIContext() { $self->ft->release($self); } + ~CMPIContext() { + $self->ft->release($self); + } const char* to_s() { CMPIString *s = CDToString(_BROKER, $self, NULL); return CMGetCharPtr(s); @@ -844,7 +888,9 @@ return CMNewDateTimeFromChars(_BROKER, utc, NULL); } - ~CMPIDateTime() { _BROKER->mft->freeDateTime(_BROKER, $self); } + ~CMPIDateTime() { + _BROKER->mft->freeDateTime(_BROKER, $self); + } const char* to_s() { return CMGetCharPtr( CMGetStringFormat( $self, NULL ) ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-06-17 05:53:46
|
Revision: 650 http://omc.svn.sourceforge.net/omc/?rev=650&view=rev Author: bartw Date: 2008-06-16 22:53:55 -0700 (Mon, 16 Jun 2008) Log Message: ----------- working on object conversions Modified Paths: -------------- cmpi-bindings/swig/python/pycmpi_provider.py Modified: cmpi-bindings/swig/python/pycmpi_provider.py =================================================================== --- cmpi-bindings/swig/python/pycmpi_provider.py 2008-06-13 21:33:53 UTC (rev 649) +++ cmpi-bindings/swig/python/pycmpi_provider.py 2008-06-17 05:53:55 UTC (rev 650) @@ -29,6 +29,8 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ############################################################################## +# Author: Bart Whiteley <bwhiteley suse.de> + import cmpi import pywbem @@ -81,6 +83,7 @@ inst = cmpi.CMPIInstance(op) inst.set_property('hello', cv, cmpi.CMPI_string) rslt.return_instance(inst) + test_conversions() rslt.done() return (0, '') @@ -177,6 +180,17 @@ inst = pywbem.CIMInstance(cop.classname, props, path=cop) return inst +def pywbem2cmpi_inst(pinst): + cop = pywbem2cmpi_instname(pinst.path) + cinst = cmpi.CMPIInstance(cop) + for prop in pinst.properties.values(): + data, _type = pywbem2cmpi_value(prop.value, _type=prop.type) + cinst.set_property(prop.name, data, _pywbem2cmpi_typemap[_type]) + print '** returning cist', cinst + return cinst + + + def cmpi2pywbem_instname(cmpiobjpath): keys = {} for i in xrange(0, cmpiobjpath.key_count()): @@ -192,11 +206,77 @@ cop = cmpi.CMPIObjectPath(iname.namespace) cop.set_classname(iname.classname) for name, val in iname.keybindings.items(): - data = pywbem2cmpi_data(data) - cop.add_key(name, data, _pywbem2cmpi_typemap[pywbem.cimtype(val)]) + data, _type = pywbem2cmpi_value(val) + cop.add_key(name, data, _pywbem2cmpi_typemap[_type]) return cop +def pywbem2cmpi_value(pdata, _type=None, cval=None): + is_array = isinstance(pdata, list) + if _type is None: + _type = pywbem.cimtype(pdata) + if cval is None: + cval = cmpi.CMPIValue() + if is_array: + ralen = len(pdata) + ctype = _pywbem2cmpi_typemap[_type] + car = cmpi.CMPIArray(ralen, ctype) + for i, rael in enumerate(pdata): + cv, tt = pywbem2cmpi_value(rael, _type=_type) + car.set(i, cv, ctype) + cval.array = car + else: + if _type == 'reference': + _type = 'ref' + if _type == 'ref': + pdata = pywbem2cmpi_instname(pdata) + elif _type == 'string': + pdata = cmpi.CMPIString(pdata) + setattr(cval, _type, pdata) + return cval, _type +def cmpi2pywbem_value(cval, _type, is_array=False): + ctype = _type + if _type == 'reference': + ctype = 'ref' + if is_array: + pval = [] + car = cval.array + for i in xrange(0, car.size()): + data = car.at(i) + ptype = _cmpi2pywbem_typemap[data.type] + rael = cmpi2pywbem_value(data.value, _type) + pval.append(rael) + else: + cval = getattr(cval, ctype) + if _type == 'string': + pval = cval.to_s() + elif ctype == 'ref': + pval = cmpi2pywbem_instname(cval) + else: + pval = pywbem.tocimobj(_type, cval) + return pval + + + +def pywbem2cmpi_data(pdata, _type=None): + is_array = isinstance(pdata, list) + if _type is None: + _type = pywbem.cimtype(pdata) + # This doesn't work below. cmpi.CMPIData() takes a CMPIData argument. ?? + data = cmpi.CMPIData() + data.state = 0 + data.type = pywbem2cmpi_typemap[_type] + if is_array: + data.type = data.type | cmpi.CMPI_ARRAY + if _type == 'reference': + _type = 'ref' + if _type == 'ref': + pdata = pywbem2cmpi_instname(pdata) + pywbem2cmpi_value(pdata, _type, data.value) + return data + + + def cmpi2pywbem_data(cdata, _type=None, is_array=None): #TODO check for valid cdata.state #TODO error handling @@ -226,7 +306,7 @@ 'datetime' : cmpi.CMPI_dateTime, } -_cmpy2pywbem_typemap = { +_cmpi2pywbem_typemap = { cmpi.CMPI_boolean : 'boolean', cmpi.CMPI_real32 : 'real32', cmpi.CMPI_real64 : 'real64', @@ -269,7 +349,7 @@ itype = itype ^ cmpi.CMPI_ARRAY try: - tp = _cmpy2pywbem_typemap[itype] + tp = _cmpi2pywbem_typemap[itype] except KeyError: raise ValueError('Unknown type: %d' % itype) @@ -283,3 +363,57 @@ s = iostr.getvalue() return (s, 'cmpi:' + s.replace('\n', '<br>')) + +def test_conversions(): + s = 'foo' + cs, _type = pywbem2cmpi_value(s) + assert(cs.string.to_s() == s) + assert(_type == 'string') + ns = cmpi2pywbem_value(cs, _type) + assert(s == ns) + #cdata = cmpi.CMPIData(None) + i = pywbem.Uint32(5) + ci, _type = pywbem2cmpi_value(i) + assert(_type == 'uint32') + assert(ci.uint32 == i) + ni = cmpi2pywbem_value(ci, _type) + assert(isinstance(ni, pywbem.Uint32)) + assert(i == ni) + l = ['python','is','great'] + cl, _type = pywbem2cmpi_value(l) + nl = cmpi2pywbem_value(cl, _type, is_array=True) + print '*** l', l + print '*** nl', nl + assert(nl == l) + + + + #print s == cmpi2pywbem_ + + pcop = pywbem.CIMInstanceName('TestMe', namespace='root/test', + keybindings={'k1':'A', 'k2':'B'}) + ccop = pywbem2cmpi_instname(pcop) + ncop = cmpi2pywbem_instname(ccop) + assert(ncop.classname == 'TestMe') + assert(ncop.namespace == 'root/test') + assert(len(ncop.keybindings) == 2) + assert(ncop['k1'] == 'A') + assert(ncop['k2'] == 'B') + + cinst = cmpi.CMPIInstance(ccop) + # Klaus, fix this. + assert(cinst.objectpath() is not None) + + pinst = pywbem.CIMInstance('TestMe', path=pcop, + properties={'k1':'A', 'k2':'B', + 'p3':'string prop', + 'p4':pywbem.Uint32(47) + }) + cinst = pywbem2cmpi_inst(pinst) + ninst = cmpi2pywbem_inst(cinst) + assert(ninst.classname == pinst.classname) + + + + print '** tests passed' + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-06-13 21:34:23
|
Revision: 649 http://omc.svn.sourceforge.net/omc/?rev=649&view=rev Author: bartw Date: 2008-06-13 14:33:53 -0700 (Fri, 13 Jun 2008) Log Message: ----------- dev checkpoint Modified Paths: -------------- cmpi-bindings/include/cmpi/cmpift.h cmpi-bindings/src/cmpi_provider.c cmpi-bindings/swig/cmpi_types.i cmpi-bindings/swig/python/pycmpi_provider.py Modified: cmpi-bindings/include/cmpi/cmpift.h =================================================================== --- cmpi-bindings/include/cmpi/cmpift.h 2008-06-13 10:36:22 UTC (rev 648) +++ cmpi-bindings/include/cmpi/cmpift.h 2008-06-13 21:33:53 UTC (rev 649) @@ -1619,7 +1619,7 @@ @return Data value. */ CMPIData (*getKeyAt) - (const CMPIObjectPath * op, CMPICount index, CMPIString ** OUTPUT, + (const CMPIObjectPath * op, CMPICount index, CMPIString ** name, CMPIStatus * rc); /** Gets the number of key properties contained in this ObjectPath. @param op ObjectPath this pointer. Modified: cmpi-bindings/src/cmpi_provider.c =================================================================== --- cmpi-bindings/src/cmpi_provider.c 2008-06-13 10:36:22 UTC (rev 648) +++ cmpi-bindings/src/cmpi_provider.c 2008-06-13 21:33:53 UTC (rev 649) @@ -1,13 +1,33 @@ -// ============================================================================ -// (C) Copyright Novell Inc. 2008 -// -// THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE -// ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE -// CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. -// -// You can obtain a current copy of the Common Public License from -// http://www.opensource.org/licenses/cpl1.0.php -// +/***************************************************************************** +* Copyright (C) 2008 Novell Inc. All rights reserved. +* Copyright (C) 2008 SUSE Linux Products GmbH. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell Inc. nor of SUSE Linux Products GmbH nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell Inc. OR SUSE Linux Products GmbH OR +* THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ #ifdef SWIGRUBY static char _CLASSNAME[] = "CmpiInstanceRuby"; @@ -55,6 +75,9 @@ /* Global handle to the CIM broker. This is initialized by the CIMOM when the provider is loaded */ static const CMPIBroker * _BROKER = NULL; static char* _MINAME = NULL; +#ifdef SWIGPYTHON +PyObject* _PYPROVMOD = NULL; +#endif static char* fmtstr(const char* fmt, ...) { @@ -121,50 +144,25 @@ { char *tbstr = NULL; - PyObject *iostrmod = NULL; - PyObject *tbmod = NULL; - PyObject *iostr = NULL; - PyObject *obstr = NULL; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); PyErr_Clear(); PyErr_NormalizeException(&type, &value, &traceback); - iostrmod = PyImport_ImportModule("StringIO"); - if (iostrmod==NULL) - TB_ERROR("can't import StringIO"); - - iostr = PyObject_CallMethod(iostrmod, "StringIO", NULL); - - if (iostr==NULL) - TB_ERROR("cStringIO.StringIO() failed"); - - tbmod = PyImport_ImportModule("traceback"); - if (tbmod==NULL) - TB_ERROR("can't import traceback"); - - obstr = PyObject_CallMethod(tbmod, "print_exception", - "(OOOOO)", + PyObject* obstr = PyObject_CallMethod(_PYPROVMOD, "traceback2string", + "(OOO)", type, value ? value : Py_None, - traceback ? traceback : Py_None, - Py_None, - iostr); + traceback ? traceback : Py_None); if (obstr==NULL) TB_ERROR("traceback.print_exception() failed"); - Py_DecRef(obstr); + PyObject* raw = PyTuple_GetItem(obstr, 0); + PyObject* formatted = PyTuple_GetItem(obstr, 1); + tbstr = PyString_AsString(formatted); + _SBLIM_TRACE(1,(PyString_AsString(raw))); - obstr = PyObject_CallMethod(iostr, "getvalue", NULL); - if (obstr==NULL) - TB_ERROR("getvalue() failed."); - - if (!PyString_Check(obstr)) - TB_ERROR("getvalue() did not return a string"); - - tbstr = PyString_AsString(obstr); - cleanup: PyErr_Restore(type, value, traceback); @@ -178,10 +176,10 @@ rv = _BROKER->eft->newString(_BROKER, "", NULL); } - Py_DecRef(iostr); Py_DecRef(obstr); - Py_DecRef(iostrmod); - Py_DecRef(tbmod); + Py_DecRef(type); + Py_DecRef(value); + Py_DecRef(traceback); return rv; } @@ -251,7 +249,7 @@ } PyObject* prc = PyTuple_GetItem(prv, 0); PyObject* prstr = PyTuple_GetItem(prv, 1); - if (! PyInt_Check(prc) || ! PyString_Check(prstr)) + if (! PyInt_Check(prc) || (! PyString_Check(prstr) && prstr != Py_None)) { char* str = fmtstr("Python function \"%s\" didn't return a {<int>, <str>) two-tuple", opname); _SBLIM_TRACE(1,(str)); @@ -263,7 +261,14 @@ } long pi = PyInt_AsLong(prc); st->rc = (CMPIrc)pi; - st->msg = _BROKER->eft->newString(_BROKER, PyString_AsString(prstr), NULL); + if (prstr == Py_None) + { + st->msg = _BROKER->eft->newString(_BROKER, "", NULL); + } + else + { + st->msg = _BROKER->eft->newString(_BROKER, PyString_AsString(prstr), NULL); + } rc = pi != 0; cleanup: Py_DecRef(pyargs); @@ -292,6 +297,7 @@ #endif #ifdef SWIGPYTHON + Py_DecRef(_PYPROVMOD); Py_Finalize(); _SBLIM_TRACE(1,("Cleanup(Python) called")); #endif @@ -777,19 +783,18 @@ Py_Initialize(); SWIG_init(); - PyObject *cmpiProviderModule = PyImport_ImportModule("pycmpi_provider"); - if (cmpiProviderModule == NULL) + _PYPROVMOD = PyImport_ImportModule("pycmpi_provider"); + if (_PYPROVMOD == NULL) { PY_CMPI_SETFAIL(get_exc_trace()); return -1; } - _SBLIM_TRACE(1,("Python: cmpiProviderModule at %p", cmpiProviderModule)); - PyObject* provclass = PyObject_GetAttrString(cmpiProviderModule, + _SBLIM_TRACE(1,("Python: _PYPROVMOD at %p", _PYPROVMOD)); + PyObject* provclass = PyObject_GetAttrString(_PYPROVMOD, "CMPIProvider"); if (provclass == NULL) { PY_CMPI_SETFAIL(get_exc_trace()); - Py_DecRef(cmpiProviderModule); return -1; } PyObject* broker = SWIG_NewPointerObj((void*) _BROKER, SWIGTYPE_p__CMPIBroker, 0); @@ -802,7 +807,6 @@ if (provinst == NULL) { PY_CMPI_SETFAIL(get_exc_trace()); - Py_DecRef(cmpiProviderModule); return -1; } Modified: cmpi-bindings/swig/cmpi_types.i =================================================================== --- cmpi-bindings/swig/cmpi_types.i 2008-06-13 10:36:22 UTC (rev 648) +++ cmpi-bindings/swig/cmpi_types.i 2008-06-13 21:33:53 UTC (rev 649) @@ -1,3 +1,34 @@ +/***************************************************************************** +* Copyright (C) 2008 Novell Inc. All rights reserved. +* Copyright (C) 2008 SUSE Linux Products GmbH. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* - Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* +* - Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* - Neither the name of Novell Inc. nor of SUSE Linux Products GmbH nor the +* names of its contributors may be used to endorse or promote products +* derived from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL Novell Inc. OR SUSE Linux Products GmbH OR +* THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + # cmpift.i # # swig bindings for CMPI function tables @@ -362,13 +393,13 @@ VALUE rl = rb_ary_new2(2); return rb_ary_push( rb_ary_push( rl, rbdata ), rb_str_new2(CMGetCharPtr(s) ); #endif - #if defined (SWIGPYTHON) + #TODO memory leak alert (clone_data) PyObject* pydata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 0); - PyObject* pl = PyList_New(0); - PyList_Append(pl, pydata); - PyList_Append(pl, PyString_FromString(CMGetCharPtr(s))); + PyObject* pl = PyTuple_New(2); + PyTuple_SetItem(pl, 0, pydata); + PyTuple_SetItem(pl, 1, PyString_FromString(CMGetCharPtr(s))); return pl; #endif } @@ -557,8 +588,30 @@ * index: Position in the internal Data array. * name [Output]: Returned property name (suppressed when NULL). */ - CMPIData get_property_at(int index) { - return CMGetPropertyAt( $self, index, NULL, NULL ); +#if defined (SWIGRUBY) + VALUE +#endif +#if defined (SWIGPYTHON) + PyObject* +#endif + get_property_at(int index) { + CMPIString *s = NULL; + CMPIData data = CMGetPropertyAt( $self, index, &s, NULL ); + +#if defined (SWIGRUBY) + VALUE rbdata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 0); + VALUE rl = rb_ary_new2(2); + return rb_ary_push( rb_ary_push( rl, rbdata ), rb_str_new2(CMGetCharPtr(s) ); +#endif +#if defined (SWIGPYTHON) + #TODO memory leak alert (clone_data) + PyObject* pydata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 0); + + PyObject* pl = PyTuple_New(2); + PyTuple_SetItem(pl, 0, pydata); + PyTuple_SetItem(pl, 1, PyString_FromString(CMGetCharPtr(s))); + return pl; +#endif } /* Gets the number of properties contained in this Instance. */ #if defined(SWIGRUBY) Modified: cmpi-bindings/swig/python/pycmpi_provider.py =================================================================== --- cmpi-bindings/swig/python/pycmpi_provider.py 2008-06-13 10:36:22 UTC (rev 648) +++ cmpi-bindings/swig/python/pycmpi_provider.py 2008-06-13 21:33:53 UTC (rev 649) @@ -1,6 +1,35 @@ +############################################################################## +# Copyright (C) 2008 Novell Inc. All rights reserved. +# Copyright (C) 2008 SUSE Linux Products GmbH. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# - Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# - Neither the name of Novell Inc. nor of SUSE Linux Products GmbH nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL Novell Inc. OR SUSE Linux Products GmbH OR +# THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +############################################################################## + import cmpi -import sys -import traceback import pywbem @@ -12,66 +41,69 @@ self.miname = miname def enum_instance_names(self, ctx, rslt, objname): - #try: - print 'provider.py: In enum_instance_names()' - print 'namespace: %s, classname: %s' % (objname.namespace(), objname.classname()) - print dir(ctx) - print dir(rslt) - print dir(objname) - op = cmpi.CMPIObjectPath(objname.namespace()) - op.set_classname('Cmpi_Swig') - cv = cmpi.CMPIValue() - cv.string = cmpi.CMPIString('Hello') - op.add_key('hello', cv, cmpi.CMPI_string) - rslt.return_objectpath(op) - cv.string = cmpi.CMPIString('World') - op.add_key('hello', cv, cmpi.CMPI_string) - rslt.return_objectpath(op) - rslt.done() - return (0, 'My String') - #except: - #print sys.exc_info() - #traceback.print_tb(sys.exc_info()[2]) - #raise + print 'provider.py: In enum_instance_names()' + print 'namespace: %s, classname: %s' % (objname.namespace(), objname.classname()) + print dir(ctx) + print dir(rslt) + print dir(objname) + op = cmpi.CMPIObjectPath(objname.namespace()) + op.set_classname('Cmpi_Swig') + cv = cmpi.CMPIValue() + cv.string = cmpi.CMPIString('Hello') + op.add_key('hello', cv, cmpi.CMPI_string) + rslt.return_objectpath(op) + cv.string = cmpi.CMPIString('World') + op.add_key('hello', cv, cmpi.CMPI_string) + rslt.return_objectpath(op) + rslt.done() + return (0, '') def enum_instances(self, ctx, rslt, objname, plist): - #try: - print 'provider.py: In enum_instances()' - print 'namespace: %s, classname: %s' % (objname.namespace(), objname.classname()) - print dir(ctx) - print dir(rslt) - print dir(objname) - print 'plist:', plist - op = cmpi.CMPIObjectPath(objname.namespace()) - op.set_classname('Cmpi_Swig') - cv = cmpi.CMPIValue() - cv.string = cmpi.CMPIString('Hello') - op.add_key('hello', cv, cmpi.CMPI_string) + print 'provider.py: In enum_instances()' + print 'namespace: %s, classname: %s' % (objname.namespace(), objname.classname()) + print dir(ctx) + print dir(rslt) + print dir(objname) + print 'plist:', plist + op = cmpi.CMPIObjectPath(objname.namespace()) + op.set_classname('Cmpi_Swig') + cv = cmpi.CMPIValue() + cv.string = cmpi.CMPIString('Hello') + op.add_key('hello', cv, cmpi.CMPI_string) - inst = cmpi.CMPIInstance(op) - inst.set_property('hello', cv, cmpi.CMPI_string) + inst = cmpi.CMPIInstance(op) + inst.set_property('hello', cv, cmpi.CMPI_string) - rslt.return_instance(inst) - cv.string = cmpi.CMPIString('World') - op.add_key('hello', cv, cmpi.CMPI_string) - inst = cmpi.CMPIInstance(op) - inst.set_property('hello', cv, cmpi.CMPI_string) - rslt.return_instance(inst) - rslt.done() - return (0, 'My String') - #except: - #print sys.exc_info() - #traceback.print_tb(sys.exc_info()[2]) - #raise + rslt.return_instance(inst) + cv.string = cmpi.CMPIString('World') + op.add_key('hello', cv, cmpi.CMPI_string) + inst = cmpi.CMPIInstance(op) + inst.set_property('hello', cv, cmpi.CMPI_string) + rslt.return_instance(inst) + rslt.done() + return (0, '') def get_instance(self, ctx, rslt, objname, plist): - cop = cmpi2pywbem_instname(objname) - print cop + #cop = cmpi2pywbem_instname(objname) + op = cmpi.CMPIObjectPath(objname.namespace()) + op.set_classname('Cmpi_Swig') + cv = cmpi.CMPIValue() + cv.string = cmpi.CMPIString('Hello') + op.add_key('hello', cv, cmpi.CMPI_string) + inst = cmpi.CMPIInstance(op) + inst.set_property('hello', cv, cmpi.CMPI_string) + + rslt.return_instance(inst) + return (0, None) + def create_instance(self, ctx, rslt, objname, newinst): - pass + inst = cmpi2pywbem_inst(newinst) + rslt.return_objectpath(objname) + print inst + return (0, '') def set_instance(self, ctx, rslt, objname, newinst, plist): pass @@ -134,18 +166,120 @@ def cmpi2pywbem_inst(cmpiinst): - inst = pywbem.CIMInstance() + cop = cmpi2pywbem_instname(cmpiinst.objectpath()) + props = {} + for i in xrange(0, cmpiinst.property_count()): + data, name = cmpiinst.get_property_at(i) + _type, is_array = cmpi_type2string(data.type) + pval = cmpi2pywbem_data(data, _type, is_array) + prop = pywbem.CIMProperty(name, pval, _type, is_array=is_array) + props[name] = prop + inst = pywbem.CIMInstance(cop.classname, props, path=cop) return inst def cmpi2pywbem_instname(cmpiobjpath): keys = {} for i in xrange(0, cmpiobjpath.key_count()): data,keyname = cmpiobjpath.get_key_at(i) - # We're doomed until we figure out how - # to fetch the outparameter CMPIObjectPath** name from get_key_at(). - print "data.to_s: ", data.value.string.to_s() - print "data.type: ", data.type - print "keyname: ", keyname + pval = cmpi2pywbem_data(data) + keys[keyname] = pval - return pywbem.CIMInstanceName() + rv = pywbem.CIMInstanceName(cmpiobjpath.classname(), + keys, namespace=cmpiobjpath.namespace()) + return rv +def pywbem2cmpi_instname(iname): + cop = cmpi.CMPIObjectPath(iname.namespace) + cop.set_classname(iname.classname) + for name, val in iname.keybindings.items(): + data = pywbem2cmpi_data(data) + cop.add_key(name, data, _pywbem2cmpi_typemap[pywbem.cimtype(val)]) + return cop + + +def cmpi2pywbem_data(cdata, _type=None, is_array=None): + #TODO check for valid cdata.state + #TODO error handling + if _type is None: + _type, is_array = cmpi_type2string(cdata.type) + #TODO array types + val = getattr(cdata.value, _type) + if _type == 'string': + val = val.to_s() + return pywbem.tocimobj(_type, val) + + +_pywbem2cmpi_typemap = { + 'boolean' : cmpi.CMPI_boolean, + 'real32' : cmpi.CMPI_real32, + 'real64' : cmpi.CMPI_real64, + 'uint8 ' : cmpi.CMPI_uint8, + 'uint16' : cmpi.CMPI_uint16, + 'uint32' : cmpi.CMPI_uint32, + 'uint64' : cmpi.CMPI_uint64, + 'sint8 ' : cmpi.CMPI_sint8, + 'sint16' : cmpi.CMPI_sint16, + 'sint32' : cmpi.CMPI_sint32, + 'sint64' : cmpi.CMPI_sint64, + 'reference' : cmpi.CMPI_ref, + 'string' : cmpi.CMPI_string, + 'datetime' : cmpi.CMPI_dateTime, + } + +_cmpy2pywbem_typemap = { + cmpi.CMPI_boolean : 'boolean', + cmpi.CMPI_real32 : 'real32', + cmpi.CMPI_real64 : 'real64', + cmpi.CMPI_uint8 : 'uint8 ', + cmpi.CMPI_uint16 : 'uint16', + cmpi.CMPI_uint32 : 'uint32', + cmpi.CMPI_uint64 : 'uint64', + cmpi.CMPI_sint8 : 'sint8 ', + cmpi.CMPI_sint16 : 'sint16', + cmpi.CMPI_sint32 : 'sint32', + cmpi.CMPI_sint64 : 'sint64', + cmpi.CMPI_ref : 'reference', + cmpi.CMPI_string : 'string', + cmpi.CMPI_dateTime : 'datetime', + + #cmpi.CMPI_null : None, + #cmpi.CMPI_args : 'args', + #cmpi.CMPI_instance : 'instance', + #cmpi.CMPI_class : 'class ', + #cmpi.CMPI_filter : 'filter', + #cmpi.CMPI_ptr : 'ptr', + #cmpi.CMPI_charsptr : 'charsp', + #cmpi.CMPI_enumeration : 'enumeration', + #cmpi.CMPI_chars : 'chars ', + #cmpi.CMPI_char16 : 'char16' + } + +def cmpi_type2string(itype): + """ Convert an unsigned short CMPIType to the string representation of + the type. + + returns a two-tuple: (<str_type>, bool_is_array) + + """ + + tp = None + is_array = bool(itype & cmpi.CMPI_ARRAY) + + if is_array: + itype = itype ^ cmpi.CMPI_ARRAY + + try: + tp = _cmpy2pywbem_typemap[itype] + except KeyError: + raise ValueError('Unknown type: %d' % itype) + + return (tp, is_array) + +def traceback2string(_type, value, tb): + import traceback + import cStringIO + iostr = cStringIO.StringIO() + traceback.print_exception(_type, value, tb, None, iostr) + s = iostr.getvalue() + return (s, 'cmpi:' + s.replace('\n', '<br>')) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-06-13 10:36:20
|
Revision: 648 http://omc.svn.sourceforge.net/omc/?rev=648&view=rev Author: kkaempf Date: 2008-06-13 03:36:22 -0700 (Fri, 13 Jun 2008) Log Message: ----------- - make CMPIData a known class - provide clone_data function Modified Paths: -------------- cmpi-bindings/swig/cmpi.i cmpi-bindings/swig/cmpi_defs.i cmpi-bindings/swig/cmpi_types.i Modified: cmpi-bindings/swig/cmpi.i =================================================================== --- cmpi-bindings/swig/cmpi.i 2008-06-12 21:33:21 UTC (rev 647) +++ cmpi-bindings/swig/cmpi.i 2008-06-13 10:36:22 UTC (rev 648) @@ -14,6 +14,15 @@ /* CMPI platform check */ #include <cmpipl.h> + +static CMPIData * +clone_data(const CMPIData *dp) +{ + CMPIData *data = (CMPIData *)calloc(1, sizeof(CMPIData)); + memcpy(data, dp, sizeof(CMPIData)); + return data; +} + /* * provider code */ Modified: cmpi-bindings/swig/cmpi_defs.i =================================================================== --- cmpi-bindings/swig/cmpi_defs.i 2008-06-12 21:33:21 UTC (rev 647) +++ cmpi-bindings/swig/cmpi_defs.i 2008-06-13 10:36:22 UTC (rev 648) @@ -4,10 +4,61 @@ # %nodefault CMPIData; +#%ignore _CMPIData::type; +#%ignore _CMPIData::state; +#%ignore _CMPIData::value; +%rename(CMPIData) _CMPIData; +%nodefault CMPIStatus; +#%rename(CMPIStatus) _CMPIStatus; +%ignore _CMPIStatus::rc; +%ignore _CMPIStatus::msg; + %include "cmpidt.h" -%ignore _CMPIData::type; -%ignore _CMPIData::state; -%ignore _CMPIData::value; -%rename(CMPIData) _CMPIData; + +#----------------------------------------------------- +# +# CMPIData +# + +%extend CMPIData { + CMPIData(const CMPIData *dp) + { + return clone_data(dp); + } + ~CMPIData() + { + free( $self ); + } +} + + +#----------------------------------------------------- +# +# CMPIStatus +# + +%extend CMPIStatus { + CMPIStatus() + { + CMPIStatus *status = (CMPIStatus *)calloc(1, sizeof(CMPIStatus)); + status->rc = CMPI_RC_OK; + return status; + } + ~CMPIStatus() + { + free( $self ); + } + int rc() { return $self->rc; } + char *msg() { return (char *) ($self->msg->hdl); } +#if defined(SWIGRUBY) + %rename("ok?") is_ok; +#endif + int is_ok() { return $self->rc == CMPI_RC_OK; } + const char* to_s() { + CMPIString *s = CDToString(_BROKER, $self, NULL); + return CMGetCharPtr(s); + } +} + Modified: cmpi-bindings/swig/cmpi_types.i =================================================================== --- cmpi-bindings/swig/cmpi_types.i 2008-06-12 21:33:21 UTC (rev 647) +++ cmpi-bindings/swig/cmpi_types.i 2008-06-13 10:36:22 UTC (rev 648) @@ -9,13 +9,6 @@ # and the broker. # -#%apply char **OUTPUT { char **outname }; - -%nodefault CMPIStatus; -#%rename(CMPIStatus) _CMPIStatus; -%ignore _CMPIStatus::rc; -%ignore _CMPIStatus::msg; - %nodefault CMPIError; #%rename(CMPIError) _CMPIError; typedef struct _CMPIError {} CMPIError; @@ -78,34 +71,6 @@ #----------------------------------------------------- # -# CMPIStatus -# - -%extend CMPIStatus { - CMPIStatus() - { - CMPIStatus *status = (CMPIStatus *)calloc(1, sizeof(CMPIStatus)); - status->rc = CMPI_RC_OK; - return status; - } - ~CMPIStatus() - { - free( $self ); - } - int rc() { return $self->rc; } - char *msg() { return (char *) ($self->msg->hdl); } -#if defined(SWIGRUBY) - %rename("ok?") is_ok; -#endif - int is_ok() { return $self->rc == CMPI_RC_OK; } - const char* to_s() { - CMPIString *s = CDToString(_BROKER, $self, NULL); - return CMGetCharPtr(s); - } -} - -#----------------------------------------------------- -# # CMPIError # @@ -382,20 +347,30 @@ /* Gets a key property value defined by its index. * name: [out] Key property name */ - PyObject* get_key_at( int index ) { +#if defined (SWIGRUBY) + VALUE +#endif +#if defined (SWIGPYTHON) + PyObject* +#endif + get_key_at( int index ) { CMPIString *s = NULL; - CMPIData *dptr = (CMPIData *)malloc(sizeof(CMPIData)); - CMPIData data = CMGetKeyAt( $self, index, &s, NULL ); - memcpy(dptr, &data, sizeof(CMPIData)); + +#if defined (SWIGRUBY) + VALUE rbdata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 0); + VALUE rl = rb_ary_new2(2); + return rb_ary_push( rb_ary_push( rl, rbdata ), rb_str_new2(CMGetCharPtr(s) ); +#endif + #if defined (SWIGPYTHON) - PyObject* pydata = SWIG_NewPointerObj((void*) dptr, SWIGTYPE_p__CMPIData, 0); + PyObject* pydata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 0); PyObject* pl = PyList_New(0); PyList_Append(pl, pydata); PyList_Append(pl, PyString_FromString(CMGetCharPtr(s))); -#endif return pl; +#endif } /* Gets the number of key properties contained in this ObjectPath. */ int key_count() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-06-12 21:33:19
|
Revision: 647 http://omc.svn.sourceforge.net/omc/?rev=647&view=rev Author: kkaempf Date: 2008-06-12 14:33:21 -0700 (Thu, 12 Jun 2008) Log Message: ----------- - make CMPIData an explicit data type for swig - fix get_key_at to return a pair adapt pycmpi_provider.py to call get_key_at with a single arg adapt cmpi_types.i (get_key_at) to return a Python array Modified Paths: -------------- cmpi-bindings/swig/cmpi_defs.i cmpi-bindings/swig/cmpi_types.i cmpi-bindings/swig/python/pycmpi_provider.py Modified: cmpi-bindings/swig/cmpi_defs.i =================================================================== --- cmpi-bindings/swig/cmpi_defs.i 2008-06-12 21:30:27 UTC (rev 646) +++ cmpi-bindings/swig/cmpi_defs.i 2008-06-12 21:33:21 UTC (rev 647) @@ -3,4 +3,11 @@ # swig bindings for CMPI constant definitions # +%nodefault CMPIData; + %include "cmpidt.h" + +%ignore _CMPIData::type; +%ignore _CMPIData::state; +%ignore _CMPIData::value; +%rename(CMPIData) _CMPIData; Modified: cmpi-bindings/swig/cmpi_types.i =================================================================== --- cmpi-bindings/swig/cmpi_types.i 2008-06-12 21:30:27 UTC (rev 646) +++ cmpi-bindings/swig/cmpi_types.i 2008-06-12 21:33:21 UTC (rev 647) @@ -9,7 +9,7 @@ # and the broker. # -%apply char *OUTPUT { char *outname }; +#%apply char **OUTPUT { char **outname }; %nodefault CMPIStatus; #%rename(CMPIStatus) _CMPIStatus; @@ -382,11 +382,20 @@ /* Gets a key property value defined by its index. * name: [out] Key property name */ - CMPIData get_key_at( int index, char *outname ) { - CMPIString *s = CMNewString(_BROKER, "", NULL); + PyObject* get_key_at( int index ) { + CMPIString *s = NULL; + CMPIData *dptr = (CMPIData *)malloc(sizeof(CMPIData)); + CMPIData data = CMGetKeyAt( $self, index, &s, NULL ); - outname = CMGetCharPtr(s); - return data; + memcpy(dptr, &data, sizeof(CMPIData)); +#if defined (SWIGPYTHON) + PyObject* pydata = SWIG_NewPointerObj((void*) dptr, SWIGTYPE_p__CMPIData, 0); + + PyObject* pl = PyList_New(0); + PyList_Append(pl, pydata); + PyList_Append(pl, PyString_FromString(CMGetCharPtr(s))); +#endif + return pl; } /* Gets the number of key properties contained in this ObjectPath. */ int key_count() { Modified: cmpi-bindings/swig/python/pycmpi_provider.py =================================================================== --- cmpi-bindings/swig/python/pycmpi_provider.py 2008-06-12 21:30:27 UTC (rev 646) +++ cmpi-bindings/swig/python/pycmpi_provider.py 2008-06-12 21:33:21 UTC (rev 647) @@ -140,14 +140,12 @@ def cmpi2pywbem_instname(cmpiobjpath): keys = {} for i in xrange(0, cmpiobjpath.key_count()): - kn = cmpi.CMPIString - data = cmpiobjpath.get_key_at(i, kn) + data,keyname = cmpiobjpath.get_key_at(i) # We're doomed until we figure out how # to fetch the outparameter CMPIObjectPath** name from get_key_at(). - print data.value.string.to_s() - print data.type - print cmpi.CMPI_string - print kn + print "data.to_s: ", data.value.string.to_s() + print "data.type: ", data.type + print "keyname: ", keyname return pywbem.CIMInstanceName() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-06-12 21:30:52
|
Revision: 646 http://omc.svn.sourceforge.net/omc/?rev=646&view=rev Author: kkaempf Date: 2008-06-12 14:30:27 -0700 (Thu, 12 Jun 2008) Log Message: ----------- - prefix target language to provider binary - use correct install path (lib vs lib64) - rename from Cmpi_Instance to {rb,py}CmpiProvider Modified Paths: -------------- cmpi-bindings/CMakeLists.txt cmpi-bindings/mof/Swig_Generic.reg cmpi-bindings/swig/CMakeLists.txt cmpi-bindings/swig/python/CMakeLists.txt cmpi-bindings/swig/ruby/CMakeLists.txt Modified: cmpi-bindings/CMakeLists.txt =================================================================== --- cmpi-bindings/CMakeLists.txt 2008-06-12 17:05:12 UTC (rev 645) +++ cmpi-bindings/CMakeLists.txt 2008-06-12 21:30:27 UTC (rev 646) @@ -15,6 +15,22 @@ #SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) #SET(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules ${CMAKE_MODULE_PATH}) +# Library +IF ( DEFINED LIB ) + SET ( CMPI_LIBRARY_DIR "${CMAKE_INSTALL_PREFIX}/${LIB}/cmpi" ) +ELSE ( DEFINED LIB ) + IF (CMAKE_SIZEOF_VOID_P MATCHES "8") + SET( LIB_SUFFIX "64" ) + ENDIF(CMAKE_SIZEOF_VOID_P MATCHES "8") + SET ( CMPI_LIBRARY_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/cmpi" ) +ENDIF ( DEFINED LIB ) +MESSAGE(STATUS "Providers will be installed in ${CMPI_LIBRARY_DIR}" ) + +# Include +SET( CMPI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include/cmpi ) + + + INCLUDE(${CMAKE_SOURCE_DIR}/VERSION.cmake) SET( PACKAGE "cmpi-bindings" ) Modified: cmpi-bindings/mof/Swig_Generic.reg =================================================================== --- cmpi-bindings/mof/Swig_Generic.reg 2008-06-12 17:05:12 UTC (rev 645) +++ cmpi-bindings/mof/Swig_Generic.reg 2008-06-12 21:30:27 UTC (rev 646) @@ -1,5 +1,5 @@ [Cmpi_Swig] provider: Cmpi_Swig - location: cmpiInstance + location: pyCmpiProvider type: instance namespace: root/cimv2 Modified: cmpi-bindings/swig/CMakeLists.txt =================================================================== --- cmpi-bindings/swig/CMakeLists.txt 2008-06-12 17:05:12 UTC (rev 645) +++ cmpi-bindings/swig/CMakeLists.txt 2008-06-12 21:30:27 UTC (rev 646) @@ -4,8 +4,8 @@ FIND_PACKAGE(Ruby) IF (RUBY_LIBRARY AND RUBY_INCLUDE_PATH) - MESSAGE(STATUS "Building Ruby...") - ADD_SUBDIRECTORY(ruby) +# MESSAGE(STATUS "Building Ruby...") +# ADD_SUBDIRECTORY(ruby) ENDIF (RUBY_LIBRARY AND RUBY_INCLUDE_PATH) FIND_PACKAGE(PythonLibs) Modified: cmpi-bindings/swig/python/CMakeLists.txt =================================================================== --- cmpi-bindings/swig/python/CMakeLists.txt 2008-06-12 17:05:12 UTC (rev 645) +++ cmpi-bindings/swig/python/CMakeLists.txt 2008-06-12 21:30:27 UTC (rev 646) @@ -17,8 +17,6 @@ SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmpi_wrap.c" ) SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/../cmpi.i" ) -SET( CMPI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include/cmpi ) -SET( CMPI_LIBRARY_DIR /usr/lib/cmpi ) ADD_CUSTOM_COMMAND ( OUTPUT ${SWIG_OUTPUT} Modified: cmpi-bindings/swig/ruby/CMakeLists.txt =================================================================== --- cmpi-bindings/swig/ruby/CMakeLists.txt 2008-06-12 17:05:12 UTC (rev 645) +++ cmpi-bindings/swig/ruby/CMakeLists.txt 2008-06-12 21:30:27 UTC (rev 646) @@ -11,8 +11,6 @@ SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmpi_wrap.c" ) SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/../cmpi.i" ) -SET( CMPI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include/cmpi ) -SET( CMPI_LIBRARY_DIR /usr/lib/cmpi ) ADD_CUSTOM_COMMAND ( OUTPUT ${SWIG_OUTPUT} @@ -39,7 +37,7 @@ # cmpi_instance: provider .so # -SET( NAME rbCmpiInstance ) +SET( NAME rbCmpiProvider ) ADD_LIBRARY( ${NAME} SHARED ${SWIG_OUTPUT}) TARGET_LINK_LIBRARIES( ${NAME} ${RUBY_LIBRARY} ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-06-12 17:06:18
|
Revision: 645 http://omc.svn.sourceforge.net/omc/?rev=645&view=rev Author: kkaempf Date: 2008-06-12 10:05:12 -0700 (Thu, 12 Jun 2008) Log Message: ----------- Initial try to implement CMPIString** as output Modified Paths: -------------- cmpi-bindings/swig/cmpi_types.i Modified: cmpi-bindings/swig/cmpi_types.i =================================================================== --- cmpi-bindings/swig/cmpi_types.i 2008-06-12 03:39:05 UTC (rev 644) +++ cmpi-bindings/swig/cmpi_types.i 2008-06-12 17:05:12 UTC (rev 645) @@ -9,6 +9,8 @@ # and the broker. # +%apply char *OUTPUT { char *outname }; + %nodefault CMPIStatus; #%rename(CMPIStatus) _CMPIStatus; %ignore _CMPIStatus::rc; @@ -378,10 +380,13 @@ return CMGetKey( $self, name, NULL ); } /* Gets a key property value defined by its index. - * name: Key property name. + * name: [out] Key property name */ - CMPIData get_key_at( int index, CMPIString **name ) { - return CMGetKeyAt( $self, index, name, NULL ); + CMPIData get_key_at( int index, char *outname ) { + CMPIString *s = CMNewString(_BROKER, "", NULL); + CMPIData data = CMGetKeyAt( $self, index, &s, NULL ); + outname = CMGetCharPtr(s); + return data; } /* Gets the number of key properties contained in this ObjectPath. */ int key_count() { @@ -631,7 +636,9 @@ CMPIData get( const char *name ) { return CMGetArg( $self, name, NULL ); } - /* Gets a Argument value defined by its index. */ + /* Gets a Argument value defined by its index. + * name: [out] argument name. + */ CMPIData get_at( CMPICount index, CMPIString ** name ) { return CMGetArgAt( $self, index, name, NULL ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-06-12 03:39:02
|
Revision: 644 http://omc.svn.sourceforge.net/omc/?rev=644&view=rev Author: bartw Date: 2008-06-11 20:39:05 -0700 (Wed, 11 Jun 2008) Log Message: ----------- hacking through the issues Modified Paths: -------------- cmpi-bindings/include/cmpi/cmpift.h cmpi-bindings/swig/cmpi.i cmpi-bindings/swig/python/CMakeLists.txt cmpi-bindings/swig/python/pycmpi_provider.py Modified: cmpi-bindings/include/cmpi/cmpift.h =================================================================== --- cmpi-bindings/include/cmpi/cmpift.h 2008-06-11 23:40:58 UTC (rev 643) +++ cmpi-bindings/include/cmpi/cmpift.h 2008-06-12 03:39:05 UTC (rev 644) @@ -1619,7 +1619,7 @@ @return Data value. */ CMPIData (*getKeyAt) - (const CMPIObjectPath * op, CMPICount index, CMPIString ** name, + (const CMPIObjectPath * op, CMPICount index, CMPIString ** OUTPUT, CMPIStatus * rc); /** Gets the number of key properties contained in this ObjectPath. @param op ObjectPath this pointer. Modified: cmpi-bindings/swig/cmpi.i =================================================================== --- cmpi-bindings/swig/cmpi.i 2008-06-11 23:40:58 UTC (rev 643) +++ cmpi-bindings/swig/cmpi.i 2008-06-12 03:39:05 UTC (rev 644) @@ -1,5 +1,7 @@ %module cmpi +%include "typemaps.i" + %{ #include <stdint.h> @@ -13,7 +15,7 @@ #include <cmpipl.h> /* - * Instance provider stub + * provider code */ #include "../src/cmpi_provider.c" Modified: cmpi-bindings/swig/python/CMakeLists.txt =================================================================== --- cmpi-bindings/swig/python/CMakeLists.txt 2008-06-11 23:40:58 UTC (rev 643) +++ cmpi-bindings/swig/python/CMakeLists.txt 2008-06-12 03:39:05 UTC (rev 644) @@ -44,7 +44,8 @@ SET( NAME pyCmpiProvider ) ADD_LIBRARY( ${NAME} SHARED ${SWIG_OUTPUT}) -TARGET_LINK_LIBRARIES( ${NAME} ${PYTHON_LIBRARIES} ) +#TARGET_LINK_LIBRARIES( ${NAME} ${PYTHON_LIBRARIES} ) +TARGET_LINK_LIBRARIES( ${NAME} python2.5 ) TARGET_LINK_LIBRARIES( ${NAME} m ) TARGET_LINK_LIBRARIES( ${NAME} util ) Modified: cmpi-bindings/swig/python/pycmpi_provider.py =================================================================== --- cmpi-bindings/swig/python/pycmpi_provider.py 2008-06-11 23:40:58 UTC (rev 643) +++ cmpi-bindings/swig/python/pycmpi_provider.py 2008-06-12 03:39:05 UTC (rev 644) @@ -2,6 +2,7 @@ import sys import traceback +import pywbem class CMPIProvider(object): @@ -66,7 +67,8 @@ def get_instance(self, ctx, rslt, objname, plist): - pass + cop = cmpi2pywbem_instname(objname) + print cop def create_instance(self, ctx, rslt, objname, newinst): pass @@ -131,3 +133,21 @@ pass +def cmpi2pywbem_inst(cmpiinst): + inst = pywbem.CIMInstance() + return inst + +def cmpi2pywbem_instname(cmpiobjpath): + keys = {} + for i in xrange(0, cmpiobjpath.key_count()): + kn = cmpi.CMPIString + data = cmpiobjpath.get_key_at(i, kn) + # We're doomed until we figure out how + # to fetch the outparameter CMPIObjectPath** name from get_key_at(). + print data.value.string.to_s() + print data.type + print cmpi.CMPI_string + print kn + + return pywbem.CIMInstanceName() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-06-11 23:40:59
|
Revision: 643 http://omc.svn.sourceforge.net/omc/?rev=643&view=rev Author: bartw Date: 2008-06-11 16:40:58 -0700 (Wed, 11 Jun 2008) Log Message: ----------- renamed things since the provider is all types, not just instance Modified Paths: -------------- cmpi-bindings/src/CMakeLists.txt cmpi-bindings/swig/cmpi.i cmpi-bindings/swig/python/CMakeLists.txt Added Paths: ----------- cmpi-bindings/src/cmpi_provider.c cmpi-bindings/swig/python/pycmpi_provider.py Removed Paths: ------------- cmpi-bindings/src/cmpi_instance.c cmpi-bindings/swig/python/pycmpi_instance.py Modified: cmpi-bindings/src/CMakeLists.txt =================================================================== --- cmpi-bindings/src/CMakeLists.txt 2008-06-11 23:33:14 UTC (rev 642) +++ cmpi-bindings/src/CMakeLists.txt 2008-06-11 23:40:58 UTC (rev 643) @@ -5,10 +5,10 @@ SET( CMPI_INCLUDE_DIR /usr/include/cmpi ) SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -g" ) -SET(cmpi_instance_SRCS cmpi_instance.c) +SET(cmpi_provider_SRCS cmpi_provider.c) ADD_DEFINITIONS(-DCMPI_PLATFORM_LINUX_GENERIC_GNU -DCMPI_VERSION=200) -ADD_LIBRARY(cmpi_instance SHARED ${cmpi_instance_SRCS}) +ADD_LIBRARY(cmpi_provider SHARED ${cmpi_provider_SRCS}) INCLUDE_DIRECTORIES( ${CMPI_INCLUDE_DIR} ) @@ -25,10 +25,10 @@ INCLUDE_DIRECTORIES( ${RUBY_INCLUDE_PATH} ) INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include/cmpi ) -TARGET_LINK_LIBRARIES( cmpi_instance cmpi ) -TARGET_LINK_LIBRARIES( cmpi_instance ${RUBY_LIBRARY} ) +TARGET_LINK_LIBRARIES( cmpi_provider cmpi ) +TARGET_LINK_LIBRARIES( cmpi_provider ${RUBY_LIBRARY} ) # # # -INSTALL(TARGETS cmpi_instance LIBRARY DESTINATION ${CMPI_LIBRARY_DIR} ARCHIVE DESTINATION ${CMPI_LIBRARY_DIR}) +INSTALL(TARGETS cmpi_provider LIBRARY DESTINATION ${CMPI_LIBRARY_DIR} ARCHIVE DESTINATION ${CMPI_LIBRARY_DIR}) Deleted: cmpi-bindings/src/cmpi_instance.c =================================================================== --- cmpi-bindings/src/cmpi_instance.c 2008-06-11 23:33:14 UTC (rev 642) +++ cmpi-bindings/src/cmpi_instance.c 2008-06-11 23:40:58 UTC (rev 643) @@ -1,1313 +0,0 @@ -// ============================================================================ -// (C) Copyright Novell Inc. 2008 -// -// THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE -// ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE -// CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. -// -// You can obtain a current copy of the Common Public License from -// http://www.opensource.org/licenses/cpl1.0.php -// - -#ifdef SWIGRUBY -static char _CLASSNAME[] = "CmpiInstanceRuby"; -#endif -#ifdef SWIGPYTHON -static char _CLASSNAME[] = "CmpiInstanceSwig"; -#endif - -#include <stdio.h> -#include <stdarg.h> - -/* Include the required CMPI macros, data types, and API function headers */ -#include <cmpidt.h> -#include <cmpift.h> -#include <cmpimacs.h> - -// Needed to obtain errno of failed system calls -#include <errno.h> - -/* Needed for kill() */ -#include <signal.h> - - -#ifdef SWIGRUBY -#include <ruby.h> -#endif - -#ifdef SWIGPYTHON -#include <Python.h> -#endif - -/* A simple stderr logging/tracing facility. */ -#ifndef _SBLIM_TRACE -#define _SBLIM_TRACE(tracelevel,args) _logstderr args -void _logstderr(char *fmt,...) -{ - va_list ap; - va_start(ap,fmt); - vfprintf(stderr,fmt,ap); - va_end(ap); - fprintf(stderr,"\n"); -} -#endif - -/* Global handle to the CIM broker. This is initialized by the CIMOM when the provider is loaded */ -static const CMPIBroker * _BROKER = NULL; -static char* _MINAME = NULL; - -static char* fmtstr(const char* fmt, ...) -{ - va_list ap; - int len; - va_start(ap, fmt); - len = vsnprintf(NULL, 0, fmt, ap); - va_end(ap); - if (len <= 0) - { - return NULL; - } - char* str = (char*)malloc(len+1); - if (str == NULL) - { - return NULL; - } - va_start(ap, fmt); - vsnprintf(str, len+1, fmt, ap); - va_end(ap); - return str; -} - -#ifdef SWIGRUBY -static int RBInitialize(CMPIInstanceMI * self, CMPIStatus* st); -#endif - -#ifdef SWIGPYTHON -static int PyInitialize(PyObject** self, CMPIStatus* st); -#define PY_CMPI_INIT { if (self->hdl == NULL) if (PyInitialize((PyObject**)&(self->hdl), &status) != 0) return status; } -#endif - -#ifdef SWIGRUBY -static VALUE -properties2ruby( const char ** properties ) -{ - if (properties) { - VALUE rproperties = rb_ary_new(); - while (*properties) - rb_ary_push( rproperties, rb_str_new2(*properties++) ); - return rproperties; - } - return Qnil; -} -#endif - -#ifdef SWIGPYTHON -static PyObject* proplist2py(const char** cplist) -{ - if (cplist == NULL) - { - Py_RETURN_NONE; - } - PyObject* pl = PyList_New(0); - for (; *cplist != NULL; ++cplist) - { - PyList_Append(pl, PyString_FromString(*cplist)); - } - return pl; -} - -#define TB_ERROR(str) {tbstr = str; goto cleanup;} -static CMPIString* get_exc_trace() -{ - char *tbstr = NULL; - - PyObject *iostrmod = NULL; - PyObject *tbmod = NULL; - PyObject *iostr = NULL; - PyObject *obstr = NULL; - - PyObject *type, *value, *traceback; - PyErr_Fetch(&type, &value, &traceback); - PyErr_Clear(); - PyErr_NormalizeException(&type, &value, &traceback); - - iostrmod = PyImport_ImportModule("StringIO"); - if (iostrmod==NULL) - TB_ERROR("can't import StringIO"); - - iostr = PyObject_CallMethod(iostrmod, "StringIO", NULL); - - if (iostr==NULL) - TB_ERROR("cStringIO.StringIO() failed"); - - tbmod = PyImport_ImportModule("traceback"); - if (tbmod==NULL) - TB_ERROR("can't import traceback"); - - obstr = PyObject_CallMethod(tbmod, "print_exception", - "(OOOOO)", - type, value ? value : Py_None, - traceback ? traceback : Py_None, - Py_None, - iostr); - - if (obstr==NULL) - TB_ERROR("traceback.print_exception() failed"); - - Py_DecRef(obstr); - - obstr = PyObject_CallMethod(iostr, "getvalue", NULL); - if (obstr==NULL) - TB_ERROR("getvalue() failed."); - - if (!PyString_Check(obstr)) - TB_ERROR("getvalue() did not return a string"); - - tbstr = PyString_AsString(obstr); - -cleanup: - PyErr_Restore(type, value, traceback); - - CMPIString* rv; - if (tbstr != NULL) - { - rv = _BROKER->eft->newString(_BROKER, tbstr, NULL); - } - else - { - rv = _BROKER->eft->newString(_BROKER, "", NULL); - } - - Py_DecRef(iostr); - Py_DecRef(obstr); - Py_DecRef(iostrmod); - Py_DecRef(tbmod); - return rv; -} - - -static int -call_py_provider(PyObject* hdl, CMPIStatus* st, - const char* opname, int nargs, ...) -{ - int rc = 1; - va_list vargs; - PyObject *pyargs = NULL; - PyObject *pyfunc = NULL; - PyObject *prv = NULL; - pyargs = PyTuple_New(nargs); - pyfunc = PyObject_GetAttrString(hdl, opname); - if (pyfunc == NULL) - { - PyErr_Clear(); - char* str = fmtstr("Python module does not contain \"%s\"", opname); - _SBLIM_TRACE(1,(str)); - st->rc = CMPI_RC_ERR_FAILED; - st->msg = _BROKER->eft->newString(_BROKER, str, NULL); - free(str); - rc = 1; - goto cleanup; - } - if (! PyCallable_Check(pyfunc)) - { - char* str = fmtstr("Python module attribute \"%s\" is not callable", - opname); - _SBLIM_TRACE(1,(str)); - st->rc = CMPI_RC_ERR_FAILED; - st->msg = _BROKER->eft->newString(_BROKER, str, NULL); - free(str); - rc = 1; - goto cleanup; - } - - va_start(vargs, nargs); - int i; - for (i = 0; i < nargs; ++i) - { - PyObject* arg = va_arg(vargs, PyObject*); - PyTuple_SET_ITEM(pyargs, i, arg); - } - va_end(vargs); - prv = PyObject_CallObject(pyfunc, pyargs); - if (PyErr_Occurred()) - { - st->rc = CMPI_RC_ERR_FAILED; - st->msg = get_exc_trace(); - PyErr_Clear(); - rc = 1; - goto cleanup; - } - - if (! PyTuple_Check(prv) || PyTuple_Size(prv) != 2) - { - char* str = fmtstr("Python function \"%s\" didn't return a two-tuple", - opname); - _SBLIM_TRACE(1,(str)); - st->rc = CMPI_RC_ERR_FAILED; - st->msg = _BROKER->eft->newString(_BROKER, str, NULL); - free(str); - rc = 1; - goto cleanup; - } - PyObject* prc = PyTuple_GetItem(prv, 0); - PyObject* prstr = PyTuple_GetItem(prv, 1); - if (! PyInt_Check(prc) || ! PyString_Check(prstr)) - { - char* str = fmtstr("Python function \"%s\" didn't return a {<int>, <str>) two-tuple", opname); - _SBLIM_TRACE(1,(str)); - st->rc = CMPI_RC_ERR_FAILED; - st->msg = _BROKER->eft->newString(_BROKER, str, NULL); - free(str); - rc = 1; - goto cleanup; - } - long pi = PyInt_AsLong(prc); - st->rc = (CMPIrc)pi; - st->msg = _BROKER->eft->newString(_BROKER, PyString_AsString(prstr), NULL); - rc = pi != 0; -cleanup: - Py_DecRef(pyargs); - Py_DecRef(pyfunc); - Py_DecRef(prv); - return rc; -} -#endif - - -// ---------------------------------------------------------------------------- -// CMPI INSTANCE PROVIDER FUNCTIONS -// ---------------------------------------------------------------------------- - -static CMPIStatus Cleanup( - const CMPIContext * context, - CMPIBoolean terminating) -{ - CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ - - _SBLIM_TRACE(1,("Cleanup() called")); - -#ifdef SWIGRUBY - ruby_finalize(); - _SBLIM_TRACE(1,("Cleanup(Ruby) called")); -#endif - -#ifdef SWIGPYTHON - Py_Finalize(); - _SBLIM_TRACE(1,("Cleanup(Python) called")); -#endif - - if (_MINAME != NULL) - { - free(_MINAME); - _MINAME = NULL; - } - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("Cleanup() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - -static CMPIStatus InstCleanup( - CMPIInstanceMI * self, - const CMPIContext * context, - CMPIBoolean terminating) -{ - return Cleanup(context, terminating); -} - -static CMPIStatus AssocCleanup( - CMPIAssociationMI * self, - const CMPIContext * context, - CMPIBoolean terminating) -{ - return Cleanup(context, terminating); -} - -static CMPIStatus MethodCleanup( - CMPIMethodMI * self, - const CMPIContext * context, - CMPIBoolean terminating) -{ - return Cleanup(context, terminating); -} - -static CMPIStatus IndicationCleanup( - CMPIIndicationMI * self, - const CMPIContext * context, - CMPIBoolean terminating) -{ - return Cleanup(context, terminating); -} - -// ---------------------------------------------------------------------------- - - -/* EnumInstanceNames() - return a list of all the instances names (i.e. return their object paths only) */ -static CMPIStatus EnumInstanceNames( - CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ - const CMPIContext * context, /* [in] Additional context info, if any */ - const CMPIResult * result, /* [in] Contains the CIM namespace and classname */ - const CMPIObjectPath * reference) /* [in] Contains the CIM namespace and classname */ -{ - CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ - - _SBLIM_TRACE(1,("EnumInstanceNames() called")); - -#ifdef SWIGRUBY - _SBLIM_TRACE(1,("EnumInstanceNames(Ruby) called, context %p, result %p, reference %p", context, result, reference)); - VALUE klass = (VALUE)self->hdl; - VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - VALUE rresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); - VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - - /* enum_instance_names instead of EnumInstanceNames to follow Ruby naming convention */ - VALUE r = rb_funcall( klass, rb_intern( "enum_instance_names" ), 3, rcontext, rresult, rreference ); - _SBLIM_TRACE(1,("r %p", r)); -#endif -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("EnumInstancesNames(Python) called, context %p, result %p, reference %p", context, result, reference)); - - PY_CMPI_INIT - - PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); - PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - - call_py_provider((PyObject*)self->hdl, &status, "enum_instance_names", 3, - pycontext, - pyresult, - pyreference); -#endif - -exit: - _SBLIM_TRACE(1,("EnumInstanceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - - -// ---------------------------------------------------------------------------- - - -/* EnumInstances() - return a list of all the instances (i.e. return all the instance data) */ -static CMPIStatus EnumInstances( - CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ - const CMPIContext * context, /* [in] Additional context info, if any */ - const CMPIResult * result, /* [in] Contains the CIM namespace and classname */ - const CMPIObjectPath * reference, /* [in] Contains the CIM namespace and classname */ - const char ** properties) /* [in] List of desired properties (NULL=all) */ -{ - CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ -/* char * namespace = CMGetCharPtr(CMGetNameSpace(reference, NULL)); Our current CIM namespace */ - -#ifdef SWIGRUBY - _SBLIM_TRACE(1,("EnumInstances(Ruby) called, context %p, result %p, reference %p, properties %p", context, result, reference, properties)); - VALUE klass = (VALUE)self->hdl; - VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - VALUE rresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); - VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - VALUE rproperties = properties2ruby( properties ); - /* enum_instances instead of EnumInstances to follow Ruby naming convention */ - VALUE r = rb_funcall( klass, rb_intern( "enum_instances" ), 4, rcontext, rresult, rreference, rproperties ); - _SBLIM_TRACE(1,("r %p", r)); -#endif -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("EnumInstances(Python) called, context %p, result %p, reference %p, properties %p", context, result, reference, properties)); - - PY_CMPI_INIT - - PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); - PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pyproperties = proplist2py(properties); - - call_py_provider((PyObject*)self->hdl, &status, "enum_instances", 4, - pycontext, - pyresult, - pyreference, - pyproperties); -#endif - -exit: - _SBLIM_TRACE(1,("EnumInstances() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - - -// ---------------------------------------------------------------------------- - - -/* GetInstance() - return the instance data for the specified instance only */ -static CMPIStatus GetInstance( - CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ - const CMPIContext * context, /* [in] Additional context info, if any */ - const CMPIResult * results, /* [out] Results of this operation */ - const CMPIObjectPath * reference, /* [in] Contains the CIM namespace, classname and desired object path */ - const char ** properties) /* [in] List of desired properties (NULL=all) */ -{ - CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ - -#ifdef SWIGRUBY - _SBLIM_TRACE(1,("GetInstance(Ruby) called, context %p, results %p, reference %p, properties %p", context, results, reference, properties)); - VALUE klass = (VALUE)self->hdl; - VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - VALUE rresults = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - VALUE rproperties = properties2ruby( properties ); - /* get_instance instead of GetInstance to follow Ruby naming convention */ - VALUE r = rb_funcall( klass, rb_intern( "get_instance" ), 4, rcontext, rresults, rreference, rproperties ); - _SBLIM_TRACE(1,("r %p", r)); -#endif -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("GetInstance(Python) called, context %p, results %p, reference %p, properties %p", context, results, reference, properties)); - - PY_CMPI_INIT - - PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pyproperties = proplist2py(properties); - - call_py_provider((PyObject*)self->hdl, &status, "get_instance", 4, - pycontext, - pyresult, - pyreference, - pyproperties); -#endif - -exit: - _SBLIM_TRACE(1,("GetInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - - -// ---------------------------------------------------------------------------- - - -/* CreateInstance() - create a new instance from the specified instance data. */ -static CMPIStatus CreateInstance( - CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ - const CMPIContext * context, /* [in] Additional context info, if any. */ - const CMPIResult * results, /* [out] Results of this operation */ - const CMPIObjectPath * reference, /* [in] Contains the target namespace, classname and objectpath. */ - const CMPIInstance * newinstance) /* [in] Contains all the new instance data. */ -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ - - /* Creating new instances is not supported for this class. */ - -#ifdef SWIGRUBY - _SBLIM_TRACE(1,("CreateInstance(Ruby) called, context %p, results %p, reference %p, instance %p, properties %p", context, results, reference, newinstance)); - VALUE klass = (VALUE)self->hdl; - VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - VALUE rresults = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - VALUE rinstance = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); - /* create_instance instead of CreateInstance to follow Ruby naming convention */ - VALUE r = rb_funcall( klass, rb_intern( "create_instance" ), 4, rcontext, rresults, rreference, rinstance ); - _SBLIM_TRACE(1,("r %p", r)); -#endif -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("CreateInstance(Python) called, context %p, results %p, reference %p, newinstance %p", context, results, reference, newinstance)); - - PY_CMPI_INIT - - PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pynewinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); - - call_py_provider((PyObject*)self->hdl, &status, "create_instance", 4, - pycontext, - pyresult, - pyreference, - pynewinst); -#endif - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("CreateInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - - -// ---------------------------------------------------------------------------- - -#ifdef CMPI_VER_100 -#define SetInstance ModifyInstance -#endif - -/* SetInstance() - save modified instance data for the specified instance. */ -static CMPIStatus SetInstance( - CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ - const CMPIContext * context, /* [in] Additional context info, if any. */ - const CMPIResult * results, /* [out] Results of this operation. */ - const CMPIObjectPath * reference, /* [in] Contains the target namespace, classname and objectpath. */ - const CMPIInstance * newinstance, /* [in] Contains all the new instance data. */ - const char ** properties) /* [in] List of desired properties (NULL=all) */ -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ - - /* Modifying existing instances is not supported for this class. */ - -#ifdef SWIGRUBY - _SBLIM_TRACE(1,("SetInstance(Ruby) called, context %p, results %p, reference %p, instance %p, properties %p", context, results, reference, newinstance, properties)); - VALUE klass = (VALUE)self->hdl; - VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - VALUE rresults = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - VALUE rinstance = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); - VALUE rproperties = properties2ruby( properties ); - /* set_instance instead of SetInstance to follow Ruby naming convention */ - VALUE r = rb_funcall( klass, rb_intern( "set_instance" ), 5, rcontext, rresults, rreference, rinstance, rproperties ); - _SBLIM_TRACE(1,("r %p", r)); -#endif -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("SetInstance(Python) called, context %p, results %p, reference %p, newinstance %p, properties %p", context, results, reference, newinstance, properties)); - - PY_CMPI_INIT - - PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pynewinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); - PyObject *plist = proplist2py(properties); - - call_py_provider((PyObject*)self->hdl, &status, "set_instance", 5, - pycontext, - pyresult, - pyreference, - pynewinst, - plist); -#endif - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("SetInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - -// ---------------------------------------------------------------------------- - - -/* DeleteInstance() - delete/remove the specified instance. */ -static CMPIStatus DeleteInstance( - CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ - const CMPIContext * context, /* [in] Additional context info, if any. */ - const CMPIResult * results, /* [out] Results of this operation. */ - const CMPIObjectPath * reference) /* [in] Contains the target namespace, classname and objectpath. */ -{ - CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ - -#ifdef SWIGRUBY - _SBLIM_TRACE(1,("DeleteInstance(Ruby) called, context %p, results %p, reference %p", context, results, reference)); - VALUE klass = (VALUE)self->hdl; - VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - VALUE rresults = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - /* delete_instance instead of DeleteInstance to follow Ruby naming convention */ - VALUE r = rb_funcall( klass, rb_intern( "delete_instance" ), 3, rcontext, rresults, rreference ); - _SBLIM_TRACE(1,("r %p", r)); -#endif -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("DeleteInstance(Python) called, context %p, results %p, reference %p", context, results, reference)); - - PY_CMPI_INIT - - PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - - call_py_provider((PyObject*)self->hdl, &status, "delete_instance", 3, - pycontext, - pyresult, - pyreference); -#endif - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("DeleteInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - -// ---------------------------------------------------------------------------- - - -/* ExecQuery() - return a list of all the instances that satisfy the desired query filter. */ -static CMPIStatus ExecQuery( - CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ - const CMPIContext * context, /* [in] Additional context info, if any. */ - const CMPIResult * results, /* [out] Results of this operation. */ - const CMPIObjectPath * reference, /* [in] Contains the target namespace and classname. */ - const char * query, /* [in] Text of the query, written in the query language. */ - const char * language) /* [in] Name of the query language (e.g. "WQL"). */ -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; /* Return status of CIM operations. */ - -#ifdef SWIGRUBY - _SBLIM_TRACE(1,("ExecQuery(Ruby) called, context %p, results %p, reference %p, query %s, language %s", context, results, reference, query, language)); - VALUE klass = (VALUE)self->hdl; - VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - VALUE rresults = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - VALUE rquery = rb_str_new2( query ); - VALUE rlanguage = rb_str_new2( language ); - /* exec_query instead of ExecQuery to follow Ruby naming convention */ - VALUE r = rb_funcall( klass, rb_intern( "exec_query" ), 5, rcontext, rresults, rreference, query, language ); - _SBLIM_TRACE(1,("r %p", r)); -#endif -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("ExecQuery(Python) called, context %p, results %p, reference %p, query %s, language %s", context, results, reference, query, language)); - - PY_CMPI_INIT - - PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); - PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pyquery = PyString_FromString(query); - PyObject *pylang = PyString_FromString(language); - - call_py_provider((PyObject*)self->hdl, &status, "exec_query", 5, - pycontext, - pyresult, - pyreference, - pyquery, - pylang); -#endif - - /* Query filtering is not supported for this class. */ - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("ExecQuery() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - - -// ---------------------------------------------------------------------------- - -#ifdef SWIGRUBY -static VALUE load_code() -{ - _SBLIM_TRACE(1,("Ruby: require 'rcmpi_instance'...")); - - rb_require("rcmpi_instance"); - - _SBLIM_TRACE(1,("Ruby: ... done")); -} - -static VALUE create_cmpi(VALUE args) -{ - VALUE *values = (VALUE *)args; - _SBLIM_TRACE(1,("Ruby: Cmpi_Instance.new ...")); - VALUE klass = rb_class_new_instance(1, values, rb_const_get(rb_cObject, rb_intern("Cmpi_Instance"))); - _SBLIM_TRACE(1,("Ruby: ... done")); - return klass; -} -#endif - -#ifdef SWIGRUBY -/* Initialize() - perform any necessary initialization immediately after this provider is loaded. */ -static int RBInitialize( - CMPIInstanceMI * self, CMPIStatus* st) /* [in] Handle to this provider (i.e. 'self'). */ -{ - int rc = 0; - if (st != NULL) - { - st->rc = CMPI_RC_OK; - st->msg = NULL; - } - int error = 0; - VALUE cmpiInstance; - SWIGEXPORT void SWIG_init(void); - - _SBLIM_TRACE(1,("Initialize() called")); - - _SBLIM_TRACE(1,("Ruby: Loading")); - ruby_init(); - ruby_init_loadpath(); - ruby_script("rcmpi_instance"); - SWIG_init(); - - rb_protect(load_code, Qnil, &error); - if (error) { - _SBLIM_TRACE(1,("Ruby: FAILED loading rcmpi_instance.rb")); - if (st != NULL) - { - st->rc = CMPI_RC_ERR_FAILED; - } - } - else { - _SBLIM_TRACE(1,("Ruby: loaded rcmpi_instance.rb")); - VALUE args[1]; - args[0] = rb_str_new2(_CLASSNAME); - cmpiInstance = rb_protect(create_cmpi, (VALUE)args, &error); - if (error) { - _SBLIM_TRACE(1,("Ruby: FAILED creating Cmpi")); - if (st != NULL) - { - st->rc = CMPI_RC_ERR_FAILED; - } - } - else { - _SBLIM_TRACE(1,("Ruby: cmpi at %p", cmpiInstance)); - self->hdl = (void *)cmpiInstance; - } - } - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("Initialize() %s", (rc == 0)? "succeeded":"failed")); - return rc; -} -#endif - -#ifdef SWIGPYTHON -#define PY_CMPI_SETFAIL(msgstr) {if (st != NULL) st->rc = CMPI_RC_ERR_FAILED; st->msg = msgstr; } -static int PyInitialize(PyObject** self, CMPIStatus* st) -{ - int rc = 0; - SWIGEXPORT void SWIG_init(void); - - _SBLIM_TRACE(1,("PyInitialize() called")); - - - _SBLIM_TRACE(1,("Python: Loading")); - Py_SetProgramName("cmpi_swig"); - Py_Initialize(); - SWIG_init(); - - PyObject *cmpiProviderModule = PyImport_ImportModule("pycmpi_instance"); - if (cmpiProviderModule == NULL) - { - PY_CMPI_SETFAIL(get_exc_trace()); - return -1; - } - _SBLIM_TRACE(1,("Python: cmpiProviderModule at %p", cmpiProviderModule)); - PyObject* provclass = PyObject_GetAttrString(cmpiProviderModule, - "CMPIProvider"); - if (provclass == NULL) - { - PY_CMPI_SETFAIL(get_exc_trace()); - Py_DecRef(cmpiProviderModule); - return -1; - } - PyObject* broker = SWIG_NewPointerObj((void*) _BROKER, SWIGTYPE_p__CMPIBroker, 0); - PyObject* args = PyTuple_New(2); - PyTuple_SetItem(args, 0, PyString_FromString(_MINAME)); - PyTuple_SetItem(args, 1, broker); - PyObject* provinst = PyObject_CallObject(provclass, args); - Py_DecRef(args); - Py_DecRef(provclass); - if (provinst == NULL) - { - PY_CMPI_SETFAIL(get_exc_trace()); - Py_DecRef(cmpiProviderModule); - return -1; - } - - *self = provinst; - _SBLIM_TRACE(1,("PyInitialize() succeeded")); - return 0; -} -#endif - - - -// associatorMIFT -// - -CMPIStatus associatorNames( - CMPIAssociationMI* self, - const CMPIContext* ctx, - const CMPIResult* rslt, - const CMPIObjectPath* objName, - const char* assocClass, - const char* resultClass, - const char* role, - const char* resultRole) -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("associatorNames(Python) called, ctx %p, rslt %p, objName %p, assocClass %s, resultClass %s, role %s, resultRole %s", ctx, rslt, objName, assocClass, resultClass, role, resultRole)); - - PY_CMPI_INIT - - PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pyassocClass = PyString_FromString(assocClass); - PyObject *pyresultClass = PyString_FromString(resultClass); - PyObject *pyrole = PyString_FromString(role); - PyObject *pyresultRole = PyString_FromString(resultRole); - - call_py_provider((PyObject*)self->hdl, &status, "associator_names", 7, - pyctx, - pyrslt, - pyobjName, - pyassocClass, - pyresultClass, - pyrole, - pyresultRole); -#endif - - /* Query filtering is not supported for this class. */ - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("associatorNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - -/***************************************************************************/ -CMPIStatus associators( - CMPIAssociationMI* self, - const CMPIContext* ctx, - const CMPIResult* rslt, - const CMPIObjectPath* objName, - const char* assocClass, - const char* resultClass, - const char* role, - const char* resultRole, - const char** properties) -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("associators(Python) called, ctx %p, rslt %p, objName %p, assocClass %s, resultClass %s, role %s, resultRole %s", ctx, rslt, objName, assocClass, resultClass, role, resultRole)); - - PY_CMPI_INIT - - PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pyassocClass = PyString_FromString(assocClass); - PyObject *pyresultClass = PyString_FromString(resultClass); - PyObject *pyrole = PyString_FromString(role); - PyObject *pyresultRole = PyString_FromString(resultRole); - PyObject *pyprops = proplist2py(properties); - - call_py_provider((PyObject*)self->hdl, &status, "associators", 8, - pyctx, - pyrslt, - pyobjName, - pyassocClass, - pyresultClass, - pyrole, - pyresultRole, - pyprops); -#endif - - /* Query filtering is not supported for this class. */ - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("associators() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - -/***************************************************************************/ -CMPIStatus referenceNames( - CMPIAssociationMI* self, - const CMPIContext* ctx, - const CMPIResult* rslt, - const CMPIObjectPath* objName, - const char* role, - const char* resultRole) -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("referenceNames(Python) called, ctx %p, rslt %p, objName %p, role %s, resultRole %s", ctx, rslt, objName, role, resultRole)); - - PY_CMPI_INIT - - PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pyrole = PyString_FromString(role); - PyObject *pyresultRole = PyString_FromString(resultRole); - - call_py_provider((PyObject*)self->hdl, &status, "reference_names", 5, - pyctx, - pyrslt, - pyobjName, - pyrole, - pyresultRole); -#endif - - /* Query filtering is not supported for this class. */ - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("referenceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - - -/***************************************************************************/ -CMPIStatus references( - CMPIAssociationMI* self, - const CMPIContext* ctx, - const CMPIResult* rslt, - const CMPIObjectPath* objName, - const char* role, - const char* resultRole, - const char** properties) -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("references(Python) called, ctx %p, rslt %p, objName %p, role %s, resultRole %s, properties %p", ctx, rslt, objName, role, resultRole, properties)); - - PY_CMPI_INIT - - PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pyrole = PyString_FromString(role); - PyObject *pyresultRole = PyString_FromString(resultRole); - PyObject *pyprops = proplist2py(properties); - - call_py_provider((PyObject*)self->hdl, &status, "references", 6, - pyctx, - pyrslt, - pyobjName, - pyrole, - pyresultRole, - pyprops); -#endif - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("references() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - -/***************************************************************************/ -CMPIStatus invokeMethod( - CMPIMethodMI* self, - const CMPIContext* ctx, - const CMPIResult* rslt, - const CMPIObjectPath* objName, - const char* method, - const CMPIArgs* in, - CMPIArgs* out) -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("invokeMethod(Python) called, ctx %p, rslt %p, objName %p, method %s, in %p, out %p", ctx, rslt, objName, method, in, out)); - - PY_CMPI_INIT - - PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pymethod = PyString_FromString(method); - PyObject *pyin = SWIG_NewPointerObj((void*) in, SWIGTYPE_p__CMPIArgs, 0); - PyObject *pyout = SWIG_NewPointerObj((void*) out, SWIGTYPE_p__CMPIArgs, 0); - - call_py_provider((PyObject*)self->hdl, &status, "invoke_method", 6, - pyctx, - pyrslt, - pyobjName, - pymethod, - pyin, - pyout); -#endif - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("invokeMethod() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - -/***************************************************************************/ -CMPIStatus authorizeFilter( - CMPIIndicationMI* self, - const CMPIContext* ctx, - const CMPISelectExp* filter, - const char* className, - const CMPIObjectPath* classPath, - const char* owner) -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("authorizeFilter(Python) called, ctx %p, filter %p, className %s, classPath %p, owner %s", ctx, filter, className, classPath, owner)); - - PY_CMPI_INIT - - PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyfilter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); - PyObject *pyclassPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pyclassName = PyString_FromString(className); - PyObject *pyowner = PyString_FromString(owner); - - call_py_provider((PyObject*)self->hdl, &status, "authorize_filter", 5, - pyctx, - pyfilter, - pyclassName, - pyclassPath, - pyowner); -#endif - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("authorizeFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - -/***************************************************************************/ -CMPIStatus activateFilter( - CMPIIndicationMI* self, - const CMPIContext* ctx, - const CMPISelectExp* filter, - const char* className, - const CMPIObjectPath* classPath, - CMPIBoolean firstActivation) -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("activateFilter(Python) called, ctx %p, filter %p, className %s, classPath %p, firstActivation %d", ctx, filter, className, classPath, firstActivation)); - - PY_CMPI_INIT - - PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyfilter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); - PyObject *pyclassPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pyclassName = PyString_FromString(className); - PyObject *pyfirstActivation = PyBool_FromLong(firstActivation); - - call_py_provider((PyObject*)self->hdl, &status, "activate_filter", 5, - pyctx, - pyfilter, - pyclassName, - pyclassPath, - pyfirstActivation); -#endif - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("activateFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - -/***************************************************************************/ -CMPIStatus deActivateFilter( - CMPIIndicationMI* self, - const CMPIContext* ctx, - const CMPISelectExp* filter, - const char* className, - const CMPIObjectPath* classPath, - CMPIBoolean lastActivation) -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("deActivateFilter(Python) called, ctx %p, filter %p, className %s, classPath %p, lastActivation %d", ctx, filter, className, classPath, lastActivation)); - - PY_CMPI_INIT - - PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - PyObject *pyfilter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); - PyObject *pyclassPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pyclassName = PyString_FromString(className); - PyObject *pylastActivation = PyBool_FromLong(lastActivation); - - call_py_provider((PyObject*)self->hdl, &status, "deactivate_filter", 5, - pyctx, - pyfilter, - pyclassName, - pyclassPath, - pylastActivation); -#endif - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("deActivateFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - - -/***************************************************************************/ -// Note: sfcb doesn't support mustPoll. :( -// http://sourceforge.net/mailarchive/message.php?msg_id=OFF38FF3F9.39FD2E1F-ONC1257385.004A7122-C1257385.004BB0AF%40de.ibm.com -CMPIStatus mustPoll( - CMPIIndicationMI* self, - const CMPIContext* ctx, - //const CMPIResult* rslt, TODO: figure out who is right: spec. vs. sblim - const CMPISelectExp* filter, - const char* className, - const CMPIObjectPath* classPath) -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - -#ifdef SWIGPYTHON - //_SBLIM_TRACE(1,("mustPoll(Python) called, ctx %p, rslt %p, filter %p, className %s, classPath %p", ctx, rslt, filter, className, classPath)); - _SBLIM_TRACE(1,("mustPoll(Python) called, ctx %p, filter %p, className %s, classPath %p", ctx, filter, className, classPath)); - - PY_CMPI_INIT - - PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - //PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); - PyObject *pyfilter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); - PyObject *pyclassPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pyclassName = PyString_FromString(className); - - call_py_provider((PyObject*)self->hdl, &status, "must_poll", 4, - pyctx, - //pyrslt, - pyfilter, - pyclassName, - pyclassPath); -#endif - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("mustPoll() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; -} - - -/***************************************************************************/ -CMPIStatus enableIndications( - CMPIIndicationMI* self, - const CMPIContext* ctx) -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("enableIndications(Python) called, ctx %p", ctx)); - - PY_CMPI_INIT - - PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - - call_py_provider((PyObject*)self->hdl, &status, "enable_indications", 1, pyctx); -#endif - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("enableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; - -} - -/***************************************************************************/ -CMPIStatus disableIndications( - CMPIIndicationMI* self, - const CMPIContext* ctx) -{ - CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; - -#ifdef SWIGPYTHON - _SBLIM_TRACE(1,("disableIndications(Python) called, ctx %p", ctx)); - - PY_CMPI_INIT - - PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - - call_py_provider((PyObject*)self->hdl, &status, "disable_indications", 1, pyctx); -#endif - - /* Finished. */ -exit: - _SBLIM_TRACE(1,("disableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); - return status; - -} - - -/***************************************************************************/ - - - - - - - - - -static CMPIMethodMIFT MethodMIFT__={ - CMPICurrentVersion, - CMPICurrentVersion, - "methodCmpi_Swig", // miName - MethodCleanup, - invokeMethod, -}; - - -static CMPIIndicationMIFT IndicationMIFT__={ - CMPICurrentVersion, - CMPICurrentVersion, - "indicationCmpi_Swig", // miName - IndicationCleanup, - authorizeFilter, - mustPoll, - activateFilter, - deActivateFilter, - enableIndications, - disableIndications, -}; - - -static CMPIAssociationMIFT AssociationMIFT__={ - CMPICurrentVersion, - CMPICurrentVersion, - "instanceCmpi_Swig", // miName - AssocCleanup, - associators, - associatorNames, - references, - referenceNames, -}; - - -static CMPIInstanceMIFT InstanceMIFT__={ - CMPICurrentVersion, - CMPICurrentVersion, - "associatorCmpi_Swig", // miName - InstCleanup, - EnumInstanceNames, - EnumInstances, - GetInstance, - CreateInstance, - SetInstance, - DeleteInstance, - ExecQuery, -}; - -static int createInit(const CMPIBroker* broker, - const CMPIContext* context, const char* miname, CMPIStatus* st) -{ - _BROKER = broker; - _MINAME = strdup(miname); - /* - * We can't initialize Python here and load Python modules, because - * SFCB passes a NULL CMPIStatus* st, which means we can't report - * back error strings. Instead, we'll check and initialize in each - * MIFT function - */ -} - -#define SWIG_CMPI_MI_FACTORY(ptype) \ -CMPI##ptype##MI* _Generic_Create_##ptype##MI(const CMPIBroker* broker, \ - const CMPIContext* context, const char* miname, CMPIStatus* st)\ -{ \ - static CMPI##ptype##MI mi={ \ - NULL, \ - &ptype##MIFT__, \ - }; \ - createInit(broker, context, miname, st); \ - return &mi; \ -} - -SWIG_CMPI_MI_FACTORY(Instance) -SWIG_CMPI_MI_FACTORY(Method) -SWIG_CMPI_MI_FACTORY(Association) -SWIG_CMPI_MI_FACTORY(Indication) - Copied: cmpi-bindings/src/cmpi_provider.c (from rev 642, cmpi-bindings/src/cmpi_instance.c) =================================================================== --- cmpi-bindings/src/cmpi_provider.c (rev 0) +++ cmpi-bindings/src/cmpi_provider.c 2008-06-11 23:40:58 UTC (rev 643) @@ -0,0 +1,1313 @@ +// ============================================================================ +// (C) Copyright Novell Inc. 2008 +// +// THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE +// ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE +// CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. +// +// You can obtain a current copy of the Common Public License from +// http://www.opensource.org/licenses/cpl1.0.php +// + +#ifdef SWIGRUBY +static char _CLASSNAME[] = "CmpiInstanceRuby"; +#endif +#ifdef SWIGPYTHON +static char _CLASSNAME[] = "CmpiInstanceSwig"; +#endif + +#include <stdio.h> +#include <stdarg.h> + +/* Include the required CMPI macros, data types, and API function headers */ +#include <cmpidt.h> +#include <cmpift.h> +#include <cmpimacs.h> + +// Needed to obtain errno of failed system calls +#include <errno.h> + +/* Needed for kill() */ +#include <signal.h> + + +#ifdef SWIGRUBY +#include <ruby.h> +#endif + +#ifdef SWIGPYTHON +#include <Python.h> +#endif + +/* A simple stderr logging/tracing facility. */ +#ifndef _SBLIM_TRACE +#define _SBLIM_TRACE(tracelevel,args) _logstderr args +void _logstderr(char *fmt,...) +{ + va_list ap; + va_start(ap,fmt); + vfprintf(stderr,fmt,ap); + va_end(ap); + fprintf(stderr,"\n"); +} +#endif + +/* Global handle to the CIM broker. This is initialized by the CIMOM when the provider is loaded */ +static const CMPIBroker * _BROKER = NULL; +static char* _MINAME = NULL; + +static char* fmtstr(const char* fmt, ...) +{ + va_list ap; + int len; + va_start(ap, fmt); + len = vsnprintf(NULL, 0, fmt, ap); + va_end(ap); + if (len <= 0) + { + return NULL; + } + char* str = (char*)malloc(len+1); + if (str == NULL) + { + return NULL; + } + va_start(ap, fmt); + vsnprintf(str, len+1, fmt, ap); + va_end(ap); + return str; +} + +#ifdef SWIGRUBY +static int RBInitialize(CMPIInstanceMI * self, CMPIStatus* st); +#endif + +#ifdef SWIGPYTHON +static int PyInitialize(PyObject** self, CMPIStatus* st); +#define PY_CMPI_INIT { if (self->hdl == NULL) if (PyInitialize((PyObject**)&(self->hdl), &status) != 0) return status; } +#endif + +#ifdef SWIGRUBY +static VALUE +properties2ruby( const char ** properties ) +{ + if (properties) { + VALUE rproperties = rb_ary_new(); + while (*properties) + rb_ary_push( rproperties, rb_str_new2(*properties++) ); + return rproperties; + } + return Qnil; +} +#endif + +#ifdef SWIGPYTHON +static PyObject* proplist2py(const char** cplist) +{ + if (cplist == NULL) + { + Py_RETURN_NONE; + } + PyObject* pl = PyList_New(0); + for (; *cplist != NULL; ++cplist) + { + PyList_Append(pl, PyString_FromString(*cplist)); + } + return pl; +} + +#define TB_ERROR(str) {tbstr = str; goto cleanup;} +static CMPIString* get_exc_trace() +{ + char *tbstr = NULL; + + PyObject *iostrmod = NULL; + PyObject *tbmod = NULL; + PyObject *iostr = NULL; + PyObject *obstr = NULL; + + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + PyErr_Clear(); + PyErr_NormalizeException(&type, &value, &traceback); + + iostrmod = PyImport_ImportModule("StringIO"); + if (iostrmod==NULL) + TB_ERROR("can't import StringIO"); + + iostr = PyObject_CallMethod(iostrmod, "StringIO", NULL); + + if (iostr==NULL) + TB_ERROR("cStringIO.StringIO() failed"); + + tbmod = PyImport_ImportModule("traceback"); + if (tbmod==NULL) + TB_ERROR("can't import traceback"); + + obstr = PyObject_CallMethod(tbmod, "print_exception", + "(OOOOO)", + type, value ? value : Py_None, + traceback ? traceback : Py_None, + Py_None, + iostr); + + if (obstr==NULL) + TB_ERROR("traceback.print_exception() failed"); + + Py_DecRef(obstr); + + obstr = PyObject_CallMethod(iostr, "getvalue", NULL); + if (obstr==NULL) + TB_ERROR("getvalue() failed."); + + if (!PyString_Check(obstr)) + TB_ERROR("getvalue() did not return a string"); + + tbstr = PyString_AsString(obstr); + +cleanup: + PyErr_Restore(type, value, traceback); + + CMPIString* rv; + if (tbstr != NULL) + { + rv = _BROKER->eft->newString(_BROKER, tbstr, NULL); + } + else + { + rv = _BROKER->eft->newString(_BROKER, "", NULL); + } + + Py_DecRef(iostr); + Py_DecRef(obstr); + Py_DecRef(iostrmod); + Py_DecRef(tbmod); + return rv; +} + + +static int +call_py_provider(PyObject* hdl, CMPIStatus* st, + const char* opname, int nargs, ...) +{ + int rc = 1; + va_list vargs; + PyObject *pyargs = NULL; + PyObject *pyfunc = NULL; + PyObject *prv = NULL; + pyargs = PyTuple_New(nargs); + pyfunc = PyObject_GetAttrString(hdl, opname); + if (pyfunc == NULL) + { + PyErr_Clear(); + char* str = fmtstr("Python module does not contain \"%s\"", opname); + _SBLIM_TRACE(1,(str)); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = _BROKER->eft->newString(_BROKER, str, NULL); + free(str); + rc = 1; + goto cleanup; + } + if (! PyCallable_Check(pyfunc)) + { + char* str = fmtstr("Python module attribute \"%s\" is not callable", + opname); + _SBLIM_TRACE(1,(str)); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = _BROKER->eft->newString(_BROKER, str, NULL); + free(str); + rc = 1; + goto cleanup; + } + + va_start(vargs, nargs); + int i; + for (i = 0; i < nargs; ++i) + { + PyObject* arg = va_arg(vargs, PyObject*); + PyTuple_SET_ITEM(pyargs, i, arg); + } + va_end(vargs); + prv = PyObject_CallObject(pyfunc, pyargs); + if (PyErr_Occurred()) + { + st->rc = CMPI_RC_ERR_FAILED; + st->msg = get_exc_trace(); + PyErr_Clear(); + rc = 1; + goto cleanup; + } + + if (! PyTuple_Check(prv) || PyTuple_Size(prv) != 2) + { + char* str = fmtstr("Python function \"%s\" didn't return a two-tuple", + opname); + _SBLIM_TRACE(1,(str)); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = _BROKER->eft->newString(_BROKER, str, NULL); + free(str); + rc = 1; + goto cleanup; + } + PyObject* prc = PyTuple_GetItem(prv, 0); + PyObject* prstr = PyTuple_GetItem(prv, 1); + if (! PyInt_Check(prc) || ! PyString_Check(prstr)) + { + char* str = fmtstr("Python function \"%s\" didn't return a {<int>, <str>) two-tuple", opname); + _SBLIM_TRACE(1,(str)); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = _BROKER->eft->newString(_BROKER, str, NULL); + free(str); + rc = 1; + goto cleanup; + } + long pi = PyInt_AsLong(prc); + st->rc = (CMPIrc)pi; + st->msg = _BROKER->eft->newString(_BROKER, PyString_AsString(prstr), NULL); + rc = pi != 0; +cleanup: + Py_DecRef(pyargs); + Py_DecRef(pyfunc); + Py_DecRef(prv); + return rc; +} +#endif + + +// ---------------------------------------------------------------------------- +// CMPI INSTANCE PROVIDER FUNCTIONS +// ---------------------------------------------------------------------------- + +static CMPIStatus Cleanup( + const CMPIContext * context, + CMPIBoolean terminating) +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ + + _SBLIM_TRACE(1,("Cleanup() called")); + +#ifdef SWIGRUBY + ruby_finalize(); + _SBLIM_TRACE(1,("Cleanup(Ruby) called")); +#endif + +#ifdef SWIGPYTHON + Py_Finalize(); + _SBLIM_TRACE(1,("Cleanup(Python) called")); +#endif + + if (_MINAME != NULL) + { + free(_MINAME); + _MINAME = NULL; + } + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("Cleanup() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +static CMPIStatus InstCleanup( + CMPIInstanceMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +static CMPIStatus AssocCleanup( + CMPIAssociationMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +static CMPIStatus MethodCleanup( + CMPIMethodMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +static CMPIStatus IndicationCleanup( + CMPIIndicationMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +// ---------------------------------------------------------------------------- + + +/* EnumInstanceNames() - return a list of all the instances names (i.e. return their object paths only) */ +static CMPIStatus EnumInstanceNames( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ + const CMPIContext * context, /* [in] Additional context info, if any */ + const CMPIResult * result, /* [in] Contains the CIM namespace and classname */ + const CMPIObjectPath * reference) /* [in] Contains the CIM namespace and classname */ +{ + CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations */ + + _SBLIM_TRACE(1,("EnumInstanceNames() called")); + +#ifdef SWIGRUBY + _SBLIM_TRACE(1,("EnumInstanceNames(Ruby) called, context %p, result %p, reference %p", context, result, reference)); + VALUE klass = (VALUE)self->hdl; + VALUE rcontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + VALUE rresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); + VALUE rreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + + /* enum_instance_names instead of EnumInstanceNames to follow Ruby naming convention */ + VALUE r = rb_funcall( klass, rb_intern( "enum_instance_names" ), 3, rcontext, rresult, rreference ); + _SBLIM_TRACE(1,("r %p", r)); +#endif +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("EnumInstancesNames(Python) called, context %p, result %p, reference %p", context, result, reference)); + + PY_CMPI_INIT + + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + + call_py_provider((PyObject*)self->hdl, &status, "enum_instance_names", 3, + pycontext, + pyresult, + pyreference); +#endif + +exit: + _SBLIM_TRACE(1,("EnumInstanceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +// ---------------------------------------------------------------------------- + + +/* EnumInstances() - return a list of all the instances (i.e. return all the instance data) */ +static CMPIStatus EnumInstances( + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ + const CMPIContext * context, /* [in] Additional context info, if a... [truncated message content] |
From: <ba...@us...> - 2008-06-11 23:33:12
|
Revision: 642 http://omc.svn.sourceforge.net/omc/?rev=642&view=rev Author: bartw Date: 2008-06-11 16:33:14 -0700 (Wed, 11 Jun 2008) Log Message: ----------- more work on python bindings Modified Paths: -------------- cmpi-bindings/src/cmpi_instance.c cmpi-bindings/swig/python/pycmpi_instance.py Modified: cmpi-bindings/src/cmpi_instance.c =================================================================== --- cmpi-bindings/src/cmpi_instance.c 2008-06-11 04:46:41 UTC (rev 641) +++ cmpi-bindings/src/cmpi_instance.c 2008-06-11 23:33:14 UTC (rev 642) @@ -53,26 +53,29 @@ #endif /* Global handle to the CIM broker. This is initialized by the CIMOM when the provider is loaded */ -static const CMPIBroker * _BROKER; +static const CMPIBroker * _BROKER = NULL; +static char* _MINAME = NULL; static char* fmtstr(const char* fmt, ...) { va_list ap; int len; + va_start(ap, fmt); len = vsnprintf(NULL, 0, fmt, ap); + va_end(ap); if (len <= 0) { - return NULL; - } - char* str = (char*)malloc(len+1); - if (str == NULL) - { - return NULL; - } - va_start(ap, fmt); - vsnprintf(str, len+1, fmt, ap); - va_end(ap); - return str; + return NULL; + } + char* str = (char*)malloc(len+1); + if (str == NULL) + { + return NULL; + } + va_start(ap, fmt); + vsnprintf(str, len+1, fmt, ap); + va_end(ap); + return str; } #ifdef SWIGRUBY @@ -103,8 +106,7 @@ { if (cplist == NULL) { - Py_IncRef(Py_None); // TODO: make sure we need this incref. - return Py_None; + Py_RETURN_NONE; } PyObject* pl = PyList_New(0); for (; *cplist != NULL; ++cplist) @@ -293,6 +295,12 @@ Py_Finalize(); _SBLIM_TRACE(1,("Cleanup(Python) called")); #endif + + if (_MINAME != NULL) + { + free(_MINAME); + _MINAME = NULL; + } /* Finished. */ exit: @@ -366,7 +374,7 @@ PyObject *pyresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - call_py_provider((PyObject*)self->hdl, &status, "enumInstanceNames", 3, + call_py_provider((PyObject*)self->hdl, &status, "enum_instance_names", 3, pycontext, pyresult, pyreference); @@ -413,7 +421,7 @@ PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); PyObject *pyproperties = proplist2py(properties); - call_py_provider((PyObject*)self->hdl, &status, "enumInstances", 4, + call_py_provider((PyObject*)self->hdl, &status, "enum_instances", 4, pycontext, pyresult, pyreference, @@ -460,7 +468,7 @@ PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); PyObject *pyproperties = proplist2py(properties); - call_py_provider((PyObject*)self->hdl, &status, "getInstance", 4, + call_py_provider((PyObject*)self->hdl, &status, "get_instance", 4, pycontext, pyresult, pyreference, @@ -509,7 +517,7 @@ PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); PyObject *pynewinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); - call_py_provider((PyObject*)self->hdl, &status, "createInstance", 4, + call_py_provider((PyObject*)self->hdl, &status, "create_instance", 4, pycontext, pyresult, pyreference, @@ -565,7 +573,7 @@ PyObject *pynewinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); PyObject *plist = proplist2py(properties); - call_py_provider((PyObject*)self->hdl, &status, "setInstance", 5, + call_py_provider((PyObject*)self->hdl, &status, "set_instance", 5, pycontext, pyresult, pyreference, @@ -610,7 +618,7 @@ PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - call_py_provider((PyObject*)self->hdl, &status, "deleteInstance", 3, + call_py_provider((PyObject*)self->hdl, &status, "delete_instance", 3, pycontext, pyresult, pyreference); @@ -659,7 +667,7 @@ PyObject *pyquery = PyString_FromString(query); PyObject *pylang = PyString_FromString(language); - call_py_provider((PyObject*)self->hdl, &status, "deleteInstance", 5, + call_py_provider((PyObject*)self->hdl, &status, "exec_query", 5, pycontext, pyresult, pyreference, @@ -755,14 +763,10 @@ #endif #ifdef SWIGPYTHON +#define PY_CMPI_SETFAIL(msgstr) {if (st != NULL) st->rc = CMPI_RC_ERR_FAILED; st->msg = msgstr; } static int PyInitialize(PyObject** self, CMPIStatus* st) { int rc = 0; - if (st != NULL) - { - st->rc = CMPI_RC_OK; - st->msg = NULL; - } SWIGEXPORT void SWIG_init(void); _SBLIM_TRACE(1,("PyInitialize() called")); @@ -773,43 +777,38 @@ Py_Initialize(); SWIG_init(); - /* 'import cmpi;' */ - PyObject *name = PyString_FromString("cmpi"); - PyObject *cmpiModule = PyImport_Import(name); - Py_DecRef(name); - if (cmpiModule) { - /* 'import pycmpi_instance;' */ - name = PyString_FromString("pycmpi_instance"); - PyObject *instanceModule = PyImport_Import(name); - Py_DecRef(name); - if (instanceModule) { - _SBLIM_TRACE(1,("Python: instanceModule at %p", instanceModule)); - *self = instanceModule; + PyObject *cmpiProviderModule = PyImport_ImportModule("pycmpi_instance"); + if (cmpiProviderModule == NULL) + { + PY_CMPI_SETFAIL(get_exc_trace()); + return -1; } - else { - _SBLIM_TRACE(1,("Python: FAILED loading pycmpi_instance.py")); - rc = -1; - if (st != NULL) - { - st->rc = CMPI_RC_ERR_FAILED; - st->msg = get_exc_trace(); - } - PyErr_Clear(); + _SBLIM_TRACE(1,("Python: cmpiProviderModule at %p", cmpiProviderModule)); + PyObject* provclass = PyObject_GetAttrString(cmpiProviderModule, + "CMPIProvider"); + if (provclass == NULL) + { + PY_CMPI_SETFAIL(get_exc_trace()); + Py_DecRef(cmpiProviderModule); + return -1; } - } - else { - if (st != NULL) - _SBLIM_TRACE(1,("Python: FAILED loading cmpi.py")); - { - rc = -1; - st->rc = CMPI_RC_ERR_FAILED; - st->msg = get_exc_trace(); - } - PyErr_Clear(); - } -exit: - _SBLIM_TRACE(1,("PyInitialize() %s", (rc == 0)? "succeeded":"failed")); - return rc; + PyObject* broker = SWIG_NewPointerObj((void*) _BROKER, SWIGTYPE_p__CMPIBroker, 0); + PyObject* args = PyTuple_New(2); + PyTuple_SetItem(args, 0, PyString_FromString(_MINAME)); + PyTuple_SetItem(args, 1, broker); + PyObject* provinst = PyObject_CallObject(provclass, args); + Py_DecRef(args); + Py_DecRef(provclass); + if (provinst == NULL) + { + PY_CMPI_SETFAIL(get_exc_trace()); + Py_DecRef(cmpiProviderModule); + return -1; + } + + *self = provinst; + _SBLIM_TRACE(1,("PyInitialize() succeeded")); + return 0; } #endif @@ -843,7 +842,7 @@ PyObject *pyrole = PyString_FromString(role); PyObject *pyresultRole = PyString_FromString(resultRole); - call_py_provider((PyObject*)self->hdl, &status, "associatorNames", 7, + call_py_provider((PyObject*)self->hdl, &status, "associator_names", 7, pyctx, pyrslt, pyobjName, @@ -930,7 +929,7 @@ PyObject *pyrole = PyString_FromString(role); PyObject *pyresultRole = PyString_FromString(resultRole); - call_py_provider((PyObject*)self->hdl, &status, "referenceNames", 5, + call_py_provider((PyObject*)self->hdl, &status, "reference_names", 5, pyctx, pyrslt, pyobjName, @@ -1010,7 +1009,7 @@ PyObject *pyin = SWIG_NewPointerObj((void*) in, SWIGTYPE_p__CMPIArgs, 0); PyObject *pyout = SWIG_NewPointerObj((void*) out, SWIGTYPE_p__CMPIArgs, 0); - call_py_provider((PyObject*)self->hdl, &status, "invokeMethod", 6, + call_py_provider((PyObject*)self->hdl, &status, "invoke_method", 6, pyctx, pyrslt, pyobjName, @@ -1047,7 +1046,7 @@ PyObject *pyclassName = PyString_FromString(className); PyObject *pyowner = PyString_FromString(owner); - call_py_provider((PyObject*)self->hdl, &status, "authorizeFilter", 5, + call_py_provider((PyObject*)self->hdl, &status, "authorize_filter", 5, pyctx, pyfilter, pyclassName, @@ -1083,7 +1082,7 @@ PyObject *pyclassName = PyString_FromString(className); PyObject *pyfirstActivation = PyBool_FromLong(firstActivation); - call_py_provider((PyObject*)self->hdl, &status, "activateFilter", 5, + call_py_provider((PyObject*)self->hdl, &status, "activate_filter", 5, pyctx, pyfilter, pyclassName, @@ -1119,7 +1118,7 @@ PyObject *pyclassName = PyString_FromString(className); PyObject *pylastActivation = PyBool_FromLong(lastActivation); - call_py_provider((PyObject*)self->hdl, &status, "deActivateFilter", 5, + call_py_provider((PyObject*)self->hdl, &status, "deactivate_filter", 5, pyctx, pyfilter, pyclassName, @@ -1135,6 +1134,8 @@ /***************************************************************************/ +// Note: sfcb doesn't support mustPoll. :( +// http://sourceforge.net/mailarchive/message.php?msg_id=OFF38FF3F9.39FD2E1F-ONC1257385.004A7122-C1257385.004BB0AF%40de.ibm.com CMPIStatus mustPoll( CMPIIndicationMI* self, const CMPIContext* ctx, @@ -1157,7 +1158,7 @@ PyObject *pyclassPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); PyObject *pyclassName = PyString_FromString(className); - call_py_provider((PyObject*)self->hdl, &status, "mustPoll", 5, + call_py_provider((PyObject*)self->hdl, &status, "must_poll", 4, pyctx, //pyrslt, pyfilter, @@ -1186,7 +1187,7 @@ PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - call_py_provider((PyObject*)self->hdl, &status, "enableIndications", 1, pyctx); + call_py_provider((PyObject*)self->hdl, &status, "enable_indications", 1, pyctx); #endif /* Finished. */ @@ -1210,7 +1211,7 @@ PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); - call_py_provider((PyObject*)self->hdl, &status, "disableIndications", 1, pyctx); + call_py_provider((PyObject*)self->hdl, &status, "disable_indications", 1, pyctx); #endif /* Finished. */ @@ -1231,7 +1232,7 @@ -static CMPIMethodMIFT methodMIFT__={ +static CMPIMethodMIFT MethodMIFT__={ CMPICurrentVersion, CMPICurrentVersion, "methodCmpi_Swig", // miName @@ -1239,22 +1240,8 @@ invokeMethod, }; -CMPIMethodMI* _Generic_Create_MethodMI(const CMPIBroker* broker, - const CMPIContext* context, const char* miname, CMPIStatus* st) -{ - static CMPIMethodMI mi={ - NULL, - &methodMIFT__, - }; - _BROKER=broker; -#ifdef SWIGRUBY - //RBInitialize(&mi, st); -#endif - return &mi; -} - -static CMPIIndicationMIFT indMIFT__={ +static CMPIIndicationMIFT IndicationMIFT__={ CMPICurrentVersion, CMPICurrentVersion, "indicationCmpi_Swig", // miName @@ -1267,23 +1254,8 @@ disableIndications, }; -CMPIIndicationMI* _Generic_Create_IndicationMI(const CMPIBroker* broker, - const CMPIContext* context, const char* miname, CMPIStatus* st) -{ - static CMPIIndicationMI mi={ - NULL, - &indMIFT__, - }; - _BROKER=broker; -#ifdef SWIGRUBY - //RBInitialize(&mi, st); -#endif - return &mi; -} - - -static CMPIAssociationMIFT assocMIFT__={ +static CMPIAssociationMIFT AssociationMIFT__={ CMPICurrentVersion, CMPICurrentVersion, "instanceCmpi_Swig", // miName @@ -1294,22 +1266,8 @@ referenceNames, }; -CMPIAssociationMI* _Generic_Create_AssociationMI(const CMPIBroker* broker, - const CMPIContext* context, const char* miname, CMPIStatus* st) -{ - static CMPIAssociationMI mi={ - NULL, - &assocMIFT__, - }; - _BROKER=broker; -#ifdef SWIGRUBY - //RBInitialize(&mi, st); -#endif - return &mi; -} - -static CMPIInstanceMIFT instMIFT__={ +static CMPIInstanceMIFT InstanceMIFT__={ CMPICurrentVersion, CMPICurrentVersion, "associatorCmpi_Swig", // miName @@ -1323,17 +1281,33 @@ ExecQuery, }; -CMPIInstanceMI* _Generic_Create_InstanceMI(const CMPIBroker* broker, +static int createInit(const CMPIBroker* broker, const CMPIContext* context, const char* miname, CMPIStatus* st) { - static CMPIInstanceMI mi={ - NULL, - &instMIFT__, - }; - _BROKER=broker; -#ifdef SWIGRUBY - RBInitialize(&mi, st); -#endif - return &mi; + _BROKER = broker; + _MINAME = strdup(miname); + /* + * We can't initialize Python here and load Python modules, because + * SFCB passes a NULL CMPIStatus* st, which means we can't report + * back error strings. Instead, we'll check and initialize in each + * MIFT function + */ } +#define SWIG_CMPI_MI_FACTORY(ptype) \ +CMPI##ptype##MI* _Generic_Create_##ptype##MI(const CMPIBroker* broker, \ + const CMPIContext* context, const char* miname, CMPIStatus* st)\ +{ \ + static CMPI##ptype##MI mi={ \ + NULL, \ + &ptype##MIFT__, \ + }; \ + createInit(broker, context, miname, st); \ + return &mi; \ +} + +SWIG_CMPI_MI_FACTORY(Instance) +SWIG_CMPI_MI_FACTORY(Method) +SWIG_CMPI_MI_FACTORY(Association) +SWIG_CMPI_MI_FACTORY(Indication) + Modified: cmpi-bindings/swig/python/pycmpi_instance.py =================================================================== --- cmpi-bindings/swig/python/pycmpi_instance.py 2008-06-11 04:46:41 UTC (rev 641) +++ cmpi-bindings/swig/python/pycmpi_instance.py 2008-06-11 23:33:14 UTC (rev 642) @@ -1,61 +1,133 @@ import cmpi import sys import traceback -#import cStringIO -print "Hello, from pycmpi_instance.py" -def enumInstanceNames(context, result, reference): - #try: - print 'provider.py: In enumInstanceNames()' - print 'namespace: %s, classname: %s' % (reference.namespace(), reference.classname()) - print dir(context) - print dir(result) - print dir(reference) - op = cmpi.CMPIObjectPath(reference.namespace()) - op.set_classname('Cmpi_Swig') - cv = cmpi.CMPIValue() - cv.string = cmpi.CMPIString('Hello') - op.add_key('hello', cv, cmpi.CMPI_string) - result.return_objectpath(op) - cv.string = cmpi.CMPIString('World') - op.add_key('hello', cv, cmpi.CMPI_string) - result.return_objectpath(op) - result.done() - return (0, 'My String') - #except: - #print sys.exc_info() - #traceback.print_tb(sys.exc_info()[2]) - #raise - +class CMPIProvider(object): -def enumInstances(context, result, reference, plist): - #try: - print 'provider.py: In enumInstanceNames()' - print 'namespace: %s, classname: %s' % (reference.namespace(), reference.classname()) - print dir(context) - print dir(result) - print dir(reference) - print 'plist:', plist - op = cmpi.CMPIObjectPath(reference.namespace()) - op.set_classname('Cmpi_Swig') - cv = cmpi.CMPIValue() - cv.string = cmpi.CMPIString('Hello') - op.add_key('hello', cv, cmpi.CMPI_string) + def __init__(self, miname, broker): + print 'called CMPIProvider(', miname, ',', broker, ')' + self.broker = broker + self.miname = miname - inst = cmpi.CMPIInstance(op) - inst.set_property('hello', cv, cmpi.CMPI_string) + def enum_instance_names(self, ctx, rslt, objname): + #try: + print 'provider.py: In enum_instance_names()' + print 'namespace: %s, classname: %s' % (objname.namespace(), objname.classname()) + print dir(ctx) + print dir(rslt) + print dir(objname) + op = cmpi.CMPIObjectPath(objname.namespace()) + op.set_classname('Cmpi_Swig') + cv = cmpi.CMPIValue() + cv.string = cmpi.CMPIString('Hello') + op.add_key('hello', cv, cmpi.CMPI_string) + rslt.return_objectpath(op) + cv.string = cmpi.CMPIString('World') + op.add_key('hello', cv, cmpi.CMPI_string) + rslt.return_objectpath(op) + rslt.done() + return (0, 'My String') + #except: + #print sys.exc_info() + #traceback.print_tb(sys.exc_info()[2]) + #raise + - result.return_instance(inst) - cv.string = cmpi.CMPIString('World') - op.add_key('hello', cv, cmpi.CMPI_string) - inst = cmpi.CMPIInstance(op) - inst.set_property('hello', cv, cmpi.CMPI_string) - result.return_instance(inst) - result.done() - return (0, 'My String') - #except: - #print sys.exc_info() - #traceback.print_tb(sys.exc_info()[2]) - #raise + def enum_instances(self, ctx, rslt, objname, plist): + #try: + print 'provider.py: In enum_instances()' + print 'namespace: %s, classname: %s' % (objname.namespace(), objname.classname()) + print dir(ctx) + print dir(rslt) + print dir(objname) + print 'plist:', plist + op = cmpi.CMPIObjectPath(objname.namespace()) + op.set_classname('Cmpi_Swig') + cv = cmpi.CMPIValue() + cv.string = cmpi.CMPIString('Hello') + op.add_key('hello', cv, cmpi.CMPI_string) + inst = cmpi.CMPIInstance(op) + inst.set_property('hello', cv, cmpi.CMPI_string) + + rslt.return_instance(inst) + cv.string = cmpi.CMPIString('World') + op.add_key('hello', cv, cmpi.CMPI_string) + inst = cmpi.CMPIInstance(op) + inst.set_property('hello', cv, cmpi.CMPI_string) + rslt.return_instance(inst) + rslt.done() + return (0, 'My String') + #except: + #print sys.exc_info() + #traceback.print_tb(sys.exc_info()[2]) + #raise + + + def get_instance(self, ctx, rslt, objname, plist): + pass + + def create_instance(self, ctx, rslt, objname, newinst): + pass + + def set_instance(self, ctx, rslt, objname, newinst, plist): + pass + + def delete_instance(self, ctx, rslt, objname): + pass + + + def exec_query(self, ctx, rslt, objname, query, lang): + pass + + + def associator_names(self, ctx, rslt, objName, assocClass, resultClass, + role, resultRole): + pass + + + def associators(self, ctx, rslt, objName, assocClass, resultClass, + role, resultRole, props): + pass + + + def reference_names(self, ctx, rslt, objName, role, resultRole): + pass + + + def references(self, ctx, rslt, objName, role, resultRole, props): + pass + + + def invoke_method(self, ctx, rslt, objName, method, inargs, outargs): + pass + + + def authorize_filter(self, ctx, filter, className, classPath, owner): + pass + + def activate_filter(self, ctx, filter, className, classPath, + firstActivation): + pass + + + def deactivate_filter(self, ctx, filter, className, classPath, + lastActivation): + pass + + + + #def must_poll(self, ctx, rslt, filter, className, classPath): + # NOTE: sfcb signature for this doesn't have the rslt. + def must_poll(self, ctx, filter, className, classPath): + pass + + + def enable_indications(self, ctx): + pass + + def disable_indications(self, ctx): + pass + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-06-11 04:46:34
|
Revision: 641 http://omc.svn.sourceforge.net/omc/?rev=641&view=rev Author: bartw Date: 2008-06-10 21:46:41 -0700 (Tue, 10 Jun 2008) Log Message: ----------- added python implementation for all provider types. Modified Paths: -------------- cmpi-bindings/src/cmpi_instance.c Modified: cmpi-bindings/src/cmpi_instance.c =================================================================== --- cmpi-bindings/src/cmpi_instance.c 2008-06-10 23:11:39 UTC (rev 640) +++ cmpi-bindings/src/cmpi_instance.c 2008-06-11 04:46:41 UTC (rev 641) @@ -75,8 +75,15 @@ return str; } -static int Initialize(CMPIInstanceMI * self, CMPIStatus* st); +#ifdef SWIGRUBY +static int RBInitialize(CMPIInstanceMI * self, CMPIStatus* st); +#endif +#ifdef SWIGPYTHON +static int PyInitialize(PyObject** self, CMPIStatus* st); +#define PY_CMPI_INIT { if (self->hdl == NULL) if (PyInitialize((PyObject**)&(self->hdl), &status) != 0) return status; } +#endif + #ifdef SWIGRUBY static VALUE properties2ruby( const char ** properties ) @@ -269,12 +276,9 @@ // CMPI INSTANCE PROVIDER FUNCTIONS // ---------------------------------------------------------------------------- - -/* Cleanup() - perform any necessary cleanup immediately before this provider is unloaded. */ static CMPIStatus Cleanup( - CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self'). */ const CMPIContext * context, - CMPIBoolean terminating) /* [in] Additional context info, if any. */ + CMPIBoolean terminating) { CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ @@ -296,7 +300,38 @@ return status; } +static CMPIStatus InstCleanup( + CMPIInstanceMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} +static CMPIStatus AssocCleanup( + CMPIAssociationMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +static CMPIStatus MethodCleanup( + CMPIMethodMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + +static CMPIStatus IndicationCleanup( + CMPIIndicationMI * self, + const CMPIContext * context, + CMPIBoolean terminating) +{ + return Cleanup(context, terminating); +} + // ---------------------------------------------------------------------------- @@ -325,7 +360,7 @@ #ifdef SWIGPYTHON _SBLIM_TRACE(1,("EnumInstancesNames(Python) called, context %p, result %p, reference %p", context, result, reference)); - if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + PY_CMPI_INIT PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); PyObject *pyresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); @@ -371,7 +406,7 @@ #ifdef SWIGPYTHON _SBLIM_TRACE(1,("EnumInstances(Python) called, context %p, result %p, reference %p, properties %p", context, result, reference, properties)); - if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + PY_CMPI_INIT PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); PyObject *pyresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); @@ -418,7 +453,7 @@ #ifdef SWIGPYTHON _SBLIM_TRACE(1,("GetInstance(Python) called, context %p, results %p, reference %p, properties %p", context, results, reference, properties)); - if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + PY_CMPI_INIT PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); @@ -467,7 +502,7 @@ #ifdef SWIGPYTHON _SBLIM_TRACE(1,("CreateInstance(Python) called, context %p, results %p, reference %p, newinstance %p", context, results, reference, newinstance)); - if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + PY_CMPI_INIT PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); @@ -522,7 +557,7 @@ #ifdef SWIGPYTHON _SBLIM_TRACE(1,("SetInstance(Python) called, context %p, results %p, reference %p, newinstance %p, properties %p", context, results, reference, newinstance, properties)); - if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + PY_CMPI_INIT PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); @@ -569,7 +604,7 @@ #ifdef SWIGPYTHON _SBLIM_TRACE(1,("DeleteInstance(Python) called, context %p, results %p, reference %p", context, results, reference)); - if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + PY_CMPI_INIT PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); @@ -616,7 +651,7 @@ #ifdef SWIGPYTHON _SBLIM_TRACE(1,("ExecQuery(Python) called, context %p, results %p, reference %p, query %s, language %s", context, results, reference, query, language)); - if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + PY_CMPI_INIT PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); @@ -663,8 +698,9 @@ } #endif +#ifdef SWIGRUBY /* Initialize() - perform any necessary initialization immediately after this provider is loaded. */ -static int Initialize( +static int RBInitialize( CMPIInstanceMI * self, CMPIStatus* st) /* [in] Handle to this provider (i.e. 'self'). */ { int rc = 0; @@ -673,15 +709,12 @@ st->rc = CMPI_RC_OK; st->msg = NULL; } -#ifdef SWIGRUBY int error = 0; VALUE cmpiInstance; -#endif SWIGEXPORT void SWIG_init(void); _SBLIM_TRACE(1,("Initialize() called")); -#ifdef SWIGRUBY _SBLIM_TRACE(1,("Ruby: Loading")); ruby_init(); ruby_init_loadpath(); @@ -713,9 +746,28 @@ self->hdl = (void *)cmpiInstance; } } -#endif /* SWIGRUBY */ + /* Finished. */ +exit: + _SBLIM_TRACE(1,("Initialize() %s", (rc == 0)? "succeeded":"failed")); + return rc; +} +#endif + #ifdef SWIGPYTHON +static int PyInitialize(PyObject** self, CMPIStatus* st) +{ + int rc = 0; + if (st != NULL) + { + st->rc = CMPI_RC_OK; + st->msg = NULL; + } + SWIGEXPORT void SWIG_init(void); + + _SBLIM_TRACE(1,("PyInitialize() called")); + + _SBLIM_TRACE(1,("Python: Loading")); Py_SetProgramName("cmpi_swig"); Py_Initialize(); @@ -732,7 +784,7 @@ Py_DecRef(name); if (instanceModule) { _SBLIM_TRACE(1,("Python: instanceModule at %p", instanceModule)); - self->hdl = instanceModule; + *self = instanceModule; } else { _SBLIM_TRACE(1,("Python: FAILED loading pycmpi_instance.py")); @@ -755,20 +807,513 @@ } PyErr_Clear(); } +exit: + _SBLIM_TRACE(1,("PyInitialize() %s", (rc == 0)? "succeeded":"failed")); + return rc; +} #endif + + + +// associatorMIFT +// + +CMPIStatus associatorNames( + CMPIAssociationMI* self, + const CMPIContext* ctx, + const CMPIResult* rslt, + const CMPIObjectPath* objName, + const char* assocClass, + const char* resultClass, + const char* role, + const char* resultRole) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("associatorNames(Python) called, ctx %p, rslt %p, objName %p, assocClass %s, resultClass %s, role %s, resultRole %s", ctx, rslt, objName, assocClass, resultClass, role, resultRole)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyassocClass = PyString_FromString(assocClass); + PyObject *pyresultClass = PyString_FromString(resultClass); + PyObject *pyrole = PyString_FromString(role); + PyObject *pyresultRole = PyString_FromString(resultRole); + + call_py_provider((PyObject*)self->hdl, &status, "associatorNames", 7, + pyctx, + pyrslt, + pyobjName, + pyassocClass, + pyresultClass, + pyrole, + pyresultRole); +#endif + + /* Query filtering is not supported for this class. */ + /* Finished. */ exit: - _SBLIM_TRACE(1,("Initialize() %s", (rc == 0)? "succeeded":"failed")); - return rc; + _SBLIM_TRACE(1,("associatorNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; } +/***************************************************************************/ +CMPIStatus associators( + CMPIAssociationMI* self, + const CMPIContext* ctx, + const CMPIResult* rslt, + const CMPIObjectPath* objName, + const char* assocClass, + const char* resultClass, + const char* role, + const char* resultRole, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("associators(Python) called, ctx %p, rslt %p, objName %p, assocClass %s, resultClass %s, role %s, resultRole %s", ctx, rslt, objName, assocClass, resultClass, role, resultRole)); + PY_CMPI_INIT + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyassocClass = PyString_FromString(assocClass); + PyObject *pyresultClass = PyString_FromString(resultClass); + PyObject *pyrole = PyString_FromString(role); + PyObject *pyresultRole = PyString_FromString(resultRole); + PyObject *pyprops = proplist2py(properties); + + call_py_provider((PyObject*)self->hdl, &status, "associators", 8, + pyctx, + pyrslt, + pyobjName, + pyassocClass, + pyresultClass, + pyrole, + pyresultRole, + pyprops); +#endif + + /* Query filtering is not supported for this class. */ + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("associators() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +/***************************************************************************/ +CMPIStatus referenceNames( + CMPIAssociationMI* self, + const CMPIContext* ctx, + const CMPIResult* rslt, + const CMPIObjectPath* objName, + const char* role, + const char* resultRole) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("referenceNames(Python) called, ctx %p, rslt %p, objName %p, role %s, resultRole %s", ctx, rslt, objName, role, resultRole)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyrole = PyString_FromString(role); + PyObject *pyresultRole = PyString_FromString(resultRole); + + call_py_provider((PyObject*)self->hdl, &status, "referenceNames", 5, + pyctx, + pyrslt, + pyobjName, + pyrole, + pyresultRole); +#endif + + /* Query filtering is not supported for this class. */ + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("referenceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +/***************************************************************************/ +CMPIStatus references( + CMPIAssociationMI* self, + const CMPIContext* ctx, + const CMPIResult* rslt, + const CMPIObjectPath* objName, + const char* role, + const char* resultRole, + const char** properties) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("references(Python) called, ctx %p, rslt %p, objName %p, role %s, resultRole %s, properties %p", ctx, rslt, objName, role, resultRole, properties)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyrole = PyString_FromString(role); + PyObject *pyresultRole = PyString_FromString(resultRole); + PyObject *pyprops = proplist2py(properties); + + call_py_provider((PyObject*)self->hdl, &status, "references", 6, + pyctx, + pyrslt, + pyobjName, + pyrole, + pyresultRole, + pyprops); +#endif + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("references() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +/***************************************************************************/ +CMPIStatus invokeMethod( + CMPIMethodMI* self, + const CMPIContext* ctx, + const CMPIResult* rslt, + const CMPIObjectPath* objName, + const char* method, + const CMPIArgs* in, + CMPIArgs* out) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("invokeMethod(Python) called, ctx %p, rslt %p, objName %p, method %s, in %p, out %p", ctx, rslt, objName, method, in, out)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyobjName = SWIG_NewPointerObj((void*) objName, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pymethod = PyString_FromString(method); + PyObject *pyin = SWIG_NewPointerObj((void*) in, SWIGTYPE_p__CMPIArgs, 0); + PyObject *pyout = SWIG_NewPointerObj((void*) out, SWIGTYPE_p__CMPIArgs, 0); + + call_py_provider((PyObject*)self->hdl, &status, "invokeMethod", 6, + pyctx, + pyrslt, + pyobjName, + pymethod, + pyin, + pyout); +#endif + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("invokeMethod() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +/***************************************************************************/ +CMPIStatus authorizeFilter( + CMPIIndicationMI* self, + const CMPIContext* ctx, + const CMPISelectExp* filter, + const char* className, + const CMPIObjectPath* classPath, + const char* owner) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("authorizeFilter(Python) called, ctx %p, filter %p, className %s, classPath %p, owner %s", ctx, filter, className, classPath, owner)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyfilter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + PyObject *pyclassPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyclassName = PyString_FromString(className); + PyObject *pyowner = PyString_FromString(owner); + + call_py_provider((PyObject*)self->hdl, &status, "authorizeFilter", 5, + pyctx, + pyfilter, + pyclassName, + pyclassPath, + pyowner); +#endif + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("authorizeFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +/***************************************************************************/ +CMPIStatus activateFilter( + CMPIIndicationMI* self, + const CMPIContext* ctx, + const CMPISelectExp* filter, + const char* className, + const CMPIObjectPath* classPath, + CMPIBoolean firstActivation) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("activateFilter(Python) called, ctx %p, filter %p, className %s, classPath %p, firstActivation %d", ctx, filter, className, classPath, firstActivation)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyfilter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + PyObject *pyclassPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyclassName = PyString_FromString(className); + PyObject *pyfirstActivation = PyBool_FromLong(firstActivation); + + call_py_provider((PyObject*)self->hdl, &status, "activateFilter", 5, + pyctx, + pyfilter, + pyclassName, + pyclassPath, + pyfirstActivation); +#endif + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("activateFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + +/***************************************************************************/ +CMPIStatus deActivateFilter( + CMPIIndicationMI* self, + const CMPIContext* ctx, + const CMPISelectExp* filter, + const char* className, + const CMPIObjectPath* classPath, + CMPIBoolean lastActivation) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("deActivateFilter(Python) called, ctx %p, filter %p, className %s, classPath %p, lastActivation %d", ctx, filter, className, classPath, lastActivation)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyfilter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + PyObject *pyclassPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyclassName = PyString_FromString(className); + PyObject *pylastActivation = PyBool_FromLong(lastActivation); + + call_py_provider((PyObject*)self->hdl, &status, "deActivateFilter", 5, + pyctx, + pyfilter, + pyclassName, + pyclassPath, + pylastActivation); +#endif + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("deActivateFilter() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +/***************************************************************************/ +CMPIStatus mustPoll( + CMPIIndicationMI* self, + const CMPIContext* ctx, + //const CMPIResult* rslt, TODO: figure out who is right: spec. vs. sblim + const CMPISelectExp* filter, + const char* className, + const CMPIObjectPath* classPath) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + +#ifdef SWIGPYTHON + //_SBLIM_TRACE(1,("mustPoll(Python) called, ctx %p, rslt %p, filter %p, className %s, classPath %p", ctx, rslt, filter, className, classPath)); + _SBLIM_TRACE(1,("mustPoll(Python) called, ctx %p, filter %p, className %s, classPath %p", ctx, filter, className, classPath)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + //PyObject *pyrslt = SWIG_NewPointerObj((void*) rslt, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyfilter = SWIG_NewPointerObj((void*) filter, SWIGTYPE_p__CMPISelectExp, 0); + PyObject *pyclassPath = SWIG_NewPointerObj((void*) classPath, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyclassName = PyString_FromString(className); + + call_py_provider((PyObject*)self->hdl, &status, "mustPoll", 5, + pyctx, + //pyrslt, + pyfilter, + pyclassName, + pyclassPath); +#endif + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("mustPoll() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; +} + + +/***************************************************************************/ +CMPIStatus enableIndications( + CMPIIndicationMI* self, + const CMPIContext* ctx) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("enableIndications(Python) called, ctx %p", ctx)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + + call_py_provider((PyObject*)self->hdl, &status, "enableIndications", 1, pyctx); +#endif + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("enableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; + +} + +/***************************************************************************/ +CMPIStatus disableIndications( + CMPIIndicationMI* self, + const CMPIContext* ctx) +{ + CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL}; + +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("disableIndications(Python) called, ctx %p", ctx)); + + PY_CMPI_INIT + + PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0); + + call_py_provider((PyObject*)self->hdl, &status, "disableIndications", 1, pyctx); +#endif + + /* Finished. */ +exit: + _SBLIM_TRACE(1,("disableIndications() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + return status; + +} + + +/***************************************************************************/ + + + + + + + + + +static CMPIMethodMIFT methodMIFT__={ + CMPICurrentVersion, + CMPICurrentVersion, + "methodCmpi_Swig", // miName + MethodCleanup, + invokeMethod, +}; + +CMPIMethodMI* _Generic_Create_MethodMI(const CMPIBroker* broker, + const CMPIContext* context, const char* miname, CMPIStatus* st) +{ + static CMPIMethodMI mi={ + NULL, + &methodMIFT__, + }; + _BROKER=broker; +#ifdef SWIGRUBY + //RBInitialize(&mi, st); +#endif + return &mi; +} + + +static CMPIIndicationMIFT indMIFT__={ + CMPICurrentVersion, + CMPICurrentVersion, + "indicationCmpi_Swig", // miName + IndicationCleanup, + authorizeFilter, + mustPoll, + activateFilter, + deActivateFilter, + enableIndications, + disableIndications, +}; + +CMPIIndicationMI* _Generic_Create_IndicationMI(const CMPIBroker* broker, + const CMPIContext* context, const char* miname, CMPIStatus* st) +{ + static CMPIIndicationMI mi={ + NULL, + &indMIFT__, + }; + _BROKER=broker; +#ifdef SWIGRUBY + //RBInitialize(&mi, st); +#endif + return &mi; +} + + + +static CMPIAssociationMIFT assocMIFT__={ + CMPICurrentVersion, + CMPICurrentVersion, + "instanceCmpi_Swig", // miName + AssocCleanup, + associators, + associatorNames, + references, + referenceNames, +}; + +CMPIAssociationMI* _Generic_Create_AssociationMI(const CMPIBroker* broker, + const CMPIContext* context, const char* miname, CMPIStatus* st) +{ + static CMPIAssociationMI mi={ + NULL, + &assocMIFT__, + }; + _BROKER=broker; +#ifdef SWIGRUBY + //RBInitialize(&mi, st); +#endif + return &mi; +} + + static CMPIInstanceMIFT instMIFT__={ CMPICurrentVersion, CMPICurrentVersion, - "instanceCmpi_Swig", // miName - Cleanup, + "associatorCmpi_Swig", // miName + InstCleanup, EnumInstanceNames, EnumInstances, GetInstance, @@ -785,7 +1330,10 @@ NULL, &instMIFT__, }; - _BROKER=broker; + _BROKER=broker; +#ifdef SWIGRUBY + RBInitialize(&mi, st); +#endif return &mi; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-06-10 23:11:39
|
Revision: 640 http://omc.svn.sourceforge.net/omc/?rev=640&view=rev Author: bartw Date: 2008-06-10 16:11:39 -0700 (Tue, 10 Jun 2008) Log Message: ----------- more work on the python side of things Modified Paths: -------------- cmpi-bindings/src/cmpi_instance.c cmpi-bindings/swig/python/pycmpi_instance.py Modified: cmpi-bindings/src/cmpi_instance.c =================================================================== --- cmpi-bindings/src/cmpi_instance.c 2008-06-10 19:30:17 UTC (rev 639) +++ cmpi-bindings/src/cmpi_instance.c 2008-06-10 23:11:39 UTC (rev 640) @@ -1,5 +1,5 @@ // ============================================================================ -// (C) Copyright IBM Corp. 2005 +// (C) Copyright Novell Inc. 2008 // // THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE // ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE @@ -8,40 +8,7 @@ // You can obtain a current copy of the Common Public License from // http://www.opensource.org/licenses/cpl1.0.php // -// Author: Dr. Gareth S. Bestor, <bes...@us...> -// Contributors: -// Last Updated: October 23, 2005 -// Description: -// CMPI sample process instance provider. -// This is an example CMPI instance provider that exposes basic system -// process data (PID, TTY, time & command). -// -// The following CMPI instance methods are supported: -// - EnumerateInstancesNames() -// Returns PID of all processes -// - EnumerateInstances() -// Returns PID, TTY, time & command of all processes -// - GetInstance() -// Returns PID, TTY, time & command of desired processes -// - DeleteInstance() -// Kills the desired process -// -// The following CMPI methods are NOT supported or do nothing: -// - SetInstance() -// - CreateInstance() -// - ExecQuery() -// - Cleanup() -// - Initialize() **NOTE: THIS IS NOT A PREDEFINED CMPI METHOD** -// -// ============================================================================ -// THIS FILE CAN BE USED AS A TEMPLATE FOR WRITING CMPI INSTANCE PROVIDERS. -// MUCH OF THE CODE IS NOT CLASS DEPENDENT AND CAN BE REUSED/ADAPTED. -// CHANGE THE RELEVANT SECTIONS OF EACH OF THE PRIMARY INSTANCE METHOD -// FUNCTIONS TO PERFORM THE OPERATIONS TO GET/SET INSTANCE DATA FOR YOUR CLASS. -// ============================================================================ -/* Classname implemented by this provider */ -// CHANGE THIS TO YOUR PROVIDER'S CLASSNAME #ifdef SWIGRUBY static char _CLASSNAME[] = "CmpiInstanceRuby"; #endif @@ -50,6 +17,7 @@ #endif #include <stdio.h> +#include <stdarg.h> /* Include the required CMPI macros, data types, and API function headers */ #include <cmpidt.h> @@ -73,7 +41,6 @@ /* A simple stderr logging/tracing facility. */ #ifndef _SBLIM_TRACE -#include <stdarg.h> #define _SBLIM_TRACE(tracelevel,args) _logstderr args void _logstderr(char *fmt,...) { @@ -85,6 +52,31 @@ } #endif +/* Global handle to the CIM broker. This is initialized by the CIMOM when the provider is loaded */ +static const CMPIBroker * _BROKER; + +static char* fmtstr(const char* fmt, ...) +{ + va_list ap; + int len; + len = vsnprintf(NULL, 0, fmt, ap); + if (len <= 0) + { + return NULL; + } + char* str = (char*)malloc(len+1); + if (str == NULL) + { + return NULL; + } + va_start(ap, fmt); + vsnprintf(str, len+1, fmt, ap); + va_end(ap); + return str; +} + +static int Initialize(CMPIInstanceMI * self, CMPIStatus* st); + #ifdef SWIGRUBY static VALUE properties2ruby( const char ** properties ) @@ -99,10 +91,180 @@ } #endif -/* Global handle to the CIM broker. This is initialized by the CIMOM when the provider is loaded */ -static const CMPIBroker * _BROKER; +#ifdef SWIGPYTHON +static PyObject* proplist2py(const char** cplist) +{ + if (cplist == NULL) + { + Py_IncRef(Py_None); // TODO: make sure we need this incref. + return Py_None; + } + PyObject* pl = PyList_New(0); + for (; *cplist != NULL; ++cplist) + { + PyList_Append(pl, PyString_FromString(*cplist)); + } + return pl; +} +#define TB_ERROR(str) {tbstr = str; goto cleanup;} +static CMPIString* get_exc_trace() +{ + char *tbstr = NULL; + PyObject *iostrmod = NULL; + PyObject *tbmod = NULL; + PyObject *iostr = NULL; + PyObject *obstr = NULL; + + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + PyErr_Clear(); + PyErr_NormalizeException(&type, &value, &traceback); + + iostrmod = PyImport_ImportModule("StringIO"); + if (iostrmod==NULL) + TB_ERROR("can't import StringIO"); + + iostr = PyObject_CallMethod(iostrmod, "StringIO", NULL); + + if (iostr==NULL) + TB_ERROR("cStringIO.StringIO() failed"); + + tbmod = PyImport_ImportModule("traceback"); + if (tbmod==NULL) + TB_ERROR("can't import traceback"); + + obstr = PyObject_CallMethod(tbmod, "print_exception", + "(OOOOO)", + type, value ? value : Py_None, + traceback ? traceback : Py_None, + Py_None, + iostr); + + if (obstr==NULL) + TB_ERROR("traceback.print_exception() failed"); + + Py_DecRef(obstr); + + obstr = PyObject_CallMethod(iostr, "getvalue", NULL); + if (obstr==NULL) + TB_ERROR("getvalue() failed."); + + if (!PyString_Check(obstr)) + TB_ERROR("getvalue() did not return a string"); + + tbstr = PyString_AsString(obstr); + +cleanup: + PyErr_Restore(type, value, traceback); + + CMPIString* rv; + if (tbstr != NULL) + { + rv = _BROKER->eft->newString(_BROKER, tbstr, NULL); + } + else + { + rv = _BROKER->eft->newString(_BROKER, "", NULL); + } + + Py_DecRef(iostr); + Py_DecRef(obstr); + Py_DecRef(iostrmod); + Py_DecRef(tbmod); + return rv; +} + + +static int +call_py_provider(PyObject* hdl, CMPIStatus* st, + const char* opname, int nargs, ...) +{ + int rc = 1; + va_list vargs; + PyObject *pyargs = NULL; + PyObject *pyfunc = NULL; + PyObject *prv = NULL; + pyargs = PyTuple_New(nargs); + pyfunc = PyObject_GetAttrString(hdl, opname); + if (pyfunc == NULL) + { + PyErr_Clear(); + char* str = fmtstr("Python module does not contain \"%s\"", opname); + _SBLIM_TRACE(1,(str)); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = _BROKER->eft->newString(_BROKER, str, NULL); + free(str); + rc = 1; + goto cleanup; + } + if (! PyCallable_Check(pyfunc)) + { + char* str = fmtstr("Python module attribute \"%s\" is not callable", + opname); + _SBLIM_TRACE(1,(str)); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = _BROKER->eft->newString(_BROKER, str, NULL); + free(str); + rc = 1; + goto cleanup; + } + + va_start(vargs, nargs); + int i; + for (i = 0; i < nargs; ++i) + { + PyObject* arg = va_arg(vargs, PyObject*); + PyTuple_SET_ITEM(pyargs, i, arg); + } + va_end(vargs); + prv = PyObject_CallObject(pyfunc, pyargs); + if (PyErr_Occurred()) + { + st->rc = CMPI_RC_ERR_FAILED; + st->msg = get_exc_trace(); + PyErr_Clear(); + rc = 1; + goto cleanup; + } + + if (! PyTuple_Check(prv) || PyTuple_Size(prv) != 2) + { + char* str = fmtstr("Python function \"%s\" didn't return a two-tuple", + opname); + _SBLIM_TRACE(1,(str)); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = _BROKER->eft->newString(_BROKER, str, NULL); + free(str); + rc = 1; + goto cleanup; + } + PyObject* prc = PyTuple_GetItem(prv, 0); + PyObject* prstr = PyTuple_GetItem(prv, 1); + if (! PyInt_Check(prc) || ! PyString_Check(prstr)) + { + char* str = fmtstr("Python function \"%s\" didn't return a {<int>, <str>) two-tuple", opname); + _SBLIM_TRACE(1,(str)); + st->rc = CMPI_RC_ERR_FAILED; + st->msg = _BROKER->eft->newString(_BROKER, str, NULL); + free(str); + rc = 1; + goto cleanup; + } + long pi = PyInt_AsLong(prc); + st->rc = (CMPIrc)pi; + st->msg = _BROKER->eft->newString(_BROKER, PyString_AsString(prstr), NULL); + rc = pi != 0; +cleanup: + Py_DecRef(pyargs); + Py_DecRef(pyfunc); + Py_DecRef(prv); + return rc; +} +#endif + + // ---------------------------------------------------------------------------- // CMPI INSTANCE PROVIDER FUNCTIONS // ---------------------------------------------------------------------------- @@ -162,30 +324,17 @@ #endif #ifdef SWIGPYTHON _SBLIM_TRACE(1,("EnumInstancesNames(Python) called, context %p, result %p, reference %p", context, result, reference)); - PyObject *klass = (PyObject *)self->hdl; + + if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); PyObject *pyresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pyfunc = PyObject_GetAttrString(klass, "enumInstanceNames"); - if (pyfunc && PyCallable_Check(pyfunc)) - { - PyObject *pyargs = PyTuple_New(3); - PyTuple_SetItem(pyargs, 0, pycontext); - PyTuple_SetItem(pyargs, 1, pyresult); - PyTuple_SetItem(pyargs, 2, pyreference); - PyObject* pValue = PyObject_CallObject(pyfunc, pyargs); - Py_DECREF(pyargs); - // TODO: check pValue and DECREF - } - else - { - // TODO: - } - /* - * PyObject * arglist = Py_BuildValue( "(OOOO)", pycontext, pyresult, pyreference, pyproperties ); - * PyEval_CallObject( klass.EnumInstances, arglist ) - */ + call_py_provider((PyObject*)self->hdl, &status, "enumInstanceNames", 3, + pycontext, + pyresult, + pyreference); #endif exit: @@ -199,7 +348,7 @@ /* EnumInstances() - return a list of all the instances (i.e. return all the instance data) */ static CMPIStatus EnumInstances( - CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ + CMPIInstanceMI * self, /* [in] Handle to this provider (i.e. 'self') */ const CMPIContext * context, /* [in] Additional context info, if any */ const CMPIResult * result, /* [in] Contains the CIM namespace and classname */ const CMPIObjectPath * reference, /* [in] Contains the CIM namespace and classname */ @@ -221,15 +370,19 @@ #endif #ifdef SWIGPYTHON _SBLIM_TRACE(1,("EnumInstances(Python) called, context %p, result %p, reference %p, properties %p", context, result, reference, properties)); - PyObject *klass = (PyObject *)self->hdl; + + if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); PyObject *pyresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); - PyObject *pyproperties = NULL; /* FIXME: convert char** to python array */ - /* - * PyObject * arglist = Py_BuildValue( "(OOOO)", pycontext, pyresult, pyreference, pyproperties ); - * PyEval_CallObject( klass.EnumInstances, arglist ) - */ + PyObject *pyproperties = proplist2py(properties); + + call_py_provider((PyObject*)self->hdl, &status, "enumInstances", 4, + pycontext, + pyresult, + pyreference, + pyproperties); #endif exit: @@ -261,12 +414,24 @@ /* get_instance instead of GetInstance to follow Ruby naming convention */ VALUE r = rb_funcall( klass, rb_intern( "get_instance" ), 4, rcontext, rresults, rreference, rproperties ); _SBLIM_TRACE(1,("r %p", r)); -#else - _SBLIM_TRACE(1,("GetInstance() called")); - /* Finished */ - CMReturnDone(results); #endif +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("GetInstance(Python) called, context %p, results %p, reference %p, properties %p", context, results, reference, properties)); + if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyproperties = proplist2py(properties); + + call_py_provider((PyObject*)self->hdl, &status, "getInstance", 4, + pycontext, + pyresult, + pyreference, + pyproperties); +#endif + exit: _SBLIM_TRACE(1,("GetInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); return status; @@ -298,10 +463,24 @@ /* create_instance instead of CreateInstance to follow Ruby naming convention */ VALUE r = rb_funcall( klass, rb_intern( "create_instance" ), 4, rcontext, rresults, rreference, rinstance ); _SBLIM_TRACE(1,("r %p", r)); -#else - _SBLIM_TRACE(1,("CreateInstance() called")); #endif +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("CreateInstance(Python) called, context %p, results %p, reference %p, newinstance %p", context, results, reference, newinstance)); + if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pynewinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); + + call_py_provider((PyObject*)self->hdl, &status, "createInstance", 4, + pycontext, + pyresult, + pyreference, + pynewinst); +#endif + /* Finished. */ exit: _SBLIM_TRACE(1,("CreateInstance() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); @@ -339,9 +518,25 @@ /* set_instance instead of SetInstance to follow Ruby naming convention */ VALUE r = rb_funcall( klass, rb_intern( "set_instance" ), 5, rcontext, rresults, rreference, rinstance, rproperties ); _SBLIM_TRACE(1,("r %p", r)); -#else - _SBLIM_TRACE(1,("SetInstance() called")); #endif +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("SetInstance(Python) called, context %p, results %p, reference %p, newinstance %p, properties %p", context, results, reference, newinstance, properties)); + + if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pynewinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0); + PyObject *plist = proplist2py(properties); + + call_py_provider((PyObject*)self->hdl, &status, "setInstance", 5, + pycontext, + pyresult, + pyreference, + pynewinst, + plist); +#endif /* Finished. */ exit: @@ -370,9 +565,21 @@ /* delete_instance instead of DeleteInstance to follow Ruby naming convention */ VALUE r = rb_funcall( klass, rb_intern( "delete_instance" ), 3, rcontext, rresults, rreference ); _SBLIM_TRACE(1,("r %p", r)); -#else - _SBLIM_TRACE(1,("DeleteInstance() called")); #endif +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("DeleteInstance(Python) called, context %p, results %p, reference %p", context, results, reference)); + + if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + + call_py_provider((PyObject*)self->hdl, &status, "deleteInstance", 3, + pycontext, + pyresult, + pyreference); +#endif /* Finished. */ exit: @@ -405,10 +612,26 @@ /* exec_query instead of ExecQuery to follow Ruby naming convention */ VALUE r = rb_funcall( klass, rb_intern( "exec_query" ), 5, rcontext, rresults, rreference, query, language ); _SBLIM_TRACE(1,("r %p", r)); -#else - _SBLIM_TRACE(1,("ExecQuery() called")); #endif +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("ExecQuery(Python) called, context %p, results %p, reference %p, query %s, language %s", context, results, reference, query, language)); + if (self->hdl == NULL) if (Initialize(self, &status) != 0) return status; + + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) results, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyquery = PyString_FromString(query); + PyObject *pylang = PyString_FromString(language); + + call_py_provider((PyObject*)self->hdl, &status, "deleteInstance", 5, + pycontext, + pyresult, + pyreference, + pyquery, + pylang); +#endif + /* Query filtering is not supported for this class. */ /* Finished. */ @@ -441,10 +664,15 @@ #endif /* Initialize() - perform any necessary initialization immediately after this provider is loaded. */ -static void Initialize( - CMPIInstanceMI * self) /* [in] Handle to this provider (i.e. 'self'). */ +static int Initialize( + CMPIInstanceMI * self, CMPIStatus* st) /* [in] Handle to this provider (i.e. 'self'). */ { - CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */ + int rc = 0; + if (st != NULL) + { + st->rc = CMPI_RC_OK; + st->msg = NULL; + } #ifdef SWIGRUBY int error = 0; VALUE cmpiInstance; @@ -462,8 +690,11 @@ rb_protect(load_code, Qnil, &error); if (error) { - _SBLIM_TRACE(1,("Ruby: FAILED loading rcmpi_instance.rb")); - status.rc = CMPI_RC_ERR_NOT_FOUND; + _SBLIM_TRACE(1,("Ruby: FAILED loading rcmpi_instance.rb")); + if (st != NULL) + { + st->rc = CMPI_RC_ERR_FAILED; + } } else { _SBLIM_TRACE(1,("Ruby: loaded rcmpi_instance.rb")); @@ -472,7 +703,10 @@ cmpiInstance = rb_protect(create_cmpi, (VALUE)args, &error); if (error) { _SBLIM_TRACE(1,("Ruby: FAILED creating Cmpi")); - status.rc = CMPI_RC_ERR_INVALID_CLASS; + if (st != NULL) + { + st->rc = CMPI_RC_ERR_FAILED; + } } else { _SBLIM_TRACE(1,("Ruby: cmpi at %p", cmpiInstance)); @@ -490,77 +724,68 @@ /* 'import cmpi;' */ PyObject *name = PyString_FromString("cmpi"); PyObject *cmpiModule = PyImport_Import(name); - Py_DECREF(name); + Py_DecRef(name); if (cmpiModule) { /* 'import pycmpi_instance;' */ name = PyString_FromString("pycmpi_instance"); PyObject *instanceModule = PyImport_Import(name); - Py_DECREF(name); + Py_DecRef(name); if (instanceModule) { _SBLIM_TRACE(1,("Python: instanceModule at %p", instanceModule)); self->hdl = instanceModule; - /* - * FIXME - * - * pycmpi_instance.py defines a class 'Cmpi_Instance' - * we now have to create an instance of this class - * and store it as self->hdl - */ - /* probably something like - PyObject *cmpi_instance = Py_CreateInstance( instanceModule, "Cmpi_Instance" ) - if (cmpi_instance) - self->hdl = (void *)cmpi_instance; - else { - _SBLIM_TRACE(1,("Ruby: FAILED creating Cmpi")); - status.rc = CMPI_RC_ERR_INVALID_CLASS; - } - */ } else { _SBLIM_TRACE(1,("Python: FAILED loading pycmpi_instance.py")); - status.rc = CMPI_RC_ERR_NOT_FOUND; + rc = -1; + if (st != NULL) + { + st->rc = CMPI_RC_ERR_FAILED; + st->msg = get_exc_trace(); + } + PyErr_Clear(); } } else { - _SBLIM_TRACE(1,("Python: FAILED loading cmpi.py")); - status.rc = CMPI_RC_ERR_NOT_FOUND; + if (st != NULL) + _SBLIM_TRACE(1,("Python: FAILED loading cmpi.py")); + { + rc = -1; + st->rc = CMPI_RC_ERR_FAILED; + st->msg = get_exc_trace(); + } + PyErr_Clear(); } #endif /* Finished. */ exit: - _SBLIM_TRACE(1,("Initialize() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); + _SBLIM_TRACE(1,("Initialize() %s", (rc == 0)? "succeeded":"failed")); + return rc; } -// ---------------------------------------------------------------------------- -// SETUP CMPI INSTANCE PROVIDER FUNCTION TABLE -// ---------------------------------------------------------------------------- -/* Factory method that creates the handle to this provider, specifically - setting up the instance provider function table: - - 1st param is an optional prefix for the function names in the table. - It is blank in this sample provider because the instance provider - function names do not need a unique prefix. - - 2nd param is the name to call this provider within the CIMOM. It is - recommended to call providers "<_CLASSNAME>Provider". This name must be - unique among all providers. Make sure to use the same name when - registering the provider with the hosting CIMOM. - - 3rd param is the local static variable acting as a handle to the CIMOM. - This will be initialized by the CIMOM when the provider is loaded. - - 4th param specifies the provider's initialization function to be called - immediately after loading the provider. Specify "CMNoHook" if no special - initialization routine is required. -*/ -/* - pfx##Cleanup, \ - pfx##EnumInstanceNames, \ - pfx##EnumInstances, \ - pfx##GetInstance, \ - pfx##CreateInstance, \ - CMInstanceMIStubChange(pfx), \ - pfx##DeleteInstance, \ - pfx##ExecQuery, \ -*/ +static CMPIInstanceMIFT instMIFT__={ + CMPICurrentVersion, + CMPICurrentVersion, + "instanceCmpi_Swig", // miName + Cleanup, + EnumInstanceNames, + EnumInstances, + GetInstance, + CreateInstance, + SetInstance, + DeleteInstance, + ExecQuery, +}; -// CHANGE THE 2ND PARAM TO THE NAME OF YOUR PROVIDER -CMInstanceMIStub( , Cmpi_Swig, _BROKER, Initialize(&mi)); +CMPIInstanceMI* _Generic_Create_InstanceMI(const CMPIBroker* broker, + const CMPIContext* context, const char* miname, CMPIStatus* st) +{ + static CMPIInstanceMI mi={ + NULL, + &instMIFT__, + }; + _BROKER=broker; + return &mi; +} + Modified: cmpi-bindings/swig/python/pycmpi_instance.py =================================================================== --- cmpi-bindings/swig/python/pycmpi_instance.py 2008-06-10 19:30:17 UTC (rev 639) +++ cmpi-bindings/swig/python/pycmpi_instance.py 2008-06-10 23:11:39 UTC (rev 640) @@ -1,11 +1,12 @@ import cmpi import sys import traceback +#import cStringIO print "Hello, from pycmpi_instance.py" def enumInstanceNames(context, result, reference): - try: + #try: print 'provider.py: In enumInstanceNames()' print 'namespace: %s, classname: %s' % (reference.namespace(), reference.classname()) print dir(context) @@ -21,10 +22,40 @@ op.add_key('hello', cv, cmpi.CMPI_string) result.return_objectpath(op) result.done() - except: - print sys.exc_info() - traceback.print_tb(sys.exc_info()[2]) - raise + return (0, 'My String') + #except: + #print sys.exc_info() + #traceback.print_tb(sys.exc_info()[2]) + #raise +def enumInstances(context, result, reference, plist): + #try: + print 'provider.py: In enumInstanceNames()' + print 'namespace: %s, classname: %s' % (reference.namespace(), reference.classname()) + print dir(context) + print dir(result) + print dir(reference) + print 'plist:', plist + op = cmpi.CMPIObjectPath(reference.namespace()) + op.set_classname('Cmpi_Swig') + cv = cmpi.CMPIValue() + cv.string = cmpi.CMPIString('Hello') + op.add_key('hello', cv, cmpi.CMPI_string) + inst = cmpi.CMPIInstance(op) + inst.set_property('hello', cv, cmpi.CMPI_string) + + result.return_instance(inst) + cv.string = cmpi.CMPIString('World') + op.add_key('hello', cv, cmpi.CMPI_string) + inst = cmpi.CMPIInstance(op) + inst.set_property('hello', cv, cmpi.CMPI_string) + result.return_instance(inst) + result.done() + return (0, 'My String') + #except: + #print sys.exc_info() + #traceback.print_tb(sys.exc_info()[2]) + #raise + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-06-10 19:30:15
|
Revision: 639 http://omc.svn.sourceforge.net/omc/?rev=639&view=rev Author: kkaempf Date: 2008-06-10 12:30:17 -0700 (Tue, 10 Jun 2008) Log Message: ----------- - fix cmake2.6 warning - make cmake targets unique - generate Ruby and Python bindings with different names - provide .reg and .mof files for Python and Ruby Modified Paths: -------------- cmpi-bindings/CMakeLists.txt cmpi-bindings/src/cmpi_instance.c cmpi-bindings/swig/python/CMakeLists.txt cmpi-bindings/swig/ruby/CMakeLists.txt Added Paths: ----------- cmpi-bindings/mof/Python_Example.mof cmpi-bindings/mof/Python_Example.reg cmpi-bindings/mof/Ruby_Example.mof cmpi-bindings/mof/Ruby_Example.reg Modified: cmpi-bindings/CMakeLists.txt =================================================================== --- cmpi-bindings/CMakeLists.txt 2008-06-07 05:39:53 UTC (rev 638) +++ cmpi-bindings/CMakeLists.txt 2008-06-10 19:30:17 UTC (rev 639) @@ -1,4 +1,16 @@ +# +# CMakeLists.txt for cmpi-bindings +# +cmake_minimum_required(VERSION 2.4) + +# +# cmake2.6: backward compatibility to cmake 2.4 +# +if(COMMAND cmake_policy) + cmake_policy(SET CMP0003 OLD) +endif(COMMAND cmake_policy) + # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked #SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) #SET(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules ${CMAKE_MODULE_PATH}) Added: cmpi-bindings/mof/Python_Example.mof =================================================================== --- cmpi-bindings/mof/Python_Example.mof (rev 0) +++ cmpi-bindings/mof/Python_Example.mof 2008-06-10 19:30:17 UTC (rev 639) @@ -0,0 +1,44 @@ +// +// Python_Example.mof +// +// (C) Copyright SUSE Linux Products GmbH 2008 +// +// THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE +// ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE +// CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. +// +// You can obtain a current copy of the Common Public License from +// http://www.opensource.org/licenses/cpl1.0.txt +// +// Author: Klaus Kaempf <kk...@su...> +// Contributors: +// +// Description: +// CIM classes for SWIG/CMPI +// + + +#pragma locale ("en_US") +//#pragma namespace ("root/cimv2") + + +// ------------------------------------------------------------------- +// ******************************************************************* +// Classes +// ******************************************************************* +// ------------------------------------------------------------------- + + + +// =================================================================== +// Python_Example +// =================================================================== + +[ Provider("cmpi:cmpi_swig_python"), + Description ("A sample class to demonstrate cmpi/swig Python bindings" ) +] +class Python_Example : CIM_ManagedElement +{ + [Description ("A friendly greeting from Python") ] + string hello; +}; Added: cmpi-bindings/mof/Python_Example.reg =================================================================== --- cmpi-bindings/mof/Python_Example.reg (rev 0) +++ cmpi-bindings/mof/Python_Example.reg 2008-06-10 19:30:17 UTC (rev 639) @@ -0,0 +1,5 @@ +[Python_Example] + provider: CmpiInstancePython + location: pyCmpiInstance + type: instance + namespace: root/cimv2 Added: cmpi-bindings/mof/Ruby_Example.mof =================================================================== --- cmpi-bindings/mof/Ruby_Example.mof (rev 0) +++ cmpi-bindings/mof/Ruby_Example.mof 2008-06-10 19:30:17 UTC (rev 639) @@ -0,0 +1,44 @@ +// +// Ruby_Example.mof +// +// (C) Copyright SUSE Linux Products GmbH 2008 +// +// THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE +// ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE +// CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. +// +// You can obtain a current copy of the Common Public License from +// http://www.opensource.org/licenses/cpl1.0.txt +// +// Author: Klaus Kaempf <kk...@su...> +// Contributors: +// +// Description: +// CIM classes for SWIG/CMPI +// + + +#pragma locale ("en_US") +//#pragma namespace ("root/cimv2") + + +// ------------------------------------------------------------------- +// ******************************************************************* +// Classes +// ******************************************************************* +// ------------------------------------------------------------------- + + + +// =================================================================== +// Ruby_Example +// =================================================================== + +[ Provider("cmpi:cmpi_swig"), + Description ("A sample class to demonstrate cmpi/swig Ruby bindings" ) +] +class Ruby_Example : CIM_ManagedElement +{ + [Description ("A friendly greeting from Ruby") ] + string hello; +}; Added: cmpi-bindings/mof/Ruby_Example.reg =================================================================== --- cmpi-bindings/mof/Ruby_Example.reg (rev 0) +++ cmpi-bindings/mof/Ruby_Example.reg 2008-06-10 19:30:17 UTC (rev 639) @@ -0,0 +1,5 @@ +[Ruby_Example] + provider: CmpiInstanceRuby + location: rbCmpiInstance + type: instance + namespace: root/cimv2 Modified: cmpi-bindings/src/cmpi_instance.c =================================================================== --- cmpi-bindings/src/cmpi_instance.c 2008-06-07 05:39:53 UTC (rev 638) +++ cmpi-bindings/src/cmpi_instance.c 2008-06-10 19:30:17 UTC (rev 639) @@ -42,7 +42,12 @@ /* Classname implemented by this provider */ // CHANGE THIS TO YOUR PROVIDER'S CLASSNAME -static char _CLASSNAME[] = "Cmpi_Swig"; +#ifdef SWIGRUBY +static char _CLASSNAME[] = "CmpiInstanceRuby"; +#endif +#ifdef SWIGPYTHON +static char _CLASSNAME[] = "CmpiInstanceSwig"; +#endif #include <stdio.h> Modified: cmpi-bindings/swig/python/CMakeLists.txt =================================================================== --- cmpi-bindings/swig/python/CMakeLists.txt 2008-06-07 05:39:53 UTC (rev 638) +++ cmpi-bindings/swig/python/CMakeLists.txt 2008-06-10 19:30:17 UTC (rev 639) @@ -30,8 +30,6 @@ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../../src/*.c ) -ADD_CUSTOM_TARGET( glue DEPENDS ${SWIG_OUTPUT} ) - SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -g" ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/.. ) @@ -44,9 +42,8 @@ # cmpi_instance: provider .so # -SET( NAME cmpiInstance ) +SET( NAME pyCmpiInstance ) ADD_LIBRARY( ${NAME} SHARED ${SWIG_OUTPUT}) -ADD_DEPENDENCIES( ${NAME} glue ) TARGET_LINK_LIBRARIES( ${NAME} ${PYTHON_LIBRARIES} ) TARGET_LINK_LIBRARIES( ${NAME} m ) TARGET_LINK_LIBRARIES( ${NAME} util ) Modified: cmpi-bindings/swig/ruby/CMakeLists.txt =================================================================== --- cmpi-bindings/swig/ruby/CMakeLists.txt 2008-06-07 05:39:53 UTC (rev 638) +++ cmpi-bindings/swig/ruby/CMakeLists.txt 2008-06-10 19:30:17 UTC (rev 639) @@ -24,7 +24,6 @@ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../../src/*.c ) -ADD_CUSTOM_TARGET( glue DEPENDS ${SWIG_OUTPUT} ) SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -g" ) @@ -40,9 +39,8 @@ # cmpi_instance: provider .so # -SET( NAME cmpiInstance ) +SET( NAME rbCmpiInstance ) ADD_LIBRARY( ${NAME} SHARED ${SWIG_OUTPUT}) -ADD_DEPENDENCIES( ${NAME} glue ) TARGET_LINK_LIBRARIES( ${NAME} ${RUBY_LIBRARY} ) INSTALL(TARGETS ${NAME} LIBRARY DESTINATION ${CMPI_LIBRARY_DIR}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-06-07 05:39:45
|
Revision: 638 http://omc.svn.sourceforge.net/omc/?rev=638&view=rev Author: bartw Date: 2008-06-06 22:39:53 -0700 (Fri, 06 Jun 2008) Log Message: ----------- prototype python provider working. Modified Paths: -------------- cmpi-bindings/swig/python/pycmpi_instance.py Modified: cmpi-bindings/swig/python/pycmpi_instance.py =================================================================== --- cmpi-bindings/swig/python/pycmpi_instance.py 2008-06-06 17:48:27 UTC (rev 637) +++ cmpi-bindings/swig/python/pycmpi_instance.py 2008-06-07 05:39:53 UTC (rev 638) @@ -1,12 +1,30 @@ -# -# -# +import cmpi +import sys +import traceback + print "Hello, from pycmpi_instance.py" def enumInstanceNames(context, result, reference): - print 'provider.py: In enumInstanceNames()' - print 'namespace: %s, classname: %s' % (reference.namespace(), reference.classname()) - print dir(context) - print dir(result) - print dir(reference) + try: + print 'provider.py: In enumInstanceNames()' + print 'namespace: %s, classname: %s' % (reference.namespace(), reference.classname()) + print dir(context) + print dir(result) + print dir(reference) + op = cmpi.CMPIObjectPath(reference.namespace()) + op.set_classname('Cmpi_Swig') + cv = cmpi.CMPIValue() + cv.string = cmpi.CMPIString('Hello') + op.add_key('hello', cv, cmpi.CMPI_string) + result.return_objectpath(op) + cv.string = cmpi.CMPIString('World') + op.add_key('hello', cv, cmpi.CMPI_string) + result.return_objectpath(op) + result.done() + except: + print sys.exc_info() + traceback.print_tb(sys.exc_info()[2]) + raise + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-06-06 17:48:23
|
Revision: 637 http://omc.svn.sourceforge.net/omc/?rev=637&view=rev Author: bartw Date: 2008-06-06 10:48:27 -0700 (Fri, 06 Jun 2008) Log Message: ----------- fixed it to at least call into the python provider module Modified Paths: -------------- cmpi-bindings/src/cmpi_instance.c cmpi-bindings/swig/CMakeLists.txt cmpi-bindings/swig/python/CMakeLists.txt cmpi-bindings/swig/python/pycmpi_instance.py Modified: cmpi-bindings/src/cmpi_instance.c =================================================================== --- cmpi-bindings/src/cmpi_instance.c 2008-06-06 10:22:47 UTC (rev 636) +++ cmpi-bindings/src/cmpi_instance.c 2008-06-06 17:48:27 UTC (rev 637) @@ -155,7 +155,34 @@ VALUE r = rb_funcall( klass, rb_intern( "enum_instance_names" ), 3, rcontext, rresult, rreference ); _SBLIM_TRACE(1,("r %p", r)); #endif +#ifdef SWIGPYTHON + _SBLIM_TRACE(1,("EnumInstancesNames(Python) called, context %p, result %p, reference %p", context, result, reference)); + PyObject *klass = (PyObject *)self->hdl; + PyObject *pycontext = SWIG_NewPointerObj((void*) context, SWIGTYPE_p__CMPIContext, 0); + PyObject *pyresult = SWIG_NewPointerObj((void*) result, SWIGTYPE_p__CMPIResult, 0); + PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0); + PyObject *pyfunc = PyObject_GetAttrString(klass, "enumInstanceNames"); + if (pyfunc && PyCallable_Check(pyfunc)) + { + PyObject *pyargs = PyTuple_New(3); + PyTuple_SetItem(pyargs, 0, pycontext); + PyTuple_SetItem(pyargs, 1, pyresult); + PyTuple_SetItem(pyargs, 2, pyreference); + PyObject* pValue = PyObject_CallObject(pyfunc, pyargs); + Py_DECREF(pyargs); + // TODO: check pValue and DECREF + } + else + { + // TODO: + } + /* + * PyObject * arglist = Py_BuildValue( "(OOOO)", pycontext, pyresult, pyreference, pyproperties ); + * PyEval_CallObject( klass.EnumInstances, arglist ) + */ +#endif + exit: _SBLIM_TRACE(1,("EnumInstanceNames() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed")); return status; @@ -466,6 +493,7 @@ Py_DECREF(name); if (instanceModule) { _SBLIM_TRACE(1,("Python: instanceModule at %p", instanceModule)); + self->hdl = instanceModule; /* * FIXME * Modified: cmpi-bindings/swig/CMakeLists.txt =================================================================== --- cmpi-bindings/swig/CMakeLists.txt 2008-06-06 10:22:47 UTC (rev 636) +++ cmpi-bindings/swig/CMakeLists.txt 2008-06-06 17:48:27 UTC (rev 637) @@ -10,6 +10,6 @@ FIND_PACKAGE(PythonLibs) IF (PYTHON_LIBRARY) -# MESSAGE(STATUS "Building Python...") -# ADD_SUBDIRECTORY(python) + MESSAGE(STATUS "Building Python...") + ADD_SUBDIRECTORY(python) ENDIF (PYTHON_LIBRARY) Modified: cmpi-bindings/swig/python/CMakeLists.txt =================================================================== --- cmpi-bindings/swig/python/CMakeLists.txt 2008-06-06 10:22:47 UTC (rev 636) +++ cmpi-bindings/swig/python/CMakeLists.txt 2008-06-06 17:48:27 UTC (rev 637) @@ -17,7 +17,7 @@ SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmpi_wrap.c" ) SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/../cmpi.i" ) -SET( CMPI_INCLUDE_DIR /usr/include/cmpi ) +SET( CMPI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include/cmpi ) SET( CMPI_LIBRARY_DIR /usr/lib/cmpi ) ADD_CUSTOM_COMMAND ( Modified: cmpi-bindings/swig/python/pycmpi_instance.py =================================================================== --- cmpi-bindings/swig/python/pycmpi_instance.py 2008-06-06 10:22:47 UTC (rev 636) +++ cmpi-bindings/swig/python/pycmpi_instance.py 2008-06-06 17:48:27 UTC (rev 637) @@ -3,4 +3,10 @@ # print "Hello, from pycmpi_instance.py" -return 0 +def enumInstanceNames(context, result, reference): + print 'provider.py: In enumInstanceNames()' + print 'namespace: %s, classname: %s' % (reference.namespace(), reference.classname()) + print dir(context) + print dir(result) + print dir(reference) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-06-06 10:22:45
|
Revision: 636 http://omc.svn.sourceforge.net/omc/?rev=636&view=rev Author: kkaempf Date: 2008-06-06 03:22:47 -0700 (Fri, 06 Jun 2008) Log Message: ----------- This is a generic CMPI provider interface based on SWIG. It allows writing CIM Providers exposing a CMPI API to the CIMOM using SWIG supported languages. The initial implementation supports Ruby and Python. Added Paths: ----------- cmpi-bindings/ cmpi-bindings/CMakeLists.txt cmpi-bindings/COPYING cmpi-bindings/README cmpi-bindings/VERSION.cmake cmpi-bindings/cmpi-bindings.spec.cmake cmpi-bindings/doc/ cmpi-bindings/doc/HOWTO cmpi-bindings/doc/INSTALL cmpi-bindings/doc/README cmpi-bindings/include/ cmpi-bindings/include/cmpi/ cmpi-bindings/include/cmpi/cmpidt.h cmpi-bindings/include/cmpi/cmpift.h cmpi-bindings/include/cmpi/cmpimacs.h cmpi-bindings/include/cmpi/cmpios.h cmpi-bindings/include/cmpi/cmpipl.h cmpi-bindings/mof/ cmpi-bindings/mof/CMakeLists.txt cmpi-bindings/mof/Swig_Generic.mof cmpi-bindings/mof/Swig_Generic.reg cmpi-bindings/src/ cmpi-bindings/src/CMakeLists.txt cmpi-bindings/src/cmpi_instance.c cmpi-bindings/swig/ cmpi-bindings/swig/CMakeLists.txt cmpi-bindings/swig/cmpi.i cmpi-bindings/swig/cmpi_defs.i cmpi-bindings/swig/cmpi_types.i cmpi-bindings/swig/python/ cmpi-bindings/swig/python/CMakeLists.txt cmpi-bindings/swig/python/pycmpi_instance.py cmpi-bindings/swig/ruby/ cmpi-bindings/swig/ruby/CMakeLists.txt cmpi-bindings/swig/ruby/rcmpi_instance.rb Added: cmpi-bindings/CMakeLists.txt =================================================================== --- cmpi-bindings/CMakeLists.txt (rev 0) +++ cmpi-bindings/CMakeLists.txt 2008-06-06 10:22:47 UTC (rev 636) @@ -0,0 +1,67 @@ + +# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked +#SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) +#SET(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules ${CMAKE_MODULE_PATH}) + +INCLUDE(${CMAKE_SOURCE_DIR}/VERSION.cmake) + +SET( PACKAGE "cmpi-bindings" ) +SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" ) + +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Language Bindings for CMPI") +SET(CPACK_PACKAGE_VENDOR "Novell Inc.") +#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt") +#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") +SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) +SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) +SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) + +SET( CPACK_GENERATOR "TBZ2") +SET( CPACK_SOURCE_GENERATOR "TBZ2") +SET( CPACK_SOURCE_PACKAGE_FILE_NAME "${PACKAGE}-${VERSION}" ) + +# The following components are regex's to match anywhere (unless anchored) +# in absolute path + filename to find files or directories to be excluded +# from source tarball. +SET (CPACK_SOURCE_IGNORE_FILES +"/CVS/;/.svn/;/.libs/;/.deps/;.swp$;.#;/#;/build/" +"~$" +"\\\\.cvsignore$" +"/package" +"Makefile\\\\.in$" +) + +INCLUDE(CPack) + +#FIND_PACKAGE(SWIG REQUIRED) +MESSAGE(STATUS "Looking modules in ${CMAKE_MODULE_PATH}") +FIND_PROGRAM(SWIG_EXECUTABLE + NAMES swig-1.3 swig + PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin /usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin +) + +IF ( NOT SWIG_EXECUTABLE ) + MESSAGE( FATAL "SWIG not found." ) +ELSE ( NOT SWIG_EXECUTABLE ) + MESSAGE( STATUS "SWIG found at ${SWIG_EXECUTABLE}" ) +ENDIF ( NOT SWIG_EXECUTABLE ) + +# don't build standalone provider, its included in the swig code +#ADD_SUBDIRECTORY(src) + +ADD_SUBDIRECTORY(swig) +ADD_SUBDIRECTORY(mof) + +SET( SRCPACKAGE_COMMAND + COMMAND ${CMAKE_MAKE_PROGRAM} package_source + COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2 ${CMAKE_BINARY_DIR}/package/ + COMMAND ${CMAKE_COMMAND} -E remove ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2 + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/package/${PACKAGE}.changes" "${CMAKE_BINARY_DIR}/package/${PACKAGE}.changes" +) + +ADD_CUSTOM_TARGET( srcpackage + ${SRCPACKAGE_COMMAND} +) + +MESSAGE(STATUS "Writing spec file...") +CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmpi-bindings.spec.cmake ${CMAKE_BINARY_DIR}/package/cmpi-bindings.spec @ONLY) Added: cmpi-bindings/COPYING =================================================================== --- cmpi-bindings/COPYING (rev 0) +++ cmpi-bindings/COPYING 2008-06-06 10:22:47 UTC (rev 636) @@ -0,0 +1,28 @@ +Copyright (C) 2008 Novell Inc. All rights reserved. +Copyright (C) 2008 SUSE Linux Products GmbH. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + - Neither the name of Novell Inc. nor of SUSE Linux Products GmbH nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL Novell Inc. OR SUSE Linux Products GmbH OR +THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. Added: cmpi-bindings/README =================================================================== --- cmpi-bindings/README (rev 0) +++ cmpi-bindings/README 2008-06-06 10:22:47 UTC (rev 636) @@ -0,0 +1,50 @@ +Swig bases CMPI bindings +------------------------ + +This implements a CMPI Instance provider via SWIG. + + +Currently supported languages + +- Ruby (complete) +- Python (almost there) + +Support for Python is only rough. The Python interpreter and the +Provider implementation get correctly loaded. But I do not know yet +how to call a Python function from C. + + +The prototype implements a dummy class 'Cmpi_Swig' which looks like +this: + +class Cmpi_Swig : CIM_ManagedElement +{ + [Description ("A friendly greeting") ] + string hello; +}; + + +FILES +----- + +mof/Swig_Generic.mof + The class definition +mof/Swig_Generic.reg + The (sfcb based) provider registration data + +src/cmpi_instance.c + A CMPI instance provider C stub to be included into + the SWIG generated C code. + It currently implements EnumInstances (for Ruby and Python) and + EnumInstanceNames (Ruby only) + Supporting more instance methods should be straightforward. + +include/cmpi + cmpi header files + + + +TODO +---- + +Convert it to a 'Generic' CMPI provider. \ No newline at end of file Added: cmpi-bindings/VERSION.cmake =================================================================== --- cmpi-bindings/VERSION.cmake (rev 0) +++ cmpi-bindings/VERSION.cmake 2008-06-06 10:22:47 UTC (rev 636) @@ -0,0 +1,3 @@ +SET(VERSION_MAJOR "0") +SET(VERSION_MINOR "1") +SET(VERSION_PATCH "0") Added: cmpi-bindings/cmpi-bindings.spec.cmake =================================================================== --- cmpi-bindings/cmpi-bindings.spec.cmake (rev 0) +++ cmpi-bindings/cmpi-bindings.spec.cmake 2008-06-06 10:22:47 UTC (rev 636) @@ -0,0 +1,84 @@ +# +# spec file for package cmpi-bindings +# +# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. +# +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + +# nodebuginfo + +Name: @PACKAGE@ +Version: @VERSION@ +Release: 0 +License: GPL +Summary: Bindings for cmpi +Group: Development/Sources +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: cmake gcc-c++ ruby-devel swig +BuildRequires: sblim-sfcb-devel +Source: %{name}-%{version}.tar.bz2 + +%description +- + +%prep +%setup -q + +%build +mkdir build +cd build +cmake -DCMAKE_INSTALL_PREFIX=%{prefix} \ + -DLIB=%{_lib} \ + -DCMAKE_VERBOSE_MAKEFILE=TRUE \ + -DCMAKE_C_FLAGS_RELEASE:STRING="%{optflags}" \ + -DCMAKE_CXX_FLAGS_RELEASE:STRING="%{optflags}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_SKIP_RPATH=1 \ + .. +make %{?jobs:-j %jobs} + +%install +cd build +make install DESTDIR=$RPM_BUILD_ROOT + +%clean +%{__rm} -rf %{buildroot} + +%package -n cmpi-ruby +Summary: Ruby bindings for cmpi +Group: Development/Languages/Ruby + +%description -n cmpi-ruby +- + +%files -n cmpi-ruby +%defattr(-,root,root,-) +%{_libdir}/ruby/vendor_ruby/%{rb_ver}/%{rb_arch}/yui.so + +#%package -n python-yui +#Summary: Python bindings for cmpi +#Group: Development/Languages/Python +#%description -n python-yui +#- +# +#%files -n python-yui +#%defattr(-,root,root,-) +#%{_libdir}/python2.5/site-packages/_yui.so +#%{_libdir}/python2.5/site-packages/yui.py + +#%package -n perl-yui +#Summary: Perl bindings for cmpi +#Group: Development/Languages/Perl +# +#%description -n perl-yui +#- +# +#%files -n perl-yui +#%defattr(-,root,root,-) +#/usr/lib/perl5/*/*/yui.pm +#/usr/lib/perl5/*/*/yui.so + +%changelog Added: cmpi-bindings/doc/HOWTO =================================================================== --- cmpi-bindings/doc/HOWTO (rev 0) +++ cmpi-bindings/doc/HOWTO 2008-06-06 10:22:47 UTC (rev 636) @@ -0,0 +1,44 @@ +CMPI providers with SWIG +------------------------ + +Problem statement +----------------- + +SWIG (www.swig.org) is a bindings generator used to create language +bindings (i.e. Perl, Ruby, Python) for C or C++ libraries. +This makes library functions accessible from a foreign language. + +Using SWIG to create CMPI providers reverts the flow of control. This +is usally from the foreign language to the C or C++ library. The SWIG +bindings 'call into' the library. + +Writing CMPI providers in a foreign language reverts the calling +process. The CIMOM call into functions implemented in the foreign +language. + + +Solution +-------- + +The problem is solved by creating a shim layer, providing a CMPI API +towards the CIMOM and transfering calls to this API through the SWIG +bindings into the scripting language interpreter. + +This shim links with and initializes the target language interpreter. +When loaded by the CIMOM, an init function is called. This in turn +initializes the target interpreter and calls it to load the SWIG +binding code. + +It then calls an initialization function (a singleton class) which +provides hooks to fill the function pointer table defined by CMPI. + + +Target language considerations +------------------------------ + +Implementing a provider needs information defined in the .mof file of +the CIM class to be instrumented. Thus the target language +implementation is best driven by a MOF parser. The concept to be +used here is similar to SWIG, which uses a C/C++ parser to +automatically generate bindings. + Added: cmpi-bindings/doc/INSTALL =================================================================== --- cmpi-bindings/doc/INSTALL (rev 0) +++ cmpi-bindings/doc/INSTALL 2008-06-06 10:22:47 UTC (rev 636) @@ -0,0 +1,20 @@ +Prerequisites + +- cmpi header files + (The ones from sfcb are broken, you can use those below include/cmpi) +- a CIMOM (sfcb does nicely) +- SWIG 1.3.x (I used 1.3.35) +- Cmake (I used 2.4) +- Ruby ( ruby, ruby-devel) +- wbemcli (or any other way to access the CIMOM) + +Now do: + cd cmpi-bindings + mkdir build + cd build + cmake .. + make + sudo make install + sudo sfcbrepos -f + sfcbd + \ No newline at end of file Added: cmpi-bindings/doc/README =================================================================== --- cmpi-bindings/doc/README (rev 0) +++ cmpi-bindings/doc/README 2008-06-06 10:22:47 UTC (rev 636) @@ -0,0 +1,8 @@ +Support for Python is only rough. The Python interpreter and the +Provider implementation get correctly loaded. But I do not know yet +how to call a Python function from C. + +- (build and) install sfcbd +- (build and) install sblim-wbemcli +- build and install . +- run 'wbemcli ei http://localhost/root/cimv2:Cmpi_Swig' Added: cmpi-bindings/include/cmpi/cmpidt.h =================================================================== --- cmpi-bindings/include/cmpi/cmpidt.h (rev 0) +++ cmpi-bindings/include/cmpi/cmpidt.h 2008-06-06 10:22:47 UTC (rev 636) @@ -0,0 +1,908 @@ + +/* + * cmpidt.h + * + * (C) Copyright IBM Corp. 2005 + * + * THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + * + * You can obtain a current copy of the Eclipse Public License from + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * Author: Adrian Schuur <sc...@de...> + * + * Description: + * + * CMPI data types. + * +*/ +/* ------------------------------------------------------------------------- */ +/* */ +/* Copyright (c) 2006 The Open Group */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining a */ +/* copy of this software (the "Software"), to deal in the Software without */ +/* restriction, including without limitation the rights to use, copy, */ +/* modify, merge, publish, distribute, sublicense, and/or sell copies of */ +/* the Software, and to permit persons to whom the Software is furnished */ +/* to do so, subject to the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be included */ +/* in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS */ +/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */ +/* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR */ +/* THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* */ +/* ------------------------------------------------------------------------- */ + +#ifndef _CMPIDT_H_ +# define _CMPIDT_H_ + +# include "cmpipl.h" + +# ifdef __cplusplus +extern "C" +{ +# endif + +// defintion of version numbers to be used by providers using CMBrokerVersion() +// They indicate what CMPI version is supported by both the broker and its adapter + +# define CMPIVersion100 100 + // 1.00 +# define CMPIVersion200 200 + // 2.00 + +// CMPI_VERSION compile switch should be used during MI compilation only. +// It is used define minimal version support needed from Management Broker. +// This value will be set in <mi-name>_Create<mi-type>MI.mi_version + +# ifdef CMPI_VERSION +# if (CMPI_VERSION==200) +# define CMPI_VER_200 1 +# elif (CMPI_VERSION==100) +# define CMPI_VER_100 1 +// Please note that if the CMPI implementations supports "historical" CMPI +// levels (90, 86, etc) this would be the place to add the checks for the +// version. +// +# else +# error Unsupported CMPI_VERSION defined +# endif +# else +# define CMPI_VER_200 +# endif + + +// CMPI_VER_x switch is used by Management Broker implementations only. + +// It defines the CMPI version supported by the Management Broker. +// This value must be set in the ftVersion field of all functions tables. + +// Version definitions are cumulative. +// A new version definition must #define all previous definitions. + +// During MI loading MBs must ensure that +// <mi-name>_Create<mi-type>MI.miVersion<=<mi-name>_Create<mi-type>MI.ftVersion +// If this is not the case, the MI might require higher version MB support. +# if defined (CMPI_VER_200) || defined(CMPI_VER_ALL) +# define CMPI_VER_100 +# define CMPICurrentVersion CMPIVersion200 +# elif defined (CMPI_VER_100) || defined(CMPI_VER_ALL) +# define CMPICurrentVersion CMPIVersion100 + +// Please note that if the CMPI implementations supports "historical" CMPI +// levels (90, 86, etc) this would be the place to add the checks for the +// version. + +# else // default version +# define CMPI_VER_200 +# define CMPI_VER_100 +# define CMPICurrentVersion CMPIVersion200 +# endif + +/** A platform independent CMPI data type, usually an unsigned int */ + typedef unsigned int CMPICount; + + + struct _CMPIBroker; + struct _CMPIInstance; + struct _CMPIObjectPath; + struct _CMPIArgs; + struct _CMPISelectExp; + struct _CMPISelectCond; + struct _CMPISubCond; + struct _CMPIPredicate; + struct _CMPIEnumeration; + struct _CMPIArray; + struct _CMPIString; + struct _CMPIResult; + struct _CMPIContext; + struct _CMPIDateTime; + + typedef struct _CMPIBroker CMPIBroker; + typedef struct _CMPIInstance CMPIInstance; + typedef struct _CMPIObjectPath CMPIObjectPath; + typedef struct _CMPIArgs CMPIArgs; + typedef struct _CMPISelectExp CMPISelectExp; + typedef struct _CMPISelectCond CMPISelectCond; + typedef struct _CMPISubCond CMPISubCond; + typedef struct _CMPIPredicate CMPIPredicate; + typedef struct _CMPIEnumeration CMPIEnumeration; + typedef struct _CMPIArray CMPIArray; + typedef struct _CMPIString CMPIString; + typedef struct _CMPIResult CMPIResult; + typedef struct _CMPIContext CMPIContext; + typedef struct _CMPIDateTime CMPIDateTime; + +# ifdef CMPI_VER_200 + struct _CMPIError; + + typedef struct _CMPIError CMPIError; +# endif + + struct _CMPIBrokerFT; + struct _CMPIBrokerEncFT; + struct _CMPIInstanceFT; + struct _CMPIObjectPathFT; + struct _CMPIArgsFT; + struct _CMPISelectExpFT; + struct _CMPISelectCondFT; + struct _CMPISelectCondDocFT; + struct _CMPISelectCondCodFT; + struct _CMPISubCondFT; + struct _CMPIPredicateFT; + struct _CMPIEnumerationFT; + struct _CMPIArrayFT; + struct _CMPIStringFT; + struct _CMPIresultFT; + struct _CMPIContextFT; + struct _CMPIDateTimeFT; +# ifdef CMPI_VER_200 + struct _CMPIBrokerMemFT; + struct _CMPIErrorFT; + + typedef struct _CMPIBrokerMemFT CMPIBrokerMemFT; + typedef struct _CMPIErrorFT CMPIErrorFT; +# endif + typedef struct _CMPIBrokerFT CMPIBrokerFT; + typedef struct _CMPIBrokerEncFT CMPIBrokerEncFT; + typedef struct _CMPIBrokerExtFT CMPIBrokerExtFT; + typedef struct _CMPIInstanceFT CMPIInstanceFT; + typedef struct _CMPIObjectPathFT CMPIObjectPathFT; + typedef struct _CMPIArgsFT CMPIArgsFT; + typedef struct _CMPISelectExpFT CMPISelectExpFT; + typedef struct _CMPISelectCondFT CMPISelectCondFT; + typedef struct _CMPISubCondFT CMPISubCondFT; + typedef struct _CMPIPredicateFT CMPIPredicateFT; + typedef struct _CMPIEnumerationFT CMPIEnumerationFT; + typedef struct _CMPIArrayFT CMPIArrayFT; + typedef struct _CMPIStringFT CMPIStringFT; + typedef struct _CMPIResultFT CMPIResultFT; + typedef struct _CMPIContextFT CMPIContextFT; + typedef struct _CMPIDateTimeFT CMPIDateTimeFT; + + + typedef unsigned char CMPIBoolean; + typedef unsigned short CMPIChar16; + typedef unsigned char CMPIUint8; + typedef unsigned short CMPIUint16; + typedef unsigned int CMPIUint32; +# ifndef CMPI_PLATFORM_WIN32_IX86_MSVC + typedef unsigned long long CMPIUint64; +# else + typedef unsigned __int64 CMPIUint64; +# endif + typedef signed char CMPISint8; + typedef short CMPISint16; + typedef signed int CMPISint32; +# ifndef CMPI_PLATFORM_WIN32_IX86_MSVC + typedef long long CMPISint64; +# else + typedef __int64 CMPISint64; +# endif + typedef float CMPIReal32; + typedef double CMPIReal64; + + typedef struct _CMPIValuePtr + { + void *ptr; + CMPICount length; + } CMPIValuePtr; + + + typedef union _CMPIValue + { + CMPIUint64 uint64; + CMPIUint32 uint32; + CMPIUint16 uint16; + CMPIUint8 uint8; + CMPISint64 sint64; + CMPISint32 sint32; + CMPISint16 sint16; + CMPISint8 sint8; + CMPIReal64 real64; + CMPIReal32 real32; + CMPIBoolean boolean; + CMPIChar16 char16; + + CMPIInstance *inst; + CMPIObjectPath *ref; + CMPIArgs *args; + CMPISelectExp *filter; + CMPIEnumeration *Enum; + CMPIArray *array; + CMPIString *string; + char *chars; + CMPIDateTime *dateTime; + CMPIValuePtr dataPtr; + + CMPISint8 Byte; + CMPISint16 Short; + CMPISint32 Int; + CMPISint64 Long; + CMPIReal32 Float; + CMPIReal64 Double; + } CMPIValue; + + + typedef unsigned short CMPIType; + +# define CMPI_null 0 + +# define CMPI_SIMPLE (2) +# define CMPI_boolean (2+0) +# define CMPI_char16 (2+1) + +# define CMPI_REAL ((2)<<2) +# define CMPI_real32 ((2+0)<<2) +# define CMPI_real64 ((2+1)<<2) + +# define CMPI_UINT ((8)<<4) +# define CMPI_uint8 ((8+0)<<4) +# define CMPI_uint16 ((8+1)<<4) +# define CMPI_uint32 ((8+2)<<4) +# define CMPI_uint64 ((8+3)<<4) +# define CMPI_SINT ((8+4)<<4) +# define CMPI_sint8 ((8+4)<<4) +# define CMPI_sint16 ((8+5)<<4) +# define CMPI_sint32 ((8+6)<<4) +# define CMPI_sint64 ((8+7)<<4) +# define CMPI_INTEGER ((CMPI_UINT | CMPI_SINT)) + +# define CMPI_ENC ((16)<<8) +# define CMPI_instance ((16+0)<<8) +# define CMPI_ref ((16+1)<<8) +# define CMPI_args ((16+2)<<8) +# define CMPI_class ((16+3)<<8) +# define CMPI_filter ((16+4)<<8) +# define CMPI_enumeration ((16+5)<<8) +# define CMPI_string ((16+6)<<8) +# define CMPI_chars ((16+7)<<8) +# define CMPI_dateTime ((16+8)<<8) +# define CMPI_ptr ((16+9)<<8) +# define CMPI_charsptr ((16+10)<<8) + +# define CMPI_ARRAY ((1)<<13) +# define CMPI_SIMPLEA (CMPI_ARRAY | CMPI_SIMPLE) +# define CMPI_booleanA (CMPI_ARRAY | CMPI_boolean) +# define CMPI_char16A (CMPI_ARRAY | CMPI_char16) + +# define CMPI_REALA (CMPI_ARRAY | CMPI_REAL) +# define CMPI_real32A (CMPI_ARRAY | CMPI_real32) +# define CMPI_real64A (CMPI_ARRAY | CMPI_real64) + +# define CMPI_UINTA (CMPI_ARRAY | CMPI_UINT) +# define CMPI_uint8A (CMPI_ARRAY | CMPI_uint8) +# define CMPI_uint16A (CMPI_ARRAY | CMPI_uint16) +# define CMPI_uint32A (CMPI_ARRAY | CMPI_uint32) +# define CMPI_uint64A (CMPI_ARRAY | CMPI_uint64) +# define CMPI_SINTA (CMPI_ARRAY | CMPI_SINT) +# define CMPI_sint8A (CMPI_ARRAY | CMPI_sint8) +# define CMPI_sint16A (CMPI_ARRAY | CMPI_sint16) +# define CMPI_sint32A (CMPI_ARRAY | CMPI_sint32) +# define CMPI_sint64A (CMPI_ARRAY | CMPI_sint64) +# define CMPI_INTEGERA (CMPI_ARRAY | CMPI_INTEGER) + +# define CMPI_ENCA (CMPI_ARRAY | CMPI_ENC) +# define CMPI_stringA (CMPI_ARRAY | CMPI_string) +# define CMPI_charsA (CMPI_ARRAY | CMPI_chars) +# define CMPI_dateTimeA (CMPI_ARRAY | CMPI_dateTime) +# define CMPI_instanceA (CMPI_ARRAY | CMPI_instance) +# define CMPI_refA (CMPI_ARRAY | CMPI_ref) +# define CMPI_charsptrA (CMPI_ARRAY | CMPI_charsptr) + + // the following are CMPIObjectPath key-types synonyms + // and are valid only when CMPI_keyValue of CMPIValueState is set + +# define CMPI_keyInteger (CMPI_sint64) +# define CMPI_keyString (CMPI_string) +# define CMPI_keyBoolean (CMPI_boolean) +# define CMPI_keyRef (CMPI_ref) + + // the following are predicate types only + +# define CMPI_charString (CMPI_string) +# define CMPI_integerString (CMPI_string | CMPI_sint64) +# define CMPI_realString (CMPI_string | CMPI_real64) +# define CMPI_numericString (CMPI_string | CMPI_sint64 | CMPI_real64) +# define CMPI_booleanString (CMPI_string | CMPI_boolean) +# define CMPI_dateTimeString (CMPI_string | CMPI_dateTime) +# define CMPI_classNameString (CMPI_string | CMPI_class) +# define CMPI_nameString (CMPI_string | ((16+10)<<8)) + +/** Indicates the state of a CMPI value. + <UL> + <LI>CMPI_goodValue - Value embedded in CMPIData object is valid. + <LI>CMPI_nullValue - Value embedded in CMPIData object is NULL. + <LI>CMPI_keyValue - Value embedded in CMPIData object is valid & is a key + <LI>CMPI_notFound - + <LI>CMPI_badValue - Value embedded in CMPIData object is not valid. + </UL> +*/ + typedef unsigned short CMPIValueState; +# define CMPI_goodValue (0) +# define CMPI_nullValue (1<<8) +# define CMPI_keyValue (2<<8) +# define CMPI_notFound (4<<8) +# define CMPI_badValue (0x80<<8) + +/** Values transferred from CMPI functions to the MI return three + components: the value, its state, and its type as defined by the schema. + All three components are bundled into this one structure. +*/ + typedef struct _CMPIData + { + /** An unsigned short representing the type of the CMPIData object */ + CMPIType type; + /** An unsigned short representing whether this CMPIData object is + valid or not. + */ + CMPIValueState state; + /** A union which holds the actual underlying value of the data object */ + CMPIValue value; + } CMPIData; + + typedef CMPIData CMPIAccessor (const char *, void *parm); + +# ifndef CMPI_NO_SYNONYM_SUPPORT +# define CMPI_Byte CMPI_sint8 +# define CMPI_Short CMPI_sint16 +# define CMPI_Int CMPI_sint32 +# define CMPI_Long CMPI_sint64 +# define CMPI_Float CMPI_real32 +# define CMPI_Double CMPI_real64 + +# define CMPI_ByteA CMPI_sint8A +# define CMPI_ShortA CMPI_sint16A +# define CMPI_IntA CMPI_sint32A +# define CMPI_LongA CMPI_sint64A +# define CMPI_FloatA CMPI_real32A +# define CMPI_DoubleA CMPI_real64A +# endif // CMPI_NO_SYNONYM_SUPPORT + + typedef void* CMPIMsgFileHandle; + typedef void CMPIGcStat; + +/** The CMPIFlags type is used to inform MI functions about options specified + by the client and passed on to the MI for certain requests. CMPIFlags are + not passed to MIs directly. MIs must use the CMPIContext services to gain + access under the name CMPIInvocationFlags. + <UL> + <LI>CMPI_FLAG_LocalOnly - Local only attributes + <LI>CMPI_FLAG_DeepInheritance - Providers should provide deep inhertiance + information + <LI>CMPI_FLAG_IncludeQualifiers - <I>deprecated</I> Indicates that a + MI's should return qualifiers + <LI>CMPI_FLAG_IncludeClassOrigin - MI should return class origin info + </UL> +*/ + typedef unsigned int CMPIFlags; + +# define CMPI_FLAG_LocalOnly 1 +# define CMPI_FLAG_DeepInheritance 2 +# define CMPI_FLAG_IncludeQualifiers 4 +# define CMPI_FLAG_IncludeClassOrigin 8 + + /* Authenticated ID of the user requesting this MI invocation. */ +# define CMPIPrincipal "CMPIPrincipal" + /* CMPIFlags - invocation flags as specified by the client. */ +# define CMPIInvocationFlags "CMPIInvocationFlags" + /* Namespace for which the MI is started. */ +# define CMPIInitNameSpace "CMPIInitNameSpace" + /* The role assumed by the current authenticated user. */ +# define CMPIRole "CMPIRole" + /* The accept language from the request */ +# define CMPIAcceptLanguage "CMPIAcceptLanguage" + /* The content language of the request */ +# define CMPIContentLanguage "CMPIContentLanguage" + +/** Enum which indicates success or failure, usually accessed as part + of the CMPIStatus structure +*/ + typedef enum _CMPIrc + { + /** Success */ + CMPI_RC_OK = 0, + /** Generic failure */ + CMPI_RC_ERR_FAILED = 1, + /** Specified user does not have access to perform the requested action */ + CMPI_RC_ERR_ACCESS_DENIED = 2, + /** invalid namespace specified */ + CMPI_RC_ERR_INVALID_NAMESPACE = 3, + /** invalid parameter specified */ + CMPI_RC_ERR_INVALID_PARAMETER = 4, + /** Invalid class specified */ + CMPI_RC_ERR_INVALID_CLASS = 5, + /** Item was not found */ + CMPI_RC_ERR_NOT_FOUND = 6, + /** Operation not supported */ + CMPI_RC_ERR_NOT_SUPPORTED = 7, + /** Object has child objects */ + CMPI_RC_ERR_CLASS_HAS_CHILDREN = 8, + /** Object has instances */ + CMPI_RC_ERR_CLASS_HAS_INSTANCES = 9, + /** Invalid super class specified */ + CMPI_RC_ERR_INVALID_SUPERCLASS = 10, + /** specified object already exists */ + CMPI_RC_ERR_ALREADY_EXISTS = 11, + /** Property does not exist */ + CMPI_RC_ERR_NO_SUCH_PROPERTY = 12, + /** This is a type mismatch */ + CMPI_RC_ERR_TYPE_MISMATCH = 13, + /** Query language not supported */ + CMPI_RC_ERR_QUERY_LANGUAGE_NOT_SUPPORTED = 14, + /** Invalid query */ + CMPI_RC_ERR_INVALID_QUERY = 15, + /** Method is not available */ + CMPI_RC_ERR_METHOD_NOT_AVAILABLE = 16, + /** could not find the specified method */ + CMPI_RC_ERR_METHOD_NOT_FOUND = 17, + /** Returned by a MI to indicate that it should not be unloaded, only + returned via a cleanup() call + */ + CMPI_RC_DO_NOT_UNLOAD = 50, + /** Returned by a MI to indicate that it should never be unloaded, only + returned via a cleanup() call + */ + CMPI_RC_NEVER_UNLOAD = 51, + /* Internal CMPI return codes. */ + CMPI_RC_ERR_INVALID_HANDLE = 60, + CMPI_RC_ERR_INVALID_DATA_TYPE = 61, + /* Hosting OS errors. */ + CMPI_RC_ERROR_SYSTEM = 100, + CMPI_RC_ERROR = 200 + } CMPIrc; + +/** The status structure is used to indicate success or failure of a call */ + typedef struct _CMPIStatus + { + /** The CMPIrc value. + @see _CMPIrc + */ + CMPIrc rc; + /** A text string representing the error message + @see CMPIString + */ + CMPIString *msg; + } CMPIStatus; + + + /* Management Broker capabilities and feature support */ + +# define CMPI_MB_Class_0 0x00000001 +# define CMPI_MB_Class_1 0x00000003 +# define CMPI_MB_Class_2 0x00000007 + +# define CMPI_MB_Supports_PropertyMI 0x00000100 +# define CMPI_MB_Supports_IndicationMI 0x00000200 +# define CMPI_MB_Supports_IndicationPolling 0x00000400 +# define CMPI_MB_Supports_QueryNormalization 0x00000800 +# define CMPI_MB_Supports_Qualifier 0x00001000 +# define CMPI_MB_Supports_Schema 0x00003000 + +# ifdef CMPI_VER_200 +# define CMPI_MB_Supports_MemEnhancements 0x00004000 +# define CMPI_MB_Supports_Extended_Error 0x00008000 +# endif + +# define CMPI_MB_BasicRead 0x00000001 +# define CMPI_MB_BasicWrite 0x00000003 +# define CMPI_MB_InstanceManipulation 0x00000007 +# define CMPI_MB_AssociationTraversal 0x00000009 +# define CMPI_MB_QueryExecution 0x00000011 +# define CMPI_MB_QueryNormalization 0x00000031 +# define CMPI_MB_Indications 0x00000081 +# define CMPI_MB_BasicQualifierSupport 0x00000047 +# define CMPI_MB_OSEncapsulationSupport 0x00000100 + + + /* Query Predicate operations */ + + typedef enum _CMPIPredOp + { + CMPI_PredOp_Equals = 1, + CMPI_PredOp_NotEquals = 2, + CMPI_PredOp_LessThan = 3, + CMPI_PredOp_GreaterThanOrEquals = 4, + CMPI_PredOp_GreaterThan = 5, + CMPI_PredOp_LessThanOrEquals = 6, + CMPI_PredOp_Isa = 7, + CMPI_PredOp_NotIsa = 8, + CMPI_PredOp_Like = 9, + CMPI_PredOp_NotLike = 10 +# ifdef CMPI_VER_200 + , + CMPI_PredOp_Not_Null = 11, + CMPI_PredOp_Null = 12, + CMPI_PredOp_And = 13, + CMPI_PredOp_Or = 14 +# endif + } CMPIPredOp; + + /** Severity levels for logging functions */ + typedef enum _CMPISeverity + { + /** Error */ + CMPI_SEV_ERROR = 1, + /** General info */ + CMPI_SEV_INFO = 2, + /** Warning message */ + CMPI_SEV_WARNING = 3, + /** Debug message */ + CMPI_DEV_DEBUG = 4 + } CMPISeverity; + + /** Logging level for trace functions*/ + typedef enum _CMPILevel + { + /** Generic information */ + CMPI_LEV_INFO = 1, + /** warnings */ + CMPI_LEV_WARNING = 2, + /** detailed/specific information */ + CMPI_LEV_VERBOSE = 3 + } CMPILevel; + + /** Type of query expression it is normalized to. */ + typedef enum _CMPISelectCondType + { + /** Disjuntion Of Conjunctions */ + CMPI_COND_DOC = 0, + /** Conjuction of disjunctions */ + CMPI_COND_COD = 1 + } CMPISelectCondType; + +#ifdef CMPI_VER_200 + /** Possible values an Error object can use in its type property + @version 2.0 + */ +typedef enum _CMPIErrorType { + /** Unkown */ + UnknownErrorType = 0, + /** Other */ + OtherErrorType = 1, + /** Communications error */ + CommunicationsError = 2, + /** QoS error */ + QualityOfServiceError = 3, + /** Software error */ + SoftwareError = 4, + /** Hardware error */ + HardwareError = 5, + /** Environmental error */ + EnvironmentalError = 6, + /** Security error */ + SecurityError = 7, + /** over subscription error */ + Oversubscription_Error = 8, + /** Unavailable resource */ + UnavailableResourceError = 9, + /** Unsupported operation */ + UnsupportedOperationError = 10 +} CMPIErrorType; + +/** Possible values an Error object can use to indicate severity */ +typedef enum _CMPIErrorSeverity { + /** Unknown */ + ErrorSevUnknown = 0, + /** Low severity */ + ErrorSevLow = 2, + /** Medium Severity */ + ErrorSevMedium = 3, + /** High severity */ + ErrorSevHigh = 4, + /** Fatal error */ + ErrorSevFatal = 5, +} CMPIErrorSeverity; + +/** Possible values an Error object can use to indicate the probable cause */ +typedef enum _CMPIErrorProbableCause { + /** Unknown */ + ErrorProbCauseUnknown = 0, + /** Other cause */ + ErrorProbCauseOther = 1, + /** Adpater card failure */ + Adapter_Card_Error = 2, + /** Subsystem failure */ + Application_Subsystem_Failure = 3, + /** Reduced bandwidth */ + Bandwidth_Reduced = 4, + /** Could not establish connection */ + Connection_Establishment_Error = 5, + /** protocol error */ + Communications_Protocol_Error = 6, + /** Subsystem failure */ + Communications_Subsystem_Failure = 7, + /** Configuration error */ + ConfigurationCustomization_Error = 8, + /** Congested */ + Congestion = 9, + /** Data is corrupt */ + Corrupt_Data = 10, + /** CPU cycles exceeded */ + CPU_Cycles_Limit_Exceeded = 11, + /* Dataset modem error */ + DatasetModem_Error = 12, + /** Degraded signal */ + Degraded_Signal = 13, + /** STE/DCE Interface Error */ + DTE_DCE_Interface_Error = 14, + /** Door open */ + Enclosure_Door_Open = 15, + /** Equipment malfunction */ + Equipment_Malfunction = 16, + /** Excessive Vibration */ + Excessive_Vibration = 17, + /** File format error */ + File_Format_Error = 18, + /** Fire detected */ + Fire_Detected = 19, + /** Flood detected */ + Flood_Detected = 20, + /** framing error */ + Framing_Error = 21, + /** HVAC problem */ + HVAC_Problem = 22, + /* Humidity unacceptable */ + Humidity_Unacceptable = 23, + /** IO device error */ + IO_Device_Error = 24, + /** Input device error */ + Input_Device_Error = 25, + /** LAN Error */ + LAN_Error = 26, + /** Non-toxic leak detected */ + Non_Toxic_Leak_Detected = 27, + /* Local node transmission error */ + Local_Node_Transmission_Error = 28, + /** loss of frame */ + Loss_of_Frame = 29, + /** loss of signal */ + Loss_of_Signal = 30, + /** Material supply exhausted */ + Material_Supply_Exhausted = 31, + /** Multiplexer problem */ + Multiplexer_Problem = 32, + /** Out of memory */ + Out_of_Memory = 33, + /** Output device error */ + Output_Device_Error = 34, + /** Performance degraded */ + Performance_Degraded = 35, + /** Power problem */ + Power_Problem = 36, + /** Pressure unacceptable */ + Pressure_Unacceptable = 37, + /** Processor problem */ + Processor_Problem = 38, + /** Pump failure */ + Pump_Failure = 39, + /** Queue size exceeded */ + Queue_Size_Exceeded = 40, + /** Receive failure */ + Receive_Failure = 41, + /** Receiver failure */ + Receiver_Failure = 42, + /** Remote node transmission error */ + Remote_Node_Transmission_Error = 43, + /** Resource at or nearing capacity */ + Resource_at_or_Nearing_Capacity = 44, + /** Response time excessive */ + Response_Time_Excessive = 45, + /** Retransmission rate excessive */ + Retransmission_Rate_Excessive = 46, + /** Software Error */ + Software_Error = 47, + /** Software terminated abnormally */ + Software_Program_Abnormally_Terminated = 48, + /** Program error */ + Software_Program_Error = 49, + /** Storage capacity problem */ + Storage_Capacity_Problem = 50, + /** Temperature_Unacceptable */ + Temperature_Unacceptable = 51, + /** Threshold_Crossed */ + Threshold_Crossed = 52, + /** Timing_Problem */ + Timing_Problem = 53, + /** Toxic_Leak_Detected */ + Toxic_Leak_Detected = 54, + /** Transmit_Failure */ + Transmit_Failure = 55, + /** Transmitter_Failure */ + Transmitter_Failure = 56, + /** Underlying_Resource_Unavailable */ + Underlying_Resource_Unavailable = 57, + /** Version_Mismatch */ + Version_Mismatch = 58, + /** Previous_Alert_Cleared */ + Previous_Alert_Cleared = 59, + /** Login_Attempts_Failed */ + Login_Attempts_Failed = 60, + /** Software_Virus_Detected */ + Software_Virus_Detected = 61, + /** Hardware_Security_Breached */ + Hardware_Security_Breached = 62, + /** Denial_of_Service_Detected */ + Denial_of_Service_Detected = 63, + /** Security_Credential_Mismatch */ + Security_Credential_Mismatch = 64, + /** Unauthorized_Access */ + Unauthorized_Access = 65, + /** Alarm_Received */ + Alarm_Received = 66, + /** Loss_of_Pointer */ + Loss_of_Pointer = 67, + /** Payload_Mismatch */ + Payload_Mismatch = 68, + /** Transmission_Error */ + Transmission_Error = 69, + /** Excessive_Error_Rate */ + Excessive_Error_Rate = 70, + /** Trace_Problem */ + Trace_Problem = 71, + /** Element_Unavailable */ + Element_Unavailable = 72, + /** Element_Missing */ + Element_Missing = 73, + /** Loss_of_Multi_Frame */ + Loss_of_Multi_Frame = 74, + /** Broadcast_Channel_Failure */ + Broadcast_Channel_Failure = 75, + /** Invalid_Message_Received */ + Invalid_Message_Received = 76, + /** Routing_Failure */ + Routing_Failure = 77, + /** Backplane_Failure */ + Backplane_Failure = 78, + /** Identifier_Duplication */ + Identifier_Duplication = 79, + /** Protection_Path_Failure */ + Protection_Path_Failure = 80, + /** Sync_Loss_or_Mismatch */ + Sync_Loss_or_Mismatch = 81, + /** Terminal_Problem */ + Terminal_Problem = 82, + /** Real_Time_Clock_Failure */ + Real_Time_Clock_Failure = 83, + /** Antenna_Failure */ + Antenna_Failure = 84, + /** Battery_Charging_Failure */ + Battery_Charging_Failure = 85, + /** Disk_Failure */ + Disk_Failure = 86, + /** Frequency_Hopping_Failure */ + Frequency_Hopping_Failure = 87, + /** Loss_of_Redundancy */ + Loss_of_Redundancy = 88, + /** Power_Supply_Failure */ + Power_Supply_Failure = 89, + /** Signal_Quality_Problem */ + Signal_Quality_Problem = 90, + /** Battery_Discharging */ + Battery_Discharging = 91, + /** Battery_Failure */ + Battery_Failure = 92, + /** Commercial_Power_Problem */ + Commercial_Power_Problem = 93, + /** Fan_Failure */ + Fan_Failure = 94, + /** Engine_Failure */ + Engine_Failure = 95, + /** Sensor_Failure */ + Sensor_Failure = 96, + /** Fuse_Failure */ + Fuse_Failure = 97, + /** Generator_Failure */ + Generator_Failure = 98, + /** Low_Battery */ + Low_Battery = 99, + /** Low_Fuel */ + Low_Fuel = 100, + /** Low_Water */ + Low_Water = 101, + /** Explosive_Gas */ + Explosive_Gas = 102, + /** High_Winds */ + High_Winds = 103, + /** Ice_Buildup */ + Ice_Buildup = 104, + /** Smoke */ + Smoke = 105, + /** Memory_Mismatch */ + Memory_Mismatch = 106, + /** Out_of_CPU_Cycles */ + Out_of_CPU_Cycles = 107, + /** Software_Environment_Problem */ + Software_Environment_Problem = 108, + /** Software_Download_Failure */ + Software_Download_Failure = 109, + /** Element_Reinitialized */ + Element_Reinitialized = 110, + /** Timeout */ + Timeout = 111, + /** Logging_Problems */ + Logging_Problems = 112, + /** Leak_Detected */ + Leak_Detected_113, + /** Protection_Mechanism_Failure */ + Protection_Mechanism_Failure = 114, + /** Protecting_Resource_Failure */ + Protecting_Resource_Failure = 115, + /** Database_Inconsistency */ + Database_Inconsistency = 116, + /** Authentication_Failure */ + Authentication_Failure = 117, + /** Breach_of_Confidentiality */ + Breach_of_Confidentiality = 118, + /** Cable_Tamper */ + Cable_Tamper = 119, + /** Delayed_Information */ + Delayed_Information = 120, + /** Duplicate_Information */ + Duplicate_Information = 121, + /** Information_Missing */ + Information_Missing = 122, + /** Information_Modification */ + Information_Modification = 123, + /** Information_Out_of_Sequence */ + Information_Out_of_Sequence = 124, + /** Key_Expired */ + Key_Expired = 125, + /** Non_Repudiation_Failure */ + Non_Repudiation_Failure = 126, + /** Out_of_Hours_Activity */ + Out_of_Hours_Activity = 127, + /** Out_of_Service */ + Out_of_Service = 128, + /** Procedural_Error */ + Procedural_Error = 129, + /** Unexpected_Information */ + Unexpected_Information = 130, +} CMPIErrorProbableCause; + +/** Possible values an Error object can have for the error src format */ +typedef enum _CMPIErrorSrcFormat { + /** Unknown source */ + CMPIErrSrcUnknown = 0, + /** Other source */ + CMPIErrSrcOther = 1, + /* Object handle */ + CIMObjectHandle = 2, +} CMPIErrorSrcFormat; + +#endif /* CMPI_VER_200 */ + +# ifdef __cplusplus +}; +# endif + +#endif // _CMPIDT_H_ Added: cmpi-bindings/include/cmpi/cmpift.h =================================================================== --- cmpi-bindings/include/cmpi/cmpift.h (rev 0) +++ cmpi-bindings/include/cmpi/cmpift.h 2008-06-06 10:22:47 UTC (rev 636) @@ -0,0 +1,3355 @@ + +/* + * cmpift.h + * + * (C) Copyright IBM Corp. 2005 + * + * THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE + * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + * + * You can obtain a current copy of the Eclipse Public License from + * http://www.opensource.org/licenses/eclipse-1.0.php + * + * Author: Adrian Schuur <sc...@de...> + * + * Description: + * + * CMPI function tables. + * +*/ +/* ------------------------------------------------------------------------- */ +/* */ +/* Copyright (c) 2006 The Open Group */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining a */ +/* copy of this software (the "Software"), to deal in the Software without */ +/* restriction, including without limitation the rights to use, copy, */ +/* modify, merge, publish, distribute, sublicense, and/or sell copies of */ +/* the Software, and to permit persons to whom the Software is furnished */ +/* to do so, subject to the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be included */ +/* in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS */ +/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */ +/* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR */ +/* THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* */ +/* ------------------------------------------------------------------------- */ + +#ifndef _CMPIFT_H_ +# define _CMPIFT_H_ + +# include "cmpidt.h" +# include "cmpios.h" + +# ifdef __cplusplus +extern "C" +{ +# endif + + + //--------------------------------------------------- + //-- + // _CMPIBrokerEncFT Function Table + //-- + //--------------------------------------------------- + + + /** This structure is a table of pointers to broker and factory services + of encapsulated CMPIObjects. This table is made available + by the Management Broker, aka CIMOM, whenever a provider + is loaded and initialized. + */ + struct _CMPIBrokerEncFT + { + + /** Function table version + */ + int ftVersion; + + /** Instance factory service. + @param mb Pointer to the broker. + @param op ObjectPath containing namespace and classname. + @param rc Output: Service return status (suppressed when NULL). + @return The newly created Instance. + */ + CMPIInstance *(*newInstance) + (const CMPIBroker * mb, const CMPIObjectPath * op, CMPIStatus * rc); + + /** ObjectPath factory service. + @param mb Pointer to the broker. + @param ns Namespace + @param cn Classname. + @param rc Output: Service return status (suppressed when NULL). + @return The newly created ObjectPath. + */ + CMPIObjectPath *(*newObjectPath) + (const CMPIBroker * mb, const char *ns, const char *cn, + CMPIStatus * rc); + + /** Args container factory service. + @param mb Pointer to the broker. + @param rc Output: Service return status (suppressed when NULL). + @return The newly created Args container. + */ + CMPIArgs *(*newArgs) (const CMPIBroker * mb, CMPIStatus * rc); + + /** String container factory service. + @param mb Pointer to the broker. + @param data String data + @param rc Output: Service return status (suppressed when NULL). + @return The newly created String. + */ + CMPIString *(*newString) + (const CMPIBroker * mb, const char *data, CMPIStatus * rc); + + /** Array container factory service. + @param mb Pointer to the broker. + @param max Maximum number of elements + @param type Element type + @param rc Output: Service return status (suppressed when NULL). + @return The newly created Array. + */ + CMPIArray *(*newArray) + (const CMPIBroker * mb, CMPICount max, CMPIType type, CMPIStatus * rc); + + /** DateTime factory service. Initialized with the time of day. + @param mb Pointer to the broker. + @param rc Output: Service return status (suppressed when NULL). + @return The newly created DateTime. + */ + CMPIDateTime *(*newDateTime) (const CMPIBroker * mb, CMPIStatus * rc); + + /** DateTime factory service. Initialized from <binTime>. + @param mb Pointer to the broker. + @param binTime Date/Time definition in binary format in microsecods + starting since 00:00:00 GMT, Jan 1,1970. + @param interval Wenn true, defines Date/Time definition to be an interval value + @param rc Output: Service return status (suppressed when NULL). + @return The newly created DateTime. + */ + CMPIDateTime *(*newDateTimeFromBinary) + (const CMPIBroker * mb, CMPIUint64 binTime, CMPIBoolean interval, + CMPIStatus * rc); + + /** DateTime factory service. Is initialized from <utcTime>. + @param mb Pointer to the broker. + @param utcTime Date/Time definition in UTC format + @param rc Output: Service return status (suppressed when NULL). + @return The newly created DateTime. + */ + CMPIDateTime *(*newDateTimeFromChars) + (const CMPIBroker * mb, const char *utcTime, CMPIStatus * rc); + + /** SelectExp factory service. + @param mb Pointer to the broker. + @param query The select expression. + @param lang The query language. + @param projection Output: Projection specification (suppressed when NULL). + @param rc Output: Service return status (suppressed when NULL). + @return The newly created SelectExp. + */ + CMPISelectExp *(*newSelectExp) + (const CMPIBroker * mb, const char *query, const char *lang, + CMPIArray ** projection, CMPIStatus * st); + + /** Function to determine whether a CIM class is of <type> or any of + <type> subclasses. + @param mb Pointer to the broker. + @param op The class path (namespace and classname components). + @param type The type to tested for. + @param rc Output: Service return status (suppressed when NULL). + @return True if test successful. + */ + CMPIBoolean (*classPathIsA) + (const CMPIBroker * mb, const CMPIObjectPath * op, const char *type, + CMPIStatus * rc); + + /** Attempts to transforms an CMPI object to a broker specific string format. + Intended for debugging purposes only. + @param mb Pointer to the broker. + @param object A valid CMPI object. + @param rc Output: Service return status (suppressed when NULL). + @return String from representation of <object>. + */ + CMPIString *(*toString) + (const CMPIBroker * mb, const void *object, CMPIStatus * rc); + + /** Verifies whether <object> is of CMPI type <type>. + Intended for debugging purposes only. + @param mb Pointer to the broker. + @param object A valid CMPI object. + @param type A string specifying a valid CMPI Object type + ("CMPIInstance", "CMPIObjectPath", etc). + @param rc Output: Service return status (suppressed when NULL). + @return True if test successful. + */ + CMPIBoolean (*isOfType) + (const CMPIBroker * mb, const void *object, const char *type, + CMPIStatus * rc); + + /** Retrieves the CMPI type of <object>. + Intended for debugging purposes only. + @param mb Pointer to the broker. + @param object A valid CMPI object. + @param rc Output: Service return status (suppressed when NULL). + @return CMPI object type. + */ + CMPIString *(*getType) + (const CMPIBroker * mb, const void *object, CMPIStatus * rc); + + /** Retrieves translated message. + @param mb Pointer to the broker. + @param msgId The message identifier. + @param defMsg The default message. + @param rc Output: Service return status (suppressed when NULL). + @param count The number of message substitution values. + @return the trabslated message. + */ + CMPIString *(*getMessage) + (const CMPIBroker * mb, const char *msgId, const char *defMsg, + CMPIStatus * rc, CMPICount count, ...); + + /** Logs a diagnostic message. + @param mb The mb argument points to a CMPIBroker structure. + @param severity The level argument describes the level of log message. Levels are defined in Section 4.9. + @param id The component argument, if not NULL, is the component ID. + @param text The text argument, if not NULL, is the message text to be logged. + @param string The string argument, if not NULL, is the message text to be logged. string will be + ignored when text is not NULL. + @return Service return status. + */ + + CMPIStatus (*logMessage) + (const CMPIBroker *, int severity, const char *id, + const char *text, const CMPIString * string); + + /** Logs a trace entry. Intended for debugging purposes. + @param mb The mb argument points to a CMPIBroker structure. + @param level The level argument describes the level of log message. Levels are defined in Section 4.9. + @param component The component argument, if not NULL, is the component ID. + @param text The text argument, if not NULL, is the message text to be logged. + @param string The string argument, if not NULL, is the message text to be logged. string will be + ignored when text is not NULL. + @return Service return status. + */ + CMPIStatus (*trace) + (const CMPIBroker *, int level, const char *component, + const char *text, const CMPIString * string); + +# ifdef CMPI_VER_200 + /** Error factory service. + @param mb Pointer to the broker. + @param msgID A string which uniquely identifies, within the scope of the 'owner' argument, the format of the message. + @param msg A string which represenst the formatted message. + @parem sev The percieved severity of the error. + @param pc The probably cause of this error + @param status Service return status. + @return The newly created Error. + */ + CMPIError* (*newCMPIError) + (const CMPIBroker*, const char*, const char*, const char*, + const CMPIErrorSeverity, const CMPIErrorProbableCause,const CMPIrc, + CMPIStatus *rc); + /** Opens a message file. + @param mb Broker this pointer + @param msgFile The message file identifier. + @param msgFileHandle Output: The handle representing the open message file. + @return Service return status. + */ + CMPIStatus (*openMessageFile) + (const CMPIBroker* mb, const char *msgFile, + CMPIMsgFileHandle* msgFileHandle); + + /** Closes a message file. + @param mb Broker this pointer + @param msgFileHandle The handle representing the open message file. + @return Service return status. + */ + CMPIStatus (*closeMessageFile) + (const CMPIBroker* mb, const CMPIMsgFileHandle msgFileHandle); + + /** Retrieves translated message. + @param mb Broker this pointer + @param msgId The message identifier. + @param msgFileHandle The handle representing the open message file. + @param defMsg The default message. + @param rc Output: Service return status (suppressed when NULL). + @param count The number of message substitution values. + @return the translated message. + */ + CMPIString* (*getMessage2) + (const CMPIBroker* mb, const char *msgId, + const CMPIMsgFileHandle msgFileHandle, const char *defMsg, + CMPIStatus* rc, CMPICount count, ...); +# endif /* CMPI_VER_200 */ + + }; + + + + //--------------------------------------------------- + //-- + // _CMPIBrokerFT Function Table + //-- + //--------------------------------------------------- + + + /** This structure is a table of pointers to broker CIMOM services + (up-calls). This table is made available by the Management Broker, + whenever a provider is loaded and initialized. + */ + struct _CMPIBrokerFT + { + + /** 32 bits describing CMPI features supported by this CIMOM. + See CMPI_MB_Class_x and CMPI_MB_Supports_xxx flags. + */ + unsigned int brokerCapabilities; + /** CIMOM version as defined by CIMOM + */ + unsigned int brokerVersion; + /** CIMOM name + */ + const char *brokerName; + + /** This function prepares the CMPI run time system to accept + a thread that will be using CMPI services. The returned + CMPIContext object must be used by the subsequent attachThread() + and detachThread() invocations. + @param mb Pointer to the broker. + @param ctx Old Context object + @return New Context object to be used by thread to be attached. + */ + CMPIContext *(*prepareAttachThread) + (const CMPIBroker * mb, const CMPIContext * ctx); + + /** This function informs the CMPI run time system that the current + thread with Context will begin using CMPI services. + @param mb Pointer to the broker. + @param ctx Context object + @return Service return status. + */ + CMPIStatus (*attachThread) (const CMPIBroker *, const CMPIContext *); + + /** This function informs the CMPI run time system that the current thread + will not be using CMPI services anymore. The Context object will be + freed during this operation. + @param mb Pointer to the broker. + @param ctx Context object + @return Service return status. + */ + CMPIStatus (*detachThread) + (const CMPIBroker * mb, const CMPIContext * ctx); + + // class 0 services + + /** This function requests delivery of an Indication. The CIMOM will + locate pertinent subscribers and notify them about the event. + @param mb Pointer to the broker. + @param ctx Context object + @param ns Namespace + @param ind Indication Instance + @return Service return status. + */ + CMPIStatus (*deliverIndication) + (const CMPIBroker * mb, const CMPIContext * ctx, + const char *ns, const CMPIInstance * ind); + // class 1 services + + /** Enumerate Instance Names of the class (and subclasses) defined by <op>. + @param mb Pointer to the broker. + @param ctx Context object + @param op ObjectPath containing namespace and classname components. + @param rc Output: Service return status (suppressed when NULL). + @return Enumeration of ObjectPathes. + */ + CMPIEnumeration *(*enumerateInstanceNames) + (const CMPIBroker * mb, const CMPIContext * ctx, + const CMPIObjectPath * op, CMPIStatus * rc); + + /** Get Instance using <op> as reference. Instance structure can be + controled using the CMPIInvocationFlags entry in <ctx>. + @param mb Pointer to the broker. + @param ctx Context object + @param op ObjectPath containing namespace, classname and key components. + @param properties If not NULL, the members of the array define one or more Property + names. Each returned Object MUST NOT include elements for any Properties + missing from this list + @param rc Output: Service return status (suppressed when NULL). + @return The Instance. + */ + CMPIInstance *(*getInstance) + (const CMPIBroker * mb, const CMPIContext * ctx, + const CMPIObjectPath * op, const char **properties, CMPIStatus * rc); + + // class 2 services + + /** Create Instance from <inst> using <op> as reference. + @param mb Pointer to the broker. + @param ctx Context object + @param op ObjectPath containing namespace, classname and key components. + @param inst Complete instance. + @param rc Output: Service return status (suppressed when NULL). + @return The assigned instance reference. + */ + CMPIObjectPath *(*createInstance) + (const CMPIBroker * mb, const CMPIContext * ctx, + const CMPIObjectPath * op, const CMPIInstance * inst, CMPIStatus * rc); + + /** Replace an existing Instance from <inst> using <op> as reference. + @param mb Pointer to the broker. + @param ctx Context object + @param op ObjectPath containing namespace, classname and key components. + @param inst Complete instance. + @return Service return status. + */ + CMPIStatus (*modifyInstance) + (const CMPIBroker * mb, const CMPIContext * ctx, + const CMPIObjectPath * op, const CMPIInstance * inst, + const char **properties); + + /** Delete an existing Instance using <op> as reference. + @param mb Pointer to the broker. + @param ctx Context object + @param op ObjectPath containing namespace, classname and key components. + @return Service return status. + */ + CMPIStatus (*deleteInstance) + (const CMPIBroker * mb, const CMPIC... [truncated message content] |
From: <jc...@us...> - 2008-06-02 22:25:59
|
Revision: 635 http://omc.svn.sourceforge.net/omc/?rev=635&view=rev Author: jcarey Date: 2008-06-02 15:26:06 -0700 (Mon, 02 Jun 2008) Log Message: ----------- More adjustments for RPM build Modified Paths: -------------- contrib/xen-vm-builder/trunk/sblim-cmpi-xenvm-builder.spec contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am Modified: contrib/xen-vm-builder/trunk/sblim-cmpi-xenvm-builder.spec =================================================================== --- contrib/xen-vm-builder/trunk/sblim-cmpi-xenvm-builder.spec 2008-06-02 21:15:37 UTC (rev 634) +++ contrib/xen-vm-builder/trunk/sblim-cmpi-xenvm-builder.spec 2008-06-02 22:26:06 UTC (rev 635) @@ -1,5 +1,5 @@ # -# spec file for package sblim-cmpi-base-plus (Version 1.0.0) +# spec file for package sblim-cmpi-xenvm-builder (Version 1.0.0) # # Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -11,47 +11,35 @@ # norootforbuild # usedforbuild aaa_base acl attr audit-libs autoconf automake bash bind-libs bind-utils binutils bison blocxx blocxx-devel bzip2 cim-schema coreutils cpio cpp cracklib cvs cyrus-sasl db dbus-1 dbus-1-glib dejagnu diffutils docbook-xsl-stylesheets docbook_4 doxygen e2fsprogs expat expect file filesystem fillup findutils flex fop gawk gcc gcc-c++ gdbm gdbm-devel gettext gettext-devel glib2 glibc glibc-devel glibc-locale gnome-filesystem gpm grep groff gzip hal hwinfo hwinfo-devel info insserv java-1_4_2-sun jpackage-utils klogd less libacl libapr-util1 libapr1 libattr libcom_err libgcc libgcrypt libgpg-error libltdl libnscd libpng libstdc++ libstdc++-devel libtool libusb libvolume_id libxcrypt libxml2 libxslt libzio limal limal-devel limal-devtools limal-runlevel limal-runlevel-devel m4 make man mktemp module-init-tools ncurses ncurses-devel neon net-tools netcfg openldap2-client openslp openslp-devel openssl openssl-devel openwbem openwbem-devel pam pam-devel pam-modules patch pcre pcre-devel perl perl-Config-IniFiles perl-XML-Parser perl-XML-Writer permissions pkgconfig popt procinfo procps psmisc pwdutils rcs readline recode rpm sed strace subversion swig sysfsutils sysvinit tar tcl tcpd texinfo timezone udev unzip util-linux vim wireless-tools zlib zlib-devel -Name: sblim-cmpi-base-plus -BuildRequires: gcc sblim-cmpi-devel sblim-cmpiutil-devel pkgconfig -%if 0%{?suse_version} >= 100 -BuildRequires: gcc sblim-cmpi-devel sblim-cmpiutil-devel pkgconfig -%else -BuildRequires: gcc sblim-cmpi-devel sblim-cmpiutil-devel pkgconfig -%endif -%define tarname sblim-cmpi-base-plus +Name: sblim-cmpi-xenvm-builder +BuildRequires: gcc sblim-cmpi-devel sblim-cmpiutil-devel sqlite-devel pkgconfig +%define tarname sblim-cmpi-xenvm-builder URL: http://www.omc-project.org %define sblimprefix /usr # Increment the version every time the source code changes. Version: 1.0.0 -Release: 1.1 +Release: 1 Group: System/Management -Summary: Linux Instrumentation for Enterprise OpenWBEM providers -PreReq: /usr/bin/loadmof.sh, coreutils +Summary: Linux CIM providers for CMPI instrumentation of virtual machine creation. +PreReq: %{_datadir}/sblim-cmpi-base/provider-register.sh coreutils License: Other License(s), see package, Commercial # This is necessary to build the RPM as a non-root user. BuildRoot: %{_tmppath}/%{name}-%{version}-build # "yes" is the default, but we put it here explicitly to avoid someone # setting it to "no" -AutoReqProv: yes -Requires: openwbem, sblim-cmpiutil +AutoReqProv: yes +Requires: cim-server, cim-schema, sblim-cmpiutil sblim-cmpi-base xen-tools Source0: %{tarname}-%{version}.tar.gz #Source1: %{tarname}-mof.tar.bz2 %description -Linux providers for cmpi instrumentation of base operating system components -such as computer, system, operating system, and processes. These are -used by the OpenWBEM (Web-Based Enterprise Management) Common -Information Model (CIM) object broker. +Linux CIM providers for CMPI instrumentation of XEN virtual machine creation. - - Authors: -------- Jon Carey - Norm Paxton - Bart Whiteley %prep @@ -80,24 +68,23 @@ install -d $MOFDIR install mof/*.mof $MOFDIR/ install mof/*.registration $MOFDIR/ -#tar jxv -C $MOFDIR -f %{S:1} -#mv $MOFDIR/mof/* $MOFDIR/ -#rmdir $MOFDIR/mof +install mof/*-peg.reg $MOFDIR/ %{__rm} -f $RPM_BUILD_ROOT%{sblimprefix}/%_lib/cmpi/*.{a,la} +%{__rm} -f $RPM_BUILD_ROOT%{sblimprefix}/%_lib/libcmpixen*.{a,la} %clean %{__rm} -rf $RPM_BUILD_ROOT %pre # Conditional definition of schema and registration files -%define SCHEMA %{_datadir}/%{name}/linux-file-system-elements.mof %{_datadir}/%{name}/linux-initd.mof %{_datadir}/%{name}/linux-installed-os.mof %{_datadir}/%{name}/linux-logical-file.mof %{_datadir}/%{name}/linux-time-service.mof -%define REGISTRATION %{_datadir}/%{name}/Linux_BasePlus.registration +%define SCHEMA %{_datadir}/%{name}/XEN_VMBuilder.mof +%define REGISTRATION %{_datadir}/%{name}/XEN_VMBuilder.registration +%define PROVREG %{_datadir}/sblim-cmpi-base/provider-register.sh # If upgrading, deregister old version if [ $1 -gt 1 ] then - %{_datadir}/%{name}/provider-register.sh -d \ - -r %{REGISTRATION} -m %{SCHEMA} > /dev/null + %{PROVREG} -d -r %{REGISTRATION} -m %{SCHEMA} > /dev/null fi %post @@ -109,35 +96,27 @@ # load MOF MOFDIR=%{sblimprefix}/share/%{name} -/usr/share/sblim-cmpi-base/provider-register.sh -r %{REGISTRATION} -m %{SCHEMA} -#loadmof.sh -n root/cimv2 \ -# $MOFDIR/omc-base/omc-core.mof \ -# $MOFDIR/omc-base-providers/omc-base-providers.mof || /bin/true -#loadmof.sh -n omc/internal \ -# $MOFDIR/omc-base-providers/omc-provider-store.mof || /bin/true +%{PROVREG} -r %{REGISTRATION} -m %{SCHEMA} %preun -# if -e operation, not -U -#if [ "x$1" = "x0" ]; then -#if [ -x /usr/bin/rmmof.sh ]; then -# MOFDIR=%{sblimprefix}/share/mof/%{name} -# rmmof.sh -n root/cimv2 \ -# $MOFDIR/omc-base/omc-core.mof \ -# $MOFDIR/omc-base-providers/omc-base-providers.mof -# rmmof.sh -n omc/internal \ -# $MOFDIR/omc-base-providers/omc-provider-store.mof -#fi -#fi -/usr/share/sblim-cmpi-base/provider-register.sh -r %{REGISTRATION} -m %{SCHEMA} +%{PROVREG} -r %{REGISTRATION} -m %{SCHEMA} +# if -e operation, not -U +#if remove/not an upgrade, then deregister +if [ "x$1" = "x0" ]; then +%{PROVREG} -d -r %{_datadir}/%{name}/*.registration -m %{_datadir}/%{name}/*.mof +fi + %postun %run_ldconfig %files %defattr(-,root,root) %{sblimprefix}/%_lib/cmpi/*.so* +%{sblimprefix}/%_lib/libcmpixen*.so* + %dir %{sblimprefix}/share/%{name} %{sblimprefix}/share/%{name}/* -%changelog -n sblim-cmpi-base-plus +%changelog -n sblim-cmpi-xenvm-builder Modified: contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am =================================================================== --- contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am 2008-06-02 21:15:37 UTC (rev 634) +++ contrib/xen-vm-builder/trunk/src/providers/vm-builder/Makefile.am 2008-06-02 22:26:06 UTC (rev 635) @@ -17,6 +17,7 @@ ### libcmpixenvmbuilder_common_la_SOURCES = \ vmbuilder-util.c \ + vmbuilder-util.h \ vmbuilder-db.c \ vmbuilder-db.h This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-06-02 21:15:43
|
Revision: 634 http://omc.svn.sourceforge.net/omc/?rev=634&view=rev Author: jcarey Date: 2008-06-02 14:15:37 -0700 (Mon, 02 Jun 2008) Log Message: ----------- adjustments for RPM build... Modified Paths: -------------- contrib/xen-vm-builder/trunk/configure.ac Added Paths: ----------- contrib/xen-vm-builder/trunk/sblim-cmpi-xenvm-builder.spec Removed Paths: ------------- contrib/xen-vm-builder/trunk/omc-xenvm-builder.changes contrib/xen-vm-builder/trunk/omc-xenvm-builder.spec Modified: contrib/xen-vm-builder/trunk/configure.ac =================================================================== --- contrib/xen-vm-builder/trunk/configure.ac 2008-06-02 21:04:02 UTC (rev 633) +++ contrib/xen-vm-builder/trunk/configure.ac 2008-06-02 21:15:37 UTC (rev 634) @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) -AC_INIT(omc-xenvm-builder, 1.0.0) +AC_INIT(sblim-cmpi-xenvm-builder, 1.0.0) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src]) AC_CONFIG_HEADER([config.h]) @@ -55,18 +55,19 @@ [ --with-cmpi-include-dir=PATH Specify locaction of the CMPI header files ], [ if test "x$withval" != "xno" ; then - CXXFLAGS="$CXXFLAGS -I$withval" - CPPFLAGS="$CPPFLAGS -I$withval" - CFLAGS="$CFLAGS -I$withval" cmpiIncDir="$withval" fi ] ) if test "x$cmpiIncDir" == "x"; then - AC_MSG_ERROR(You must specify the location of the cmpi include files. Use the --with-cmpi-include-dir option) + cmpiIncDir="/usr/include/cmpi" fi +CXXFLAGS="$CXXFLAGS -I$cmpiIncDir" +CPPFLAGS="$CPPFLAGS -I$cmpiIncDir" +CFLAGS="$CFLAGS -I$cmpiIncDir" + debuglevel="0" ####################################################################### # Set the debug flag if specified Deleted: contrib/xen-vm-builder/trunk/omc-xenvm-builder.changes =================================================================== --- contrib/xen-vm-builder/trunk/omc-xenvm-builder.changes 2008-06-02 21:04:02 UTC (rev 633) +++ contrib/xen-vm-builder/trunk/omc-xenvm-builder.changes 2008-06-02 21:15:37 UTC (rev 634) @@ -1,5 +0,0 @@ -------------------------------------------------------------------- -Tue Apr 22 17:02:33 MDT 2008 - jc...@no... - -- Initial Revision - Deleted: contrib/xen-vm-builder/trunk/omc-xenvm-builder.spec =================================================================== --- contrib/xen-vm-builder/trunk/omc-xenvm-builder.spec 2008-06-02 21:04:02 UTC (rev 633) +++ contrib/xen-vm-builder/trunk/omc-xenvm-builder.spec 2008-06-02 21:15:37 UTC (rev 634) @@ -1,95 +0,0 @@ -# -# spec file for package omc-xenvm-builder -# -# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. -# This file and all modifications and additions to the pristine -# package are under the same license as the package itself. -# -# Please submit bugfixes or comments via http://bugs.opensuse.org/ -# - -# norootforbuild -%define omcprefix /usr - -Name: omc-xenvm-builder -BuildRequires: gcc gcc-c++ cimple-devel omccmpi-devel tog-pegasus-devel -URL: http://sourceforge.net/projects/omc -# Increment the version every time the source code changes. -Version: 1.0.0 -Release: 01 -Group: System/Management -Vendor: Novell, Inc. -Summary: Open-source implementation of CIM Providers for XEN VM builds. -PreReq: /usr/bin/peg-loadmof.sh -License: BSD -# This is necessary to build the RPM as a non-root user. -BuildRoot: %{_tmppath}/%{name}-%{version}-build -# "yes" is the default, but we put it here explicitly to avoid someone -# setting it to "no" -AutoReqProv: yes -Requires: tog-pegasus omccmpi omc-cmpibase -Requires: cim-schema >= 2.12 -Source0: omc-xenvm-builder-%{version}.tar.gz - -%description -Linux providers for instrumentation of base operating system components -such as computer, system, operating system, and processes. - -Authors: --------- - Jon Carey - -%prep -# Untar the sources. -%setup -n omc-xenvm-builder-%{version} - -%build -# If the LD_RUN_PATH environment variable is set at link time, -# it's value is embedded in the resulting binary. At run time, -# The binary will look here first for shared libraries. This way -# we link against the libraries we want at run-time even if libs -# by the same name are in /usr/lib or some other path in /etc/ld.so.conf -autoreconf --force --install -CFLAGS="$RPM_OPT_FLAGS -fstack-protector" \ -CXXFLAGS="$RPM_OPT_FLAGS -fstack-protector" \ -./configure --prefix=%{omcprefix} --libdir=%_libdir --with-cmpi-include-dir=/usr/include/Pegasus/Provider/CMPI -make %{?jobs:-j%jobs} - -%install -%{__rm} -rf $RPM_BUILD_ROOT -%{__mkdir} -p $RPM_BUILD_ROOT -# Tell 'make install' to install into the BuildRoot -make DESTDIR=$RPM_BUILD_ROOT install -MOFDIR=$RPM_BUILD_ROOT/%{omcprefix}/share/mof/%{name} -install -d $MOFDIR -install mof/*.{mof,reg} $MOFDIR -%{__rm} -f $RPM_BUILD_ROOT%{omcprefix}/%_lib/*.{a,la} -%{__rm} -f $RPM_BUILD_ROOT%{omcprefix}/%_lib/cmpi/*.{a,la} - -%clean -%{__rm} -rf $RPM_BUILD_ROOT - -%post -# Any RPM that installs a shared library into any directory -# listed in /etc/ld.so.conf (or into /usr/lib if it hasn't been -# fixed yet to install into the correct FHS compliant paths) -# must run ldconfig in its post install script. -%run_ldconfig -# load MOF -MOFDIR=%{omcprefix}/share/mof/%{name} -peg-loadmof.sh -n root/cimv2 $MOFDIR/omc-cmpi-base.mof || /bin/true -peg-loadmof.sh -n root/PG_InterOp $MOFDIR/*.reg || /bin/true - -%postun -%run_ldconfig - -%files -%defattr(-,root,root) -%{omcprefix}/%_lib/*.so* -%{omcprefix}/%_lib/cmpi/*.so* -%dir %{omcprefix}/share/mof/%{name} -%{omcprefix}/share/mof/%{name}/* - - -%changelog - Added: contrib/xen-vm-builder/trunk/sblim-cmpi-xenvm-builder.spec =================================================================== --- contrib/xen-vm-builder/trunk/sblim-cmpi-xenvm-builder.spec (rev 0) +++ contrib/xen-vm-builder/trunk/sblim-cmpi-xenvm-builder.spec 2008-06-02 21:15:37 UTC (rev 634) @@ -0,0 +1,143 @@ +# +# spec file for package sblim-cmpi-base-plus (Version 1.0.0) +# +# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. +# +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + +# norootforbuild +# usedforbuild aaa_base acl attr audit-libs autoconf automake bash bind-libs bind-utils binutils bison blocxx blocxx-devel bzip2 cim-schema coreutils cpio cpp cracklib cvs cyrus-sasl db dbus-1 dbus-1-glib dejagnu diffutils docbook-xsl-stylesheets docbook_4 doxygen e2fsprogs expat expect file filesystem fillup findutils flex fop gawk gcc gcc-c++ gdbm gdbm-devel gettext gettext-devel glib2 glibc glibc-devel glibc-locale gnome-filesystem gpm grep groff gzip hal hwinfo hwinfo-devel info insserv java-1_4_2-sun jpackage-utils klogd less libacl libapr-util1 libapr1 libattr libcom_err libgcc libgcrypt libgpg-error libltdl libnscd libpng libstdc++ libstdc++-devel libtool libusb libvolume_id libxcrypt libxml2 libxslt libzio limal limal-devel limal-devtools limal-runlevel limal-runlevel-devel m4 make man mktemp module-init-tools ncurses ncurses-devel neon net-tools netcfg openldap2-client openslp openslp-devel openssl openssl-devel openwbem openwbem-devel pam pam-devel pam-modules patch pcre pcre-devel perl perl-Config-IniFiles perl-XML-Parser perl-XML-Writer permissions pkgconfig popt procinfo procps psmisc pwdutils rcs readline recode rpm sed strace subversion swig sysfsutils sysvinit tar tcl tcpd texinfo timezone udev unzip util-linux vim wireless-tools zlib zlib-devel + +Name: sblim-cmpi-base-plus +BuildRequires: gcc sblim-cmpi-devel sblim-cmpiutil-devel pkgconfig +%if 0%{?suse_version} >= 100 +BuildRequires: gcc sblim-cmpi-devel sblim-cmpiutil-devel pkgconfig +%else +BuildRequires: gcc sblim-cmpi-devel sblim-cmpiutil-devel pkgconfig +%endif +%define tarname sblim-cmpi-base-plus +URL: http://www.omc-project.org +%define sblimprefix /usr + +# Increment the version every time the source code changes. +Version: 1.0.0 +Release: 1.1 +Group: System/Management +Summary: Linux Instrumentation for Enterprise OpenWBEM providers +PreReq: /usr/bin/loadmof.sh, coreutils +License: Other License(s), see package, Commercial + +# This is necessary to build the RPM as a non-root user. +BuildRoot: %{_tmppath}/%{name}-%{version}-build +# "yes" is the default, but we put it here explicitly to avoid someone +# setting it to "no" +AutoReqProv: yes +Requires: openwbem, sblim-cmpiutil +Source0: %{tarname}-%{version}.tar.gz +#Source1: %{tarname}-mof.tar.bz2 + +%description +Linux providers for cmpi instrumentation of base operating system components +such as computer, system, operating system, and processes. These are +used by the OpenWBEM (Web-Based Enterprise Management) Common +Information Model (CIM) object broker. + + + +Authors: +-------- + Jon Carey + Norm Paxton + Bart Whiteley + + +%prep +# Untar the sources. +%setup -n %{tarname}-%{version} + +%build +# If the LD_RUN_PATH environment variable is set at link time, +# it's value is embedded in the resulting binary. At run time, +# The binary will look here first for shared libraries. This way +# we link against the libraries we want at run-time even if libs +# by the same name are in /usr/lib or some other path in /etc/ld.so.conf +autoreconf --force --install +CFLAGS="$RPM_OPT_FLAGS -fstack-protector" \ +CXXFLAGS="$RPM_OPT_FLAGS -fstack-protector" \ +./configure --prefix=%{sblimprefix} \ + --libdir=%_libdir +make %{?jobs:-j%jobs} + +%install +%{__rm} -rf $RPM_BUILD_ROOT +%{__mkdir} -p $RPM_BUILD_ROOT +# Tell 'make install' to install into the BuildRoot +make DESTDIR=$RPM_BUILD_ROOT install +MOFDIR=$RPM_BUILD_ROOT/%{sblimprefix}/share/%{name} +install -d $MOFDIR +install mof/*.mof $MOFDIR/ +install mof/*.registration $MOFDIR/ +#tar jxv -C $MOFDIR -f %{S:1} +#mv $MOFDIR/mof/* $MOFDIR/ +#rmdir $MOFDIR/mof +%{__rm} -f $RPM_BUILD_ROOT%{sblimprefix}/%_lib/cmpi/*.{a,la} + +%clean +%{__rm} -rf $RPM_BUILD_ROOT + +%pre +# Conditional definition of schema and registration files +%define SCHEMA %{_datadir}/%{name}/linux-file-system-elements.mof %{_datadir}/%{name}/linux-initd.mof %{_datadir}/%{name}/linux-installed-os.mof %{_datadir}/%{name}/linux-logical-file.mof %{_datadir}/%{name}/linux-time-service.mof +%define REGISTRATION %{_datadir}/%{name}/Linux_BasePlus.registration + +# If upgrading, deregister old version +if [ $1 -gt 1 ] +then + %{_datadir}/%{name}/provider-register.sh -d \ + -r %{REGISTRATION} -m %{SCHEMA} > /dev/null +fi + +%post +# Any RPM that installs a shared library into any directory +# listed in /etc/ld.so.conf (or into /usr/lib if it hasn't been +# fixed yet to install into the correct FHS compliant paths) +# must run ldconfig in its post install script. +%run_ldconfig +# load MOF +MOFDIR=%{sblimprefix}/share/%{name} + +/usr/share/sblim-cmpi-base/provider-register.sh -r %{REGISTRATION} -m %{SCHEMA} +#loadmof.sh -n root/cimv2 \ +# $MOFDIR/omc-base/omc-core.mof \ +# $MOFDIR/omc-base-providers/omc-base-providers.mof || /bin/true +#loadmof.sh -n omc/internal \ +# $MOFDIR/omc-base-providers/omc-provider-store.mof || /bin/true + +%preun +# if -e operation, not -U +#if [ "x$1" = "x0" ]; then +#if [ -x /usr/bin/rmmof.sh ]; then +# MOFDIR=%{sblimprefix}/share/mof/%{name} +# rmmof.sh -n root/cimv2 \ +# $MOFDIR/omc-base/omc-core.mof \ +# $MOFDIR/omc-base-providers/omc-base-providers.mof +# rmmof.sh -n omc/internal \ +# $MOFDIR/omc-base-providers/omc-provider-store.mof +#fi +#fi +/usr/share/sblim-cmpi-base/provider-register.sh -r %{REGISTRATION} -m %{SCHEMA} + +%postun +%run_ldconfig + +%files +%defattr(-,root,root) +%{sblimprefix}/%_lib/cmpi/*.so* +%dir %{sblimprefix}/share/%{name} +%{sblimprefix}/share/%{name}/* + +%changelog -n sblim-cmpi-base-plus + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jc...@us...> - 2008-06-02 21:03:59
|
Revision: 633 http://omc.svn.sourceforge.net/omc/?rev=633&view=rev Author: jcarey Date: 2008-06-02 14:04:02 -0700 (Mon, 02 Jun 2008) Log Message: ----------- Additional dist files Modified Paths: -------------- contrib/xen-vm-builder/trunk/mof/Makefile.am Modified: contrib/xen-vm-builder/trunk/mof/Makefile.am =================================================================== --- contrib/xen-vm-builder/trunk/mof/Makefile.am 2008-06-02 20:19:18 UTC (rev 632) +++ contrib/xen-vm-builder/trunk/mof/Makefile.am 2008-06-02 21:04:02 UTC (rev 633) @@ -11,5 +11,5 @@ builder-service-peg.reg \ owning-job-peg.reg \ settings-define-build-peg.reg \ - vmcreation-data-peg.reg - + vmcreation-data-peg.reg \ + XEN_VMBuilder.registration This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |