commit 1a64a3d4724ed1f2ed9024baf5a480f8d3c92b6c
Author: Michael Calmer
Date: Tue Jan 20 16:05:12 2009 +0100
Implement SUSE_SystemSpecificCollection
---
mof/CMakeLists.txt | 2 +
mof/SUSE_SystemSpecificCollection.mof | 22 ++++++
mof/SUSE_SystemSpecificCollection.sfcb.reg | 5 +
mof/deploy.mof | 1 +
src/CMakeLists.txt | 2 +
src/SUSE_SystemSpecificCollectionProvider.cc | 105 ++++++++++++++++++++++++++
src/SUSE_SystemSpecificCollectionProvider.h | 22 ++++++
7 files changed, 159 insertions(+), 0 deletions(-)
diff --git a/mof/CMakeLists.txt b/mof/CMakeLists.txt
index dfd60c9..4c4e3af 100644
--- a/mof/CMakeLists.txt
+++ b/mof/CMakeLists.txt
@@ -4,6 +4,8 @@ INSTALL( FILES
SUSE_SoftwareIdentity.sfcb.reg
SUSE_InstalledSoftwareIdentity.mof
SUSE_InstalledSoftwareIdentity.sfcb.reg
+ SUSE_SystemSpecificCollection.mof
+ SUSE_SystemSpecificCollection.sfcb.reg
deploy.mof
DESTINATION ${CMPIZYPP_DATA_DIR}/
)
diff --git a/mof/SUSE_SystemSpecificCollection.mof b/mof/SUSE_SystemSpecificCollection.mof
new file mode 100644
index 0000000..c66857d
--- /dev/null
+++ b/mof/SUSE_SystemSpecificCollection.mof
@@ -0,0 +1,22 @@
+//#pragma namespace ("root/cimv2")
+
+
+// -------------------------------------------------------------------
+// *******************************************************************
+// Classes
+// *******************************************************************
+// -------------------------------------------------------------------
+
+
+
+// ===================================================================
+// SUSE_InstalledSoftwareIdentity
+// ===================================================================
+
+[ Provider("cmpi:cmpi-zypp"),
+ Description ("A System Specific Collection representing Available Software.")
+]
+class SUSE_SystemSpecificCollection : CIM_SystemSpecificCollection
+{ };
+
+
diff --git a/mof/SUSE_SystemSpecificCollection.sfcb.reg b/mof/SUSE_SystemSpecificCollection.sfcb.reg
new file mode 100644
index 0000000..7f3907e
--- /dev/null
+++ b/mof/SUSE_SystemSpecificCollection.sfcb.reg
@@ -0,0 +1,5 @@
+[SUSE_SystemSpecificCollection]
+ provider: SUSE_SystemSpecificCollectionProvider
+ location: cmpi-zypp
+ type: instance
+ namespace: root/cimv2
diff --git a/mof/deploy.mof b/mof/deploy.mof
index 0699222..0082284 100644
--- a/mof/deploy.mof
+++ b/mof/deploy.mof
@@ -1,4 +1,5 @@
#pragma namespace ("root/cimv2")
#pragma include ("SUSE_SoftwareIdentity.mof")
#pragma include ("SUSE_InstalledSoftwareIdentity.mof")
+#pragma include ("SUSE_SystemSpecificCollection.mof")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 07935f1..fc44900 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -11,12 +11,14 @@ SET( CMPIZYPP_SRCS
SUSE_zypp.cc
SUSE_SoftwareIdentityProvider.cc
SUSE_InstalledSoftwareIdentityProvider.cc
+ SUSE_SystemSpecificCollectionProvider.cc
)
SET( CMPIZYPP_HEADERS
SUSE_Common.h
SUSE_zypp.h
SUSE_SoftwareIdentityProvider.h
SUSE_InstalledSoftwareIdentityProvider.h
+ SUSE_SystemSpecificCollectionProvider.h
)
ADD_LIBRARY(cmpi-zypp SHARED ${CMPIZYPP_SRCS})
diff --git a/src/SUSE_SystemSpecificCollectionProvider.cc b/src/SUSE_SystemSpecificCollectionProvider.cc
new file mode 100644
index 0000000..75f59d1
--- /dev/null
+++ b/src/SUSE_SystemSpecificCollectionProvider.cc
@@ -0,0 +1,105 @@
+
+#include <iostream>
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include "SUSE_zypp.h"
+#include "SUSE_SystemSpecificCollectionProvider.h"
+
+using namespace zypp;
+using std::endl;
+
+namespace cmpizypp
+{
+ namespace
+ {
+ const char * _ClassName = "SUSE_SystemSpecificCollection";
+ const char * _InstanceID = "SUSE:ZYPP_POOL";
+ } // namespace
+
+
+SUSE_SystemSpecificCollectionProviderClass::SUSE_SystemSpecificCollectionProviderClass( const CmpiBroker & mbp, const CmpiContext & ctx )
+ : CmpiBaseMI( mbp, ctx )
+ , CmpiInstanceMI( mbp, ctx )
+{
+}
+
+CmpiStatus SUSE_SystemSpecificCollectionProviderClass::enumInstanceNames( const CmpiContext& ctx, CmpiResult& rslt, const CmpiObjectPath & cop )
+{
+ _CMPIZYPP_TRACE(1,("--- %s CMPI EnumInstanceNames() called",_ClassName));
+
+ CmpiObjectPath op( cop.getNameSpace(), _ClassName );
+ op.setKey( "InstanceID", _InstanceID);
+ rslt.returnData( op );
+
+ rslt.returnDone();
+ _CMPIZYPP_TRACE(1,("--- %s CMPI EnumInstanceNames() exited",_ClassName));
+ return CmpiStatus(CMPI_RC_OK);
+}
+
+CmpiStatus SUSE_SystemSpecificCollectionProviderClass::enumInstances( const CmpiContext & ctx, CmpiResult & rslt, const CmpiObjectPath & cop, const char** properties )
+{
+ _CMPIZYPP_TRACE(1,("--- %s CMPI EnumInstances() called",_ClassName));
+
+ CmpiObjectPath op( cop.getNameSpace(), _ClassName );
+ CmpiInstance ci( op );
+
+ const char * keys[] = { "InstanceID" };
+ ci.setPropertyFilter( properties, keys );
+
+ ci.setProperty( "InstanceID", _InstanceID );
+ ci.setProperty( "ElementName", "Available Software" );
+ ci.setProperty( "Caption", "Available Software" );
+ ci.setProperty( "Description", "Collection of all Available Software for installation on this System" );
+
+ rslt.returnData( ci );
+
+ rslt.returnDone();
+ _CMPIZYPP_TRACE(1,("--- %s CMPI EnumInstances() exited",_ClassName));
+ return CmpiStatus(CMPI_RC_OK);
+}
+
+
+CmpiStatus SUSE_SystemSpecificCollectionProviderClass::getInstance( const CmpiContext &ctx, CmpiResult &rslt, const CmpiObjectPath &cop, const char **properties )
+{
+ _CMPIZYPP_TRACE(1,("--- %s CMPI GetInstance() called",_ClassName));
+
+ const char * id = cop.getKey( "InstanceId" );
+ if( id == NULL || ::strcmp(id, _InstanceID) != 0 )
+ {
+ CmpiStatus rc( CMPI_RC_ERR_FAILED, "Could not find this collection." );
+ _CMPIZYPP_TRACE(1,("--- %s CMPI GetInstance() failed : %s", _ClassName, rc.msg()));
+ return rc;
+ }
+
+ CmpiObjectPath op( cop.getNameSpace(), _ClassName );
+ CmpiInstance ci( op );
+
+ const char * keys[] = { "InstanceID" };
+ ci.setPropertyFilter( properties, keys );
+
+ ci.setProperty( "InstanceID", _InstanceID );
+ ci.setProperty( "ElementName", "Available Software" );
+ ci.setProperty( "Caption", "Available Software" );
+ ci.setProperty( "Description", "All Available Software on this System" );
+
+ rslt.returnData( ci );
+
+ rslt.returnDone();
+ _CMPIZYPP_TRACE(1,("--- %s CMPI GetInstance() exited",_ClassName));
+ return CmpiStatus(CMPI_RC_OK);
+}
+
+} // namespace cmpizypp
+
+CMProviderBase( SUSE_SystemSpecificCollectionProvider );
+
+CMInstanceMIFactory( cmpizypp::SUSE_SystemSpecificCollectionProviderClass, SUSE_SystemSpecificCollectionProvider );
diff --git a/src/SUSE_SystemSpecificCollectionProvider.h b/src/SUSE_SystemSpecificCollectionProvider.h
new file mode 100644
index 0000000..5cf5b5c
--- /dev/null
+++ b/src/SUSE_SystemSpecificCollectionProvider.h
@@ -0,0 +1,22 @@
+#ifndef SUSE_SYSTEMSPECIFICCOLLECTIONPROVIDER_H
+#define SUSE_SYSTEMSPECIFICCOLLECTIONPROVIDER_H
+
+#include
+
+namespace cmpizypp
+{
+ /**
+ */
+ class SUSE_SystemSpecificCollectionProviderClass : public CmpiInstanceMI
+ {
+ public:
+ SUSE_SystemSpecificCollectionProviderClass( const CmpiBroker & mbp, const CmpiContext & ctx );
+
+ virtual CmpiStatus enumInstanceNames( const CmpiContext& ctx, CmpiResult& rslt, const CmpiObjectPath & cop );
+ virtual CmpiStatus enumInstances( const CmpiContext & ctx, CmpiResult & rslt, const CmpiObjectPath & cop, const char** properties );
+ virtual CmpiStatus getInstance( const CmpiContext &ctx, CmpiResult &rslt, const CmpiObjectPath &cop, const char **properties );
+ };
+
+} // namespace cmpizypp
+
+#endif // SUSE_SYSTEMSPECIFICCOLLECTIONPROVIDER_H
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org