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
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(2) |
2
|
|
3
|
4
|
5
(3) |
6
(4) |
7
(13) |
8
(4) |
9
|
|
10
|
11
(1) |
12
(5) |
13
(11) |
14
(4) |
15
(2) |
16
|
|
17
|
18
(3) |
19
(13) |
20
(6) |
21
(1) |
22
(1) |
23
|
|
24
|
25
|
26
(1) |
27
(4) |
28
(1) |
29
(7) |
30
(1) |
|
31
|
|
|
|
|
|
|
|
From: <mik...@us...> - 2008-08-30 00:02:36
|
Revision: 894
http://omc.svn.sourceforge.net/omc/?rev=894&view=rev
Author: mike-brasher
Date: 2008-08-30 00:02:46 +0000 (Sat, 30 Aug 2008)
Log Message:
-----------
Updated install script.
Modified Paths:
--------------
cmpi-bindings/trunk/test/python/setup.sh
Modified: cmpi-bindings/trunk/test/python/setup.sh
===================================================================
--- cmpi-bindings/trunk/test/python/setup.sh 2008-08-29 23:46:27 UTC (rev 893)
+++ cmpi-bindings/trunk/test/python/setup.sh 2008-08-30 00:02:46 UTC (rev 894)
@@ -15,8 +15,10 @@
exit 1
fi
+ echo "rm -f $dir/$fn"
rm -f $dir/$fn
- ln -s $fn $dir
+ echo "ln -s `pwd`/$fn $dir"
+ ln -s `pwd`/$fn $dir
}
__install TestMethod.mof /var/lib/sfcb/stage/mofs/root/cimv2
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-29 23:46:17
|
Revision: 893
http://omc.svn.sourceforge.net/omc/?rev=893&view=rev
Author: mike-brasher
Date: 2008-08-29 23:46:27 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
New files to setup providers registraiton etc.
Added Paths:
-----------
cmpi-bindings/trunk/test/python/setup.sh
Added: cmpi-bindings/trunk/test/python/setup.sh
===================================================================
--- cmpi-bindings/trunk/test/python/setup.sh (rev 0)
+++ cmpi-bindings/trunk/test/python/setup.sh 2008-08-29 23:46:27 UTC (rev 893)
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+function __install {
+
+ fn=$1
+ dir=$2
+
+ if [ ! -f "$fn" ]; then
+ echo "no such file: $fn"
+ exit 1
+ fi
+
+ if [ ! -d "$dir" ]; then
+ echo "no such directory: $dir"
+ exit 1
+ fi
+
+ rm -f $dir/$fn
+ ln -s $fn $dir
+}
+
+__install TestMethod.mof /var/lib/sfcb/stage/mofs/root/cimv2
+__install TestAssoc.mof /var/lib/sfcb/stage/mofs/root/cimv2
+__install TestAtom.mof /var/lib/sfcb/stage/mofs/root/cimv2
+
+__install TestMethod.py /usr/lib/pycim
+__install TestAssocProvider.py /usr/lib/pycim
+__install TestAtomProvider.py /usr/lib/pycim
+
+__install TestAssocProvider.sfcb.reg /var/lib/sfcb/stage/regs
+__install TestMethod.sfcb.reg /var/lib/sfcb/stage/regs
+__install TestAtomProvider.sfcb.reg /var/lib/sfcb/stage/regs
+
+sfcbrepos -f
Property changes on: cmpi-bindings/trunk/test/python/setup.sh
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-08-29 20:04:03
|
Revision: 892
http://omc.svn.sourceforge.net/omc/?rev=892&view=rev
Author: bartw
Date: 2008-08-29 20:04:11 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
do not install test stuff
Modified Paths:
--------------
cmpi-bindings/trunk/CMakeLists.txt
cmpi-bindings/trunk/mof/CMakeLists.txt
Modified: cmpi-bindings/trunk/CMakeLists.txt
===================================================================
--- cmpi-bindings/trunk/CMakeLists.txt 2008-08-29 20:03:53 UTC (rev 891)
+++ cmpi-bindings/trunk/CMakeLists.txt 2008-08-29 20:04:11 UTC (rev 892)
@@ -86,7 +86,6 @@
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
Modified: cmpi-bindings/trunk/mof/CMakeLists.txt
===================================================================
--- cmpi-bindings/trunk/mof/CMakeLists.txt 2008-08-29 20:03:53 UTC (rev 891)
+++ cmpi-bindings/trunk/mof/CMakeLists.txt 2008-08-29 20:04:11 UTC (rev 892)
@@ -1,13 +1,13 @@
#
#
#
-SET( CMPI_MOF_DIR /var/lib/sfcb/stage/mofs )
-SET( CMPI_REG_DIR /var/lib/sfcb/stage/regs )
+#SET( CMPI_MOF_DIR /var/lib/sfcb/stage/mofs )
+#SET( CMPI_REG_DIR /var/lib/sfcb/stage/regs )
-INSTALL(FILES Swig_Generic.mof DESTINATION ${CMPI_MOF_DIR}/root/cimv2)
-INSTALL(FILES Py_UnixProcess.mof DESTINATION ${CMPI_MOF_DIR}/root/cimv2)
-INSTALL(FILES Swig_Generic.reg DESTINATION ${CMPI_REG_DIR})
-INSTALL(FILES Py_UnixProcess.reg DESTINATION ${CMPI_REG_DIR})
-INSTALL(CODE "MESSAGE(\"Now run 'sfcbrepos -f'.\")")
+#INSTALL(FILES Swig_Generic.mof DESTINATION ${CMPI_MOF_DIR}/root/cimv2)
+#INSTALL(FILES Py_UnixProcess.mof DESTINATION ${CMPI_MOF_DIR}/root/cimv2)
+#INSTALL(FILES Swig_Generic.reg DESTINATION ${CMPI_REG_DIR})
+#INSTALL(FILES Py_UnixProcess.reg DESTINATION ${CMPI_REG_DIR})
+#INSTALL(CODE "MESSAGE(\"Now run 'sfcbrepos -f'.\")")
#INSTALL(SCRIPT "sfcbrepos -f")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-08-29 20:03:43
|
Revision: 891
http://omc.svn.sourceforge.net/omc/?rev=891&view=rev
Author: bartw
Date: 2008-08-29 20:03:53 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
working on concurrency issues
Modified Paths:
--------------
cmpi-bindings/trunk/src/cmpi_provider_python.c
cmpi-bindings/trunk/swig/cmpi_types.i
cmpi-bindings/trunk/swig/python/CMakeLists.txt
Modified: cmpi-bindings/trunk/src/cmpi_provider_python.c
===================================================================
--- cmpi-bindings/trunk/src/cmpi_provider_python.c 2008-08-29 17:43:11 UTC (rev 890)
+++ cmpi-bindings/trunk/src/cmpi_provider_python.c 2008-08-29 20:03:53 UTC (rev 891)
@@ -94,6 +94,7 @@
return str;
}
+
static int PyInitialize(PyProviderMIHandle* hdl, CMPIStatus* st);
#define PY_CMPI_INIT { if (((PyProviderMIHandle*)(self->hdl))->pyMod == NULL) if (PyInitialize(((PyProviderMIHandle*)(self->hdl)), &status) != 0) return status; }
@@ -103,11 +104,14 @@
{
Py_RETURN_NONE;
}
- PyObject* pl = PyList_New(0);
+ PyObject* pl;
+ //SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+ pl = PyList_New(0);
for (; *cplist != NULL; ++cplist)
{
PyList_Append(pl, PyString_FromString(*cplist));
}
+ //SWIG_PYTHON_THREAD_END_BLOCK;
return pl;
}
@@ -129,6 +133,7 @@
PyObject *type, *value, *traceback;
_SBLIM_TRACE(1, ("PyErr_Occurred() %d", PyErr_Occurred()));
+ //SWIG_PYTHON_THREAD_BEGIN_BLOCK;
PyErr_Fetch(&type, &value, &traceback);
_SBLIM_TRACE(1,("** type %p, value %p, traceback %p", type, value, traceback));
PyErr_Print();
@@ -188,6 +193,7 @@
cleanup:
PyErr_Restore(type, value, traceback);
+ //SWIG_PYTHON_THREAD_END_BLOCK;
if (rv == NULL)
{
@@ -217,6 +223,7 @@
PyObject *pyargs = NULL;
PyObject *pyfunc = NULL;
PyObject *prv = NULL;
+ //SWIG_PYTHON_THREAD_BEGIN_BLOCK;
pyargs = PyTuple_New(nargs);
pyfunc = PyObject_GetAttrString(hdl->pyMod, opname);
if (pyfunc == NULL)
@@ -310,6 +317,7 @@
Py_DecRef(pyargs);
Py_DecRef(pyfunc);
Py_DecRef(prv);
+ //SWIG_PYTHON_THREAD_END_BLOCK;
return rc;
}
@@ -327,8 +335,11 @@
_SBLIM_TRACE(1,("Cleanup() called"));
+ //SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_DecRef(_PYPROVMOD);
Py_Finalize();
+ // TODO should release come before finalize?
+ //SWIG_PYTHON_THREAD_END_BLOCK;
_SBLIM_TRACE(1,("Cleanup(Python) called"));
if (miHdl != NULL)
Modified: cmpi-bindings/trunk/swig/cmpi_types.i
===================================================================
--- cmpi-bindings/trunk/swig/cmpi_types.i 2008-08-29 17:43:11 UTC (rev 890)
+++ cmpi-bindings/trunk/swig/cmpi_types.i 2008-08-29 20:03:53 UTC (rev 891)
@@ -626,9 +626,11 @@
#TODO memory leak alert (clone_data)
PyObject* pydata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 0);
+ SWIG_PYTHON_THREAD_BEGIN_BLOCK;
PyObject* pl = PyTuple_New(2);
PyTuple_SetItem(pl, 0, pydata);
PyTuple_SetItem(pl, 1, PyString_FromString(CMGetCharPtr(s)));
+ SWIG_PYTHON_THREAD_END_BLOCK;
return pl;
#endif
}
@@ -722,9 +724,11 @@
#TODO memory leak alert (clone_data)
PyObject* pydata = SWIG_NewPointerObj((void*) clone_data(&data), SWIGTYPE_p__CMPIData, 0);
+ SWIG_PYTHON_THREAD_BEGIN_BLOCK;
PyObject* pl = PyTuple_New(2);
PyTuple_SetItem(pl, 0, pydata);
PyTuple_SetItem(pl, 1, PyString_FromString(CMGetCharPtr(s)));
+ SWIG_PYTHON_THREAD_END_BLOCK;
return pl;
#endif
}
Modified: cmpi-bindings/trunk/swig/python/CMakeLists.txt
===================================================================
--- cmpi-bindings/trunk/swig/python/CMakeLists.txt 2008-08-29 17:43:11 UTC (rev 890)
+++ cmpi-bindings/trunk/swig/python/CMakeLists.txt 2008-08-29 20:03:53 UTC (rev 891)
@@ -23,7 +23,7 @@
ADD_CUSTOM_COMMAND (
OUTPUT ${SWIG_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for Python ..."
- COMMAND ${SWIG_EXECUTABLE} -python -features autodoc -o ${SWIG_OUTPUT} -I${CMPI_INCLUDE_DIR} ${SWIG_INPUT}
+ COMMAND ${SWIG_EXECUTABLE} -python -threads -features autodoc -o ${SWIG_OUTPUT} -I${CMPI_INCLUDE_DIR} ${SWIG_INPUT}
COMMAND ${CMAKE_COMMAND} -E echo "Done."
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i
@@ -57,4 +57,4 @@
# pycmpi_provider.py: provider implementation
#
INSTALL(FILES pycmpi_provider.py DESTINATION ${PYTHON_LIB_DIR}/site-packages )
-INSTALL(FILES Py_UnixProcessProvider.py DESTINATION /usr/lib/pycim )
+#INSTALL(FILES Py_UnixProcessProvider.py DESTINATION /usr/lib/pycim )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-29 17:43:01
|
Revision: 890
http://omc.svn.sourceforge.net/omc/?rev=890&view=rev
Author: mike-brasher
Date: 2008-08-29 17:43:11 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
Fixed problem with failing cmpi.CMPIBroker() (needs to return _BROKER).
Modified Paths:
--------------
cmpi-bindings/trunk/swig/cmpi_callbacks.i
cmpi-bindings/trunk/swig/python/pycmpi_provider.py
Modified: cmpi-bindings/trunk/swig/cmpi_callbacks.i
===================================================================
--- cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-08-29 16:15:57 UTC (rev 889)
+++ cmpi-bindings/trunk/swig/cmpi_callbacks.i 2008-08-29 17:43:11 UTC (rev 890)
@@ -9,7 +9,7 @@
%extend CMPIBroker {
- CMPIBroker() { }
+ CMPIBroker() { return _BROKER; }
~CMPIBroker() { }
void LogMessage(int severity, const char *id, const char *text) {
CMLogMessage(_BROKER, severity, id, text, NULL);
@@ -78,4 +78,4 @@
CMPIData getProperty(const CMPIContext * ctx, const CMPIObjectPath *op, const char *name) {
return CBGetProperty(_BROKER, ctx, op, name, NULL);
}
-}
\ No newline at end of file
+}
Modified: cmpi-bindings/trunk/swig/python/pycmpi_provider.py
===================================================================
--- cmpi-bindings/trunk/swig/python/pycmpi_provider.py 2008-08-29 16:15:57 UTC (rev 889)
+++ cmpi-bindings/trunk/swig/python/pycmpi_provider.py 2008-08-29 17:43:11 UTC (rev 890)
@@ -112,6 +112,7 @@
def __init__(self, miname, broker):
print 'called CMPIProvider(', miname, ',', broker, ')'
+ broker = cmpi.CMPIBroker()
self.broker = broker
self.miname = miname
self.env = ProviderEnvironment(self.broker)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-08-29 16:15:48
|
Revision: 889
http://omc.svn.sourceforge.net/omc/?rev=889&view=rev
Author: bartw
Date: 2008-08-29 16:15:57 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
fixed exec_query to return not_supported to the CIMOM will fall back to enumInstances and do the filtering.
Modified Paths:
--------------
cmpi-bindings/trunk/swig/python/pycmpi_provider.py
Modified: cmpi-bindings/trunk/swig/python/pycmpi_provider.py
===================================================================
--- cmpi-bindings/trunk/swig/python/pycmpi_provider.py 2008-08-29 00:59:51 UTC (rev 888)
+++ cmpi-bindings/trunk/swig/python/pycmpi_provider.py 2008-08-29 16:15:57 UTC (rev 889)
@@ -205,7 +205,7 @@
def exec_query(self, ctx, rslt, objname, query, lang):
- pass
+ return (pywbem.CIM_ERR_NOT_SUPPORTED, '')
def associator_names(self, ctx, rslt, objName, assocClass, resultClass,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-29 00:59:40
|
Revision: 888
http://omc.svn.sourceforge.net/omc/?rev=888&view=rev
Author: mike-brasher
Date: 2008-08-29 00:59:51 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
Fixed crash in _Broker_name() swig function caused by creating explicit
CMPIBroker() python object.
Modified Paths:
--------------
cmpi-bindings/trunk/swig/python/CMakeLists.txt
cmpi-bindings/trunk/swig/python/pycmpi_provider.py
Modified: cmpi-bindings/trunk/swig/python/CMakeLists.txt
===================================================================
--- cmpi-bindings/trunk/swig/python/CMakeLists.txt 2008-08-29 00:55:28 UTC (rev 887)
+++ cmpi-bindings/trunk/swig/python/CMakeLists.txt 2008-08-29 00:59:51 UTC (rev 888)
@@ -45,7 +45,7 @@
SET( NAME pyCmpiProvider )
ADD_LIBRARY( ${NAME} SHARED ${SWIG_OUTPUT})
#TARGET_LINK_LIBRARIES( ${NAME} ${PYTHON_LIBRARIES} )
-TARGET_LINK_LIBRARIES( ${NAME} python2.4 )
+TARGET_LINK_LIBRARIES( ${NAME} python2.5 )
TARGET_LINK_LIBRARIES( ${NAME} m )
TARGET_LINK_LIBRARIES( ${NAME} util )
Modified: cmpi-bindings/trunk/swig/python/pycmpi_provider.py
===================================================================
--- cmpi-bindings/trunk/swig/python/pycmpi_provider.py 2008-08-29 00:55:28 UTC (rev 887)
+++ cmpi-bindings/trunk/swig/python/pycmpi_provider.py 2008-08-29 00:59:51 UTC (rev 888)
@@ -117,7 +117,6 @@
self.env = ProviderEnvironment(self.broker)
self.proxy = ProviderProxy(self.env,
'/usr/lib/pycim/'+miname+'.py')
- broker = cmpi.CMPIBroker()
print '*** broker.name()', broker.name()
print '*** broker.capabilities()', broker.capabilities()
print '*** broker.version()', broker.version()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-29 00:55:18
|
Revision: 887
http://omc.svn.sourceforge.net/omc/?rev=887&view=rev
Author: mike-brasher
Date: 2008-08-29 00:55:28 +0000 (Fri, 29 Aug 2008)
Log Message:
-----------
Development helper script to register and copy everything into place.
Added Paths:
-----------
cmpi-bindings/trunk/register.sh
Added: cmpi-bindings/trunk/register.sh
===================================================================
--- cmpi-bindings/trunk/register.sh (rev 0)
+++ cmpi-bindings/trunk/register.sh 2008-08-29 00:55:28 UTC (rev 887)
@@ -0,0 +1,7 @@
+#!/bin/sh
+cp ./build/swig/python/cmpi.py ./swig/python/pycmpi_provider.py /usr/lib64/python2.5/site-packages
+cp ./mof/Py_UnixProcess.reg /var/lib/sfcb/stage/regs
+cp ./mof/Py_UnixProcess.mof /var/lib/sfcb/stage/mofs/root/cimv2
+cp ./build/swig/python/libpyCmpiProvider.so /usr/lib64/
+cp ./swig/python/Py_UnixProcessProvider.py /usr/lib/pycim
+sfcbrepos -f
Property changes on: cmpi-bindings/trunk/register.sh
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <np...@us...> - 2008-08-28 19:53:39
|
Revision: 886
http://omc.svn.sourceforge.net/omc/?rev=886&view=rev
Author: npaxton
Date: 2008-08-28 19:53:49 +0000 (Thu, 28 Aug 2008)
Log Message:
-----------
create a providerMIHandle for each provider module/type
Modified Paths:
--------------
cmpi-bindings/trunk/src/cmpi_provider_python.c
Modified: cmpi-bindings/trunk/src/cmpi_provider_python.c
===================================================================
--- cmpi-bindings/trunk/src/cmpi_provider_python.c 2008-08-27 19:57:38 UTC (rev 885)
+++ cmpi-bindings/trunk/src/cmpi_provider_python.c 2008-08-28 19:53:49 UTC (rev 886)
@@ -62,9 +62,16 @@
/* 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* _MINAME = NULL;
PyObject* _PYPROVMOD = NULL;
+
+typedef struct __PyProviderMIHandle
+{
+ char *miName;
+ PyObject *pyMod;
+} PyProviderMIHandle;
+
static char* fmtstr(const char* fmt, ...)
{
va_list ap;
@@ -87,8 +94,8 @@
return str;
}
-static int PyInitialize(PyObject** self, CMPIStatus* st);
-#define PY_CMPI_INIT { if (self->hdl == NULL) if (PyInitialize((PyObject**)&(self->hdl), &status) != 0) return status; }
+static int PyInitialize(PyProviderMIHandle* hdl, CMPIStatus* st);
+#define PY_CMPI_INIT { if (((PyProviderMIHandle*)(self->hdl))->pyMod == NULL) if (PyInitialize(((PyProviderMIHandle*)(self->hdl)), &status) != 0) return status; }
static PyObject* proplist2py(const char** cplist)
{
@@ -202,7 +209,7 @@
static int
-call_py_provider(PyObject* hdl, CMPIStatus* st,
+call_py_provider(PyProviderMIHandle* hdl, CMPIStatus* st,
const char* opname, int nargs, ...)
{
int rc = 1;
@@ -211,7 +218,7 @@
PyObject *pyfunc = NULL;
PyObject *prv = NULL;
pyargs = PyTuple_New(nargs);
- pyfunc = PyObject_GetAttrString(hdl, opname);
+ pyfunc = PyObject_GetAttrString(hdl->pyMod, opname);
if (pyfunc == NULL)
{
PyErr_Print();
@@ -312,21 +319,24 @@
// ----------------------------------------------------------------------------
static CMPIStatus Cleanup(
+ PyProviderMIHandle * miHdl,
const CMPIContext * context,
CMPIBoolean terminating)
{
- CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */
+ CMPIStatus status = {CMPI_RC_OK, NULL}; /* Return status of CIM operations. */
- _SBLIM_TRACE(1,("Cleanup() called"));
+ _SBLIM_TRACE(1,("Cleanup() called"));
- Py_DecRef(_PYPROVMOD);
- Py_Finalize();
+ Py_DecRef(_PYPROVMOD);
+ Py_Finalize();
_SBLIM_TRACE(1,("Cleanup(Python) called"));
- if (_MINAME != NULL)
+ if (miHdl != NULL)
{
- free(_MINAME);
- _MINAME = NULL;
+ _SBLIM_TRACE(1,("\n>>>>> Cleanup(Python) called, freeing PyProviderMIHandle (%s)\n", miHdl->miName));
+ free(miHdl->miName);
+ free(miHdl);
+ miHdl = NULL;
}
/* Finished. */
@@ -340,7 +350,7 @@
const CMPIContext * context,
CMPIBoolean terminating)
{
- return Cleanup(context, terminating);
+ return Cleanup((PyProviderMIHandle*)self->hdl, context, terminating);
}
static CMPIStatus AssocCleanup(
@@ -348,7 +358,7 @@
const CMPIContext * context,
CMPIBoolean terminating)
{
- return Cleanup(context, terminating);
+ return Cleanup((PyProviderMIHandle*)self->hdl, context, terminating);
}
static CMPIStatus MethodCleanup(
@@ -356,7 +366,7 @@
const CMPIContext * context,
CMPIBoolean terminating)
{
- return Cleanup(context, terminating);
+ return Cleanup((PyProviderMIHandle*)self->hdl, context, terminating);
}
static CMPIStatus IndicationCleanup(
@@ -364,7 +374,7 @@
const CMPIContext * context,
CMPIBoolean terminating)
{
- return Cleanup(context, terminating);
+ return Cleanup((PyProviderMIHandle*)self->hdl, context, terminating);
}
// ----------------------------------------------------------------------------
@@ -389,7 +399,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, "enum_instance_names", 3,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "enum_instance_names", 3,
pycontext,
pyresult,
pyreference);
@@ -423,7 +433,7 @@
PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0);
PyObject *pyproperties = proplist2py(properties);
- call_py_provider((PyObject*)self->hdl, &status, "enum_instances", 4,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "enum_instances", 4,
pycontext,
pyresult,
pyreference,
@@ -457,7 +467,7 @@
PyObject *pyreference = SWIG_NewPointerObj((void*) reference, SWIGTYPE_p__CMPIObjectPath, 0);
PyObject *pyproperties = proplist2py(properties);
- call_py_provider((PyObject*)self->hdl, &status, "get_instance", 4,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "get_instance", 4,
pycontext,
pyresult,
pyreference,
@@ -493,7 +503,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, "create_instance", 4,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "create_instance", 4,
pycontext,
pyresult,
pyreference,
@@ -535,7 +545,7 @@
PyObject *pynewinst = SWIG_NewPointerObj((void*) newinstance, SWIGTYPE_p__CMPIInstance, 0);
PyObject *plist = proplist2py(properties);
- call_py_provider((PyObject*)self->hdl, &status, "set_instance", 5,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "set_instance", 5,
pycontext,
pyresult,
pyreference,
@@ -568,7 +578,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, "delete_instance", 3,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "delete_instance", 3,
pycontext,
pyresult,
pyreference);
@@ -603,7 +613,7 @@
PyObject *pyquery = PyString_FromString(query);
PyObject *pylang = PyString_FromString(language);
- call_py_provider((PyObject*)self->hdl, &status, "exec_query", 5,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "exec_query", 5,
pycontext,
pyresult,
pyreference,
@@ -623,7 +633,7 @@
#define PY_CMPI_SETFAIL(msgstr) {if (st != NULL) st->rc = CMPI_RC_ERR_FAILED; st->msg = msgstr; }
-static int PyInitialize(PyObject** self, CMPIStatus* st)
+static int PyInitialize(PyProviderMIHandle* hdl, CMPIStatus* st)
{
int rc = 0;
SWIGEXPORT void SWIG_init(void);
@@ -653,7 +663,8 @@
}
PyObject* broker = SWIG_NewPointerObj((void*) _BROKER, SWIGTYPE_p__CMPIBroker, 0);
PyObject* args = PyTuple_New(2);
- PyTuple_SetItem(args, 0, PyString_FromString(_MINAME));
+ _SBLIM_TRACE(1,("\n>>>>> PyInitialize(Python) called, MINAME=%s\n", hdl->miName));
+ PyTuple_SetItem(args, 0, PyString_FromString(hdl->miName));
PyTuple_SetItem(args, 1, broker);
PyObject* provinst = PyObject_CallObject(provclass, args);
Py_DecRef(args);
@@ -664,7 +675,7 @@
return -1;
}
- *self = provinst;
+ hdl->pyMod = provinst;
_SBLIM_TRACE(1,("PyInitialize() succeeded"));
return 0;
@@ -715,7 +726,7 @@
pyresultRole = PyString_FromString(resultRole);
}
- call_py_provider((PyObject*)self->hdl, &status, "associator_names", 7,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "associator_names", 7,
pyctx,
pyrslt,
pyobjName,
@@ -775,7 +786,7 @@
pyresultRole = PyString_FromString(resultRole);
}
- call_py_provider((PyObject*)self->hdl, &status, "associators", 8,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "associators", 8,
pyctx,
pyrslt,
pyobjName,
@@ -822,7 +833,7 @@
pyresultClass = PyString_FromString(resultClass);
}
- call_py_provider((PyObject*)self->hdl, &status, "reference_names", 5,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "reference_names", 5,
pyctx,
pyrslt,
pyobjName,
@@ -869,7 +880,7 @@
}
PyObject *pyprops = proplist2py(properties);
- call_py_provider((PyObject*)self->hdl, &status, "references", 6,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "references", 6,
pyctx,
pyrslt,
pyobjName,
@@ -906,7 +917,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, "invoke_method", 6,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "invoke_method", 6,
pyctx,
pyrslt,
pyobjName,
@@ -941,7 +952,7 @@
PyObject *pyclassName = PyString_FromString(className);
PyObject *pyowner = PyString_FromString(owner);
- call_py_provider((PyObject*)self->hdl, &status, "authorize_filter", 5,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "authorize_filter", 5,
pyctx,
pyfilter,
pyclassName,
@@ -975,7 +986,7 @@
PyObject *pyclassName = PyString_FromString(className);
PyObject *pyfirstActivation = PyBool_FromLong(firstActivation);
- call_py_provider((PyObject*)self->hdl, &status, "activate_filter", 5,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "activate_filter", 5,
pyctx,
pyfilter,
pyclassName,
@@ -1009,7 +1020,7 @@
PyObject *pyclassName = PyString_FromString(className);
PyObject *pylastActivation = PyBool_FromLong(lastActivation);
- call_py_provider((PyObject*)self->hdl, &status, "deactivate_filter", 5,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "deactivate_filter", 5,
pyctx,
pyfilter,
pyclassName,
@@ -1047,7 +1058,7 @@
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,
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "must_poll", 4,
pyctx,
//pyrslt,
pyfilter,
@@ -1074,7 +1085,7 @@
PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0);
- call_py_provider((PyObject*)self->hdl, &status, "enable_indications", 1, pyctx);
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "enable_indications", 1, pyctx);
/* Finished. */
exit:
@@ -1096,7 +1107,7 @@
PyObject *pyctx = SWIG_NewPointerObj((void*) ctx, SWIGTYPE_p__CMPIContext, 0);
- call_py_provider((PyObject*)self->hdl, &status, "disable_indications", 1, pyctx);
+ call_py_provider((PyProviderMIHandle*)self->hdl, &status, "disable_indications", 1, pyctx);
/* Finished. */
exit:
@@ -1168,8 +1179,9 @@
static void createInit(const CMPIBroker* broker,
const CMPIContext* context, const char* miname, CMPIStatus* st)
{
+ _SBLIM_TRACE(1,("\n>>>>> createInit(Python) called, miname= %s (ctx=%p)\n", miname, context));
_BROKER = broker;
- _MINAME = strdup(miname);
+ //_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
@@ -1182,12 +1194,18 @@
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__, \
- }; \
+ PyProviderMIHandle *hdl = (PyProviderMIHandle*)malloc(sizeof(PyProviderMIHandle)); \
+ if (hdl) { \
+ hdl->pyMod = NULL; \
+ hdl->miName = strdup(miname); \
+ } \
+ CMPI##ptype##MI *mi= (CMPI##ptype##MI*)malloc(sizeof(CMPI##ptype##MI)); \
+ if (mi) { \
+ mi->hdl = hdl; \
+ mi->ft = &ptype##MIFT__; \
+ } \
createInit(broker, context, miname, st); \
- return &mi; \
+ return mi; \
}
SWIG_CMPI_MI_FACTORY(Instance)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <np...@us...> - 2008-08-27 19:57:28
|
Revision: 885
http://omc.svn.sourceforge.net/omc/?rev=885&view=rev
Author: npaxton
Date: 2008-08-27 19:57:38 +0000 (Wed, 27 Aug 2008)
Log Message:
-----------
separate out cmpi_provider.c into type/language specific files for python and ruby
Added Paths:
-----------
cmpi-bindings/trunk/src/cmpi_provider_python.c
cmpi-bindings/trunk/src/cmpi_provider_ruby.c
Added: cmpi-bindings/trunk/src/cmpi_provider_python.c
===================================================================
--- cmpi-bindings/trunk/src/cmpi_provider_python.c (rev 0)
+++ cmpi-bindings/trunk/src/cmpi_provider_python.c 2008-08-27 19:57:38 UTC (rev 885)
@@ -0,0 +1,1197 @@
+/*****************************************************************************
+* 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.
+*****************************************************************************/
+
+static char _CLASSNAME[] = "CmpiInstanceSwig";
+
+#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>
+
+#include <Python.h>
+
+/* 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;
+PyObject* _PYPROVMOD = 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;
+}
+
+static int PyInitialize(PyObject** self, CMPIStatus* st);
+#define PY_CMPI_INIT { if (self->hdl == NULL) if (PyInitialize((PyObject**)&(self->hdl), &status) != 0) return status; }
+
+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 *args = NULL;
+ PyObject *newstr = NULL;
+ PyObject *func = NULL;
+ CMPIString* rv = NULL;
+
+ PyObject *type, *value, *traceback;
+ _SBLIM_TRACE(1, ("PyErr_Occurred() %d", PyErr_Occurred()));
+ PyErr_Fetch(&type, &value, &traceback);
+ _SBLIM_TRACE(1,("** type %p, value %p, traceback %p", type, value, traceback));
+ PyErr_Print();
+ PyErr_Clear();
+ PyErr_NormalizeException(&type, &value, &traceback);
+ _SBLIM_TRACE(1,("** type %p, value %p, traceback %p", 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 ? type : Py_None,
+ value ? value : Py_None,
+ traceback ? traceback : Py_None,
+ Py_None,
+ iostr);
+
+ if (obstr==NULL)
+ {
+ PyErr_Print();
+ 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");
+
+ args = PyTuple_New(2);
+ PyTuple_SetItem(args, 0, PyString_FromString("\n"));
+ PyTuple_SetItem(args, 1, PyString_FromString("<br>"));
+
+ func = PyObject_GetAttrString(obstr, "replace");
+ //newstr = PyObject_CallMethod(obstr, "replace", args);
+ newstr = PyObject_CallObject(func, args);
+
+ tbstr = PyString_AsString(newstr);
+
+ char* tmp = fmtstr("cmpi:%s", tbstr);
+ rv = _BROKER->eft->newString(_BROKER, tmp, NULL);
+ free(tmp);
+
+cleanup:
+ PyErr_Restore(type, value, traceback);
+
+ if (rv == NULL)
+ {
+ rv = _BROKER->eft->newString(_BROKER, tbstr ? tbstr : "", NULL);
+ }
+
+ Py_DecRef(func);
+ Py_DecRef(args);
+ Py_DecRef(newstr);
+ 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_Print();
+ 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*);
+ if (arg == NULL)
+ {
+ arg = Py_None;
+ Py_IncRef(arg);
+ }
+ 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 && PyTuple_Size(prv) != 1))
+ {
+ 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 = Py_None;
+ if (PyTuple_Size(prv) == 2)
+ {
+ prstr = PyTuple_GetItem(prv, 1);
+ }
+
+ 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));
+ 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;
+ 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);
+ Py_DecRef(pyfunc);
+ Py_DecRef(prv);
+ return rc;
+}
+
+
+// ----------------------------------------------------------------------------
+// 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"));
+
+ Py_DecRef(_PYPROVMOD);
+ Py_Finalize();
+ _SBLIM_TRACE(1,("Cleanup(Python) called"));
+
+ 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"));
+
+ _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);
+
+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 */
+
+ _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);
+
+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 */
+
+ _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);
+
+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. */
+
+ _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);
+
+ /* 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. */
+
+ _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);
+
+ /* 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,
+ const CMPIContext * context,
+ const CMPIResult * results,
+ const CMPIObjectPath * reference)
+{
+ CMPIStatus status = {CMPI_RC_OK, NULL};
+
+ _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);
+
+ /* 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. */
+
+ _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);
+
+ /* Query filtering is not supported for this class. */
+
+ /* Finished. */
+exit:
+ _SBLIM_TRACE(1,("ExecQuery() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
+ return status;
+}
+
+
+// ----------------------------------------------------------------------------
+
+
+#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();
+
+ _PYPROVMOD = PyImport_ImportModule("pycmpi_provider");
+ if (_PYPROVMOD == NULL)
+ {
+ _SBLIM_TRACE(1,("Python: _PYPROVMOD at %p", _PYPROVMOD));
+ PY_CMPI_SETFAIL(get_exc_trace());
+ return -1;
+ }
+ _SBLIM_TRACE(1,("Python: _PYPROVMOD at %p", _PYPROVMOD));
+ PyObject* provclass = PyObject_GetAttrString(_PYPROVMOD,
+ "CMPIProvider");
+ if (provclass == NULL)
+ {
+ PY_CMPI_SETFAIL(get_exc_trace());
+ 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());
+ return -1;
+ }
+
+ *self = provinst;
+
+ _SBLIM_TRACE(1,("PyInitialize() succeeded"));
+ return 0;
+}
+
+
+
+// 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};
+
+ _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 = NULL;
+ PyObject *pyresultClass = NULL;
+ PyObject* pyrole = NULL;
+ PyObject* pyresultRole = NULL;
+ if (assocClass != NULL)
+ {
+ pyassocClass = PyString_FromString(assocClass);
+ }
+ if (resultClass != NULL)
+ {
+ pyresultClass = PyString_FromString(resultClass);
+ }
+ if (role != NULL)
+ {
+ pyrole = PyString_FromString(role);
+ }
+ if (resultRole != NULL)
+ {
+ pyresultRole = PyString_FromString(resultRole);
+ }
+
+ call_py_provider((PyObject*)self->hdl, &status, "associator_names", 7,
+ pyctx,
+ pyrslt,
+ pyobjName,
+ pyassocClass,
+ pyresultClass,
+ pyrole,
+ pyresultRole);
+
+ /* 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};
+
+ _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 *pyprops = proplist2py(properties);
+ PyObject *pyassocClass = NULL;
+ PyObject *pyresultClass = NULL;
+ PyObject* pyrole = NULL;
+ PyObject* pyresultRole = NULL;
+ if (assocClass != NULL)
+ {
+ pyassocClass = PyString_FromString(assocClass);
+ }
+ if (resultClass != NULL)
+ {
+ pyresultClass = PyString_FromString(resultClass);
+ }
+ if (role != NULL)
+ {
+ pyrole = PyString_FromString(role);
+ }
+ if (resultRole != NULL)
+ {
+ pyresultRole = PyString_FromString(resultRole);
+ }
+
+ call_py_provider((PyObject*)self->hdl, &status, "associators", 8,
+ pyctx,
+ pyrslt,
+ pyobjName,
+ pyassocClass,
+ pyresultClass,
+ pyrole,
+ pyresultRole,
+ pyprops);
+
+ /* 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* resultClass,
+ const char* role)
+{
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL};
+
+ _SBLIM_TRACE(1,("referenceNames(Python) called, ctx %p, rslt %p, objName %p, resultClass %s, role %s", ctx, rslt, objName, resultClass, role));
+
+ 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* pyresultClass = NULL;
+ PyObject* pyrole = NULL;
+ if (role != NULL)
+ {
+ pyrole = PyString_FromString(role);
+ }
+ if (resultClass != NULL)
+ {
+ pyresultClass = PyString_FromString(resultClass);
+ }
+
+ call_py_provider((PyObject*)self->hdl, &status, "reference_names", 5,
+ pyctx,
+ pyrslt,
+ pyobjName,
+ pyresultClass,
+ pyrole);
+
+ /* 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* resultClass,
+ const char* role,
+ const char** properties)
+{
+ CMPIStatus status = {CMPI_RC_ERR_NOT_SUPPORTED, NULL};
+
+ _SBLIM_TRACE(1,("references(Python) called, ctx %p, rslt %p, objName %p, resultClass %s, role %s, properties %p", ctx, rslt, objName, resultClass, role, 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 = NULL;
+ PyObject* pyresultClass = NULL;
+ if (role != NULL)
+ {
+ pyrole = PyString_FromString(role);
+ }
+ if (resultClass != NULL)
+ {
+ pyresultClass = PyString_FromString(resultClass);
+ }
+ PyObject *pyprops = proplist2py(properties);
+
+ call_py_provider((PyObject*)self->hdl, &status, "references", 6,
+ pyctx,
+ pyrslt,
+ pyobjName,
+ pyresultClass,
+ pyrole,
+ pyprops);
+
+ /* 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};
+
+ _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);
+
+ /* 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};
+
+ _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);
+
+ /* 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};
+
+ _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);
+
+ /* 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};
+
+ _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);
+
+ /* 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};
+
+ //_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);
+
+ /* 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};
+
+ _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);
+
+ /* 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};
+
+ _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);
+
+ /* 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 void 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)
+
Added: cmpi-bindings/trunk/src/cmpi_provider_ruby.c
===================================================================
--- cmpi-bindings/trunk/src/cmpi_provider_ruby.c (rev 0)
+++ cmpi-bindings/trunk/src/cmpi_provider_ruby.c 2008-08-27 19:57:38 UTC (rev 885)
@@ -0,0 +1,743 @@
+/*****************************************************************************
+* 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.
+*****************************************************************************/
+
+static char _CLASSNAME[] = "CmpiInstanceRuby";
+
+#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>
+
+
+#include <ruby.h>
+
+/* 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;
+}
+
+static int RBInitialize(CMPIInstanceMI * self, CMPIStatus* st);
+
+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;
+}
+
+
+// ----------------------------------------------------------------------------
+// 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"));
+
+ ruby_finalize();
+ _SBLIM_TRACE(1,("Cleanup(Ruby) called"));
+
+ 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"));
+
+ _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));
+
+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 */
+
+ _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));
+
+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 */
+
+ _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));
+
+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. */
+
+ _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));
+
+ /* 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. */
+
+ _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));
+
+ /* 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,
+ const CMPIContext * context,
+ const CMPIResult * results,
+ const CMPIObjectPath * reference)
+{
+ CMPIStatus status = {CMPI_RC_OK, NULL};
+
+ _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));
+
+ /* 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. */
+
+ _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));
+
+ /* Query filtering is not supported for this class. */
+
+ /* Finished. */
+exit:
+ _SBLIM_TRACE(1,("ExecQuery() %s", (status.rc == CMPI_RC_OK)? "succeeded":"failed"));
+ return status;
+}
+
+
+// ----------------------------------------------------------------------------
+
+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;
+}
+
+/* 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", cmpiI...
[truncated message content] |
|
From: <np...@us...> - 2008-08-27 18:10:54
|
Revision: 884
http://omc.svn.sourceforge.net/omc/?rev=884&view=rev
Author: npaxton
Date: 2008-08-27 18:11:04 +0000 (Wed, 27 Aug 2008)
Log Message:
-----------
separate out cmpi_provider.c into type/language specific files for python and ruby
Modified Paths:
--------------
cmpi-bindings/trunk/src/CMakeLists.txt
cmpi-bindings/trunk/swig/CMakeLists.txt
cmpi-bindings/trunk/swig/cmpi.i
cmpi-bindings/trunk/swig/python/CMakeLists.txt
Modified: cmpi-bindings/trunk/src/CMakeLists.txt
===================================================================
--- cmpi-bindings/trunk/src/CMakeLists.txt 2008-08-27 17:20:45 UTC (rev 883)
+++ cmpi-bindings/trunk/src/CMakeLists.txt 2008-08-27 18:11:04 UTC (rev 884)
@@ -5,7 +5,7 @@
SET( CMPI_INCLUDE_DIR /usr/include/cmpi )
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -g" )
-SET(cmpi_provider_SRCS cmpi_provider.c)
+SET(cmpi_provider_SRCS cmpi_provider_python.c cmpi_provider_ruby.c)
ADD_DEFINITIONS(-DCMPI_PLATFORM_LINUX_GENERIC_GNU -DCMPI_VERSION=200)
ADD_LIBRARY(cmpi_provider SHARED ${cmpi_provider_SRCS})
Modified: cmpi-bindings/trunk/swig/CMakeLists.txt
===================================================================
--- cmpi-bindings/trunk/swig/CMakeLists.txt 2008-08-27 17:20:45 UTC (rev 883)
+++ cmpi-bindings/trunk/swig/CMakeLists.txt 2008-08-27 18:11:04 UTC (rev 884)
@@ -7,7 +7,7 @@
FIND_PACKAGE(Ruby)
IF (RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
MESSAGE(STATUS "Building Ruby...")
-# ADD_SUBDIRECTORY(ruby)
+ ADD_SUBDIRECTORY(ruby)
ENDIF (RUBY_LIBRARY AND RUBY_INCLUDE_PATH)
FIND_PACKAGE(PythonLibs)
Modified: cmpi-bindings/trunk/swig/cmpi.i
===================================================================
--- cmpi-bindings/trunk/swig/cmpi.i 2008-08-27 17:20:45 UTC (rev 883)
+++ cmpi-bindings/trunk/swig/cmpi.i 2008-08-27 18:11:04 UTC (rev 884)
@@ -27,8 +27,14 @@
* provider code
*/
-#include "../src/cmpi_provider.c"
+#if defined(SWIGRUBY)
+#include "../src/cmpi_provider_ruby.c"
+#endif
+#if defined(SWIGPYTHON)
+#include "../src/cmpi_provider_python.c"
+#endif
+
%}
# Definitions
Modified: cmpi-bindings/trunk/swig/python/CMakeLists.txt
===================================================================
--- cmpi-bindings/trunk/swig/python/CMakeLists.txt 2008-08-27 17:20:45 UTC (rev 883)
+++ cmpi-bindings/trunk/swig/python/CMakeLists.txt 2008-08-27 18:11:04 UTC (rev 884)
@@ -45,7 +45,7 @@
SET( NAME pyCmpiProvider )
ADD_LIBRARY( ${NAME} SHARED ${SWIG_OUTPUT})
#TARGET_LINK_LIBRARIES( ${NAME} ${PYTHON_LIBRARIES} )
-TARGET_LINK_LIBRARIES( ${NAME} python2.5 )
+TARGET_LINK_LIBRARIES( ${NAME} python2.4 )
TARGET_LINK_LIBRARIES( ${NAME} m )
TARGET_LINK_LIBRARIES( ${NAME} util )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-08-27 17:20:37
|
Revision: 883
http://omc.svn.sourceforge.net/omc/?rev=883&view=rev
Author: bartw
Date: 2008-08-27 17:20:45 +0000 (Wed, 27 Aug 2008)
Log Message:
-----------
added testsuite
Added Paths:
-----------
cmpi-bindings/trunk/test/
cmpi-bindings/trunk/test/python/
cmpi-bindings/trunk/test/python/TestAssoc.mof
cmpi-bindings/trunk/test/python/TestAssocProvider-peg.reg
cmpi-bindings/trunk/test/python/TestAssocProvider.py
cmpi-bindings/trunk/test/python/TestAssocProvider.reg
cmpi-bindings/trunk/test/python/TestAssocProvider.sfcb.reg
cmpi-bindings/trunk/test/python/TestAtom.mof
cmpi-bindings/trunk/test/python/TestAtomProvider.peg.reg
cmpi-bindings/trunk/test/python/TestAtomProvider.py
cmpi-bindings/trunk/test/python/TestAtomProvider.reg
cmpi-bindings/trunk/test/python/TestAtomProvider.sfcb.reg
cmpi-bindings/trunk/test/python/TestAtomProvider_Test.py
cmpi-bindings/trunk/test/python/TestMethod.mof
cmpi-bindings/trunk/test/python/TestMethod.peg.reg
cmpi-bindings/trunk/test/python/TestMethod.py
cmpi-bindings/trunk/test/python/TestMethod.reg
cmpi-bindings/trunk/test/python/TestMethod.sfcb.reg
cmpi-bindings/trunk/test/python/TestMethod_Test.py
cmpi-bindings/trunk/test/python/UpcallAtom-peg.mof
cmpi-bindings/trunk/test/python/UpcallAtom.mof
cmpi-bindings/trunk/test/python/UpcallAtom.peg.reg
cmpi-bindings/trunk/test/python/UpcallAtom.reg
cmpi-bindings/trunk/test/python/UpcallAtomProvider.py
cmpi-bindings/trunk/test/python/lib/
cmpi-bindings/trunk/test/python/lib/ProviderSanityTest.py
cmpi-bindings/trunk/test/python/lib/__init__.py
cmpi-bindings/trunk/test/python/lib/wbem_connection.py
cmpi-bindings/trunk/test/python/test_assoc.py
Added: cmpi-bindings/trunk/test/python/TestAssoc.mof
===================================================================
--- cmpi-bindings/trunk/test/python/TestAssoc.mof (rev 0)
+++ cmpi-bindings/trunk/test/python/TestAssoc.mof 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,39 @@
+[ Description("Local user of the system on which the CIMOM is running")]
+class TestAssoc_User
+{
+ [Key, Description("The user's numeric user ID")]
+ string UserID;
+
+ [Required, Description("The user's username")]
+ string UserName;
+
+ [Description("The user's home directory, if any")]
+ string HomeDirectory;
+
+ [Description("The user's login shell, if any")]
+ string LoginShell;
+};
+
+[ Description("Local group of users on the system on which the CIMOM is running")]
+class TestAssoc_Group
+{
+ [Key, Description("The group's numeric group ID")]
+ string GroupID;
+
+ [Required, Description("The group's name")]
+ string GroupName;
+};
+
+[ Association, Description("Association that shows relationship of users and groups")]
+class TestAssoc_MemberOfGroup
+{
+ [Key, Override("Antecedent"), Description ("The group")]
+ TestAssoc_Group REF Antecedent;
+
+ [Key, Override("Dependent"), Description("The user")]
+ TestAssoc_User REF Dependent;
+
+ [Required, Description("Indicates whether the associated group is the primary group for the associated user")]
+ boolean isPrimaryGroup;
+};
+
Added: cmpi-bindings/trunk/test/python/TestAssocProvider-peg.reg
===================================================================
--- cmpi-bindings/trunk/test/python/TestAssocProvider-peg.reg (rev 0)
+++ cmpi-bindings/trunk/test/python/TestAssocProvider-peg.reg 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,47 @@
+// Provider registration for TestAssoc
+instance of PG_ProviderModule
+{
+ Name = "TestAssocProvider-Module";
+ InterfaceType = "Python";
+ InterfaceVersion = "1.0.0";
+ Location = "/usr/lib/pycim/TestAssocProvider.py";
+ Vendor = "Novell";
+ Version = "1.0.0";
+};
+
+instance of PG_Provider
+{
+ Name = "TestAssocProvider-Provider";
+ ProviderModuleName = "TestAssocProvider-Module";
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "TestAssocProvider-Capability1";
+ ProviderModuleName = "TestAssocProvider-Module";
+ ProviderName = "TestAssocProvider-Provider";
+ ClassName = "TestAssoc_User";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2}; // Instance
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "TestAssocProvider-Capability2";
+ ProviderModuleName = "TestAssocProvider-Module";
+ ProviderName = "TestAssocProvider-Provider";
+ ClassName = "TestAssoc_Group";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2}; // Instance
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "TestAssocProvider-Capability3";
+ ProviderModuleName = "TestAssocProvider-Module";
+ ProviderName = "TestAssocProvider-Provider";
+ ClassName = "TestAssoc_MemberOfGroup";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,3}; // Instance/Association
+};
+
Added: cmpi-bindings/trunk/test/python/TestAssocProvider.py
===================================================================
--- cmpi-bindings/trunk/test/python/TestAssocProvider.py (rev 0)
+++ cmpi-bindings/trunk/test/python/TestAssocProvider.py 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,229 @@
+"""Python Provider for TestAssoc
+
+Instruments:
+- TestAssoc_User (instance provider)
+- TestAssoc_Group (instance provider)
+- TestAssoc_MemberOfGroup (instance and association provider)
+
+"""
+
+import pywbem
+import pwd
+import grp
+
+def get_user_instance(uid, model, keys_only):
+ try:
+ pwinfo = pwd.getpwuid(uid)
+ #model['UserID'] = pywbem.Uint32(uid)
+ model['UserID'] = str(uid)
+ if keys_only:
+ return model
+ model['UserName'] = pwinfo[0]
+ model['LoginShell'] = pwinfo[6]
+ model['HomeDirectory'] = pwinfo[5]
+ return model
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+
+def get_group_instance(gid, model, keys_only):
+ try:
+ grinfo = grp.getgrgid(gid)
+ #model['GroupID'] = pywbem.Uint32(gid)
+ model['GroupID'] = str(gid)
+ if keys_only:
+ return model
+ model['GroupName'] = grinfo[0]
+ return model
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+
+def is_primary_user(uid, gid):
+ pwinfo = pwd.getpwuid(uid)
+ return gid == pwinfo[3]
+
+def is_user_in_group(uid, gid):
+ pwinfo = pwd.getpwuid(uid)
+ grinfo = grp.getgrgid(gid)
+ return pwinfo[0] in grinfo[3]
+
+def get_assoc_instance(uid, gid, model, keys_only):
+ try:
+ isPrimary = is_primary_user(uid, gid)
+ if not isPrimary and not is_user_in_group(uid, gid):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ model['Dependent'] = get_user_instance(uid, model['Dependent'], keys_only)
+ model['Antecedent'] = get_group_instance(gid, model['Antecedent'], keys_only)
+ if keys_only:
+ return model
+ model['isPrimaryGroup'] = isPrimary
+ return model
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+
+class TestAssoc_User(pywbem.CIMProvider):
+
+ def __init__(self, env):
+ self._logger = env.get_logger()
+
+ def get_instance(self, env, model, cim_class, inst=None):
+ try:
+ uid = model['UserID']
+ uid = int(uid)
+ return get_user_instance(uid, model, False)
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+ self._logger.log_debug("%s: enum_instances called for class %s" % (self.__class__.__name__.upper(), model.classname))
+ for pwent in pwd.getpwall():
+ yield get_user_instance(pwent[2], model, keys_only)
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ def delete_instance(self, env, instance_name):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+
+
+class TestAssoc_Group(pywbem.CIMProvider):
+
+ def __init__(self, env):
+ self._logger = env.get_logger()
+
+ def get_instance(self, env, model, cim_class, inst=None):
+ try:
+ gid = model['GroupID']
+ gid = int(gid)
+ return get_group_instance(gid, model, False)
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+ for grent in grp.getgrall():
+ yield get_group_instance(grent[2], model, keys_only)
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ def delete_instance(self, env, instance_name):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+
+class TestAssoc_MemberOfGroup(pywbem.CIMProvider):
+
+ def __init__(self, env):
+ self._logger = env.get_logger()
+
+ def get_instance(self, env, model, cim_class, inst=None):
+ try:
+ uid = model['Dependent']['UserID']
+ uid = int(uid)
+ gid = model['Antecedent']['GroupID']
+ gid = int(gid)
+ return get_assoc_instance(uid, gid, model, False)
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+ self._logger.log_debug("\n%s: enum_instances called for class %s" % (self.__class__.__name__.upper(), model.classname))
+ for pwent in pwd.getpwall():
+ user_cin = pywbem.CIMInstanceName('TestAssoc_User',
+ namespace=model.path.namespace)
+ group_cin = pywbem.CIMInstanceName('TestAssoc_Group',
+ namespace=model.path.namespace)
+ model['Dependent'] = get_user_instance(pwent[2], user_cin, True)
+ model['Antecedent'] = get_group_instance(pwent[3], group_cin, True)
+ if not keys_only:
+ model['isPrimaryGroup'] = True
+ yield model
+ for grent in grp.getgrall():
+ if pwent[0] in grent[3]:
+ model['Antecedent'] = get_group_instance(grent[2], group_cin, True)
+ if not keys_only:
+ model['isPrimaryGroup'] = False
+ yield model
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ def delete_instance(self, env, instance_name):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ def xxx_hello(self):
+ pass
+
+ def references(self, env, object_name, model, assoc_class,
+ result_class_name, role, result_role, keys_only):
+ print '!!!!!!! in TestAssoc_MemberOfGroup.references()'
+ self._logger.log_debug("\n%s: References called for class %s" % (self.__class__.__name__.upper(), object_name))
+ ch = env.get_cimom_handle()
+ if pywbem.is_subclass(ch,
+ object_name.namespace,
+ sub=object_name.classname,
+ super='TestAssoc_User'):
+ if role and role.lower() == 'antecedent':
+ return
+ if result_role and result_role.lower() == 'dependent':
+ return
+ if result_class_name and not pywbem.is_subclass(ch,
+ object_name.namespace,
+ sub = 'TestAssoc_Group',
+ super = result_class_name):
+ return
+ model['Dependent'] = object_name
+ cn = pywbem.CIMInstanceName('TestAssoc_Group',
+ namespace=object_name.namespace)
+ uid = model['Dependent']['UserID']
+ uid = int(uid)
+ pwinfo = pwd.getpwuid(uid)
+ model['Antecedent'] = get_group_instance(pwinfo[3], cn, True)
+ if not keys_only:
+ model['isPrimaryGroup'] = True
+ yield model
+ for grent in grp.getgrall():
+ if pwinfo[0] in grent[3]:
+ model['Antecedent'] = get_group_instance(grent[2], cn, True)
+ if not keys_only:
+ model['isPrimaryGroup'] = False
+ yield model
+ elif pywbem.is_subclass(ch,
+ object_name.namespace,
+ sub=object_name.classname,
+ super='TestAssoc_Group'):
+ if role and role.lower() == 'dependent':
+ return
+ if result_role and result_role.lower() == 'antecedent':
+ return
+ if result_class_name and not pywbem.is_subclass(ch,
+ object_name.namespace,
+ sub = 'TestAssoc_User',
+ super = result_class_name):
+ return
+ model['Antecedent'] = object_name
+ cn = pywbem.CIMInstanceName('TestAssoc_User',
+ namespace=object_name.namespace)
+ gid = model['Antecedent']['GroupID']
+ gid = int(gid)
+ grinfo = grp.getgrgid(gid)
+ for member_name in grinfo[3]:
+ pwinfo = pwd.getpwnam(member_name)
+ model['Dependent'] = get_user_instance(pwinfo[2], cn, True)
+ if not keys_only:
+ model['isPrimaryGroup'] = False
+ yield model
+ for pwent in pwd.getpwall():
+ if pwent[3] == grinfo[2]:
+ model['Dependent'] = get_user_instance(pwent[2], cn, True)
+ if not keys_only:
+ model['isPrimaryGroup'] = True
+ yield model
+
+
+def get_providers(env):
+ user_prov = TestAssoc_User(env)
+ group_prov = TestAssoc_Group(env)
+ mog_prov = TestAssoc_MemberOfGroup(env)
+ return { 'TestAssoc_User' : user_prov,
+ 'TestAssoc_Group' : group_prov,
+ 'TestAssoc_MemberOfGroup' : mog_prov }
Added: cmpi-bindings/trunk/test/python/TestAssocProvider.reg
===================================================================
--- cmpi-bindings/trunk/test/python/TestAssocProvider.reg (rev 0)
+++ cmpi-bindings/trunk/test/python/TestAssocProvider.reg 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,27 @@
+// Provider registration for TestAssoc
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "<Novell:ZENworks:TestAssoc:001>";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "TestAssoc_User";
+ ProviderTypes = {1};
+ ModulePath = "/usr/lib/pycim/TestAssocProvider.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "<Novell:ZENworks:TestAssoc:002>";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "TestAssoc_Group";
+ ProviderTypes = {1};
+ ModulePath = "/usr/lib/pycim/TestAssocProvider.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "<Novell:ZENworks:TestAssoc:003>";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "TestAssoc_MemberOfGroup";
+ ProviderTypes = {1, 3};
+ ModulePath = "/usr/lib/pycim/TestAssocProvider.py";
+};
Added: cmpi-bindings/trunk/test/python/TestAssocProvider.sfcb.reg
===================================================================
--- cmpi-bindings/trunk/test/python/TestAssocProvider.sfcb.reg (rev 0)
+++ cmpi-bindings/trunk/test/python/TestAssocProvider.sfcb.reg 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,17 @@
+[TestAssoc_Group]
+ provider: TestAssocProvider
+ location: pyCmpiProvider
+ type: instance
+ namespace: root/cimv2
+
+[TestAssoc_User]
+ provider: TestAssocProvider
+ location: pyCmpiProvider
+ type: instance
+ namespace: root/cimv2
+
+[TestAssoc_MemberOfGroup]
+ provider: TestAssocProvider
+ location: pyCmpiProvider
+ type: instance association
+ namespace: root/cimv2
Added: cmpi-bindings/trunk/test/python/TestAtom.mof
===================================================================
--- cmpi-bindings/trunk/test/python/TestAtom.mof (rev 0)
+++ cmpi-bindings/trunk/test/python/TestAtom.mof 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,53 @@
+[ Description("Model an atom, For use with CIMOM and PyWBEM Provider")]
+class Test_Atom
+{
+ /*
+ INTRINSIC DATA TYPE INTERPRETATION
+ uint8 Unsigned 8-bit integer
+ sint8 Signed 8-bit integer
+ uint16 Unsigned 16-bit integer
+ sint16 Signed 16-bit integer
+ uint32 Unsigned 32-bit integer
+ sint32 Signed 32-bit integer
+ uint64 Unsigned 64-bit integer
+ sint64 Signed 64-bit integer
+ string UCS-2 string
+ boolean Boolean
+ real32 IEEE 4-byte floating-point
+ real64 IEEE 8-byte floating-point
+ datetime A string containing a date-time
+ <classname> ref Strongly typed reference
+ char16 16-bit UCS-2 character
+ */
+ uint8 uint8Prop;
+ uint8 uint8Propa[];
+ sint8 sint8prop;
+ sint8 sint8propa[];
+ uint16 uint16Prop;
+ uint16 uint16Propa[];
+ sint16 sint16Prop;
+ sint16 sint16Propa[];
+ uint32 uint32Prop;
+ uint32 uint32Propa[];
+ sint32 sint32Prop;
+ sint32 sint32Propa[];
+ uint64 uint64Prop;
+ uint64 uint64Propa[];
+ sint64 sint64Prop;
+ sint64 sint64Propa[];
+ string stringProp;
+ string stringPropa[];
+ real32 real32Prop;
+ real32 real32Propa[];
+ real64 real64Prop;
+ real64 real64Propa[];
+// char16 char16Prop;
+// char16 char16Propa[];
+ datetime dateProp;
+ boolean boolProp;
+ [Key, Description("The Name of the atom.")]
+ string Name;
+
+ //<classname> ref //Strongly typed reference "its value is an object path -- pointer to another instance
+
+};
Added: cmpi-bindings/trunk/test/python/TestAtomProvider.peg.reg
===================================================================
--- cmpi-bindings/trunk/test/python/TestAtomProvider.peg.reg (rev 0)
+++ cmpi-bindings/trunk/test/python/TestAtomProvider.peg.reg 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,28 @@
+// Provider registration for TestAtom
+instance of PG_ProviderModule
+{
+ Name = "TestAtom_Module";
+ Location = "TestAtomProvider";
+ Vendor = "Novell";
+ Version = "1.0.0";
+ InterfaceType = "Python";
+ InterfaceVersion = "1.0.0";
+};
+
+instance of PG_Provider
+{
+ Name = "TestAtom_Provider";
+ ProviderModuleName = "TestAtom_Module";
+};
+
+instance of PG_ProviderCapabilities
+{
+ ProviderModuleName = "TestAtom_Module";
+ ProviderName = "TestAtom_Provider";
+ ClassName = "Test_Atom";
+ ProviderType = { 2 };
+ Namespaces = {"root/cimv2"};
+ SupportedProperties = NULL;
+ SupportedMethods = NULL;
+ CapabilityID = "TestAtom-Prov-1";
+};
Added: cmpi-bindings/trunk/test/python/TestAtomProvider.py
===================================================================
--- cmpi-bindings/trunk/test/python/TestAtomProvider.py (rev 0)
+++ cmpi-bindings/trunk/test/python/TestAtomProvider.py 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,203 @@
+"""Python Provider for TestAtom
+
+Instruments the CIM class TestAtom
+
+"""
+
+import pywbem
+import sys
+
+class TestAtomProvider(pywbem.CIMProvider):
+ """Instrument the CIM class TestAtom
+
+ Model an atom, For use with CIMOM and PyWBEM Provider
+
+ """
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+ self.storage = {}
+ # If you will be filtering instances yourself according to
+ # property_list, role, result_role, and result_class_name
+ # parameters, set self.filter_results to False
+ # self.filter_results = False
+
+ def get_instance(self, env, model, cim_class):
+ """Return an instance.
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ model -- A template of the pywbem.CIMInstance to be returned. The
+ key properties are set on this instance to correspond to the
+ instanceName that was requested. The properties of the model
+ are already filtered according to the PropertyList from the
+ request. Only properties present in the model need to be
+ given values. If you prefer, you can set all of the
+ values, and the instance will be filtered for you.
+ cim_class -- The pywbem.CIMClass
+
+ Possible Errors:
+ CIM_ERR_ACCESS_DENIED
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ or otherwise incorrect parameters)
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ Instance does not exist in the specified namespace)
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+
+ try:
+ #logger.log_debug("**** GET_INSTANCE model[name]: %s ****" % model['Name'])
+ #print "**** GET_INSTANCE model[name]: %s ****" % str(model['Name'])
+ #if model['Name'] in self.storage.keys():
+ inst = self.storage[model['Name']]
+ #else:
+ #print "This is not working.... ******* FIX ME"
+
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ #print " **** Setting Model Properties: ****"
+ for k, v in inst.items():
+ model.update_existing(((k, v),))
+
+ #return inst
+ return model
+
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+ """Enumerate instances.
+
+ The WBEM operations EnumerateInstances and EnumerateInstanceNames
+ are both mapped to this method.
+ This method is a python generator
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ model -- A template of the pywbem.CIMInstances to be generated.
+ The properties of the model are already filtered according to
+ the PropertyList from the request. Only properties present in
+ the model need to be given values. If you prefer, you can
+ always set all of the values, and the instance will be filtered
+ for you.
+ cim_class -- The pywbem.CIMClass
+ keys_only -- A boolean. True if only the key properties should be
+ set on the generated instances.
+
+ Possible Errors:
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+ #for atom in self.storage.keys():
+ #print "Key = %s " %str(atom)
+
+ for key in self.storage.keys():
+ #print "***** HELLO ***** "
+ #logger.log_debug("************ ENUM_INSTANCES ********")
+ #logger.log_debug(" **** model['Name'] = %s ****" % key)
+ #print "************ ENUM_INSTANCES ********"
+ #print " **** model['Name'] = %s ****" % key
+ model['Name'] = key
+ try:
+ yield self.get_instance(env, model, cim_class)
+ except pywbem.CIMError, (num, msg):
+ if num not in (pywbem.CIM_ERR_NOT_FOUND,
+ pywbem.CIM_ERR_ACCESS_DENIED):
+ raise
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ """Return a newly created or modified instance.
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ instance -- The new pywbem.CIMInstance. If modifying an existing
+ instance, the properties on this instance have been filtered by
+ the PropertyList from the request.
+ previous_instance -- The previous pywbem.CIMInstance if modifying
+ an existing instance. None if creating a new instance.
+ cim_class -- The pywbem.CIMClass
+
+ Return the new instance. The keys must be set on the new instance.
+
+ Possible Errors:
+ CIM_ERR_ACCESS_DENIED
+ CIM_ERR_NOT_SUPPORTED
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ or otherwise incorrect parameters)
+ CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
+ valid if previous_instance is None, indicating that the operation
+ was CreateInstance)
+ CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
+ if previous_instance is not None, indicating that the operation
+ was ModifyInstance)
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.set_instance()' \
+ % self.__class__.__name__)
+
+ if previous_instance is not None:#Existing Instance or Modify
+ if instance['Name'] not in self.storage:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ inst = self.storage[instance['Name']]
+ inst.properties.update(instance.properties)
+ #logger.log_debug("***** Updating stuff :%s *****" % instance.properties)
+
+ #loop, if it exists, throw exception (Already_Exists)
+ elif previous_instance is None:
+ if instance['Name'] in self.storage:
+ raise pywbem.CIMError(pywbem.CIM_ERR_ALREADY_EXISTS)
+ else:
+ #Creating a new instance
+ #print "Copying Instance"
+ #print "Instance name: %s"%str(instance['Name'])
+ #for key in instance.properties.keys():
+ #print "key=%s"%str(key)
+ self.storage[instance['Name']] = instance.copy()
+
+ return instance
+
+ def delete_instance(self, env, instance_name):
+ """Delete an instance.
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ instance_name -- A pywbem.CIMInstanceName specifying the instance
+ to delete.
+
+ Possible Errors:
+ CIM_ERR_ACCESS_DENIED
+ CIM_ERR_NOT_SUPPORTED
+ CIM_ERR_INVALID_NAMESPACE
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ or otherwise incorrect parameters)
+ CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
+ namespace)
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ Instance does not exist in the specified namespace)
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.delete_instance()' \
+ % self.__class__.__name__)
+ try:
+ del self.storage[instance_name['Name']]
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+
+## end of class TestAtomProvider
+
+def get_providers(env):
+ testatom_prov = TestAtomProvider(env)
+ return {'Test_Atom': testatom_prov}
Added: cmpi-bindings/trunk/test/python/TestAtomProvider.reg
===================================================================
--- cmpi-bindings/trunk/test/python/TestAtomProvider.reg (rev 0)
+++ cmpi-bindings/trunk/test/python/TestAtomProvider.reg 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,9 @@
+// Provider registration for TestAtom
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "<org:product:TestAtom:unique_id>"; // TODO
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "Test_Atom";
+ ProviderTypes = {1}; // Instance
+ ModulePath = "/usr/lib/pycim/TestAtomProvider.py"; // TODO
+};
Added: cmpi-bindings/trunk/test/python/TestAtomProvider.sfcb.reg
===================================================================
--- cmpi-bindings/trunk/test/python/TestAtomProvider.sfcb.reg (rev 0)
+++ cmpi-bindings/trunk/test/python/TestAtomProvider.sfcb.reg 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,5 @@
+[Test_Atom]
+ provider: TestAtomProvider
+ location: pyCmpiProvider
+ type: instance
+ namespace: root/cimv2
Added: cmpi-bindings/trunk/test/python/TestAtomProvider_Test.py
===================================================================
--- cmpi-bindings/trunk/test/python/TestAtomProvider_Test.py (rev 0)
+++ cmpi-bindings/trunk/test/python/TestAtomProvider_Test.py 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,534 @@
+#!/usr/bin/env python
+#
+#Author: Kenny Woodson
+#Date: Mon Sep 17, 2007
+#Description: Script to test the functions of the TestAtomProvider.
+#Tests include:
+# CreateInstance, EnumerateInstance, EnumerateInstanceNames,
+# ModifyInstance, DeleteInstance, GetInstance
+#
+###############################################################################
+
+import pywbem
+from os import path
+import subprocess
+import unittest
+import math
+from lib import wbem_connection
+
+_tolerance = .04
+
+_atoms = {'Hydrogen': 1,
+ 'Helium': 2,
+ 'Lithium': 3,
+ 'Beryllium': 4,
+ 'Boron': 5,
+ 'Carbon': 6,
+ 'Nitrogen': 7,
+ 'Oxygen': 8,
+ 'Fluorine': 9,
+ 'Neon': 10 }
+
+_atomic_weights = {'Hydrogen': 1.00794,
+ 'Helium': 4.002602,
+ 'Lithium': 6.941,
+ 'Beryllium': 9.012182,
+ 'Boron': 10.811,
+ 'Carbon': 12.0107,
+ 'Nitrogen': 14.0067,
+ 'Oxygen': 15.9994,
+ 'Fluorine': 18.9984032,
+ 'Neon': 20.1797 }
+
+def restart_gmond():
+ p = subprocess.Popen([ path.join('/etc/init.d/', "novell-gmond"), \
+ "restart"], stdout=subprocess.PIPE)
+ p.wait()
+
+
+def _compare_values(conn, instance, time):
+ types = {'boolProp': 'boolean',
+ 'dateProp': 'datetime',
+ 'real32Prop': 'real32',
+ 'real32Propa': 'real32',
+ 'real64Prop': 'real64',
+ 'real64Propa': 'real64',
+ 'sint16Prop': 'sint16',
+ 'sint16Propa': 'sint16',
+ 'sint32Prop': 'sint32',
+ 'sint32Propa': 'sint32',
+ 'sint64Prop': 'sint64',
+ 'sint64Propa': 'sint64',
+ 'sint8prop': 'sint8',
+ 'sint8propa': 'sint8',
+ 'stringProp': 'string',
+ 'stringPropa': 'string',
+ 'uint16Prop': 'uint16',
+ 'uint16Propa': 'uint16',
+ 'uint32Prop': 'uint32',
+ 'uint32Propa': 'uint32',
+ 'uint64Prop': 'uint64',
+ 'uint64Propa': 'uint64',
+ 'uint8Prop' : 'uint8',
+ 'uint8Propa' : 'uint8' }
+
+ if instance['Name'] in _atoms:
+ #print instance['Name']
+ atoms_value = _atoms.get(instance['Name'])
+ atoms_weight = _atomic_weights[instance['Name']]
+ for prop,value in instance.items():
+ #print "Property=%s"%str(prop)
+ #Char and Char_array
+ if prop == 'char16Prop' or prop == 'char16Propa':
+ pass
+ #Date Property
+ elif prop == 'dateProp':
+ if str(instance[prop]) != str(time):
+ raise "DateProp NOT EQUAL"
+ #Name or stringProp
+ elif prop == 'Name' or prop == 'stringProp':
+ if instance['Name'] not in _atoms or \
+ instance['stringProp'] not in _atoms:
+ raise "Atom Name NOT FOUND: %s" & instance['Name']
+ #boolProp
+ elif prop == 'boolProp':
+ if instance[prop] != False:
+ raise "False NOT EQUAL False"
+ #All values not in lists
+ #real64Prop fails this check
+ elif (instance.properties[prop].type == types.get(prop)) and \
+ type(instance.properties[prop].value) != type([]):
+ if prop == 'uint8Prop':
+ if pywbem.Uint8(atoms_value) != instance[prop]:
+ raise "%s Error: %s" % (prop, instance[prop])
+ elif prop.startswith("real"):
+ if _atomic_weights[instance['Name']] != atoms_weight:
+ raise "%s == %s"%(_atomic_weights[instance['Name']],atoms_weight)
+ elif atoms_value != value:
+ raise "%s == %s"%(atoms_value,value)
+ #All list values
+ elif type(instance.properties[prop].value) == type([]) and \
+ instance.properties[prop].type == types.get(prop):
+ if prop == 'stringPropa':
+ if value[0] != 'proton' and value[1] != 'electron' \
+ and value[2] != 'neutron':
+ raise "String Array NOT EQUAL"
+ elif prop == 'uint8Propa':
+ for val in instance.properties[prop].value:
+ if pywbem.Uint8(atoms_value) != val:
+ raise ("Uint8 Values NOT EQUAL")
+ else:
+ #print "\n"
+ #print "instance.properties[prop]=%s"%str(prop)
+ #print "atoms_value=%s"%str(atoms_value)
+ for a_prop in instance.properties[prop].value:
+ #print "a_prop=%s"%str(a_prop)
+ #print "value=%s"%str(value)
+ for num in value: #Array
+ #print "Checking a_prop=%s with num=%s" % (str(a_prop),str(num))
+ #print "startswith=%s"%str(prop.startswith("real"))
+ #if str(instance.properties[prop]).startswith("real"):
+ if prop.startswith("real"):
+ #print "Checking num=%s with atoms_weight=%s"%(str(num),str(atoms_weight))
+ if math.fabs(num - atoms_weight) > _tolerance:
+ raise "%s NOT EQUAL %s" % (str(num), str(atoms_weight))
+ elif a_prop != num:
+ raise "%s NOT EQUAL %s" % (atoms_value, num)
+ else:
+ raise "%s NOT EQUAL %s" % (atoms_value, value)
+ else:
+ raise "Instance of Test_Atom not Found: %s" % (instance['Name'])
+
+
+def get_instance(conn, keybindings, propertylist=None):
+ if propertylist is None:
+ propertylist = []
+ inst = None
+ try:
+ iname = pywbem.CIMInstanceName(classname='Test_Atom', \
+ keybindings=(keybindings), namespace='root/cimv2')
+ inst = conn.GetInstance(iname, PropertyList=propertylist)
+ except pywbem.CIMError, arg:
+ raise (arg)
+ return inst
+
+
+def get_instance_names(conn):
+ """
+ Open a wbem connection and retrieve the newly created instance names.
+ """
+
+ try:
+ ta_list = conn.EnumerateInstanceNames('Test_Atom')
+ except pywbem.CIMError, arg:
+ raise
+ return None
+
+ return ta_list
+
+
+def get_test_instances(conn):
+ """
+ Open a wbem connection and retrieve the newly created instances.
+ """
+
+ try:
+ ta_list = conn.EnumerateInstances('Test_Atom')
+ except pywbem.CIMError, arg:
+ raise
+ return None
+
+ return ta_list
+
+
+def delete_test_instances(conn, del_instances):
+ """
+ Open a wbem connection and attempt to delete the newly created instance.
+ """
+
+ try:
+ for atom in del_instances:
+ conn.DeleteInstance(atom)
+ except pywbem.CIMError, arg:
+ raise arg
+ return False
+
+ return True
+
+class TestAtomProvider(unittest.TestCase):
+ time = pywbem.CIMDateTime.now()
+
+ def setUp(self):
+ self.inst_paths = []
+ self.instance = None
+ #wconn = wbem_connection.wbem_connection()
+ self.conn = pywbem.PegasusUDSConnection()
+ self.conn = pywbem.SFCBUDSConnection()
+ unittest.TestCase.setUp(self)
+
+ def tearDown(self):
+ for ipath in self.inst_paths:
+ try:
+ self.conn.DeleteInstance(ipath)
+ except pywbem.CIMError,arg:
+ pass
+ unittest.TestCase.tearDown(self)
+
+
+
+ #def test_1_register(self):
+ # """ Test Register Provider """
+ # testdir = "/usr/lib/pycim"
+ # reginst = pywbem.CIMInstance('OpenWBEM_PyProviderRegistration', \
+ # properties={ 'InstanceID':'TestAtomProvider', \
+ # 'NamespaceNames':['root/cimv2'],
+ # 'ClassName':'TestAtom',
+ # 'ProviderTypes':[pywbem.Uint16(1)], # Indication Handler
+ # 'ModulePath':'%s/TestAtomProvider.py' % testdir,
+ # },
+ # path=pywbem.CIMInstanceName('OpenWBEM_PyProviderRegistration',
+ # namespace='Interop'))
+ #
+ # try:
+ # self.conn.CreateInstance(reginst)
+ # except pywbem.CIMError, arg:
+ # self.fail("Could not REGISTER %s:%s" % (reginst.classname, str(arg)))
+ # restart_gmond()
+
+
+
+
+ #def test_7_deregister(self):
+ # """ Test Deregister Provider """
+ # self.conn.default_namespace = 'Interop'
+ # reglist = self.conn.EnumerateInstanceNames('OpenWBEM_PyProviderRegistration')
+ # for inst_name in reglist:
+ # if inst_name['InstanceID'] == 'TestAtomProvider':
+ # try:
+ # self.conn.DeleteInstance(inst_name)
+ # except pywbem.CIMError, arg:
+ # self.fail("Could not DEREGISTER Class")
+
+ # restart_gmond()
+
+ # try:
+ # self.conn.GetInstance(inst_name)
+ # except pywbem.CIMError, arg:
+ # self.failUnlessEqual(arg[0], pywbem.CIM_ERR_NOT_FOUND,
+ # 'Unexpected exception on GetInstance: %s' % str(arg))
+
+
+
+ def _create_test_instance(self, name_of_atom, number):
+ """ Create a TestAtom instance. """
+
+ weight = _atomic_weights[name_of_atom]
+ #new_instance['char16Prop'] =
+ #new_instance['char16Propa'] = Null
+ new_instance = pywbem.CIMInstance('Test_Atom')
+ new_instance['Name'] = name_of_atom
+ new_instance['boolProp'] = False
+ new_instance['dateProp'] = self.time
+ new_instance['real32Prop'] = pywbem.Real32(weight)
+ new_instance['real32Propa'] = [pywbem.Real32(weight), \
+ pywbem.Real32(weight), \
+ pywbem.Real32(weight)]
+ new_instance['real64Prop'] = pywbem.Real64(weight)
+ new_instance['real64Propa'] = [pywbem.Real64(weight), \
+ pywbem.Real64(weight), \
+ pywbem.Real64(weight)]
+ new_instance['sint16Prop'] = pywbem.Sint16(number)
+ new_instance['sint16Propa'] = [pywbem.Sint16(number), \
+ pywbem.Sint16(number), \
+ pywbem.Sint16(number)]
+ new_instance['sint32Prop'] = pywbem.Sint32(number)
+ new_instance['sint32Propa'] = [pywbem.Sint32(number), \
+ pywbem.Sint32(number), \
+ pywbem.Sint32(number)]
+ new_instance['sint64Prop'] = pywbem.Sint64(number)
+ new_instance['sint64Propa'] = [pywbem.Sint64(number), \
+ pywbem.Sint64(number), \
+ pywbem.Sint64(number)]
+ new_instance['sint8prop'] = pywbem.Sint8(number)
+ new_instance['sint8Propa'] = [pywbem.Sint8(number), \
+ pywbem.Sint8(number), \
+ pywbem.Sint8(number)]
+ new_instance['stringProp'] = name_of_atom
+ new_instance['stringPropa'] = ['proton', 'electron', 'neutron']
+ new_instance['uint16Prop'] = pywbem.Uint16(number)
+ new_instance['uint16Propa'] = [pywbem.Uint16(number), \
+ pywbem.Uint16(number), \
+ pywbem.Uint16(number)]
+ new_instance['uint32Prop'] = pywbem.Uint32(number)
+ new_instance['uint32Propa'] = [pywbem.Uint32(number), \
+ pywbem.Uint32(number), \
+ pywbem.Uint32(number)]
+ new_instance['uint64Prop'] = pywbem.Uint64(number)
+ new_instance['uint64Propa'] = [pywbem.Uint64(number), \
+ pywbem.Uint64(number), \
+ pywbem.Uint64(number)]
+ new_instance['uint8Prop'] = pywbem.Uint64(number)
+ new_instance['uint8Propa'] = [pywbem.Uint64(number), \
+ pywbem.Uint64(number), \
+ pywbem.Uint64(number)]
+
+ try:
+ cipath = self.conn.CreateInstance(new_instance)
+ new_instance.path = cipath
+ self.inst_paths.append(cipath)
+
+ except pywbem.CIMError, arg:
+ return None, arg
+
+ return new_instance, None
+
+
+ def test_2_create_instance(self):
+ """Test create"""
+ for atom_name, atomic_number in _atoms.items():
+ rval, msg = self._create_test_instance(atom_name, atomic_number)
+ if not rval:
+ self.fail('%s: CreateInstance Failed.' % str(msg))
+ continue
+ try:
+ ci = self.conn.GetInstance(rval.path)
+ except pywbem.CIMError,arg:
+ self.fail('GetInstance failed for instance just created')
+ continue
+
+ _compare_values(self.conn, ci, self.time)
+
+
+ def test_3_enum_instances(self):
+ """Test enum_instances"""
+ insts = []
+ for atom_name, atomic_number in _atoms.items():
+ rval, msg = self._create_test_instance(atom_name, atomic_number)
+ if not rval:
+ self.fail('%s: CreateInstance Failed.' % str(msg))
+ continue
+ try:
+ ci = self.conn.GetInstance(rval.path)
+ insts.append(ci)
+ except pywbem.CIMError,arg:
+ self.fail('GetInstance failed for instance just created')
+ continue
+
+ try:
+ ta_list = self.conn.EnumerateInstances('Test_Atom')
+ except pywbem.CIMError, arg:
+ self.fail('EnumerateInstances Failed: %s' % str(arg))
+ raise
+
+ try:
+ paths = self.conn.EnumerateInstanceNames('Test_Atom')
+ except pywbem.CIMError, arg:
+ self.fail('EnumerateInstanceNames Failed: %s' % str(arg))
+
+ if len(paths) != len(ta_list):
+ self.fail('EnumerateInstances returned different number of '
+ 'results than EnumerateInstanceNames')
+
+ for ci in insts:
+ for rci in ta_list:
+ rci.path.host = None
+ if rci.path == ci.path:
+ _compare_values(self.conn, rci, self.time)
+ break
+ else:
+ self.fail('Did not get a created instance back from EnumerateInstance')
+ return
+
+
+ def test_4_enum_instance_names(self):
+ """Test enum_instance_names"""
+ insts = []
+ for atom_name, atomic_number in _atoms.items():
+ rval, msg = self._create_test_instance(atom_name, atomic_number)
+ if not rval:
+ self.fail('%s: CreateInstance Failed.' % str(msg))
+ continue
+ try:
+ ci = self.conn.GetInstance(rval.path)
+ insts.append(ci)
+ except pywbem.CIMError,arg:
+ self.fail('GetInstance failed for instance just created')
+ continue
+
+ try:
+ ta_list = self.conn.EnumerateInstanceNames('Test_Atom')
+ except pywbem.CIMError, arg:
+ self.fail('EnumerateInstanceNames Failed: %s' % str(arg))
+ raise
+
+ try:
+ instances = self.conn.EnumerateInstances('Test_Atom')
+ except pywbem.CIMError, arg:
+ self.fail('EnumerateInstances Failed: %s' % str(arg))
+
+ for ci in insts:
+ for path in ta_list:
+ path.host = None
+ if path == ci.path:
+ break
+ else:
+ self.fail('Did not get a created instance name back from EnumerateNames')
+ return
+
+
+ def test_5_get_instance_with_property_list(self):
+ """Test Get_Instance """
+ rinst, msg = self._create_test_instance('Carbon', 6)
+ if not rinst:
+ self.fail('%s: CreateInstance Failed.' % str(msg))
+ return
+
+ propertylist = ['uint16Prop', 'dateProp', 'stringProp', 'real64Prop', \
+ 'sint32Propa', 'sint32Prop']
+ keybindings = {'Name': 'Carbon'}
+ try:
+ inst = get_instance(self.conn, keybindings, propertylist)
+ except pywbem.CIMError, arg:
+ raise arg
+
+ for prop in inst.properties.keys():
+ if prop not in propertylist:
+ #self.fail("Property Not Found in PropertyList: %s" % prop)
+ print "Property Not Found in PropertyList: %s" % prop
+
+
+ def test_6_modify_instance(self):
+ """Test modify instance"""
+ rinst, msg = self._create_test_instance('Boron', 5)
+ if not rinst:
+ self.fail('%s: CreateInstance Failed.' % str(msg))
+ return
+
+ propertylist = ['uint64Prop', 'dateProp', 'stringProp', 'real32Prop', \
+ 'sint64Propa', 'sint64prop', 'boolProp']
+ keybindings = {'Name': 'Boron'}
+
+ mod_instance = get_instance(self.conn, keybindings, propertylist)
+
+ weight = _atomic_weights['Boron']
+ new_time = pywbem.CIMDateTime.now()
+ if mod_instance['boolProp']:
+ mod_instance['boolProp'] = False
+ else:
+ mod_instance['boolProp'] = True
+ mod_instance['uint64Prop'] = pywbem.Uint64(2)
+ mod_instance['dateProp'] = new_time
+ mod_instance['stringProp'] = "Helium"
+ mod_instance['real32Prop'] = pywbem.Real32(weight)
+ mod_instance['sint64Propa'] = pywbem.CIMProperty('sint64Propa', \
+ value=[pywbem.Sint64(2), \
+ pywbem.Sint64(2), pywbem.Sint64(2)])
+ mod_instance['sint64prop'] = pywbem.Sint64(2)
+ mod_instance['Name'] = 'Boron'
+
+ try:
+ self.conn.ModifyInstance(mod_instance)
+ except pywbem.CIMError, arg:
+ self.fail(arg)
+
+ mod_instance = get_instance(self.conn, keybindings, propertylist)
+ for prop in mod_instance.properties.keys():
+ if prop == 'uint64Prop' or prop == 'sint64Prop':
+ self.assertEqual(mod_instance[prop],2,"Values NOT EQUAL")
+ elif prop == "real32Prop":
+ self.assertTrue(math.fabs(mod_instance[prop] - weight) <\
+ _tolerance,"Values NOT EQUAL")
+ elif prop == 'dateProp':
+ self.assertNotEquals(self.time,mod_instance[prop], \
+ "Times ARE EQUAL")
+ elif prop == 'sint64Propa':
+ for val in mod_instance[prop]:
+ self.assertEquals(val, pywbem.Sint64(2), \
+ ("Values NOT EQUAL: " + str(prop)))
+ elif prop == 'stringProp':
+ self.assertNotEquals(mod_instance[prop], 'Boron', \
+ ("Values NOT EQUAL"+str(prop)))
+ elif prop == 'boolProp':
+ self.assertNotEqual(mod_instance['boolProp'], \
+ (not mod_instance['boolProp']), \
+ "ModifyInstance failed.")
+
+
+ def test_7_delete(self):
+ """Test delete instance"""
+ insts = []
+ for atom_name, atomic_number in _atoms.items():
+ rval, msg = self._create_test_instance(atom_name, atomic_number)
+ if not rval:
+ self.fail('%s: CreateInstance Failed.' % str(msg))
+ continue
+ try:
+ ci = self.conn.GetInstance(rval.path)
+ insts.append(ci)
+ except pywbem.CIMError,arg:
+ self.fail('GetInstance failed for instance just created')
+ continue
+
+ del_instances = get_instance_names(self.conn)
+ for inst in del_instances:
+ try:
+ self.conn.DeleteInstance(inst)
+ except pywbem.CIMError, arg:
+ self.fail('DeleteInstance Failed: %s' % str(arg))
+ break
+ else:
+ for inst in del_instances:
+ try:
+ self.conn.DeleteInstance(inst)
+ except pywbem.CIMError, arg:
+ self.failUnlessEqual(arg[0], pywbem.CIM_ERR_NOT_FOUND,
+ 'Unexpected exception on delete: %s' % str(arg))
+
+################################################################################
+#Return the TestAtomClass
+def get_unit_test():
+ return TestAtomProvider
+
+if __name__ == "__main__":
+ suite = unittest.makeSuite(TestAtomProvider)
+ unittest.TextTestRunner(verbosity=2).run(suite)
Added: cmpi-bindings/trunk/test/python/TestMethod.mof
===================================================================
--- cmpi-bindings/trunk/test/python/TestMethod.mof (rev 0)
+++ cmpi-bindings/trunk/test/python/TestMethod.mof 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,264 @@
+[ Description("Class with several methods to test method provider capabilities.")]
+class Test_Method
+{
+ [Key, Description("Unique identifier for this instance.")]
+ string id;
+
+ string p_str;
+ sint32 p_sint32;
+
+ sint8 genRand_sint8(
+ [in] sint8 min,
+ [in] sint8 max,
+ [in(false), out] boolean success
+ );
+ sint16 genRand_sint16(
+ [in] sint16 min,
+ [in] sint16 max,
+ [in(false), out] boolean success
+ );
+ sint32 genRand_sint32(
+ [in] sint32 min,
+ [in] sint32 max,
+ [in(false), out] boolean success
+ );
+ sint64 genRand_sint64(
+ [in] sint64 min,
+ [in] sint64 max,
+ [in(false), out] boolean success
+ );
+ uint8 genRand_uint8(
+ [in] uint8 min,
+ [in] uint8 max,
+ [in(false), out] boolean success
+ );
+ uint16 genRand_uint16(
+ [in] uint16 min,
+ [in] uint16 max,
+ [in(false), out] boolean success
+ );
+ uint32 genRand_uint32(
+ [in] uint32 min,
+ [in] uint32 max,
+ [in(false), out] boolean success
+ );
+ uint64 genRand_uint64(
+ [in] uint64 min,
+ [in] uint64 max,
+ [in(false), out] boolean success
+ );
+ real32 genRand_real32(
+ [in] real32 min,
+ [in] real32 max,
+ [in(false), out] boolean success
+ );
+ real64 genRand_real64(
+ [in] real64 min,
+ [in] real64 max,
+ [in(false), out] boolean success
+ );
+
+ boolean genRandList_sint8(
+ [in, out, required] sint8 lo,
+ [in, out, required] sint8 hi,
+ [in, required] sint32 nelems,
+ [in(false), out] sint8 nlist[]
+ );
+ boolean genRandList_sint16(
+ [in, out, required] sint16 lo,
+ [in, out, required] sint16 hi,
+ [in, required] sint32 nelems,
+ [in(false), out] sint16 nlist []
+ );
+ boolean genRandList_sint32(
+ [in, out, required] sint32 lo,
+ [in, out, required] sint32 hi,
+ [in, required] sint32 nelems,
+ [in(false), out] sint32 nlist []
+ );
+ boolean genRandList_sint64(
+ [in, out, required] sint64 lo,
+ [in, out, required] sint64 hi,
+ [in, required] sint32 nelems,
+ [in(false), out] sint64 nlist []
+ );
+ boolean genRandList_uint8(
+ [in, out, required] uint8 lo,
+ [in, out, required] uint8 hi,
+ [in, required] sint32 nelems,
+ [in(false), out] uint8 nlist []
+ );
+ boolean genRandList_uint16(
+ [in, out, required] uint16 lo,
+ [in, out, required] uint16 hi,
+ [in, required] sint32 nelems,
+ [in(false), out] uint16 nlist []
+ );
+ boolean genRandList_uint32(
+ [in, out, required] uint32 lo,
+ [in, out, required] uint32 hi,
+ [in, required] sint32 nelems,
+ [in(false), out] uint32 nlist []
+ );
+ boolean genRandList_uint64(
+ [in, out, required] uint64 lo,
+ [in, out, required] uint64 hi,
+ [in, required] sint32 nelems,
+ [in(false), out] uint64 nlist []
+ );
+ boolean genRandList_real32(
+ [in, out, required] real32 lo,
+ [in, out, required] real32 hi,
+ [in, required] sint32 nelems,
+ [in(false), out] real32 nlist []
+ );
+ boolean genRandList_real64(
+ [in, out, required] real64 lo,
+ [in, out, required] real64 hi,
+ [in, required] sint32 nelems,
+ [in(false), out] real64 nlist []
+ );
+
+ boolean minmedmax_sint8(
+ [in, required] sint8 numlist[],
+ [in(false), out] sint8 min,
+ [in(false), out] sint8 max,
+ [in(false), out] sint8 med
+ );
+ boolean minmedmax_sint16(
+ [in, required] sint16 numlist[],
+ [in(false), out] sint16 min,
+ [in(false), out] sint16 max,
+ [in(false), out] sint16 med
+ );
+ boolean minmedmax_sint32(
+ [in, required] sint32 numlist[],
+ [in(false), out] sint32 min,
+ [in(false), out] sint32 max,
+ [in(false), out] sint32 med
+ );
+ boolean minmedmax_sint64(
+ [in, required] sint64 numlist[],
+ [in(false), out] sint64 min,
+ [in(false), out] sint64 max,
+ [in(false), out] sint64 med
+ );
+ boolean minmedmax_uint8(
+ [in, required] uint8 numlist[],
+ [in(false), out] uint8 min,
+ [in(false), out] uint8 max,
+ [in(false), out] uint8 med
+ );
+ boolean minmedmax_uint16(
+ [in, required] uint16 numlist[],
+ [in(false), out] uint16 min,
+ [in(false), out] uint16 max,
+ [in(false), out] uint16 med
+ );
+ boolean minmedmax_uint32(
+ [in, required] uint32 numlist[],
+ [in(false), out] uint32 min,
+ [in(false), out] uint32 max,
+ [in(false), out] uint32 med
+ );
+ boolean minmedmax_uint64(
+ [in, required] uint64 numlist[],
+ [in(false), out] uint64 min,
+ [in(false), out] uint64 max,
+ [in(false), out] uint64 med
+ );
+ boolean minmedmax_real32(
+ [in, required] real32 numlist[],
+ [in(false), out] real32 min,
+ [in(false), out] real32 max,
+ [in(false), out] real32 med
+ );
+ boolean minmedmax_real64(
+ [in, required] real64 numlist[],
+ [in(false), out] real64 min,
+ [in(false), out] real64 max,
+ [in(false), out] real64 med
+ );
+
+ boolean strSplit(
+ [in, required] string str,
+ [in] string sep,
+ [in(false), out] sint32 nelems,
+ [in(false), out] string elems[]
+ );
+ string strCat(
+ [in, required] string strs[],
+ [in] string sep
+ );
+
+ datetime getDate(
+ [in, required] string datestr
+ );
+ boolean getDates(
+ [in, required] string datestrs[],
+ [in(false), out] sint32 nelems,
+ [in(false), out] datetime elems[]
+ );
+
+ char16 mkUniChar(
+ [in, required] sint8 c
+ );
+ boolean mkUniCharArray(
+ [in, required] sint8 inArr[],
+ [in(false), out] char16 outArr[]
+ );
+ string mkUniStr_sint8(
+ [in, required] sint8 cArr[]
+ );
+ string mkUniStr_char16(
+ [in, required] char16 cArr[]
+ );
+
+ string getStrProp();
+
+ [ Description("Set the value of p_str. Return the previous value of "
+ "p_str.")]
+ string setStrProp(
+ [in, required] string value
+ );
+
+ sint32 getIntProp();
+
+ [ Description("Set the value of p_sint32. Return the previous value of "
+ "p_sint32.")]
+ sint32 setIntProp(
+ [in, required] sint32 value
+ );
+
+ [ Description("Return the instance name of any instance of Test_Method") ]
+ sint32 getObjectPath(
+ [in(false), out] Test_Method REF path
+ );
+
+ [ Description("Return instance names of all instances of Test_Method") ]
+ sint32 getObjectPaths(
+ [in(false), out] Test_Method REF paths[]
+ );
+
+ [ Description("Delete the specified instance of Test_Method") ]
+ sint32 delObject(
+ [in, required] Test_Method REF path
+ );
+
+ [ Description("Delete the specified instances of Test_Method") ]
+ sint32 delObjects(
+ [in, required] Test_Method REF paths[]
+ );
+
+ [ Description("Create the specified instance of Test_Method") ]
+ sint32 createObject(
+ [in, required, EmbeddedInstance("Test_Method")] string inst
+ );
+
+ [ Description("Create the specified instances of Test_Method") ]
+ sint32 createObjects(
+ [in, required, EmbeddedInstance("Test_Method")] string insts[]
+ );
+
+};
+
Added: cmpi-bindings/trunk/test/python/TestMethod.peg.reg
===================================================================
--- cmpi-bindings/trunk/test/python/TestMethod.peg.reg (rev 0)
+++ cmpi-bindings/trunk/test/python/TestMethod.peg.reg 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,28 @@
+//////// TestMethod
+instance of PG_ProviderModule
+{
+ Name = "/usr/lib/pycim/TestMethod.py";
+ InterfaceType = "Python";
+ InterfaceVersion = "1.0.0";
+ Location = "/usr/lib/pycim/TestMethod.py";
+ Vendor = "OMC";
+ Version = "0.1.0";
+};
+
+instance of PG_Provider
+{
+ Name = "TestMethod";
+ ProviderModuleName = "/usr/lib/pycim/TestMethod.py";
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "TestMethod";
+ ProviderModuleName = "/usr/lib/pycim/TestMethod.py";
+ ProviderName = "TestMethod";
+ ClassName = "Test_Method";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,5}; // Instance, Method
+};
+
+
Added: cmpi-bindings/trunk/test/python/TestMethod.py
===================================================================
--- cmpi-bindings/trunk/test/python/TestMethod.py (rev 0)
+++ cmpi-bindings/trunk/test/python/TestMethod.py 2008-08-27 17:20:45 UTC (rev 883)
@@ -0,0 +1,690 @@
+"""Python Provider for TestMethod
+
+Instruments the CIM class TestMethod
+
+"""
+
+import pywbem
+import random
+
+g_insts = {}
+
+class TestMethodProvider(pywbem.CIMProvider):
+ """Instrument the CIM class TestMethod
+
+ Class with several methods to test method provider capabilities.
+
+ """
+
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+ # If you will be filtering instances yourself according to
+ # property_list, role, result_role, and result_class_name
+ # parameters, set self.filter_results to False
+ # self.filter_results = False
+
+ def get_instance(self, env, model, cim_class):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+
+ try:
+ inst = g_insts[model['id']]
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+
+ model.update_existing(p_sint32=inst[1])
+ model.update_existing(p_str=inst[0])
+ return model
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+
+ for key in g_insts.keys():
+ model['id'] = key
+ if keys_only:
+ ...
[truncated message content] |
|
From: <ba...@us...> - 2008-08-27 15:10:48
|
Revision: 882
http://omc.svn.sourceforge.net/omc/?rev=882&view=rev
Author: bartw
Date: 2008-08-27 15:10:53 +0000 (Wed, 27 Aug 2008)
Log Message:
-----------
inserted a trunk directory
Added Paths:
-----------
cmpi-bindings/trunk/
cmpi-bindings/trunk/CMakeLists.txt
cmpi-bindings/trunk/COPYING
cmpi-bindings/trunk/README
cmpi-bindings/trunk/TODO
cmpi-bindings/trunk/VERSION.cmake
cmpi-bindings/trunk/cmpi-bindings.spec.cmake
cmpi-bindings/trunk/doc/
cmpi-bindings/trunk/include/
cmpi-bindings/trunk/mof/
cmpi-bindings/trunk/src/
cmpi-bindings/trunk/swig/
Removed Paths:
-------------
cmpi-bindings/CMakeLists.txt
cmpi-bindings/COPYING
cmpi-bindings/README
cmpi-bindings/TODO
cmpi-bindings/VERSION.cmake
cmpi-bindings/cmpi-bindings.spec.cmake
cmpi-bindings/doc/
cmpi-bindings/include/
cmpi-bindings/mof/
cmpi-bindings/src/
cmpi-bindings/swig/
Deleted: cmpi-bindings/CMakeLists.txt
===================================================================
--- cmpi-bindings/CMakeLists.txt 2008-08-26 23:30:44 UTC (rev 881)
+++ cmpi-bindings/CMakeLists.txt 2008-08-27 15:10:53 UTC (rev 882)
@@ -1,97 +0,0 @@
-#
-# CMakeLists.txt for cmpi-bindings
-#
-PROJECT(cmpi-bindings)
-
-cmake_minimum_required(VERSION 2.4)
-
-enable_testing()
-#
-# 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})
-
-# 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" )
-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)
Deleted: cmpi-bindings/COPYING
===================================================================
--- cmpi-bindings/COPYING 2008-08-26 23:30:44 UTC (rev 881)
+++ cmpi-bindings/COPYING 2008-08-27 15:10:53 UTC (rev 882)
@@ -1,28 +0,0 @@
-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.
Deleted: cmpi-bindings/README
===================================================================
--- cmpi-bindings/README 2008-08-26 23:30:44 UTC (rev 881)
+++ cmpi-bindings/README 2008-08-27 15:10:53 UTC (rev 882)
@@ -1,50 +0,0 @@
-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
Deleted: cmpi-bindings/TODO
===================================================================
--- cmpi-bindings/TODO 2008-08-26 23:30:44 UTC (rev 881)
+++ cmpi-bindings/TODO 2008-08-27 15:10:53 UTC (rev 882)
@@ -1,27 +0,0 @@
-Keep track of which objects are created with new*() methods from the
-brokerEncFT, and which are created with clone(). We have to release the
-later, not the former.
-
-Fix memory leaks related to cloning of CMPIData structs.
-
-Items marked as "TODO" in the code.
-
-Fix the build to determine the python version and dynamically link
-to libpython. Cmake only knows how to statically link to libpython.
-Right now it is hard-coded for libpython-2.5.
-
-Finish wrapping broker FTs, such as upcalls.
-
-Handling CMPIStatus:
-Instead of returning CMPIStatus, check it in C code, and throw and
-exception if it isn't CMPI_RC_OK. Functions that return CMPIStatus
-would then be void instead. We'll check CMPIStatus* output parameters
-as well, and do the same. We need to create an exception class with a
-code and error string in swig.
-[Not possible to pass status+message in a generic way. How about a
-toplevel function which raised the execption ?]
-
-Split src/ into target-specific and common parts
-
-Wrap CMPIEnumeration and CMPIArray in typemaps.
-
Deleted: cmpi-bindings/VERSION.cmake
===================================================================
--- cmpi-bindings/VERSION.cmake 2008-08-26 23:30:44 UTC (rev 881)
+++ cmpi-bindings/VERSION.cmake 2008-08-27 15:10:53 UTC (rev 882)
@@ -1,3 +0,0 @@
-SET(VERSION_MAJOR "0")
-SET(VERSION_MINOR "1")
-SET(VERSION_PATCH "0")
Deleted: cmpi-bindings/cmpi-bindings.spec.cmake
===================================================================
--- cmpi-bindings/cmpi-bindings.spec.cmake 2008-08-26 23:30:44 UTC (rev 881)
+++ cmpi-bindings/cmpi-bindings.spec.cmake 2008-08-27 15:10:53 UTC (rev 882)
@@ -1,84 +0,0 @@
-#
-# 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
Copied: cmpi-bindings/trunk/CMakeLists.txt (from rev 881, cmpi-bindings/CMakeLists.txt)
===================================================================
--- cmpi-bindings/trunk/CMakeLists.txt (rev 0)
+++ cmpi-bindings/trunk/CMakeLists.txt 2008-08-27 15:10:53 UTC (rev 882)
@@ -0,0 +1,97 @@
+#
+# CMakeLists.txt for cmpi-bindings
+#
+PROJECT(cmpi-bindings)
+
+cmake_minimum_required(VERSION 2.4)
+
+enable_testing()
+#
+# 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})
+
+# 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" )
+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)
Property changes on: cmpi-bindings/trunk/CMakeLists.txt
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: cmpi-bindings/trunk/COPYING (from rev 881, cmpi-bindings/COPYING)
===================================================================
--- cmpi-bindings/trunk/COPYING (rev 0)
+++ cmpi-bindings/trunk/COPYING 2008-08-27 15:10:53 UTC (rev 882)
@@ -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.
Property changes on: cmpi-bindings/trunk/COPYING
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: cmpi-bindings/trunk/README (from rev 881, cmpi-bindings/README)
===================================================================
--- cmpi-bindings/trunk/README (rev 0)
+++ cmpi-bindings/trunk/README 2008-08-27 15:10:53 UTC (rev 882)
@@ -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
Property changes on: cmpi-bindings/trunk/README
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: cmpi-bindings/trunk/TODO (from rev 881, cmpi-bindings/TODO)
===================================================================
--- cmpi-bindings/trunk/TODO (rev 0)
+++ cmpi-bindings/trunk/TODO 2008-08-27 15:10:53 UTC (rev 882)
@@ -0,0 +1,27 @@
+Keep track of which objects are created with new*() methods from the
+brokerEncFT, and which are created with clone(). We have to release the
+later, not the former.
+
+Fix memory leaks related to cloning of CMPIData structs.
+
+Items marked as "TODO" in the code.
+
+Fix the build to determine the python version and dynamically link
+to libpython. Cmake only knows how to statically link to libpython.
+Right now it is hard-coded for libpython-2.5.
+
+Finish wrapping broker FTs, such as upcalls.
+
+Handling CMPIStatus:
+Instead of returning CMPIStatus, check it in C code, and throw and
+exception if it isn't CMPI_RC_OK. Functions that return CMPIStatus
+would then be void instead. We'll check CMPIStatus* output parameters
+as well, and do the same. We need to create an exception class with a
+code and error string in swig.
+[Not possible to pass status+message in a generic way. How about a
+toplevel function which raised the execption ?]
+
+Split src/ into target-specific and common parts
+
+Wrap CMPIEnumeration and CMPIArray in typemaps.
+
Property changes on: cmpi-bindings/trunk/TODO
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: cmpi-bindings/trunk/VERSION.cmake (from rev 881, cmpi-bindings/VERSION.cmake)
===================================================================
--- cmpi-bindings/trunk/VERSION.cmake (rev 0)
+++ cmpi-bindings/trunk/VERSION.cmake 2008-08-27 15:10:53 UTC (rev 882)
@@ -0,0 +1,3 @@
+SET(VERSION_MAJOR "0")
+SET(VERSION_MINOR "1")
+SET(VERSION_PATCH "0")
Property changes on: cmpi-bindings/trunk/VERSION.cmake
___________________________________________________________________
Added: svn:mergeinfo
+
Copied: cmpi-bindings/trunk/cmpi-bindings.spec.cmake (from rev 881, cmpi-bindings/cmpi-bindings.spec.cmake)
===================================================================
--- cmpi-bindings/trunk/cmpi-bindings.spec.cmake (rev 0)
+++ cmpi-bindings/trunk/cmpi-bindings.spec.cmake 2008-08-27 15:10:53 UTC (rev 882)
@@ -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
Property changes on: cmpi-bindings/trunk/cmpi-bindings.spec.cmake
___________________________________________________________________
Added: svn:mergeinfo
+
Property changes on: cmpi-bindings/trunk/doc
___________________________________________________________________
Added: svn:mergeinfo
+
Property changes on: cmpi-bindings/trunk/include
___________________________________________________________________
Added: svn:mergeinfo
+
Property changes on: cmpi-bindings/trunk/mof
___________________________________________________________________
Added: svn:mergeinfo
+
Property changes on: cmpi-bindings/trunk/src
___________________________________________________________________
Added: svn:mergeinfo
+
Property changes on: cmpi-bindings/trunk/swig
___________________________________________________________________
Added: svn:mergeinfo
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-26 23:30:35
|
Revision: 881
http://omc.svn.sourceforge.net/omc/?rev=881&view=rev
Author: mike-brasher
Date: 2008-08-26 23:30:44 +0000 (Tue, 26 Aug 2008)
Log Message:
-----------
Some cardinality tests for boot service profile.
Modified Paths:
--------------
cmpiprofiles/test/trunk/ProviderTests.py
Modified: cmpiprofiles/test/trunk/ProviderTests.py
===================================================================
--- cmpiprofiles/test/trunk/ProviderTests.py 2008-08-22 21:19:11 UTC (rev 880)
+++ cmpiprofiles/test/trunk/ProviderTests.py 2008-08-26 23:30:44 UTC (rev 881)
@@ -221,6 +221,21 @@
"Linux_LANEndpointElementCapabilities", \
"Linux_LANEndpoint")
+ ##
+ ## Boot Control Profile
+ ##
+
+ c.expect_1("Linux_BootService")
+ c.expect_1("Linux_BootConfigSetting")
+ c.expect_1("Linux_BootElementConformsToProfile")
+ c.expect_1("Linux_BootElementSettingData")
+ c.expect_1("Linux_BootHostedService")
+ c.expect_1("Linux_BootReferencedProfile", "root/interop")
+ c.expect_1("Linux_BootRegisteredProfile", "root/interop")
+ c.expect_1("Linux_BootServiceAffectsElement")
+ n = c.expect_1_plus("Linux_GrubBootSourceSetting")
+ c.expect_n(n, "Linux_BootOrderedComponent")
+
print "OKAY"
sys.exit(0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-22 21:19:02
|
Revision: 880
http://omc.svn.sourceforge.net/omc/?rev=880&view=rev
Author: mike-brasher
Date: 2008-08-22 21:19:11 +0000 (Fri, 22 Aug 2008)
Log Message:
-----------
Added new provider-specific tests for cardinality of instances and
associations.
Modified Paths:
--------------
cmpiprofiles/test/trunk/Makefile
Added Paths:
-----------
cmpiprofiles/test/trunk/ProviderTests.py
Modified: cmpiprofiles/test/trunk/Makefile
===================================================================
--- cmpiprofiles/test/trunk/Makefile 2008-08-21 14:19:49 UTC (rev 879)
+++ cmpiprofiles/test/trunk/Makefile 2008-08-22 21:19:11 UTC (rev 880)
@@ -1,8 +1,8 @@
help:
- @ echo "targets: all sanity profiles"
+ @ echo "targets: all sanity profiles providers"
-all: sanity profiles
+all: sanity profiles providers
sanity:
./AllSanityTest.py --url=http://localhost
@@ -15,3 +15,6 @@
@ ./ProfileTest.py --url $(URL) Linux_SSHProtocolService Linux_SSHRegisteredProfile
@ ./ProfileTest.py --url $(URL) Linux_Fan Linux_FanRegisteredProfile
@ ./ProfileTest.py --url $(URL) Linux_PowerSupply Linux_PowerSupplyRegisteredProfile
+
+providers:
+ ./ProviderTests.py --url=http://localhost
Added: cmpiprofiles/test/trunk/ProviderTests.py
===================================================================
--- cmpiprofiles/test/trunk/ProviderTests.py (rev 0)
+++ cmpiprofiles/test/trunk/ProviderTests.py 2008-08-22 21:19:11 UTC (rev 880)
@@ -0,0 +1,226 @@
+#!/usr/bin/env python
+# Author: Mike Brasher
+# Date: Wed Aug 13 2008
+
+import pywbem
+import optparse
+import sys
+sys.path.append("./lib")
+import wbem_connection
+
+################################################################################
+##
+## class TestConnection
+##
+################################################################################
+
+def err(msg):
+ print "\n**** ERROR: %s\n" %(msg)
+ sys.exit(1)
+
+################################################################################
+##
+## class TestConnection
+##
+################################################################################
+
+class TestConnection(pywbem.WBEMConnection):
+
+ def __init__(self, parser = None):
+
+ if parser == None:
+ parser = optparse.OptionParser()
+
+ wbem_connection.getWBEMConnParserOptions(parser)
+ opts, args = parser.parse_args();
+
+ url = opts.url
+ user = opts.user
+ password = opts.password
+
+ if user and not password:
+ password = getpass('\nEnter password for %s: ' % user)
+
+ pywbem.WBEMConnection.__init__(self, url, ((user, password)))
+
+ # Expect exactly n instances of the given class.
+ def expect_n(self, n, classname, namespace = None):
+
+ if namespace is None:
+ namespace = self.default_namespace
+
+ print ">>>> expect_n(%u, %s, %s)" %(n, classname, namespace)
+
+ r = self.EnumerateInstances(classname, namespace)
+ m = len(r)
+
+ if (m != n):
+ err("expected %d instances but found %d" %(n, m))
+
+ return m
+
+ # Expect zero instances of the given class.
+ def expect_0(self, classname, namespace = None):
+
+ if namespace is None:
+ namespace = self.default_namespace
+
+ print ">>>> expect_0(%s, %s)" %(classname, namespace)
+
+ r = self.EnumerateInstances(classname, namespace)
+ n = len(r)
+
+ if (n != 0):
+ err("expected 0 instances but found %d" %(n))
+
+ return n
+
+ # Expect one instance of the given class.
+ def expect_1(self, classname, namespace = None):
+
+ if namespace is None:
+ namespace = self.default_namespace
+
+ print ">>>> expect_1(%s, %s)" %(classname, namespace)
+
+ r = self.EnumerateInstances(classname, namespace)
+ n = len(r)
+
+ if (n != 1):
+ err("expected 1 instance but found %d" %(n))
+
+ return n
+
+ # Expect one or more instances of the given class.
+ def expect_1_plus(self, classname, namespace = None):
+
+ if namespace is None:
+ namespace = self.default_namespace
+
+ print ">>>> expect_1_plus(%s, %s)" %(classname, namespace)
+
+ r = self.EnumerateInstances(classname, namespace)
+ n = len(r)
+
+ if (n < 1):
+ err("expected 1+ instances but found %d" %(n))
+
+ return n
+
+ # Expect 1-to-1 cardinality between class1 and class2 through the assoc.
+ def expect_1_to_1(self, class1, assoc, class2, namespace = None):
+
+ if namespace is None:
+ namespace = self.default_namespace
+
+ print ">>>> expect_1_to_1(%s, %s, %s, %s)" \
+ %(class1, assoc, class2, namespace)
+
+ r = self.EnumerateInstanceNames(class1, namespace)
+
+ for i in r:
+
+ a1 = self.AssociatorNames(i, AssocClass=assoc)
+
+ if len(a1) != 1:
+ err("expected 1 associator but found %d" %(len(a1)))
+
+ try:
+ inst = c.GetInstance(a1[0])
+ except:
+ err("GetInstance() failed")
+
+ # Expect 1-to-n cardinality between class1 and class2 through the assoc.
+ def expect_1_to_n(self, n, class1, assoc, class2, namespace = None):
+
+ if namespace is None:
+ namespace = self.default_namespace
+
+ print ">>>> expect_1_to_n(%d, %s, %s, %s, %s)" \
+ %(n, class1, assoc, class2, namespace)
+
+ r = self.EnumerateInstanceNames(class1, namespace)
+
+ for i in r:
+
+ a1 = self.AssociatorNames(i, AssocClass=assoc)
+
+ if len(a1) != n:
+ err("expected %d associators but found %d" %(n, len(a1)))
+
+################################################################################
+##
+## __main__
+##
+################################################################################
+
+if __name__ == "__main__":
+
+ c = TestConnection()
+
+ ##
+ ## General tests
+ ##
+
+ c.expect_0("CIM_RegisteredProfile")
+ c.expect_0("CIM_ReferencedProfile")
+ c.expect_1_plus("CIM_RegisteredProfile", "root/interop")
+ c.expect_1_plus("CIM_ReferencedProfile", "root/interop")
+ c.expect_1_plus("CIM_ElementConformsToProfile", "root/interop")
+ c.expect_1_plus("CIM_ElementConformsToProfile")
+
+ ##
+ ## Ethernet Port Profile
+ ##
+
+ n = c.expect_1_plus("Linux_EthernetPort")
+ c.expect_n(n, "Linux_LANEndpoint")
+ c.expect_n(n, "Linux_EthernetPortDeviceSAPImplementation")
+ c.expect_n(n, "Linux_EthernetPortElementConformsToProfile")
+ c.expect_n(n, "Linux_EthernetPortElementCapabilities")
+ c.expect_n(n, "Linux_EthernetPortHostedAccessPoint")
+ c.expect_n(n, "Linux_EthernetPortSystemDevice")
+ c.expect_n(n, "Linux_EthernetPortElementConformsToProfile", "root/interop")
+ c.expect_1("Linux_EthernetPortRegisteredProfile", "root/interop")
+ c.expect_1("Linux_EthernetPortReferencedProfile", "root/interop")
+ c.expect_1("Linux_EthernetPortEnabledLogicalElementCapabilities");
+ # Linux_EthernetPortDeviceSAPImplementation associations:
+ c.expect_1_to_1( \
+ "Linux_EthernetPort", \
+ "Linux_EthernetPortDeviceSAPImplementation", \
+ "Linux_LANEndpoint")
+ c.expect_1_to_1( \
+ "Linux_LANEndpoint", \
+ "Linux_EthernetPortDeviceSAPImplementation", \
+ "Linux_EthernetPort")
+ # Linux_EthernetPortElementCapabilities associations:
+ c.expect_1_to_n( \
+ n,
+ "Linux_EthernetPortEnabledLogicalElementCapabilities", \
+ "Linux_EthernetPortElementCapabilities", \
+ "Linux_EthernetPort")
+ c.expect_1_to_1( \
+ "Linux_EthernetPort", \
+ "Linux_EthernetPortElementCapabilities", \
+ "Linux_EthernetPortEnabledLogicalElementCapabilities")
+ # Linux_EthernetPortElementCapabilities associations:
+ c.expect_1_to_1( \
+ "Linux_EthernetPort", \
+ "Linux_EthernetPortElementConformsToProfile", \
+ "Linux_EthernetPortRegisteredProfile")
+ c.expect_1_to_n( \
+ n,
+ "Linux_EthernetPortRegisteredProfile", \
+ "Linux_EthernetPortElementConformsToProfile", \
+ "Linux_EthernetPort", \
+ "root/interop")
+ # LANEndpointElementCapabilitiesProvider associations:
+ c.expect_1_to_n( \
+ n,
+ "Linux_LANEndpointEnabledLogicalElementCapabilities", \
+ "Linux_LANEndpointElementCapabilities", \
+ "Linux_LANEndpoint")
+
+ print "OKAY"
+ sys.exit(0)
+
Property changes on: cmpiprofiles/test/trunk/ProviderTests.py
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <np...@us...> - 2008-08-21 14:19:39
|
Revision: 879
http://omc.svn.sourceforge.net/omc/?rev=879&view=rev
Author: npaxton
Date: 2008-08-21 14:19:49 +0000 (Thu, 21 Aug 2008)
Log Message:
-----------
add gdb debug flag to make
Modified Paths:
--------------
cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/lsgrub.mak
Modified: cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/lsgrub.mak
===================================================================
--- cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/lsgrub.mak 2008-08-20 23:44:59 UTC (rev 878)
+++ cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/lsgrub.mak 2008-08-21 14:19:49 UTC (rev 879)
@@ -1,2 +1,2 @@
all:
- gcc -I/usr/include/cmpi -o lsgrub -DLSGRUB Resource.c
+ gcc -ggdb -I/usr/include/cmpi -o lsgrub -DLSGRUB Resource.c
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-20 23:44:50
|
Revision: 878
http://omc.svn.sourceforge.net/omc/?rev=878&view=rev
Author: mike-brasher
Date: 2008-08-20 23:44:59 +0000 (Wed, 20 Aug 2008)
Log Message:
-----------
Backed out accidental commit.
Modified Paths:
--------------
cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/Resource.h
Modified: cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/Resource.h
===================================================================
--- cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/Resource.h 2008-08-20 22:52:36 UTC (rev 877)
+++ cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/Resource.h 2008-08-20 23:44:59 UTC (rev 878)
@@ -74,8 +74,7 @@
/* Returns 0 if Grub is enabled */
KHIDE int TestGrubEnabled();
-/* #define GRUB_MENU_LST "/boot/grub/menu.lst" */
-#define GRUB_MENU_LST "/home/mbrasher/tmp/menu.lst"
+#define GRUB_MENU_LST "/boot/grub/menu.lst"
/* Load Grub menu.lst file. Returns 0 on success */
KHIDE int LoadGrubMenu(const char* path, struct GrubMenu* menu);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-20 22:52:26
|
Revision: 877
http://omc.svn.sourceforge.net/omc/?rev=877&view=rev
Author: mike-brasher
Date: 2008-08-20 22:52:36 +0000 (Wed, 20 Aug 2008)
Log Message:
-----------
Regenerated ProviderList.txt
Modified Paths:
--------------
cmpiprofiles/test/trunk/ProviderList.txt
Modified: cmpiprofiles/test/trunk/ProviderList.txt
===================================================================
--- cmpiprofiles/test/trunk/ProviderList.txt 2008-08-20 22:50:27 UTC (rev 876)
+++ cmpiprofiles/test/trunk/ProviderList.txt 2008-08-20 22:52:36 UTC (rev 877)
@@ -26,16 +26,18 @@
Linux_EthernetPortRegisteredProfile root/interop
Linux_EthernetPortSystemDevice root/cimv2
+Linux_FanAssociatedSensor root/cimv2
Linux_FanElementConformsToProfile root/cimv2
Linux_FanElementConformsToProfile root/interop
Linux_Fan root/cimv2
Linux_FanHostedCollection root/cimv2
Linux_FanIsSpare root/cimv2
Linux_FanMemberOfCollection root/cimv2
+Linux_FanNumericSensor root/cimv2
Linux_FanOwningCollectionElement root/cimv2
Linux_FanRedundancySet root/cimv2
-Linux_FanReferencedProfile root/cimv2
-Linux_FanRegisteredProfile root/cimv2
+Linux_FanReferencedProfile root/interop
+Linux_FanRegisteredProfile root/interop
Linux_FanSystemDevice root/cimv2
Linux_PowerSupplyElementConformsToProfile root/cimv2
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-20 22:50:18
|
Revision: 876
http://omc.svn.sourceforge.net/omc/?rev=876&view=rev
Author: mike-brasher
Date: 2008-08-20 22:50:27 +0000 (Wed, 20 Aug 2008)
Log Message:
-----------
Added "world" target.
Modified Paths:
--------------
cmpiprofiles/Makefile
Modified: cmpiprofiles/Makefile
===================================================================
--- cmpiprofiles/Makefile 2008-08-20 22:38:42 UTC (rev 875)
+++ cmpiprofiles/Makefile 2008-08-20 22:50:27 UTC (rev 876)
@@ -12,6 +12,14 @@
all: build
+world:
+ - make clean
+ - make distclean
+ - make cleanup
+ make bootstrap
+ make configure
+ make build
+
bootstrap:
$(foreach i,$(DIRS), cd $i; ./bootstrap.sh; $(NL) )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-20 22:38:35
|
Revision: 875
http://omc.svn.sourceforge.net/omc/?rev=875&view=rev
Author: mike-brasher
Date: 2008-08-20 22:38:42 +0000 (Wed, 20 Aug 2008)
Log Message:
-----------
Fixed dangling char* pointer approach (used all over).
Modified Paths:
--------------
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/AssociatedSensorProvider.c
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/FanProvider.c
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/HostedCollectionProvider.c
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/IsSpareProvider.c
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/MemberOfCollectionProvider.c
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/NumericSensorProvider.c
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/OwningCollectionElementProvider.c
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/Resource.h
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/SystemDeviceProvider.c
cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/HostedCollectionProvider.c
cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/IsSpareProvider.c
cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/MemberOfCollectionProvider.c
cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/OwningCollectionElementProvider.c
cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/PowerSupplyProvider.c
cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/Resource.h
cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/SystemDeviceProvider.c
cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/ref/Resource.h
cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ElementCapabilitiesProvider.c
cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/HostedAccessPointProvider.c
cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/HostedServiceProvider.c
cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ProtocolEndpointProvider.c
cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ProtocolServiceProvider.c
cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ProvidesEndpointProvider.c
cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/Resource.h
cmpiprofiles/test/trunk/ProfileTest.py
Modified: cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/AssociatedSensorProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/AssociatedSensorProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/AssociatedSensorProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -37,6 +37,7 @@
struct FanInfo* data;
size_t size;
size_t i;
+ Str256 s;
/* Get fan resource data */
@@ -53,15 +54,15 @@
/* AssociatedSensor.Antecedent */
NumericSensorRef_Init(&a, _cb, ns);
- NumericSensorRef_Set_SystemCreationClassName(&a, SysClassName().str);
- NumericSensorRef_Set_SystemName(&a, SysName().str);
+ NumericSensorRef_Set_SystemCreationClassName(&a, SysClassName(&s));
+ NumericSensorRef_Set_SystemName(&a, SysName(&s));
NumericSensorRef_Set_CreationClassName(&a, "Linux_FanNumericSensor");
NumericSensorRef_Set_DeviceID(&a, data[i].deviceID);
/* AssociatedSensor.Dependent */
FanRef_Init(&d, _cb, ns);
- FanRef_Set_SystemCreationClassName(&d, SysClassName().str);
- FanRef_Set_SystemName(&d, SysName().str);
+ FanRef_Set_SystemCreationClassName(&d, SysClassName(&s));
+ FanRef_Set_SystemName(&d, SysName(&s));
FanRef_Set_CreationClassName(&d, "Linux_Fan");
FanRef_Set_DeviceID(&d, data[i].deviceID);
Modified: cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/FanProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/FanProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/FanProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -37,6 +37,7 @@
struct FanInfo* data;
size_t size;
size_t i;
+ Str256 s;
/* Get fan resource data */
@@ -52,10 +53,10 @@
Fan_Init(&x, _cb, ns);
/* Fan.SystemCreationClassName (mandatory) */
- Fan_Set_SystemCreationClassName(&x, SysClassName().str);
+ Fan_Set_SystemCreationClassName(&x, SysClassName(&s));
/* Fan.SystemName (mandatory) */
- Fan_Set_SystemName(&x, SysName().str);
+ Fan_Set_SystemName(&x, SysName(&s));
/* Fan.CreationClassName (mandatory) */
Fan_Set_CreationClassName(&x, "Linux_Fan");
Modified: cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/HostedCollectionProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/HostedCollectionProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/HostedCollectionProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -37,6 +37,7 @@
struct RedundancyInfo* data;
size_t size;
size_t i;
+ Str256 s;
/* Get redundancy resource data */
if (GetRedundancyInfo(&data, &size) != 0)
@@ -56,7 +57,7 @@
/* HostedCollection.Antecedent */
ComputerSystemRef_Init(&a, _cb, ns);
ComputerSystemRef_Set_CreationClassName(&a, "Linux_ComputerSystem");
- ComputerSystemRef_Set_Name(&a, SysName().str);
+ ComputerSystemRef_Set_Name(&a, SysName(&s));
/* HostedCollection.Dependent */
RedundancySetRef_Init(&d, _cb, ns);
Modified: cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/IsSpareProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/IsSpareProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/IsSpareProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -37,6 +37,7 @@
struct RedundancyInfo* data;
size_t size;
size_t i;
+ Str256 s;
/* Get redundancy resource data */
if (GetRedundancyInfo(&data, &size) != 0)
@@ -54,8 +55,8 @@
/* Linux_FanIsSpare.Antecedent */
FanRef_Init(&a, _cb, ns);
- FanRef_Set_SystemCreationClassName(&a, SysClassName().str);
- FanRef_Set_SystemName(&a, SysName().str);
+ FanRef_Set_SystemCreationClassName(&a, SysClassName(&s));
+ FanRef_Set_SystemName(&a, SysName(&s));
FanRef_Set_CreationClassName(&a, "Linux_Fan");
FanRef_Set_DeviceID(&a, data[i].deviceID);
Modified: cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/MemberOfCollectionProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/MemberOfCollectionProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/MemberOfCollectionProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -37,6 +37,7 @@
struct RedundancyInfo* data;
size_t size;
size_t i;
+ Str256 s;
/* Get redundancy resource data */
if (GetRedundancyInfo(&data, &size) != 0)
@@ -51,8 +52,8 @@
/* Linux_FanIsSpare.Antecedent */
FanRef_Init(&m, _cb, ns);
- FanRef_Set_SystemCreationClassName(&m, SysClassName().str);
- FanRef_Set_SystemName(&m, SysName().str);
+ FanRef_Set_SystemCreationClassName(&m, SysClassName(&s));
+ FanRef_Set_SystemName(&m, SysName(&s));
FanRef_Set_CreationClassName(&m, "Linux_Fan");
FanRef_Set_DeviceID(&m, data[i].deviceID);
Modified: cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/NumericSensorProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/NumericSensorProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/NumericSensorProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -37,6 +37,7 @@
struct FanInfo* data;
size_t size;
size_t i;
+ Str256 s;
/* Get fan resource data */
@@ -52,10 +53,10 @@
NumericSensor_Init(&x, _cb, ns);
/* NumericSensor.SystemCreationClassName (mandatory) */
- NumericSensor_Set_SystemCreationClassName(&x, SysClassName().str);
+ NumericSensor_Set_SystemCreationClassName(&x, SysClassName(&s));
/* NumericSensor.SystemName (mandatory) */
- NumericSensor_Set_SystemName(&x, SysName().str);
+ NumericSensor_Set_SystemName(&x, SysName(&s));
/* NumericSensor.CreationClassName (mandatory) */
NumericSensor_Set_CreationClassName(&x, "Linux_FanNumericSensor");
Modified: cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/OwningCollectionElementProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/OwningCollectionElementProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/OwningCollectionElementProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -37,6 +37,7 @@
struct RedundancyInfo* data;
size_t size;
size_t i;
+ Str256 s;
/* Get redundancy resource data */
if (GetRedundancyInfo(&data, &size) != 0)
@@ -56,7 +57,7 @@
/* OwningCollectionElement.Antecedent */
ComputerSystemRef_Init(&cs, _cb, ns);
ComputerSystemRef_Set_CreationClassName(&cs, "Linux_ComputerSystem");
- ComputerSystemRef_Set_Name(&cs, SysName().str);
+ ComputerSystemRef_Set_Name(&cs, SysName(&s));
/* OwningCollectionElement.Dependent */
RedundancySetRef_Init(&rs, _cb, ns);
Modified: cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/Resource.h
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/Resource.h 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/Resource.h 2008-08-20 22:38:42 UTC (rev 875)
@@ -15,30 +15,32 @@
#define INTEROP_NAMESPACE "root/interop"
typedef struct _Str256
-{
+{
char buf[256];
- const char* str;
}
Str256;
-static __inline__ Str256 SysName()
+KINLINE char* SysName(Str256* s)
{
- Str256 s;
- s.str = s.buf;
- s.buf[0] = '\0';
- cmpiutilGetComputerSystemName(s.buf, 256);
- return s;
-}
-
-static __inline__ Str256 SysClassName()
+ s->buf[0] = '\0';
+ cmpiutilGetComputerSystemName(s->buf, sizeof(s->buf)-1);
+ return s->buf;
+}
+
+KINLINE char* SysClassName(Str256* s)
{
- Str256 s;
- s.str = s.buf;
- s.buf[0] = '\0';
- strncat(s.buf, cmpiutilGetComputerSystemClassName(), sizeof(s.buf)-1);
- return s;
+ s->buf[0] = '\0';
+ strncat(s->buf, cmpiutilGetComputerSystemClassName(), sizeof(s->buf)-1);
+ return s->buf;
}
+KINLINE char* SysCreationClassName(Str256* s)
+{
+ s->buf[0] = '\0';
+ strncat(s->buf, "Linux_ComputerSystem", sizeof(s->buf)-1);
+ return s->buf;
+}
+
struct FanInfo
{
char deviceID[64];
Modified: cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/SystemDeviceProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/SystemDeviceProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/SystemDeviceProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -35,10 +35,11 @@
const char** properties)
{
ComputerSystemRef gc; /* GroupComponent */
+ Str256 s;
ComputerSystemRef_Init(&gc, _cb, KNameSpace(cop));
ComputerSystemRef_Set_CreationClassName(&gc, "Linux_ComputerSystem");
- ComputerSystemRef_Set_Name(&gc, SysName().str);
+ ComputerSystemRef_Set_Name(&gc, SysName(&s));
/* Associate Linux_ComputerSystem with every Linux_Fan via
* Linux_FanSystemDevice association.
Modified: cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/HostedCollectionProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/HostedCollectionProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/HostedCollectionProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -38,6 +38,7 @@
struct RedundancyInfo* data;
size_t size;
size_t i;
+ Str256 s;
/* Get redundancy resource data */
if (GetRedundancyInfo(&data, &size) != 0)
@@ -57,7 +58,7 @@
/* HostedCollection.Antecedent */
ComputerSystemRef_Init(&a, _cb, ns);
ComputerSystemRef_Set_CreationClassName(&a, "Linux_ComputerSystem");
- ComputerSystemRef_Set_Name(&a, SysName().str);
+ ComputerSystemRef_Set_Name(&a, SysName(&s));
/* HostedCollection.Dependent */
RedundancySetRef_Init(&d, _cb, ns);
Modified: cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/IsSpareProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/IsSpareProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/IsSpareProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -48,14 +48,15 @@
IsSpare x;
PowerSupplyRef a; /* Antecedent */
RedundancySetRef d; /* Dependent */
+ Str256 s;
if (!data[i].isSpare)
continue;
/* Linux_PowerSupplyIsSpare.Antecedent */
PowerSupplyRef_Init(&a, _cb, ns);
- PowerSupplyRef_Set_SystemCreationClassName(&a, SysClassName().str);
- PowerSupplyRef_Set_SystemName(&a, SysName().str);
+ PowerSupplyRef_Set_SystemCreationClassName(&a, SysClassName(&s));
+ PowerSupplyRef_Set_SystemName(&a, SysName(&s));
PowerSupplyRef_Set_CreationClassName(&a, "Linux_PowerSupply");
PowerSupplyRef_Set_DeviceID(&a, data[i].deviceID);
Modified: cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/MemberOfCollectionProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/MemberOfCollectionProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/MemberOfCollectionProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -48,11 +48,12 @@
MemberOfCollection x;
PowerSupplyRef m; /* Member */
RedundancySetRef c; /* Collection */
+ Str256 s;
/* Linux_PowerSupplyIsSpare.Antecedent */
PowerSupplyRef_Init(&m, _cb, ns);
- PowerSupplyRef_Set_SystemCreationClassName(&m, SysClassName().str);
- PowerSupplyRef_Set_SystemName(&m, SysName().str);
+ PowerSupplyRef_Set_SystemCreationClassName(&m, SysClassName(&s));
+ PowerSupplyRef_Set_SystemName(&m, SysName(&s));
PowerSupplyRef_Set_CreationClassName(&m, "Linux_PowerSupply");
PowerSupplyRef_Set_DeviceID(&m, data[i].deviceID);
Modified: cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/OwningCollectionElementProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/OwningCollectionElementProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/OwningCollectionElementProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -48,6 +48,7 @@
OwningCollectionElement x;
ComputerSystemRef cs;
RedundancySetRef rs;
+ Str256 s;
/* Skip if this redundancy element has same id as last */
if (i && strcmp(data[i].instanceID, data[i-1].instanceID) == 0)
@@ -56,7 +57,7 @@
/* OwningCollectionElement.Antecedent */
ComputerSystemRef_Init(&cs, _cb, ns);
ComputerSystemRef_Set_CreationClassName(&cs, "Linux_ComputerSystem");
- ComputerSystemRef_Set_Name(&cs, SysName().str);
+ ComputerSystemRef_Set_Name(&cs, SysName(&s));
/* OwningCollectionElement.Dependent */
RedundancySetRef_Init(&rs, _cb, ns);
Modified: cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/PowerSupplyProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/PowerSupplyProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/PowerSupplyProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -48,14 +48,15 @@
for (i = 0; i < size; i++)
{
PowerSupply x;
+ Str256 s;
PowerSupply_Init(&x, _cb, ns);
/* PowerSupply.SystemCreationClassName (mandatory) */
- PowerSupply_Set_SystemCreationClassName(&x, SysClassName().str);
+ PowerSupply_Set_SystemCreationClassName(&x, SysClassName(&s));
/* PowerSupply.SystemName (mandatory) */
- PowerSupply_Set_SystemName(&x, SysName().str);
+ PowerSupply_Set_SystemName(&x, SysName(&s));
/* PowerSupply.CreationClassName (mandatory) */
PowerSupply_Set_CreationClassName(&x, "Linux_PowerSupply");
Modified: cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/Resource.h
===================================================================
--- cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/Resource.h 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/Resource.h 2008-08-20 22:38:42 UTC (rev 875)
@@ -19,48 +19,39 @@
typedef struct _Str256
{
char buf[256];
- const char* str;
}
Str256;
-KINLINE Str256 SysName()
+KINLINE char* SysName(Str256* s)
{
- Str256 s;
- s.str = s.buf;
- s.buf[0] = '\0';
- cmpiutilGetComputerSystemName(s.buf, 256);
- return s;
+ s->buf[0] = '\0';
+ cmpiutilGetComputerSystemName(s->buf, sizeof(s->buf)-1);
+ return s->buf;
}
-KINLINE Str256 SysClassName()
+KINLINE char* SysClassName(Str256* s)
{
- Str256 s;
- s.str = s.buf;
- s.buf[0] = '\0';
- strncat(s.buf, cmpiutilGetComputerSystemClassName(), sizeof(s.buf)-1);
- return s;
+ s->buf[0] = '\0';
+ strncat(s->buf, cmpiutilGetComputerSystemClassName(), sizeof(s->buf)-1);
+ return s->buf;
}
-KINLINE Str256 SysCreationClassName()
+KINLINE char* SysCreationClassName(Str256* s)
{
- Str256 s;
- s.str = s.buf;
- s.buf[0] = '\0';
- strncat(s.buf, "Linux_ComputerSystem", sizeof(s.buf)-1);
- return s;
+ s->buf[0] = '\0';
+ strncat(s->buf, "Linux_ComputerSystem", sizeof(s->buf)-1);
+ return s->buf;
}
-KINLINE Str256 Sprintf(const char* format, ...)
+KINLINE char* Sprintf(Str256* s, const char* format, ...)
{
va_list ap;
- Str256 s;
- s.str = s.buf;
va_start(ap, format);
- vsprintf(s.buf, format, ap);
+ vsprintf(s->buf, format, ap);
va_end(ap);
- return s;
+ return s->buf;
}
struct PowerSupplyInfo
Modified: cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/SystemDeviceProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/SystemDeviceProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/SystemDeviceProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -34,10 +34,11 @@
const char** properties)
{
ComputerSystemRef gc; /* GroupComponent */
+ Str256 s;
ComputerSystemRef_Init(&gc, _cb, KNameSpace(cop));
ComputerSystemRef_Set_CreationClassName(&gc, "Linux_ComputerSystem");
- ComputerSystemRef_Set_Name(&gc, SysName().str);
+ ComputerSystemRef_Set_Name(&gc, SysName(&s));
/* Associate Linux_ComputerSystem with every Linux_Fan via
* Linux_FanSystemDevice association.
Modified: cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/ref/Resource.h
===================================================================
--- cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/ref/Resource.h 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/src/ref/Resource.h 2008-08-20 22:38:42 UTC (rev 875)
@@ -15,48 +15,39 @@
typedef struct _Str256
{
char buf[256];
- const char* str;
}
Str256;
-KINLINE Str256 SysName()
+KINLINE char* SysName(Str256* s)
{
- Str256 s;
- s.str = s.buf;
- s.buf[0] = '\0';
- cmpiutilGetComputerSystemName(s.buf, 256);
- return s;
+ s->buf[0] = '\0';
+ cmpiutilGetComputerSystemName(s->buf, sizeof(s->buf)-1);
+ return s->buf;
}
-KINLINE Str256 SysClassName()
+KINLINE char* SysClassName(Str256* s)
{
- Str256 s;
- s.str = s.buf;
- s.buf[0] = '\0';
- strncat(s.buf, cmpiutilGetComputerSystemClassName(), sizeof(s.buf)-1);
- return s;
+ s->buf[0] = '\0';
+ strncat(s->buf, cmpiutilGetComputerSystemClassName(), sizeof(s->buf)-1);
+ return s->buf;
}
-KINLINE Str256 SysCreationClassName()
+KINLINE char* SysCreationClassName(Str256* s)
{
- Str256 s;
- s.str = s.buf;
- s.buf[0] = '\0';
- strncat(s.buf, "Linux_ComputerSystem", sizeof(s.buf)-1);
- return s;
+ s->buf[0] = '\0';
+ strncat(s->buf, "Linux_ComputerSystem", sizeof(s->buf)-1);
+ return s->buf;
}
-KINLINE Str256 Sprintf(const char* format, ...)
+KINLINE char* Sprintf(Str256* s, const char* format, ...)
{
va_list ap;
- Str256 s;
- s.str = s.buf;
va_start(ap, format);
- vsprintf(s.buf, format, ap);
+ vsprintf(s->buf, format, ap);
va_end(ap);
- return s;
+ return s->buf;
}
#define MAX_GRUB_MENU_ITEMS 32
Modified: cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ElementCapabilitiesProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ElementCapabilitiesProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ElementCapabilitiesProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -37,12 +37,13 @@
ProtocolServiceRef m; /* ManagedElement */
CapabilitiesRef c; /* Capabilities */
ElementCapabilities x;
+ Str256 s;
/* Create ElementCapabilities.ManagedElement */
ProtocolServiceRef_Init(&m, _cb, ns);
- ProtocolServiceRef_Set_SystemCreationClassName(&m, SysClassName().str);
+ ProtocolServiceRef_Set_SystemCreationClassName(&m, SysClassName(&s));
ProtocolServiceRef_Set_CreationClassName(&m, "Linux_SSHProtocolService");
- ProtocolServiceRef_Set_SystemName(&m, SysName().str);
+ ProtocolServiceRef_Set_SystemName(&m, SysName(&s));
ProtocolServiceRef_Set_Name(&m, "SBLIM:Linux_SSHProtocolService");
/* Create ElementCapabilities.Capabilities */
Modified: cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/HostedAccessPointProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/HostedAccessPointProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/HostedAccessPointProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -34,10 +34,11 @@
const char** properties)
{
ComputerSystemRef a; /* Antecedent */
+ Str256 s;
ComputerSystemRef_Init(&a, _cb, KNameSpace(cop));
ComputerSystemRef_Set_CreationClassName(&a, "Linux_ComputerSystem");
- ComputerSystemRef_Set_Name(&a, SysName().str);
+ ComputerSystemRef_Set_Name(&a, SysName(&s));
return KDefaultEnumerateInstancesOneToAll(
_cb,
Modified: cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/HostedServiceProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/HostedServiceProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/HostedServiceProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -35,10 +35,11 @@
const char** properties)
{
ComputerSystemRef a; /* Antecedent */
+ Str256 s;
ComputerSystemRef_Init(&a, _cb, KNameSpace(cop));
ComputerSystemRef_Set_CreationClassName(&a, "Linux_ComputerSystem");
- ComputerSystemRef_Set_Name(&a, SysName().str);
+ ComputerSystemRef_Set_Name(&a, SysName(&s));
return KDefaultEnumerateInstancesOneToAll(
_cb,
Modified: cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ProtocolEndpointProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ProtocolEndpointProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ProtocolEndpointProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -26,12 +26,10 @@
_cb, mi, cc, cr, cop);
}
-static Str256 _NameOf(struct SSHSession* sess)
+static char* _NameOf(Str256* s, struct SSHSession* sess)
{
- Str256 s;
- s.str = s.buf;
- sprintf(s.buf, "SBLIM:Linux_SSHProtocolEndpoint:%u", sess->localPort);
- return s;
+ sprintf(s->buf, "SBLIM:Linux_SSHProtocolEndpoint:%u", sess->localPort);
+ return s->buf;
}
static CMPIStatus ProtocolEndpointEnumInstances(
@@ -57,6 +55,7 @@
{
ProtocolEndpoint x;
struct SSHDConfig conf;
+ Str256 s;
if (GetSSHDConfig(&conf) != 0)
KReturn2(_cb, ERR_FAILED, "failed to access sshd_config");
@@ -64,16 +63,16 @@
ProtocolEndpoint_Init(&x, _cb, ns);
/* Linux_SSHProtocolEndpoint.SystemCreationClassName */
- ProtocolEndpoint_Set_SystemCreationClassName(&x, SysClassName().str);
+ ProtocolEndpoint_Set_SystemCreationClassName(&x, SysClassName(&s));
/* Linux_SSHProtocolEndpoint.CreationClassName */
ProtocolEndpoint_Set_CreationClassName(&x, "Linux_SSHProtocolEndpoint");
/* Linux_SSHProtocolEndpoint.SystemName */
- ProtocolEndpoint_Set_SystemName(&x, SysName().str);
+ ProtocolEndpoint_Set_SystemName(&x, SysName(&s));
/* Linux_SSHProtocolEndpoint.Name */
- ProtocolEndpoint_Set_Name(&x, _NameOf(&sess[i]).str);
+ ProtocolEndpoint_Set_Name(&x, _NameOf(&s, &sess[i]));
/* Linux_SSHProtocolEndpoint.NameFormat */
ProtocolEndpoint_Set_NameFormat(&x,
Modified: cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ProtocolServiceProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ProtocolServiceProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ProtocolServiceProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -37,6 +37,7 @@
{
ProtocolService x;
int sshd_status;
+ Str256 s;
/* Get status of sshd */
sshd_status = GetSSHDStatus();
@@ -44,13 +45,13 @@
ProtocolService_Init(&x, _cb, KNameSpace(cop));
/* SystemCreationClassName */
- ProtocolService_Set_SystemCreationClassName(&x, SysClassName().str);
+ ProtocolService_Set_SystemCreationClassName(&x, SysClassName(&s));
/* CreationClassName */
ProtocolService_Set_CreationClassName(&x, "Linux_SSHProtocolService");
/* SystemName */
- ProtocolService_Set_SystemName(&x, SysName().str);
+ ProtocolService_Set_SystemName(&x, SysName(&s));
/* Name */
ProtocolService_Set_Name(&x, "SBLIM:Linux_SSHProtocolService");
Modified: cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ProvidesEndpointProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ProvidesEndpointProvider.c 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/ProvidesEndpointProvider.c 2008-08-20 22:38:42 UTC (rev 875)
@@ -35,12 +35,13 @@
{
const char* ns = KNameSpace(cop);
ProtocolServiceRef a; /* Antecedent */
+ Str256 s;
/* Linux_SSHProtocolService.Antecedent */
ProtocolServiceRef_Init(&a, _cb, ns);
- ProtocolServiceRef_Set_SystemCreationClassName(&a, SysClassName().str);
+ ProtocolServiceRef_Set_SystemCreationClassName(&a, SysClassName(&s));
ProtocolServiceRef_Set_CreationClassName(&a, "Linux_SSHProtocolService");
- ProtocolServiceRef_Set_SystemName(&a, SysName().str);
+ ProtocolServiceRef_Set_SystemName(&a, SysName(&s));
ProtocolServiceRef_Set_Name(&a, "SBLIM:Linux_SSHProtocolService");
/* Associate with every instance of Linux_SSHProtocolEndpoint */
Modified: cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/Resource.h
===================================================================
--- cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/Resource.h 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/src/Resource.h 2008-08-20 22:38:42 UTC (rev 875)
@@ -57,26 +57,28 @@
typedef struct _Str256
{
char buf[256];
- const char* str;
}
Str256;
-static __inline__ Str256 SysName()
+KINLINE char* SysName(Str256* s)
{
- Str256 s;
- s.str = s.buf;
- s.buf[0] = '\0';
- cmpiutilGetComputerSystemName(s.buf, 256);
- return s;
+ s->buf[0] = '\0';
+ cmpiutilGetComputerSystemName(s->buf, sizeof(s->buf)-1);
+ return s->buf;
}
-static __inline__ Str256 SysClassName()
+KINLINE char* SysClassName(Str256* s)
{
- Str256 s;
- s.str = s.buf;
- s.buf[0] = '\0';
- strncat(s.buf, cmpiutilGetComputerSystemClassName(), sizeof(s.buf)-1);
- return s;
+ s->buf[0] = '\0';
+ strncat(s->buf, cmpiutilGetComputerSystemClassName(), sizeof(s->buf)-1);
+ return s->buf;
}
+KINLINE char* SysCreationClassName(Str256* s)
+{
+ s->buf[0] = '\0';
+ strncat(s->buf, "Linux_ComputerSystem", sizeof(s->buf)-1);
+ return s->buf;
+}
+
#endif /* _Resource_h */
Modified: cmpiprofiles/test/trunk/ProfileTest.py
===================================================================
--- cmpiprofiles/test/trunk/ProfileTest.py 2008-08-20 22:24:28 UTC (rev 874)
+++ cmpiprofiles/test/trunk/ProfileTest.py 2008-08-20 22:38:42 UTC (rev 875)
@@ -63,6 +63,11 @@
print "no instances of the central class found: %s" %(centralClassName)
sys.exit(1)
+ ##
+ ## Remove this!
+ ##
+ # instances = c.EnumerateInstanceNames("Linux_BootOrderedComponent");
+
# For each instance of central class be sure there is exactly one
# RegisteredProfile instance (associated through ElementConformsToProfile).
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-20 22:24:20
|
Revision: 874
http://omc.svn.sourceforge.net/omc/?rev=874&view=rev
Author: mike-brasher
Date: 2008-08-20 22:24:28 +0000 (Wed, 20 Aug 2008)
Log Message:
-----------
Fixed bug causing CMPI string trash.
Modified Paths:
--------------
cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/BootServiceProvider.c
cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/ConfigSettingProvider.c
cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/ElementSettingDataProvider.c
cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/HostedServiceProvider.c
cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/OrderedComponentProvider.c
cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/Resource.c
cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/Resource.h
cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/ServiceAffectsElementProvider.c
cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/SourceSettingProvider.c
Modified: cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/BootServiceProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/BootServiceProvider.c 2008-08-20 21:10:23 UTC (rev 873)
+++ cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/BootServiceProvider.c 2008-08-20 22:24:28 UTC (rev 874)
@@ -34,12 +34,13 @@
const char** properties)
{
const char* ns = KNameSpace(cop);
+ Str256 s;
BootService x;
BootService_Init(&x, _cb, ns);
BootService_Set_Name(&x, "SBLIM:Boot_Service");
- BootService_Set_SystemCreationClassName(&x, SysCreationClassName().str);
- BootService_Set_SystemName(&x, SysName().str);
+ BootService_Set_SystemCreationClassName(&x, SysCreationClassName(&s));
+ BootService_Set_SystemName(&x, SysName(&s));
BootService_Set_CreationClassName(&x, "Linux_BootService");
BootService_Set_ElementName(&x, "SBLIM:Boot_Service");
KReturnInstance(cr, x);
Modified: cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/ConfigSettingProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/ConfigSettingProvider.c 2008-08-20 21:10:23 UTC (rev 873)
+++ cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/ConfigSettingProvider.c 2008-08-20 22:24:28 UTC (rev 874)
@@ -34,7 +34,7 @@
{
ConfigSetting x;
ConfigSetting_Init(&x, _cb, KNameSpace(cop));
- ConfigSetting_Set_InstanceID(&x, "SBLIM:BootConfigSetting:Grub");
+ ConfigSetting_Set_InstanceID(&x, "SBLIM:Linux_BootConfigSetting:Grub");
ConfigSetting_Set_ElementName(&x, "Default Grub Boot Configuration");
KReturnInstance(cr, x);
CMReturn(CMPI_RC_OK);
Modified: cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/ElementSettingDataProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/ElementSettingDataProvider.c 2008-08-20 21:10:23 UTC (rev 873)
+++ cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/ElementSettingDataProvider.c 2008-08-20 22:24:28 UTC (rev 874)
@@ -37,15 +37,16 @@
ComputerSystemRef me; /* ManagedElement */
ConfigSettingRef sd; /* SettingData */
ElementSettingData x;
+ Str256 s;
/* Linux_BootElementSettingData.ManagedElement */
ComputerSystemRef_Init(&me, _cb, ns);
ComputerSystemRef_Set_CreationClassName(&me, "Linux_ComputerSystem");
- ComputerSystemRef_Set_Name(&me, SysName().str);
+ ComputerSystemRef_Set_Name(&me, SysName(&s));
/* Linux_BootElementSettingData.SettingData */
ConfigSettingRef_Init(&sd, _cb, ns);
- ConfigSettingRef_Set_InstanceID(&sd, "SBLIM:BootConfigSetting:Grub");
+ ConfigSettingRef_Set_InstanceID(&sd, "SBLIM:Linux_BootConfigSetting:Grub");
/* Linux_BootElementSettingData */
ElementSettingData_Init(&x, _cb, ns);
Modified: cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/HostedServiceProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/HostedServiceProvider.c 2008-08-20 21:10:23 UTC (rev 873)
+++ cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/HostedServiceProvider.c 2008-08-20 22:24:28 UTC (rev 874)
@@ -37,17 +37,18 @@
ComputerSystemRef a; /* Antecedent */
BootServiceRef d; /* Dependent */
HostedService x;
+ Str256 s;
/* Linux_BootHostedService.Antecedent */
ComputerSystemRef_Init(&a, _cb, KNameSpace(cop));
ComputerSystemRef_Set_CreationClassName(&a, "Linux_ComputerSystem");
- ComputerSystemRef_Set_Name(&a, SysName().str);
+ ComputerSystemRef_Set_Name(&a, SysName(&s));
/* Linux_BootHostedService.Dependent */
BootServiceRef_Init(&d, _cb, ns);
BootServiceRef_Set_Name(&d, "SBLIM:Boot_Service");
- BootServiceRef_Set_SystemCreationClassName(&d, SysCreationClassName().str);
- BootServiceRef_Set_SystemName(&d, SysName().str);
+ BootServiceRef_Set_SystemCreationClassName(&d, SysCreationClassName(&s));
+ BootServiceRef_Set_SystemName(&d, SysName(&s));
BootServiceRef_Set_CreationClassName(&d, "Linux_BootService");
/* Linux_BootHostedService */
Modified: cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/OrderedComponentProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/OrderedComponentProvider.c 2008-08-20 21:10:23 UTC (rev 873)
+++ cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/OrderedComponentProvider.c 2008-08-20 22:24:28 UTC (rev 874)
@@ -39,6 +39,7 @@
OrderedComponent x;
struct GrubMenu menu;
size_t i;
+ Str256 s;
/* Load Grub configuration */
if (LoadGrubMenu(GRUB_MENU_LST, &menu) != 0)
@@ -46,7 +47,7 @@
/* Linux_BootOrderedComponent.GroupComponent */
ConfigSettingRef_Init(&g, _cb, ns);
- ConfigSettingRef_Set_InstanceID(&g, "SBLIM:ConfigSetting:Grub");
+ ConfigSettingRef_Set_InstanceID(&g, "SBLIM:Linux_BootConfigSetting:Grub");
/* Generate association instances */
@@ -55,7 +56,7 @@
/* Linux_BootOrderedComponent.PartComponent */
SourceSettingRef_Init(&p, _cb, ns);
SourceSettingRef_Set_InstanceID(&p,
- Sprintf("SBLIM:GrubBootSourceSetting:%d", i).str);
+ Sprintf(&s, "SBLIM:Linux_GrubBootSourceSetting:%d", (int)i));
/* Linux_BootOrderedComponent */
OrderedComponent_Init(&x, _cb, ns);
Modified: cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/Resource.c
===================================================================
--- cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/Resource.c 2008-08-20 21:10:23 UTC (rev 873)
+++ cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/Resource.c 2008-08-20 22:24:28 UTC (rev 874)
@@ -204,12 +204,18 @@
printf("}\n");
}
-int main()
+int main(int argc, char** argv)
{
struct GrubMenu menu;
- if (LoadGrubMenu("./menu.lst", &menu) != 0)
+ if (argc != 2)
{
+ fprintf(stderr, "Usage: %s path\n", argv[0]);
+ exit(1);
+ }
+
+ if (LoadGrubMenu(argv[1], &menu) != 0)
+ {
fprintf(stderr, "failed to load menu.lst\n");
exit(1);
}
Modified: cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/Resource.h
===================================================================
--- cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/Resource.h 2008-08-20 21:10:23 UTC (rev 873)
+++ cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/Resource.h 2008-08-20 22:24:28 UTC (rev 874)
@@ -16,48 +16,39 @@
typedef struct _Str256
{
char buf[256];
- const char* str;
}
Str256;
-KINLINE Str256 SysName()
+KINLINE char* SysName(Str256* s)
{
- Str256 s;
- s.str = s.buf;
- s.buf[0] = '\0';
- cmpiutilGetComputerSystemName(s.buf, 256);
- return s;
+ s->buf[0] = '\0';
+ cmpiutilGetComputerSystemName(s->buf, sizeof(s->buf)-1);
+ return s->buf;
}
-KINLINE Str256 SysClassName()
+KINLINE char* SysClassName(Str256* s)
{
- Str256 s;
- s.str = s.buf;
- s.buf[0] = '\0';
- strncat(s.buf, cmpiutilGetComputerSystemClassName(), sizeof(s.buf)-1);
- return s;
+ s->buf[0] = '\0';
+ strncat(s->buf, cmpiutilGetComputerSystemClassName(), sizeof(s->buf)-1);
+ return s->buf;
}
-KINLINE Str256 SysCreationClassName()
+KINLINE char* SysCreationClassName(Str256* s)
{
- Str256 s;
- s.str = s.buf;
- s.buf[0] = '\0';
- strncat(s.buf, "Linux_ComputerSystem", sizeof(s.buf)-1);
- return s;
+ s->buf[0] = '\0';
+ strncat(s->buf, "Linux_ComputerSystem", sizeof(s->buf)-1);
+ return s->buf;
}
-KINLINE Str256 Sprintf(const char* format, ...)
+KINLINE char* Sprintf(Str256* s, const char* format, ...)
{
va_list ap;
- Str256 s;
- s.str = s.buf;
va_start(ap, format);
- vsprintf(s.buf, format, ap);
+ vsprintf(s->buf, format, ap);
va_end(ap);
- return s;
+ return s->buf;
}
#define MAX_GRUB_MENU_ITEMS 32
@@ -83,7 +74,8 @@
/* Returns 0 if Grub is enabled */
KHIDE int TestGrubEnabled();
-#define GRUB_MENU_LST "/boot/grub/menu.lst"
+/* #define GRUB_MENU_LST "/boot/grub/menu.lst" */
+#define GRUB_MENU_LST "/home/mbrasher/tmp/menu.lst"
/* Load Grub menu.lst file. Returns 0 on success */
KHIDE int LoadGrubMenu(const char* path, struct GrubMenu* menu);
Modified: cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/ServiceAffectsElementProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/ServiceAffectsElementProvider.c 2008-08-20 21:10:23 UTC (rev 873)
+++ cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/ServiceAffectsElementProvider.c 2008-08-20 22:24:28 UTC (rev 874)
@@ -37,18 +37,19 @@
ComputerSystemRef cs;
BootServiceRef bs;
ServiceAffectsElement x;
+ Str256 s;
/* Linux_BootServiceAffectsElement.AffectingElement */
BootServiceRef_Init(&bs, _cb, ns);
BootServiceRef_Set_Name(&bs, "SBLIM:Boot_Service");
- BootServiceRef_Set_SystemCreationClassName(&bs, SysCreationClassName().str);
- BootServiceRef_Set_SystemName(&bs, SysName().str);
+ BootServiceRef_Set_SystemCreationClassName(&bs, SysCreationClassName(&s));
+ BootServiceRef_Set_SystemName(&bs, SysName(&s));
BootServiceRef_Set_CreationClassName(&bs, "Linux_BootService");
/* Linux_BootServiceAffectsElement.AffectedElement */
ComputerSystemRef_Init(&cs, _cb, KNameSpace(cop));
ComputerSystemRef_Set_CreationClassName(&cs, "Linux_ComputerSystem");
- ComputerSystemRef_Set_Name(&cs, SysName().str);
+ ComputerSystemRef_Set_Name(&cs, SysName(&s));
/* Linux_BootServiceAffectsElement */
ServiceAffectsElement_Init(&x, _cb, ns);
Modified: cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/SourceSettingProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/SourceSettingProvider.c 2008-08-20 21:10:23 UTC (rev 873)
+++ cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/src/SourceSettingProvider.c 2008-08-20 22:24:28 UTC (rev 874)
@@ -35,6 +35,7 @@
{
struct GrubMenu menu;
size_t i;
+ Str256 s;
/* Load Grub configuration */
if (LoadGrubMenu(GRUB_MENU_LST, &menu) != 0)
@@ -51,7 +52,7 @@
/* Linux_GrubBootSourceSetting.InstanceID */
SourceSetting_Set_InstanceID(&x,
- Sprintf("SBLIM:GrubBootSourceSetting:%d", i).str);
+ Sprintf(&s, "SBLIM:Linux_GrubBootSourceSetting:%d", (int)i));
/* Linux_GrubBootSourceSetting.FailThroughSupported */
SourceSetting_Set_FailThroughSupported_Unknown(&x);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-20 21:10:15
|
Revision: 873
http://omc.svn.sourceforge.net/omc/?rev=873&view=rev
Author: mike-brasher
Date: 2008-08-20 21:10:23 +0000 (Wed, 20 Aug 2008)
Log Message:
-----------
Implemented 2 providers: Linux_FanNumericSensor & Linux_FanAssociatedSensor.
Modified Paths:
--------------
cmpiprofiles/sblim-cmpi-fan_profile/trunk/mof/linux-fan-profile.mof
cmpiprofiles/sblim-cmpi-fan_profile/trunk/mof/linux-fan-profile.reg
cmpiprofiles/sblim-cmpi-fan_profile/trunk/mof/linux-fan-profile.registration
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/Makefile.am
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/Resource.c
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/Resource.h
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/linux-fan-profile.kon
Added Paths:
-----------
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/AssociatedSensor.h
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/AssociatedSensorProvider.c
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/CIM_AssociatedSensor.h
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/CIM_NumericSensor.h
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/CIM_Sensor.h
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/NumericSensor.h
cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/NumericSensorProvider.c
Modified: cmpiprofiles/sblim-cmpi-fan_profile/trunk/mof/linux-fan-profile.mof
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/mof/linux-fan-profile.mof 2008-08-19 23:49:21 UTC (rev 872)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/mof/linux-fan-profile.mof 2008-08-20 21:10:23 UTC (rev 873)
@@ -164,6 +164,22 @@
[Key] Linux_FanRedundancySet REF OwnedElement;
};
+// ===========================================================================
+// Linux_FanNumericSensor
+// ===========================================================================
+class Linux_FanNumericSensor : CIM_NumericSensor
+{
+};
+
+// ===========================================================================
+// Linux_AssociatedSensor
+// ===========================================================================
+class Linux_FanAssociatedSensor : CIM_AssociatedSensor
+{
+ Linux_FanNumericSensor REF Antecedent;
+ Linux_Fan REF Dependent;
+};
+
// ==================================================================
// end of file
// ==================================================================
Modified: cmpiprofiles/sblim-cmpi-fan_profile/trunk/mof/linux-fan-profile.reg
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/mof/linux-fan-profile.reg 2008-08-19 23:49:21 UTC (rev 872)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/mof/linux-fan-profile.reg 2008-08-20 21:10:23 UTC (rev 873)
@@ -1,3 +1,9 @@
+[Linux_FanAssociatedSensor]
+ provider: Linux_FanAssociatedSensor
+ location: linux_fanprovider
+ type: instance association
+ namespace: root/cimv2
+#
[Linux_FanElementConformsToProfile]
provider: Linux_FanElementConformsToProfile
location: linux_fanprovider
@@ -28,6 +34,12 @@
type: instance association
namespace: root/cimv2
#
+[Linux_FanNumericSensor]
+ provider: Linux_FanNumericSensor
+ location: linux_fanprovider
+ type: instance method
+ namespace: root/cimv2
+#
[Linux_FanOwningCollectionElement]
provider: Linux_FanOwningCollectionElement
location: linux_fanprovider
Modified: cmpiprofiles/sblim-cmpi-fan_profile/trunk/mof/linux-fan-profile.registration
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/mof/linux-fan-profile.registration 2008-08-19 23:49:21 UTC (rev 872)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/mof/linux-fan-profile.registration 2008-08-20 21:10:23 UTC (rev 873)
@@ -1,3 +1,4 @@
+Linux_FanAssociatedSensor root/cimv2 Linux_FanAssociatedSensor linux_fanprovider instance association
Linux_FanElementConformsToProfile root/cimv2\ root/interop Linux_FanElementConformsToProfile linux_fanprovider instance association
Linux_Fan root/cimv2 Linux_Fan linux_fanprovider instance method
Linux_FanHostedCollection root/cimv2 Linux_FanHostedCollection linux_fanprovider instance association
@@ -3,4 +4,5 @@
Linux_FanIsSpare root/cimv2 Linux_FanIsSpare linux_fanprovider instance association
Linux_FanMemberOfCollection root/cimv2 Linux_FanMemberOfCollection linux_fanprovider instance association
+Linux_FanNumericSensor root/cimv2 Linux_FanNumericSensor linux_fanprovider instance method
Linux_FanOwningCollectionElement root/cimv2 Linux_FanOwningCollectionElement linux_fanprovider instance association
Linux_FanRedundancySet root/cimv2 Linux_FanRedundancySet linux_fanprovider instance method
Added: cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/AssociatedSensor.h
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/AssociatedSensor.h (rev 0)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/AssociatedSensor.h 2008-08-20 21:10:23 UTC (rev 873)
@@ -0,0 +1,388 @@
+/*
+**==============================================================================
+**
+** CAUTION: This file generated by KonkretCMPI. Please do not edit.
+**
+**==============================================================================
+*/
+
+#ifndef _konkrete_AssociatedSensor_h
+#define _konkrete_AssociatedSensor_h
+
+#include <konkret/konkret.h>
+#include "NumericSensor.h"
+#include "Fan.h"
+
+/*
+**==============================================================================
+**
+** struct AssociatedSensorRef
+**
+**==============================================================================
+*/
+
+/* classname=Linux_FanAssociatedSensor */
+typedef struct _AssociatedSensorRef
+{
+ KBase __base;
+ /* CIM_Dependency features */
+ const KRef Antecedent; /* NumericSensor */
+ const KRef Dependent; /* Fan */
+ /* CIM_AssociatedSensor features */
+ /* Linux_FanAssociatedSensor features */
+}
+AssociatedSensorRef;
+
+static const unsigned char __AssociatedSensorRef_sig[] =
+{
+ 0x19,0x4c,0x69,0x6e,0x75,0x78,0x5f,0x46,0x61,0x6e,0x41,0x73,0x73,0x6f,0x63,
+ 0x69,0x61,0x74,0x65,0x64,0x53,0x65,0x6e,0x73,0x6f,0x72,0x00,0x02,0x4e,0x0a,
+ 0x41,0x6e,0x74,0x65,0x63,0x65,0x64,0x65,0x6e,0x74,0x00,0x4e,0x09,0x44,0x65,
+ 0x70,0x65,0x6e,0x64,0x65,0x6e,0x74,0x00,
+};
+
+KINLINE void AssociatedSensorRef_Init(
+ AssociatedSensorRef* self,
+ const CMPIBroker* cb,
+ const char* ns)
+{
+ const unsigned char* sig = __AssociatedSensorRef_sig;
+ KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
+ ((KRef*)&self->Antecedent)->__sig = __NumericSensor_sig;
+ ((KRef*)&self->Dependent)->__sig = __Fan_sig;
+}
+
+KINLINE CMPIStatus AssociatedSensorRef_InitFromInstance(
+ AssociatedSensorRef* self,
+ const CMPIBroker* cb,
+ const CMPIInstance* x)
+{
+ AssociatedSensorRef_Init(self, cb, NULL);
+ return KBase_FromInstance(&self->__base, x);
+}
+
+KINLINE CMPIStatus AssociatedSensorRef_InitFromObjectPath(
+ AssociatedSensorRef* self,
+ const CMPIBroker* cb,
+ const CMPIObjectPath* x)
+{
+ AssociatedSensorRef_Init(self, cb, NULL);
+ return KBase_FromObjectPath(&self->__base, x);
+}
+
+KINLINE void AssociatedSensorRef_Print(
+ const AssociatedSensorRef* self,
+ FILE* os)
+{
+ KBase_Print(os, &self->__base, 'r');
+}
+
+KINLINE CMPIInstance* AssociatedSensorRef_ToInstance(
+ const AssociatedSensorRef* self,
+ CMPIStatus* status)
+{
+ return KBase_ToInstance(&self->__base, status);
+}
+
+KINLINE CMPIObjectPath* AssociatedSensorRef_ToObjectPath(
+ const AssociatedSensorRef* self,
+ CMPIStatus* status)
+{
+ return KBase_ToObjectPath(&self->__base, status);
+}
+
+KINLINE const char* AssociatedSensorRef_NameSpace(
+ AssociatedSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ return self->__base.ns ? KChars(self->__base.ns) : NULL;
+ return NULL;
+}
+
+KINLINE void AssociatedSensorRef_SetObjectPath_Antecedent(
+ AssociatedSensorRef* self,
+ const CMPIObjectPath* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ KRef_SetObjectPath(field, x);
+ }
+}
+
+KINLINE CMPIStatus AssociatedSensorRef_Set_Antecedent(
+ AssociatedSensorRef* self,
+ const NumericSensorRef* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ return KRef_Set(field, &x->__base);
+ }
+ CMReturn(CMPI_RC_ERR_FAILED);
+}
+
+KINLINE void AssociatedSensorRef_Null_Antecedent(
+ AssociatedSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ KRef_Null(field);
+ }
+}
+
+KINLINE void AssociatedSensorRef_Clr_Antecedent(
+ AssociatedSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ KRef_Clr(field);
+ }
+}
+
+KINLINE void AssociatedSensorRef_SetObjectPath_Dependent(
+ AssociatedSensorRef* self,
+ const CMPIObjectPath* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ KRef_SetObjectPath(field, x);
+ }
+}
+
+KINLINE CMPIStatus AssociatedSensorRef_Set_Dependent(
+ AssociatedSensorRef* self,
+ const FanRef* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ return KRef_Set(field, &x->__base);
+ }
+ CMReturn(CMPI_RC_ERR_FAILED);
+}
+
+KINLINE void AssociatedSensorRef_Null_Dependent(
+ AssociatedSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ KRef_Null(field);
+ }
+}
+
+KINLINE void AssociatedSensorRef_Clr_Dependent(
+ AssociatedSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ KRef_Clr(field);
+ }
+}
+
+/*
+**==============================================================================
+**
+** struct AssociatedSensor
+**
+**==============================================================================
+*/
+
+/* classname=Linux_FanAssociatedSensor */
+typedef struct _AssociatedSensor
+{
+ KBase __base;
+ /* CIM_Dependency features */
+ const KRef Antecedent; /* NumericSensor */
+ const KRef Dependent; /* Fan */
+ /* CIM_AssociatedSensor features */
+ /* Linux_FanAssociatedSensor features */
+}
+AssociatedSensor;
+
+static const unsigned char __AssociatedSensor_sig[] =
+{
+ 0x19,0x4c,0x69,0x6e,0x75,0x78,0x5f,0x46,0x61,0x6e,0x41,0x73,0x73,0x6f,0x63,
+ 0x69,0x61,0x74,0x65,0x64,0x53,0x65,0x6e,0x73,0x6f,0x72,0x00,0x02,0x4e,0x0a,
+ 0x41,0x6e,0x74,0x65,0x63,0x65,0x64,0x65,0x6e,0x74,0x00,0x4e,0x09,0x44,0x65,
+ 0x70,0x65,0x6e,0x64,0x65,0x6e,0x74,0x00,
+};
+
+KINLINE void AssociatedSensor_Init(
+ AssociatedSensor* self,
+ const CMPIBroker* cb,
+ const char* ns)
+{
+ const unsigned char* sig = __AssociatedSensor_sig;
+ KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
+ ((KRef*)&self->Antecedent)->__sig = __NumericSensor_sig;
+ ((KRef*)&self->Dependent)->__sig = __Fan_sig;
+}
+
+KINLINE CMPIStatus AssociatedSensor_InitFromInstance(
+ AssociatedSensor* self,
+ const CMPIBroker* cb,
+ const CMPIInstance* x)
+{
+ AssociatedSensor_Init(self, cb, NULL);
+ return KBase_FromInstance(&self->__base, x);
+}
+
+KINLINE CMPIStatus AssociatedSensor_InitFromObjectPath(
+ AssociatedSensor* self,
+ const CMPIBroker* cb,
+ const CMPIObjectPath* x)
+{
+ AssociatedSensor_Init(self, cb, NULL);
+ return KBase_FromObjectPath(&self->__base, x);
+}
+
+KINLINE void AssociatedSensor_Print(
+ const AssociatedSensor* self,
+ FILE* os)
+{
+ KBase_Print(os, &self->__base, 'i');
+}
+
+KINLINE CMPIInstance* AssociatedSensor_ToInstance(
+ const AssociatedSensor* self,
+ CMPIStatus* status)
+{
+ return KBase_ToInstance(&self->__base, status);
+}
+
+KINLINE CMPIObjectPath* AssociatedSensor_ToObjectPath(
+ const AssociatedSensor* self,
+ CMPIStatus* status)
+{
+ return KBase_ToObjectPath(&self->__base, status);
+}
+
+KINLINE const char* AssociatedSensor_NameSpace(
+ AssociatedSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ return self->__base.ns ? KChars(self->__base.ns) : NULL;
+ return NULL;
+}
+
+KINLINE void AssociatedSensor_SetObjectPath_Antecedent(
+ AssociatedSensor* self,
+ const CMPIObjectPath* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ KRef_SetObjectPath(field, x);
+ }
+}
+
+KINLINE CMPIStatus AssociatedSensor_Set_Antecedent(
+ AssociatedSensor* self,
+ const NumericSensorRef* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ return KRef_Set(field, &x->__base);
+ }
+ CMReturn(CMPI_RC_ERR_FAILED);
+}
+
+KINLINE void AssociatedSensor_Null_Antecedent(
+ AssociatedSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ KRef_Null(field);
+ }
+}
+
+KINLINE void AssociatedSensor_Clr_Antecedent(
+ AssociatedSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ KRef_Clr(field);
+ }
+}
+
+KINLINE void AssociatedSensor_SetObjectPath_Dependent(
+ AssociatedSensor* self,
+ const CMPIObjectPath* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ KRef_SetObjectPath(field, x);
+ }
+}
+
+KINLINE CMPIStatus AssociatedSensor_Set_Dependent(
+ AssociatedSensor* self,
+ const FanRef* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ return KRef_Set(field, &x->__base);
+ }
+ CMReturn(CMPI_RC_ERR_FAILED);
+}
+
+KINLINE void AssociatedSensor_Null_Dependent(
+ AssociatedSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ KRef_Null(field);
+ }
+}
+
+KINLINE void AssociatedSensor_Clr_Dependent(
+ AssociatedSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ KRef_Clr(field);
+ }
+}
+
+/*
+**==============================================================================
+**
+** AssociatedSensor methods
+**
+**==============================================================================
+*/
+
+KINLINE CMPIStatus AssociatedSensor_DispatchMethod(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ AssociatedSensorRef self;
+
+ KReturnIf(AssociatedSensorRef_InitFromObjectPath(&self, cb, cop));
+
+
+ KReturn(ERR_METHOD_NOT_FOUND);
+}
+
+#define AssociatedSensor_ClassName "Linux_FanAssociatedSensor"
+
+#endif /* _konkrete_AssociatedSensor_h */
Added: cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/AssociatedSensorProvider.c
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/AssociatedSensorProvider.c (rev 0)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/AssociatedSensorProvider.c 2008-08-20 21:10:23 UTC (rev 873)
@@ -0,0 +1,246 @@
+#include <konkret/konkret.h>
+#include "AssociatedSensor.h"
+#include "Resource.h"
+
+static const CMPIBroker* _cb;
+
+static void AssociatedSensorInitialize()
+{
+}
+
+static CMPIStatus AssociatedSensorCleanup(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus AssociatedSensorEnumInstanceNames(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ return KDefaultEnumerateInstanceNames(
+ _cb, mi, cc, cr, cop);
+}
+
+static CMPIStatus AssociatedSensorEnumInstances(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ const char* ns = KNameSpace(cop);
+ struct FanInfo* data;
+ size_t size;
+ size_t i;
+
+ /* Get fan resource data */
+
+ if (GetFanInfo(&data, &size) != 0)
+ KReturn2(_cb, ERR_FAILED, "failed to access fan resources");
+
+ /* For each fan */
+
+ for (i = 0; i < size; i++)
+ {
+ AssociatedSensor x;
+ NumericSensorRef a;
+ FanRef d;
+
+ /* AssociatedSensor.Antecedent */
+ NumericSensorRef_Init(&a, _cb, ns);
+ NumericSensorRef_Set_SystemCreationClassName(&a, SysClassName().str);
+ NumericSensorRef_Set_SystemName(&a, SysName().str);
+ NumericSensorRef_Set_CreationClassName(&a, "Linux_FanNumericSensor");
+ NumericSensorRef_Set_DeviceID(&a, data[i].deviceID);
+
+ /* AssociatedSensor.Dependent */
+ FanRef_Init(&d, _cb, ns);
+ FanRef_Set_SystemCreationClassName(&d, SysClassName().str);
+ FanRef_Set_SystemName(&d, SysName().str);
+ FanRef_Set_CreationClassName(&d, "Linux_Fan");
+ FanRef_Set_DeviceID(&d, data[i].deviceID);
+
+ /* AssociatedSensor */
+ AssociatedSensor_Init(&x, _cb, ns);
+ AssociatedSensor_Set_Antecedent(&x, &a);
+ AssociatedSensor_Set_Dependent(&x, &d);
+
+ KReturnInstance(cr, x);
+ }
+
+ /* Free resource data */
+ free(data);
+
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus AssociatedSensorGetInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char** properties)
+{
+ return KDefaultGetInstance(
+ _cb, mi, cc, cr, cop, properties);
+}
+
+static CMPIStatus AssociatedSensorCreateInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus AssociatedSensorModifyInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const CMPIInstance* ci,
+ const char**properties)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus AssociatedSensorDeleteInstance(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus AssociatedSensorExecQuery(
+ CMPIInstanceMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* lang,
+ const char* query)
+{
+ CMReturn(CMPI_RC_ERR_NOT_SUPPORTED);
+}
+
+static CMPIStatus AssociatedSensorAssociationCleanup(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ CMPIBoolean term)
+{
+ CMReturn(CMPI_RC_OK);
+}
+
+static CMPIStatus AssociatedSensorAssociators(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole,
+ const char** properties)
+{
+ return KDefaultAssociators(
+ _cb,
+ mi,
+ cc,
+ cr,
+ cop,
+ AssociatedSensor_ClassName,
+ assocClass,
+ resultClass,
+ role,
+ resultRole,
+ properties);
+}
+
+static CMPIStatus AssociatedSensorAssociatorNames(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* resultClass,
+ const char* role,
+ const char* resultRole)
+{
+ return KDefaultAssociatorNames(
+ _cb,
+ mi,
+ cc,
+ cr,
+ cop,
+ AssociatedSensor_ClassName,
+ assocClass,
+ resultClass,
+ role,
+ resultRole);
+}
+
+static CMPIStatus AssociatedSensorReferences(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role,
+ const char** properties)
+{
+ return KDefaultReferences(
+ _cb,
+ mi,
+ cc,
+ cr,
+ cop,
+ AssociatedSensor_ClassName,
+ assocClass,
+ role,
+ properties);
+}
+
+static CMPIStatus AssociatedSensorReferenceNames(
+ CMPIAssociationMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* assocClass,
+ const char* role)
+{
+ return KDefaultReferenceNames(
+ _cb,
+ mi,
+ cc,
+ cr,
+ cop,
+ AssociatedSensor_ClassName,
+ assocClass,
+ role);
+}
+
+CMInstanceMIStub(
+ AssociatedSensor,
+ Linux_FanAssociatedSensor,
+ _cb,
+ AssociatedSensorInitialize())
+
+CMAssociationMIStub(
+ AssociatedSensor,
+ Linux_FanAssociatedSensor,
+ _cb,
+ AssociatedSensorInitialize())
+
+KONKRET_REGISTRATION(
+ "root/cimv2",
+ "Linux_FanAssociatedSensor",
+ "Linux_FanAssociatedSensor",
+ "instance association");
Added: cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/CIM_AssociatedSensor.h
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/CIM_AssociatedSensor.h (rev 0)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/CIM_AssociatedSensor.h 2008-08-20 21:10:23 UTC (rev 873)
@@ -0,0 +1,386 @@
+/*
+**==============================================================================
+**
+** CAUTION: This file generated by KonkretCMPI. Please do not edit.
+**
+**==============================================================================
+*/
+
+#ifndef _konkrete_CIM_AssociatedSensor_h
+#define _konkrete_CIM_AssociatedSensor_h
+
+#include <konkret/konkret.h>
+#include "CIM_Sensor.h"
+#include "CIM_ManagedSystemElement.h"
+
+/*
+**==============================================================================
+**
+** struct CIM_AssociatedSensorRef
+**
+**==============================================================================
+*/
+
+/* classname=CIM_AssociatedSensor */
+typedef struct _CIM_AssociatedSensorRef
+{
+ KBase __base;
+ /* CIM_Dependency features */
+ const KRef Antecedent; /* CIM_Sensor */
+ const KRef Dependent; /* CIM_ManagedSystemElement */
+ /* CIM_AssociatedSensor features */
+}
+CIM_AssociatedSensorRef;
+
+static const unsigned char __CIM_AssociatedSensorRef_sig[] =
+{
+ 0x14,0x43,0x49,0x4d,0x5f,0x41,0x73,0x73,0x6f,0x63,0x69,0x61,0x74,0x65,0x64,
+ 0x53,0x65,0x6e,0x73,0x6f,0x72,0x00,0x02,0x4e,0x0a,0x41,0x6e,0x74,0x65,0x63,
+ 0x65,0x64,0x65,0x6e,0x74,0x00,0x4e,0x09,0x44,0x65,0x70,0x65,0x6e,0x64,0x65,
+ 0x6e,0x74,0x00,
+};
+
+KINLINE void CIM_AssociatedSensorRef_Init(
+ CIM_AssociatedSensorRef* self,
+ const CMPIBroker* cb,
+ const char* ns)
+{
+ const unsigned char* sig = __CIM_AssociatedSensorRef_sig;
+ KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
+ ((KRef*)&self->Antecedent)->__sig = __CIM_Sensor_sig;
+ ((KRef*)&self->Dependent)->__sig = __CIM_ManagedSystemElement_sig;
+}
+
+KINLINE CMPIStatus CIM_AssociatedSensorRef_InitFromInstance(
+ CIM_AssociatedSensorRef* self,
+ const CMPIBroker* cb,
+ const CMPIInstance* x)
+{
+ CIM_AssociatedSensorRef_Init(self, cb, NULL);
+ return KBase_FromInstance(&self->__base, x);
+}
+
+KINLINE CMPIStatus CIM_AssociatedSensorRef_InitFromObjectPath(
+ CIM_AssociatedSensorRef* self,
+ const CMPIBroker* cb,
+ const CMPIObjectPath* x)
+{
+ CIM_AssociatedSensorRef_Init(self, cb, NULL);
+ return KBase_FromObjectPath(&self->__base, x);
+}
+
+KINLINE void CIM_AssociatedSensorRef_Print(
+ const CIM_AssociatedSensorRef* self,
+ FILE* os)
+{
+ KBase_Print(os, &self->__base, 'r');
+}
+
+KINLINE CMPIInstance* CIM_AssociatedSensorRef_ToInstance(
+ const CIM_AssociatedSensorRef* self,
+ CMPIStatus* status)
+{
+ return KBase_ToInstance(&self->__base, status);
+}
+
+KINLINE CMPIObjectPath* CIM_AssociatedSensorRef_ToObjectPath(
+ const CIM_AssociatedSensorRef* self,
+ CMPIStatus* status)
+{
+ return KBase_ToObjectPath(&self->__base, status);
+}
+
+KINLINE const char* CIM_AssociatedSensorRef_NameSpace(
+ CIM_AssociatedSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ return self->__base.ns ? KChars(self->__base.ns) : NULL;
+ return NULL;
+}
+
+KINLINE void CIM_AssociatedSensorRef_SetObjectPath_Antecedent(
+ CIM_AssociatedSensorRef* self,
+ const CMPIObjectPath* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ KRef_SetObjectPath(field, x);
+ }
+}
+
+KINLINE CMPIStatus CIM_AssociatedSensorRef_Set_Antecedent(
+ CIM_AssociatedSensorRef* self,
+ const CIM_SensorRef* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ return KRef_Set(field, &x->__base);
+ }
+ CMReturn(CMPI_RC_ERR_FAILED);
+}
+
+KINLINE void CIM_AssociatedSensorRef_Null_Antecedent(
+ CIM_AssociatedSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ KRef_Null(field);
+ }
+}
+
+KINLINE void CIM_AssociatedSensorRef_Clr_Antecedent(
+ CIM_AssociatedSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ KRef_Clr(field);
+ }
+}
+
+KINLINE void CIM_AssociatedSensorRef_SetObjectPath_Dependent(
+ CIM_AssociatedSensorRef* self,
+ const CMPIObjectPath* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ KRef_SetObjectPath(field, x);
+ }
+}
+
+KINLINE CMPIStatus CIM_AssociatedSensorRef_Set_Dependent(
+ CIM_AssociatedSensorRef* self,
+ const CIM_ManagedSystemElementRef* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ return KRef_Set(field, &x->__base);
+ }
+ CMReturn(CMPI_RC_ERR_FAILED);
+}
+
+KINLINE void CIM_AssociatedSensorRef_Null_Dependent(
+ CIM_AssociatedSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ KRef_Null(field);
+ }
+}
+
+KINLINE void CIM_AssociatedSensorRef_Clr_Dependent(
+ CIM_AssociatedSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ KRef_Clr(field);
+ }
+}
+
+/*
+**==============================================================================
+**
+** struct CIM_AssociatedSensor
+**
+**==============================================================================
+*/
+
+/* classname=CIM_AssociatedSensor */
+typedef struct _CIM_AssociatedSensor
+{
+ KBase __base;
+ /* CIM_Dependency features */
+ const KRef Antecedent; /* CIM_Sensor */
+ const KRef Dependent; /* CIM_ManagedSystemElement */
+ /* CIM_AssociatedSensor features */
+}
+CIM_AssociatedSensor;
+
+static const unsigned char __CIM_AssociatedSensor_sig[] =
+{
+ 0x14,0x43,0x49,0x4d,0x5f,0x41,0x73,0x73,0x6f,0x63,0x69,0x61,0x74,0x65,0x64,
+ 0x53,0x65,0x6e,0x73,0x6f,0x72,0x00,0x02,0x4e,0x0a,0x41,0x6e,0x74,0x65,0x63,
+ 0x65,0x64,0x65,0x6e,0x74,0x00,0x4e,0x09,0x44,0x65,0x70,0x65,0x6e,0x64,0x65,
+ 0x6e,0x74,0x00,
+};
+
+KINLINE void CIM_AssociatedSensor_Init(
+ CIM_AssociatedSensor* self,
+ const CMPIBroker* cb,
+ const char* ns)
+{
+ const unsigned char* sig = __CIM_AssociatedSensor_sig;
+ KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
+ ((KRef*)&self->Antecedent)->__sig = __CIM_Sensor_sig;
+ ((KRef*)&self->Dependent)->__sig = __CIM_ManagedSystemElement_sig;
+}
+
+KINLINE CMPIStatus CIM_AssociatedSensor_InitFromInstance(
+ CIM_AssociatedSensor* self,
+ const CMPIBroker* cb,
+ const CMPIInstance* x)
+{
+ CIM_AssociatedSensor_Init(self, cb, NULL);
+ return KBase_FromInstance(&self->__base, x);
+}
+
+KINLINE CMPIStatus CIM_AssociatedSensor_InitFromObjectPath(
+ CIM_AssociatedSensor* self,
+ const CMPIBroker* cb,
+ const CMPIObjectPath* x)
+{
+ CIM_AssociatedSensor_Init(self, cb, NULL);
+ return KBase_FromObjectPath(&self->__base, x);
+}
+
+KINLINE void CIM_AssociatedSensor_Print(
+ const CIM_AssociatedSensor* self,
+ FILE* os)
+{
+ KBase_Print(os, &self->__base, 'i');
+}
+
+KINLINE CMPIInstance* CIM_AssociatedSensor_ToInstance(
+ const CIM_AssociatedSensor* self,
+ CMPIStatus* status)
+{
+ return KBase_ToInstance(&self->__base, status);
+}
+
+KINLINE CMPIObjectPath* CIM_AssociatedSensor_ToObjectPath(
+ const CIM_AssociatedSensor* self,
+ CMPIStatus* status)
+{
+ return KBase_ToObjectPath(&self->__base, status);
+}
+
+KINLINE const char* CIM_AssociatedSensor_NameSpace(
+ CIM_AssociatedSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ return self->__base.ns ? KChars(self->__base.ns) : NULL;
+ return NULL;
+}
+
+KINLINE void CIM_AssociatedSensor_SetObjectPath_Antecedent(
+ CIM_AssociatedSensor* self,
+ const CMPIObjectPath* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ KRef_SetObjectPath(field, x);
+ }
+}
+
+KINLINE CMPIStatus CIM_AssociatedSensor_Set_Antecedent(
+ CIM_AssociatedSensor* self,
+ const CIM_SensorRef* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ return KRef_Set(field, &x->__base);
+ }
+ CMReturn(CMPI_RC_ERR_FAILED);
+}
+
+KINLINE void CIM_AssociatedSensor_Null_Antecedent(
+ CIM_AssociatedSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ KRef_Null(field);
+ }
+}
+
+KINLINE void CIM_AssociatedSensor_Clr_Antecedent(
+ CIM_AssociatedSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Antecedent;
+ KRef_Clr(field);
+ }
+}
+
+KINLINE void CIM_AssociatedSensor_SetObjectPath_Dependent(
+ CIM_AssociatedSensor* self,
+ const CMPIObjectPath* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ KRef_SetObjectPath(field, x);
+ }
+}
+
+KINLINE CMPIStatus CIM_AssociatedSensor_Set_Dependent(
+ CIM_AssociatedSensor* self,
+ const CIM_ManagedSystemElementRef* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ return KRef_Set(field, &x->__base);
+ }
+ CMReturn(CMPI_RC_ERR_FAILED);
+}
+
+KINLINE void CIM_AssociatedSensor_Null_Dependent(
+ CIM_AssociatedSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ KRef_Null(field);
+ }
+}
+
+KINLINE void CIM_AssociatedSensor_Clr_Dependent(
+ CIM_AssociatedSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KRef* field = (KRef*)&self->Dependent;
+ KRef_Clr(field);
+ }
+}
+
+/*
+**==============================================================================
+**
+** CIM_AssociatedSensor methods
+**
+**==============================================================================
+*/
+
+KINLINE CMPIStatus CIM_AssociatedSensor_DispatchMethod(
+ const CMPIBroker* cb,
+ CMPIMethodMI* mi,
+ const CMPIContext* cc,
+ const CMPIResult* cr,
+ const CMPIObjectPath* cop,
+ const char* meth,
+ const CMPIArgs* in,
+ CMPIArgs* out)
+{
+ CIM_AssociatedSensorRef self;
+
+ KReturnIf(CIM_AssociatedSensorRef_InitFromObjectPath(&self, cb, cop));
+
+
+ KReturn(ERR_METHOD_NOT_FOUND);
+}
+
+#define CIM_AssociatedSensor_ClassName "CIM_AssociatedSensor"
+
+#endif /* _konkrete_CIM_AssociatedSensor_h */
Added: cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/CIM_NumericSensor.h
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/CIM_NumericSensor.h (rev 0)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/src/CIM_NumericSensor.h 2008-08-20 21:10:23 UTC (rev 873)
@@ -0,0 +1,6012 @@
+/*
+**==============================================================================
+**
+** CAUTION: This file generated by KonkretCMPI. Please do not edit.
+**
+**==============================================================================
+*/
+
+#ifndef _konkrete_CIM_NumericSensor_h
+#define _konkrete_CIM_NumericSensor_h
+
+#include <konkret/konkret.h>
+#include "CIM_ConcreteJob.h"
+
+/*
+**==============================================================================
+**
+** struct CIM_NumericSensorRef
+**
+**==============================================================================
+*/
+
+/* classname=CIM_NumericSensor */
+typedef struct _CIM_NumericSensorRef
+{
+ KBase __base;
+ /* CIM_ManagedElement features */
+ /* CIM_ManagedSystemElement features */
+ /* CIM_LogicalElement features */
+ /* CIM_EnabledLogicalElement features */
+ /* CIM_LogicalDevice features */
+ const KString SystemCreationClassName;
+ const KString SystemName;
+ const KString CreationClassName;
+ const KString DeviceID;
+ /* CIM_Sensor features */
+ /* CIM_NumericSensor features */
+}
+CIM_NumericSensorRef;
+
+static const unsigned char __CIM_NumericSensorRef_sig[] =
+{
+ 0x11,0x43,0x49,0x4d,0x5f,0x4e,0x75,0x6d,0x65,0x72,0x69,0x63,0x53,0x65,0x6e,
+ 0x73,0x6f,0x72,0x00,0x04,0x4c,0x17,0x53,0x79,0x73,0x74,0x65,0x6d,0x43,0x72,
+ 0x65,0x61,0x74,0x69,0x6f,0x6e,0x43,0x6c,0x61,0x73,0x73,0x4e,0x61,0x6d,0x65,
+ 0x00,0x4c,0x0a,0x53,0x79,0x73,0x74,0x65,0x6d,0x4e,0x61,0x6d,0x65,0x00,0x4c,
+ 0x11,0x43,0x72,0x65,0x61,0x74,0x69,0x6f,0x6e,0x43,0x6c,0x61,0x73,0x73,0x4e,
+ 0x61,0x6d,0x65,0x00,0x4c,0x08,0x44,0x65,0x76,0x69,0x63,0x65,0x49,0x44,0x00,
+};
+
+KINLINE void CIM_NumericSensorRef_Init(
+ CIM_NumericSensorRef* self,
+ const CMPIBroker* cb,
+ const char* ns)
+{
+ const unsigned char* sig = __CIM_NumericSensorRef_sig;
+ KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
+}
+
+KINLINE CMPIStatus CIM_NumericSensorRef_InitFromInstance(
+ CIM_NumericSensorRef* self,
+ const CMPIBroker* cb,
+ const CMPIInstance* x)
+{
+ CIM_NumericSensorRef_Init(self, cb, NULL);
+ return KBase_FromInstance(&self->__base, x);
+}
+
+KINLINE CMPIStatus CIM_NumericSensorRef_InitFromObjectPath(
+ CIM_NumericSensorRef* self,
+ const CMPIBroker* cb,
+ const CMPIObjectPath* x)
+{
+ CIM_NumericSensorRef_Init(self, cb, NULL);
+ return KBase_FromObjectPath(&self->__base, x);
+}
+
+KINLINE void CIM_NumericSensorRef_Print(
+ const CIM_NumericSensorRef* self,
+ FILE* os)
+{
+ KBase_Print(os, &self->__base, 'r');
+}
+
+KINLINE CMPIInstance* CIM_NumericSensorRef_ToInstance(
+ const CIM_NumericSensorRef* self,
+ CMPIStatus* status)
+{
+ return KBase_ToInstance(&self->__base, status);
+}
+
+KINLINE CMPIObjectPath* CIM_NumericSensorRef_ToObjectPath(
+ const CIM_NumericSensorRef* self,
+ CMPIStatus* status)
+{
+ return KBase_ToObjectPath(&self->__base, status);
+}
+
+KINLINE const char* CIM_NumericSensorRef_NameSpace(
+ CIM_NumericSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ return self->__base.ns ? KChars(self->__base.ns) : NULL;
+ return NULL;
+}
+
+KINLINE void CIM_NumericSensorRef_SetString_SystemCreationClassName(
+ CIM_NumericSensorRef* self,
+ CMPIString* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->SystemCreationClassName;
+ KString_SetString(field, x);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_Set_SystemCreationClassName(
+ CIM_NumericSensorRef* self,
+ const char* s)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->SystemCreationClassName;
+ KString_Set(field, self->__base.cb, s);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_Null_SystemCreationClassName(
+ CIM_NumericSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->SystemCreationClassName;
+ KString_Null(field);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_Clr_SystemCreationClassName(
+ CIM_NumericSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->SystemCreationClassName;
+ KString_Clr(field);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_SetString_SystemName(
+ CIM_NumericSensorRef* self,
+ CMPIString* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->SystemName;
+ KString_SetString(field, x);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_Set_SystemName(
+ CIM_NumericSensorRef* self,
+ const char* s)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->SystemName;
+ KString_Set(field, self->__base.cb, s);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_Null_SystemName(
+ CIM_NumericSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->SystemName;
+ KString_Null(field);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_Clr_SystemName(
+ CIM_NumericSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->SystemName;
+ KString_Clr(field);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_SetString_CreationClassName(
+ CIM_NumericSensorRef* self,
+ CMPIString* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->CreationClassName;
+ KString_SetString(field, x);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_Set_CreationClassName(
+ CIM_NumericSensorRef* self,
+ const char* s)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->CreationClassName;
+ KString_Set(field, self->__base.cb, s);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_Null_CreationClassName(
+ CIM_NumericSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->CreationClassName;
+ KString_Null(field);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_Clr_CreationClassName(
+ CIM_NumericSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->CreationClassName;
+ KString_Clr(field);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_SetString_DeviceID(
+ CIM_NumericSensorRef* self,
+ CMPIString* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->DeviceID;
+ KString_SetString(field, x);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_Set_DeviceID(
+ CIM_NumericSensorRef* self,
+ const char* s)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->DeviceID;
+ KString_Set(field, self->__base.cb, s);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_Null_DeviceID(
+ CIM_NumericSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->DeviceID;
+ KString_Null(field);
+ }
+}
+
+KINLINE void CIM_NumericSensorRef_Clr_DeviceID(
+ CIM_NumericSensorRef* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->DeviceID;
+ KString_Clr(field);
+ }
+}
+
+/*
+**==============================================================================
+**
+** struct CIM_NumericSensor
+**
+**==============================================================================
+*/
+
+/* classname=CIM_NumericSensor */
+typedef struct _CIM_NumericSensor
+{
+ KBase __base;
+ /* CIM_ManagedElement features */
+ const KString Caption;
+ const KString Description;
+ const KString ElementName;
+ /* CIM_ManagedSystemElement features */
+ const KDateTime InstallDate;
+ const KString Name;
+ const KUint16A OperationalStatus;
+ const KStringA StatusDescriptions;
+ const KString Status;
+ const KUint16 HealthState;
+ const KUint16 PrimaryStatus;
+ const KUint16 DetailedStatus;
+ const KUint16 OperatingStatus;
+ const KUint16 CommunicationStatus;
+ /* CIM_LogicalElement features */
+ /* CIM_EnabledLogicalElement features */
+ const KUint16 EnabledState;
+ const KString OtherEnabledState;
+ const KUint16 RequestedState;
+ const KUint16 EnabledDefault;
+ const KDateTime TimeOfLastStateChange;
+ const KUint16A AvailableRequestedStates;
+ const KUint16 TransitioningToState;
+ /* CIM_LogicalDevice features */
+ const KString SystemCreationClassName;
+ const KString SystemName;
+ const KString CreationClassName;
+ const KString DeviceID;
+ const KBoolean PowerManagementSupported;
+ const KUint16A PowerManagementCapabilities;
+ const KUint16 Availability;
+ const KUint16 StatusInfo;
+ const KUint32 LastErrorCode;
+ const KString ErrorDescription;
+ const KBoolean ErrorCleared;
+ const KStringA OtherIdentifyingInfo;
+ const KUint64 PowerOnHours;
+ const KUint64 TotalPowerOnHours;
+ const KStringA IdentifyingDescriptions;
+ const KUint16A AdditionalAvailability;
+ const KUint64 MaxQuiesceTime;
+ const KUint16 LocationIndicator;
+ /* CIM_Sensor features */
+ const KUint16 SensorType;
+ const KString OtherSensorTypeDescription;
+ const KStringA PossibleStates;
+ const KString CurrentState;
+ const KUint64 PollingInterval;
+ const KString SensorContext;
+ /* CIM_NumericSensor features */
+ const KUint16 BaseUnits;
+ const KSint32 UnitModifier;
+ const KUint16 RateUnits;
+ const KSint32 CurrentReading;
+ const KSint32 NominalReading;
+ const KSint32 NormalMax;
+ const KSint32 NormalMin;
+ const KSint32 MaxReadable;
+ const KSint32 MinReadable;
+ const KUint32 Resolution;
+ const KSint32 Tolerance;
+ const KSint32 Accuracy;
+ const KBoolean IsLinear;
+ const KUint32 Hysteresis;
+ const KSint32 LowerThresholdNonCritical;
+ const KSint32 UpperThresholdNonCritical;
+ const KSint32 LowerThresholdCritical;
+ const KSint32 UpperThresholdCritical;
+ const KSint32 LowerThresholdFatal;
+ const KSint32 UpperThresholdFatal;
+ const KUint16A SupportedThresholds;
+ const KUint16A EnabledThresholds;
+ const KUint16A SettableThresholds;
+ const KUint32 ProgrammaticAccuracy;
+ const KString AccuracyUnits;
+ const KUint16 ValueFormulation;
+}
+CIM_NumericSensor;
+
+static const unsigned char __CIM_NumericSensor_sig[] =
+{
+ 0x11,0x43,0x49,0x4d,0x5f,0x4e,0x75,0x6d,0x65,0x72,0x69,0x63,0x53,0x65,0x6e,
+ 0x73,0x6f,0x72,0x00,0x46,0x0c,0x07,0x43,0x61,0x70,0x74,0x69,0x6f,0x6e,0x00,
+ 0x0c,0x0b,0x44,0x65,0x73,0x63,0x72,0x69,0x70,0x74,0x69,0x6f,0x6e,0x00,0x0c,
+ 0x0b,0x45,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x4e,0x61,0x6d,0x65,0x00,0x0d,0x0b,
+ 0x49,0x6e,0x73,0x74,0x61,0x6c,0x6c,0x44,0x61,0x74,0x65,0x00,0x0c,0x04,0x4e,
+ 0x61,0x6d,0x65,0x00,0x83,0x11,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e,
+ 0x61,0x6c,0x53,0x74,0x61,0x74,0x75,0x73,0x00,0x8c,0x12,0x53,0x74,0x61,0x74,
+ 0x75,0x73,0x44,0x65,0x73,0x63,0x72,0x69,0x70,0x74,0x69,0x6f,0x6e,0x73,0x00,
+ 0x0c,0x06,0x53,0x74,0x61,0x74,0x75,0x73,0x00,0x03,0x0b,0x48,0x65,0x61,0x6c,
+ 0x74,0x68,0x53,0x74,0x61,0x74,0x65,0x00,0x03,0x0d,0x50,0x72,0x69,0x6d,0x61,
+ 0x72,0x79,0x53,0x74,0x61,0x74,0x75,0x73,0x00,0x03,0x0e,0x44,0x65,0x74,0x61,
+ 0x69,0x6c,0x65,0x64,0x53,0x74,0x61,0x74,0x75,0x73,0x00,0x03,0x0f,0x4f,0x70,
+ 0x65,0x72,0x61,0x74,0x69,0x6e,0x67,0x53,0x74,0x61,0x74,0x75,0x73,0x00,0x03,
+ 0x13,0x43,0x6f,0x6d,0x6d,0x75,0x6e,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e,0x53,
+ 0x74,0x61,0x74,0x75,0x73,0x00,0x03,0x0c,0x45,0x6e,0x61,0x62,0x6c,0x65,0x64,
+ 0x53,0x74,0x61,0x74,0x65,0x00,0x0c,0x11,0x4f,0x74,0x68,0x65,0x72,0x45,0x6e,
+ 0x61,0x62,0x6c,0x65,0x64,0x53,0x74,0x61,0x74,0x65,0x00,0x03,0x0e,0x52,0x65,
+ 0x71,0x75,0x65,0x73,0x74,0x65,0x64,0x53,0x74,0x61,0x74,0x65,0x00,0x03,0x0e,
+ 0x45,0x6e,0x61,0x62,0x6c,0x65,0x64,0x44,0x65,0x66,0x61,0x75,0x6c,0x74,0x00,
+ 0x0d,0x15,0x54,0x69,0x6d,0x65,0x4f,0x66,0x4c,0x61,0x73,0x74,0x53,0x74,0x61,
+ 0x74,0x65,0x43,0x68,0x61,0x6e,0x67,0x65,0x00,0x83,0x18,0x41,0x76,0x61,0x69,
+ 0x6c,0x61,0x62,0x6c,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74,0x65,0x64,0x53,
+ 0x74,0x61,0x74,0x65,0x73,0x00,0x03,0x14,0x54,0x72,0x61,0x6e,0x73,0x69,0x74,
+ 0x69,0x6f,0x6e,0x69,0x6e,0x67,0x54,0x6f,0x53,0x74,0x61,0x74,0x65,0x00,0x4c,
+ 0x17,0x53,0x79,0x73,0x74,0x65,0x6d,0x43,0x72,0x65,0x61,0x74,0x69,0x6f,0x6e,
+ 0x43,0x6c,0x61,0x73,0x73,0x4e,0x61,0x6d,0x65,0x00,0x4c,0x0a,0x53,0x79,0x73,
+ 0x74,0x65,0x6d,0x4e,0x61,0x6d,0x65,0x00,0x4c,0x11,0x43,0x72,0x65,0x61,0x74,
+ 0x69,0x6f,0x6e,0x43,0x6c,0x61,0x73,0x73,0x4e,0x61,0x6d,0x65,0x00,0x4c,0x08,
+ 0x44,0x65,0x76,0x69,0x63,0x65,0x49,0x44,0x00,0x00,0x18,0x50,0x6f,0x77,0x65,
+ 0x72,0x4d,0x61,0x6e,0x61,0x67,0x65,0x6d,0x65,0x6e,0x74,0x53,0x75,0x70,0x70,
+ 0x6f,0x72,0x74,0x65,0x64,0x00,0x83,0x1b,0x50,0x6f,0x77,0x65,0x72,0x4d,0x61,
+ 0x6e,0x61,0x67,0x65,0x6d,0x65,0x6e,0x74,0x43,0x61,0x70,0x61,0x62,0x69,0x6c,
+ 0x69,0x74,0x69,0x65,0x73,0x00,0x03,0x0c,0x41,0x76,0x61,0x69,0x6c,0x61,0x62,
+ 0x69,0x6c,0x69,0x74,0x79,0x00,0x03,0x0a,0x53,0x74,0x61,0x74,0x75,0x73,0x49,
+ 0x6e,0x66,0x6f,0x00,0x05,0x0d,0x4c,0x61,0x73,0x74,0x45,0x72,0x72,0x6f,0x72,
+ 0x43,0x6f,0x64,0x65,0x00,0x0c,0x10,0x45,0x72,0x72,0x6f,0x72,0x44,0x65,0x73,
+ 0x63,0x72,0x69,0x70,0x74,0x69,0x6f,0x6e,0x00,0x00,0x0c,0x45,0x72,0x72,0x6f,
+ 0x72,0x43,0x6c,0x65,0x61,0x72,0x65,0x64,0x00,0x8c,0x14,0x4f,0x74,0x68,0x65,
+ 0x72,0x49,0x64,0x65,0x6e,0x74,0x69,0x66,0x79,0x69,0x6e,0x67,0x49,0x6e,0x66,
+ 0x6f,0x00,0x07,0x0c,0x50,0x6f,0x77,0x65,0x72,0x4f,0x6e,0x48,0x6f,0x75,0x72,
+ 0x73,0x00,0x07,0x11,0x54,0x6f,0x74,0x61,0x6c,0x50,0x6f,0x77,0x65,0x72,0x4f,
+ 0x6e,0x48,0x6f,0x75,0x72,0x73,0x00,0x8c,0x17,0x49,0x64,0x65,0x6e,0x74,0x69,
+ 0x66,0x79,0x69,0x6e,0x67,0x44,0x65,0x73,0x63,0x72,0x69,0x70,0x74,0x69,0x6f,
+ 0x6e,0x73,0x00,0x83,0x16,0x41,0x64,0x64,0x69,0x74,0x69,0x6f,0x6e,0x61,0x6c,
+ 0x41,0x76,0x61,0x69,0x6c,0x61,0x62,0x69,0x6c,0x69,0x74,0x79,0x00,0x07,0x0e,
+ 0x4d,0x61,0x78,0x51,0x75,0x69,0x65,0x73,0x63,0x65,0x54,0x69,0x6d,0x65,0x00,
+ 0x03,0x11,0x4c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x49,0x6e,0x64,0x69,0x63,
+ 0x61,0x74,0x6f,0x72,0x00,0x03,0x0a,0x53,0x65,0x6e,0x73,0x6f,0x72,0x54,0x79,
+ 0x70,0x65,0x00,0x0c,0x1a,0x4f,0x74,0x68,0x65,0x72,0x53,0x65,0x6e,0x73,0x6f,
+ 0x72,0x54,0x79,0x70,0x65,0x44,0x65,0x73,0x63,0x72,0x69,0x70,0x74,0x69,0x6f,
+ 0x6e,0x00,0x8c,0x0e,0x50,0x6f,0x73,0x73,0x69,0x62,0x6c,0x65,0x53,0x74,0x61,
+ 0x74,0x65,0x73,0x00,0x0c,0x0c,0x43,0x75,0x72,0x72,0x65,0x6e,0x74,0x53,0x74,
+ 0x61,0x74,0x65,0x00,0x07,0x0f,0x50,0x6f,0x6c,0x6c,0x69,0x6e,0x67,0x49,0x6e,
+ 0x74,0x65,0x72,0x76,0x61,0x6c,0x00,0x0c,0x0d,0x53,0x65,0x6e,0x73,0x6f,0x72,
+ 0x43,0x6f,0x6e,0x74,0x65,0x78,0x74,0x00,0x03,0x09,0x42,0x61,0x73,0x65,0x55,
+ 0x6e,0x69,0x74,0x73,0x00,0x06,0x0c,0x55,0x6e,0x69,0x74,0x4d,0x6f,0x64,0x69,
+ 0x66,0x69,0x65,0x72,0x00,0x03,0x09,0x52,0x61,0x74,0x65,0x55,0x6e,0x69,0x74,
+ 0x73,0x00,0x06,0x0e,0x43,0x75,0x72,0x72,0x65,0x6e,0x74,0x52,0x65,0x61,0x64,
+ 0x69,0x6e,0x67,0x00,0x06,0x0e,0x4e,0x6f,0x6d,0x69,0x6e,0x61,0x6c,0x52,0x65,
+ 0x61,0x64,0x69,0x6e,0x67,0x00,0x06,0x09,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x4d,
+ 0x61,0x78,0x00,0x06,0x09,0x4e,0x6f,0x72,0x6d,0x61,0x6c,0x4d,0x69,0x6e,0x00,
+ 0x06,0x0b,0x4d,0x61,0x78,0x52,0x65,0x61,0x64,0x61,0x62,0x6c,0x65,0x00,0x06,
+ 0x0b,0x4d,0x69,0x6e,0x52,0x65,0x61,0x64,0x61,0x62,0x6c,0x65,0x00,0x05,0x0a,
+ 0x52,0x65,0x73,0x6f,0x6c,0x75,0x74,0x69,0x6f,0x6e,0x00,0x06,0x09,0x54,0x6f,
+ 0x6c,0x65,0x72,0x61,0x6e,0x63,0x65,0x00,0x06,0x08,0x41,0x63,0x63,0x75,0x72,
+ 0x61,0x63,0x79,0x00,0x00,0x08,0x49,0x73,0x4c,0x69,0x6e,0x65,0x61,0x72,0x00,
+ 0x05,0x0a,0x48,0x79,0x73,0x74,0x65,0x72,0x65,0x73,0x69,0x73,0x00,0x06,0x19,
+ 0x4c,0x6f,0x77,0x65,0x72,0x54,0x68,0x72,0x65,0x73,0x68,0x6f,0x6c,0x64,0x4e,
+ 0x6f,0x6e,0x43,0x72,0x69,0x74,0x69,0x63,0x61,0x6c,0x00,0x06,0x19,0x55,0x70,
+ 0x70,0x65,0x72,0x54,0x68,0x72,0x65,0x73,0x68,0x6f,0x6c,0x64,0x4e,0x6f,0x6e,
+ 0x43,0x72,0x69,0x74,0x69,0x63,0x61,0x6c,0x00,0x06,0x16,0x4c,0x6f,0x77,0x65,
+ 0x72,0x54,0x68,0x72,0x65,0x73,0x68,0x6f,0x6c,0x64,0x43,0x72,0x69,0x74,0x69,
+ 0x63,0x61,0x6c,0x00,0x06,0x16,0x55,0x70,0x70,0x65,0x72,0x54,0x68,0x72,0x65,
+ 0x73,0x68,0x6f,0x6c,0x64,0x43,0x72,0x69,0x74,0x69,0x63,0x61,0x6c,0x00,0x06,
+ 0x13,0x4c,0x6f,0x77,0x65,0x72,0x54,0x68,0x72,0x65,0x73,0x68,0x6f,0x6c,0x64,
+ 0x46,0x61,0x74,0x61,0x6c,0x00,0x06,0x13,0x55,0x70,0x70,0x65,0x72,0x54,0x68,
+ 0x72,0x65,0x73,0x68,0x6f,0x6c,0x64,0x46,0x61,0x74,0x61,0x6c,0x00,0x83,0x13,
+ 0x53,0x75,0x70,0x70,0x6f,0x72,0x74,0x65,0x64,0x54,0x68,0x72,0x65,0x73,0x68,
+ 0x6f,0x6c,0x64,0x73,0x00,0x83,0x11,0x45,0x6e,0x61,0x62,0x6c,0x65,0x64,0x54,
+ 0x68,0x72,0x65,0x73,0x68,0x6f,0x6c,0x64,0x73,0x00,0x83,0x12,0x53,0x65,0x74,
+ 0x74,0x61,0x62,0x6c,0x65,0x54,0x68,0x72,0x65,0x73,0x68,0x6f,0x6c,0x64,0x73,
+ 0x00,0x05,0x14,0x50,0x72,0x6f,0x67,0x72,0x61,0x6d,0x6d,0x61,0x74,0x69,0x63,
+ 0x41,0x63,0x63,0x75,0x72,0x61,0x63,0x79,0x00,0x0c,0x0d,0x41,0x63,0x63,0x75,
+ 0x72,0x61,0x63,0x79,0x55,0x6e,0x69,0x74,0x73,0x00,0x03,0x10,0x56,0x61,0x6c,
+ 0x75,0x65,0x46,0x6f,0x72,0x6d,0x75,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x00,
+};
+
+KINLINE void CIM_NumericSensor_Init(
+ CIM_NumericSensor* self,
+ const CMPIBroker* cb,
+ const char* ns)
+{
+ const unsigned char* sig = __CIM_NumericSensor_sig;
+ KBase_Init(&self->__base, cb, sizeof(*self), sig, ns);
+}
+
+KINLINE CMPIStatus CIM_NumericSensor_InitFromInstance(
+ CIM_NumericSensor* self,
+ const CMPIBroker* cb,
+ const CMPIInstance* x)
+{
+ CIM_NumericSensor_Init(self, cb, NULL);
+ return KBase_FromInstance(&self->__base, x);
+}
+
+KINLINE CMPIStatus CIM_NumericSensor_InitFromObjectPath(
+ CIM_NumericSensor* self,
+ const CMPIBroker* cb,
+ const CMPIObjectPath* x)
+{
+ CIM_NumericSensor_Init(self, cb, NULL);
+ return KBase_FromObjectPath(&self->__base, x);
+}
+
+KINLINE void CIM_NumericSensor_Print(
+ const CIM_NumericSensor* self,
+ FILE* os)
+{
+ KBase_Print(os, &self->__base, 'i');
+}
+
+KINLINE CMPIInstance* CIM_NumericSensor_ToInstance(
+ const CIM_NumericSensor* self,
+ CMPIStatus* status)
+{
+ return KBase_ToInstance(&self->__base, status);
+}
+
+KINLINE CMPIObjectPath* CIM_NumericSensor_ToObjectPath(
+ const CIM_NumericSensor* self,
+ CMPIStatus* status)
+{
+ return KBase_ToObjectPath(&self->__base, status);
+}
+
+KINLINE const char* CIM_NumericSensor_NameSpace(
+ CIM_NumericSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ return self->__base.ns ? KChars(self->__base.ns) : NULL;
+ return NULL;
+}
+
+KINLINE void CIM_NumericSensor_SetString_Caption(
+ CIM_NumericSensor* self,
+ CMPIString* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Caption;
+ KString_SetString(field, x);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Set_Caption(
+ CIM_NumericSensor* self,
+ const char* s)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Caption;
+ KString_Set(field, self->__base.cb, s);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Null_Caption(
+ CIM_NumericSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Caption;
+ KString_Null(field);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Clr_Caption(
+ CIM_NumericSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Caption;
+ KString_Clr(field);
+ }
+}
+
+KINLINE void CIM_NumericSensor_SetString_Description(
+ CIM_NumericSensor* self,
+ CMPIString* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Description;
+ KString_SetString(field, x);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Set_Description(
+ CIM_NumericSensor* self,
+ const char* s)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Description;
+ KString_Set(field, self->__base.cb, s);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Null_Description(
+ CIM_NumericSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Description;
+ KString_Null(field);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Clr_Description(
+ CIM_NumericSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Description;
+ KString_Clr(field);
+ }
+}
+
+KINLINE void CIM_NumericSensor_SetString_ElementName(
+ CIM_NumericSensor* self,
+ CMPIString* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->ElementName;
+ KString_SetString(field, x);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Set_ElementName(
+ CIM_NumericSensor* self,
+ const char* s)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->ElementName;
+ KString_Set(field, self->__base.cb, s);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Null_ElementName(
+ CIM_NumericSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->ElementName;
+ KString_Null(field);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Clr_ElementName(
+ CIM_NumericSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->ElementName;
+ KString_Clr(field);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Set_InstallDate(
+ CIM_NumericSensor* self,
+ CMPIDateTime* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KDateTime* field = (KDateTime*)&self->InstallDate;
+ KDateTime_Set(field, x);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Null_InstallDate(
+ CIM_NumericSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KDateTime* field = (KDateTime*)&self->InstallDate;
+ KDateTime_Null(field);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Clr_InstallDate(
+ CIM_NumericSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KDateTime* field = (KDateTime*)&self->InstallDate;
+ KDateTime_Clr(field);
+ }
+}
+
+KINLINE void CIM_NumericSensor_SetString_Name(
+ CIM_NumericSensor* self,
+ CMPIString* x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Name;
+ KString_SetString(field, x);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Set_Name(
+ CIM_NumericSensor* self,
+ const char* s)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Name;
+ KString_Set(field, self->__base.cb, s);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Null_Name(
+ CIM_NumericSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Name;
+ KString_Null(field);
+ }
+}
+
+KINLINE void CIM_NumericSensor_Clr_Name(
+ CIM_NumericSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KString* field = (KString*)&self->Name;
+ KString_Clr(field);
+ }
+}
+
+KINLINE CMPIBoolean CIM_NumericSensor_Init_OperationalStatus(
+ CIM_NumericSensor* self,
+ CMPICount count)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KUint16A* field = (KUint16A*)&self->OperationalStatus;
+ return KUint16A_Init(field, self->__base.cb, count);
+ }
+ return 0;
+}
+
+KINLINE void CIM_NumericSensor_InitNull_OperationalStatus(
+ CIM_NumericSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KUint16A* field = (KUint16A*)&self->OperationalStatus;
+ KUint16A_InitNull(field);
+ }
+}
+
+KINLINE CMPIBoolean CIM_NumericSensor_Set_OperationalStatus(
+ CIM_NumericSensor* self,
+ CMPICount i,
+ CMPIUint16 x)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KUint16A* field = (KUint16A*)&self->OperationalStatus;
+ return KUint16A_Set(field, i, x);
+ }
+ return 0;
+}
+
+KINLINE KUint16 CIM_NumericSensor_Get_OperationalStatus(
+ CIM_NumericSensor* self,
+ CMPICount i)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KUint16A* field = (KUint16A*)&self->OperationalStatus;
+ return KUint16A_Get(field, i);
+ }
+ return KUint16A_Get(NULL, 0);
+}
+
+KINLINE CMPIBoolean CIM_NumericSensor_Null_OperationalStatus(
+ CIM_NumericSensor* self,
+ CMPICount i)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KUint16A* field = (KUint16A*)&self->OperationalStatus;
+ return KUint16A_Null(field, i);
+ }
+ return 0;
+}
+
+KINLINE void CIM_NumericSensor_Clr_OperationalStatus(
+ CIM_NumericSensor* self)
+{
+ if (self && self->__base.magic == KMAGIC)
+ {
+ KUint16A* field = (KUint16A*)&self->OperationalStatus;
+ KUint16A_Clr(field);
+ }
+}
+
+typedef enum _CIM_NumericSensor_OperationalStatus_Enum
+{
+ CIM_NumericSensor_OperationalStatus_Unknown = 0,
+ CIM_NumericSensor_OperationalStatus_Other = 1,
+ CIM_NumericSensor_OperationalStatus_OK = 2,
+ CIM_NumericSensor_OperationalStatus_Degraded = 3,
+ CIM_NumericSensor_OperationalStatus_Stressed = 4,
+ CIM_NumericSensor_OperationalStatus_Predictive_Failure = 5,
+ CIM_NumericSensor_OperationalStatus_Error = 6,
+ CIM_NumericSensor_OperationalStatus_Non_Recoverable_Error = 7,
+ CIM_NumericSensor_OperationalStatus_Starting = 8,
+ CIM_NumericSensor_OperationalStatus_Stopping = 9,
+ CIM_NumericSensor_OperationalStatus_Stopped = 10,
+ CIM_NumericSensor_OperationalStatus_In_Service = 11,
+ CIM_NumericSensor_OperationalStatus_No_Contact = 12,
+ CIM_NumericSensor_OperationalStatus_Lost_Communication = 13,
+ CIM_NumericSensor_OperationalStatus_Aborted = 14,
+ CIM_NumericSensor_OperationalStatus_Dormant = 15,
+ CIM_NumericSensor_OperationalStatus_Supporting_Entity_in_Error = 16,
+ CIM_NumericSensor_OperationalStatus_Completed = 17,
+ CIM_NumericSensor_OperationalStatus_Power_Mode = 18,
+ CIM_NumericSensor_OperationalStatus_DMTF_Reserved = 0,
+ CIM_NumericSensor_OperationalStatus_Vendor_Reserved = 0,
+}
+CIM_NumericSensor_OperationalStatus_Enum;
+
+/* "Unknown" */
+#define CIM_NumericSensor_Set_OperationalStatus_Unknown(SELF, INDEX)\
+ CIM_NumericSensor_Set_OperationalStatus(SELF, INDEX, 0)
+
+/* "Other" */
+#define CIM_NumericSensor_Set_OperationalStatus_Other(SELF, INDEX)\
+ CIM_NumericSensor_Set_OperationalStatus(SELF, INDEX, 1)
+
+/* "OK" */
+#define CIM_NumericSensor_Set_OperationalStatus_OK(SELF, INDEX)\
+ CIM_NumericSensor_Set_OperationalStatus(SELF, INDEX, 2)
+
+/* "Degraded" */
+#define CIM_NumericSensor_Set_OperationalStatus_Degraded(SELF, INDEX)\
+ CIM_NumericSensor_Set_OperationalStatus(SELF, INDEX, 3)
+
+/* "Stressed" */
+#define CIM_NumericSensor_Set_OperationalStatus_Stressed(SELF, INDEX)\
+ CIM_NumericSensor_Set_OperationalStatus(SELF, INDEX, 4)
+
+/* "Predictive Failure" */
+#define CIM_NumericSensor_Set_OperationalStatus_Predictive_Failure(SELF, INDEX)\
+ CIM_NumericSensor_Set_OperationalStatus(SELF, INDEX, 5)
+
+/* "Error" */
+#define CIM_NumericSensor_Set_OperationalStatus_Error(SELF, INDEX)\
+ CIM_NumericSensor_Set_OperationalStatus(SELF, INDEX, 6)
+
+/* "Non-Recoverable Error" */
+#de...
[truncated message content] |
|
From: <mik...@us...> - 2008-08-19 23:49:12
|
Revision: 872
http://omc.svn.sourceforge.net/omc/?rev=872&view=rev
Author: mike-brasher
Date: 2008-08-19 23:49:21 +0000 (Tue, 19 Aug 2008)
Log Message:
-----------
Expanded profile tests to find all associators associated through
profile related classes.
Modified Paths:
--------------
cmpiprofiles/test/trunk/ProfileTest.py
Added Paths:
-----------
cmpiprofiles/test/trunk/Makefile
Added: cmpiprofiles/test/trunk/Makefile
===================================================================
--- cmpiprofiles/test/trunk/Makefile (rev 0)
+++ cmpiprofiles/test/trunk/Makefile 2008-08-19 23:49:21 UTC (rev 872)
@@ -0,0 +1,17 @@
+
+help:
+ @ echo "targets: all sanity profiles"
+
+all: sanity profiles
+
+sanity:
+ ./AllSanityTest.py --url=http://localhost
+
+URL=http://localhost
+
+profiles:
+ @ ./ProfileTest.py --url $(URL) Linux_EthernetPort Linux_EthernetPortRegisteredProfile
+ @ ./ProfileTest.py --url $(URL) Linux_BootService Linux_BootRegisteredProfile
+ @ ./ProfileTest.py --url $(URL) Linux_SSHProtocolService Linux_SSHRegisteredProfile
+ @ ./ProfileTest.py --url $(URL) Linux_Fan Linux_FanRegisteredProfile
+ @ ./ProfileTest.py --url $(URL) Linux_PowerSupply Linux_PowerSupplyRegisteredProfile
Modified: cmpiprofiles/test/trunk/ProfileTest.py
===================================================================
--- cmpiprofiles/test/trunk/ProfileTest.py 2008-08-19 22:16:16 UTC (rev 871)
+++ cmpiprofiles/test/trunk/ProfileTest.py 2008-08-19 23:49:21 UTC (rev 872)
@@ -43,31 +43,72 @@
globalParser=p
# Get centralClassName argument:
- if (len(arguments) == 0):
- print "missing central class argument\n"
+ if len(arguments) != 2:
+ print "error: need centrl-class registered-profile-class args\n"
sys.exit(1)
centralClassName = arguments[0];
+ registeredProfileClassName = arguments[1];
+ print ">>>> Now Testing Profile: [%s]" %(centralClassName)
+
# Create connection.
c = wbem_connection.WBEMConnFromOptions(p)
- # For each instance of the central class.
+ # Find instances of the central class.
+
names = c.EnumerateInstanceNames(centralClassName)
if len(names) == 0:
print "no instances of the central class found: %s" %(centralClassName)
sys.exit(1)
- # Each instance of central class must have exactly one associator of type
- # CIM_Registered profile.
+ # For each instance of central class be sure there is exactly one
+ # RegisteredProfile instance (associated through ElementConformsToProfile).
for name in names:
inst = c.GetInstance(name)
- assocs = c.Associators(name, AssocClass='CIM_ElementConformsToProfile')
+ # Find associators through ElementConformsToProfile.
+
+ assocs = c.AssociatorNames( \
+ name, AssocClass='CIM_ElementConformsToProfile')
+
if len(assocs) != 1:
print "error: expected instance of central class to have 1 " \
"associator through CIM_ElementConformsToProfile but found %d" \
%(len(assocs))
sys.exit(1)
+
+ # Get RegisteredProfile instance.
+
+ assoc = assocs[0]
+ inst = c.GetInstance(assocs[0])
+
+ if inst.classname != registeredProfileClassName:
+ print "expected registered profile classname to be %s but got %s" \
+ %(registeredProfileClassName, inst.classname)
+ sys.exit(1)
+
+ # Be sure there is an association between RegisteredProfile instance
+ # and ComputerSystem through ReferenceProfile.
+ # [RegisteredProfile<-ReferenceProfile->ComputerSystem]
+
+ assocs = c.AssociatorNames( \
+ assoc, AssocClass='CIM_ReferencedProfile')
+
+ if len(assocs) != 1:
+ print "error: expected instance of registered profile to have 1 " \
+ "associator through CIM_ReferencedProfile but found %d" \
+ %(len(assocs))
+ sys.exit(1)
+
+ # Expect CIM_RegisteredProfile.InstanceID='SBLIM:Base_Computer'
+ # associator.
+
+ assoc = assocs[0]
+
+ if assoc['InstanceID'] != 'SBLIM:Base_Computer':
+ print "expected " \
+ "CIM_RegisteredProfile.InstanceID='SBLIM:Base_Computer'"
+ sys.exit(1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-19 22:16:07
|
Revision: 871
http://omc.svn.sourceforge.net/omc/?rev=871&view=rev
Author: mike-brasher
Date: 2008-08-19 22:16:16 +0000 (Tue, 19 Aug 2008)
Log Message:
-----------
Updated cleanup.sh scripts to remove dist file.
Modified Paths:
--------------
cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/cleanup.sh
cmpiprofiles/sblim-cmpi-ethernet_port_profile/trunk/cleanup.sh
cmpiprofiles/sblim-cmpi-fan_profile/trunk/cleanup.sh
cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/cleanup.sh
cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/cleanup.sh
Modified: cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/cleanup.sh
===================================================================
--- cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/cleanup.sh 2008-08-19 22:13:22 UTC (rev 870)
+++ cmpiprofiles/sblim-cmpi-boot_control_profile/trunk/cleanup.sh 2008-08-19 22:16:16 UTC (rev 871)
@@ -25,4 +25,5 @@
Makefile \
mof/Makefile \
src/.deps \
- src/Makefile
+ src/Makefile \
+ sblim-cmpi-boot_control_profile-1.0.0.tar.gz
Modified: cmpiprofiles/sblim-cmpi-ethernet_port_profile/trunk/cleanup.sh
===================================================================
--- cmpiprofiles/sblim-cmpi-ethernet_port_profile/trunk/cleanup.sh 2008-08-19 22:13:22 UTC (rev 870)
+++ cmpiprofiles/sblim-cmpi-ethernet_port_profile/trunk/cleanup.sh 2008-08-19 22:16:16 UTC (rev 871)
@@ -25,4 +25,5 @@
Makefile \
mof/Makefile \
src/.deps \
- src/Makefile
+ src/Makefile \
+ sblim-cmpi-ethport_profile-1.0.0.tar.gz
Modified: cmpiprofiles/sblim-cmpi-fan_profile/trunk/cleanup.sh
===================================================================
--- cmpiprofiles/sblim-cmpi-fan_profile/trunk/cleanup.sh 2008-08-19 22:13:22 UTC (rev 870)
+++ cmpiprofiles/sblim-cmpi-fan_profile/trunk/cleanup.sh 2008-08-19 22:16:16 UTC (rev 871)
@@ -16,4 +16,5 @@
install-sh \
mof/Makefile.in \
src/Makefile.in \
- config.h.in~
+ config.h.in~ \
+ sblim-cmpi-fan_profile-1.0.0.tar.gz
Modified: cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/cleanup.sh
===================================================================
--- cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/cleanup.sh 2008-08-19 22:13:22 UTC (rev 870)
+++ cmpiprofiles/sblim-cmpi-power_supply_profile/trunk/cleanup.sh 2008-08-19 22:16:16 UTC (rev 871)
@@ -25,4 +25,5 @@
Makefile \
mof/Makefile \
src/.deps \
- src/Makefile
+ src/Makefile \
+ sblim-cmpi-power_supply_profile-1.0.0.tar.gz
Modified: cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/cleanup.sh
===================================================================
--- cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/cleanup.sh 2008-08-19 22:13:22 UTC (rev 870)
+++ cmpiprofiles/sblim-cmpi-ssh_service_profile/trunk/cleanup.sh 2008-08-19 22:16:16 UTC (rev 871)
@@ -25,5 +25,5 @@
Makefile \
mof/Makefile \
src/.deps \
- src/Makefile
-
+ src/Makefile \
+ sblim-cmpi-ssh_service_profile-1.0.0.tar.gz
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mik...@us...> - 2008-08-19 22:13:11
|
Revision: 870
http://omc.svn.sourceforge.net/omc/?rev=870&view=rev
Author: mike-brasher
Date: 2008-08-19 22:13:22 +0000 (Tue, 19 Aug 2008)
Log Message:
-----------
Updated top level makefile.
Modified Paths:
--------------
cmpiprofiles/Makefile
Modified: cmpiprofiles/Makefile
===================================================================
--- cmpiprofiles/Makefile 2008-08-19 22:11:47 UTC (rev 869)
+++ cmpiprofiles/Makefile 2008-08-19 22:13:22 UTC (rev 870)
@@ -27,6 +27,9 @@
distclean:
$(foreach i,$(DIRS), $(MAKE) -C $i distclean; $(NL) )
+distcheck:
+ $(foreach i,$(DIRS), $(MAKE) -C $i distcheck; $(NL) )
+
cleanup:
$(foreach i,$(DIRS), cd $i; ./cleanup.sh ; $(NL) )
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|