ref: refs/heads/master
commit 2eaf03c7cfc76c72bd0e720e35b178d39c77bd26
Author: Michael Calmer
Date: Mon Jul 20 16:15:27 2009 +0200
implement a dummy for SUSE_SoftwareInstallationJobProvider
SUSE_SoftwareInstallationJobProvider is the instrumentation
for CIM_ConcreteJob
---
mof/CMakeLists.txt | 2 +
mof/SUSE_SoftwareInstallationJob.mof | 158 +++++++++++++++++++++++++++
mof/SUSE_SoftwareInstallationJob.sfcb.reg | 5 +
mof/deploy.mof | 3 +-
src/CMakeLists.txt | 2 +
src/SUSE_SoftwareInstallationJobProvider.cc | 156 ++++++++++++++++++++++++++
src/SUSE_SoftwareInstallationJobProvider.h | 31 +++++
7 files changed, 356 insertions(+), 1 deletions(-)
diff --git a/mof/CMakeLists.txt b/mof/CMakeLists.txt
index 5c4fe35..30c8d94 100644
--- a/mof/CMakeLists.txt
+++ b/mof/CMakeLists.txt
@@ -28,6 +28,8 @@ INSTALL( FILES
SUSE_InstallationServiceRepositoryDependency.sfcb.reg
SUSE_RepositoryAvailableForSoftwareIdentity.mof
SUSE_RepositoryAvailableForSoftwareIdentity.sfcb.reg
+ SUSE_SoftwareInstallationJob.mof
+ SUSE_SoftwareInstallationJob.sfcb.reg
deploy.mof
DESTINATION ${CMPIZYPP_DATA_DIR}/
)
diff --git a/mof/SUSE_SoftwareInstallationJob.mof b/mof/SUSE_SoftwareInstallationJob.mof
new file mode 100644
index 0000000..030ec02
--- /dev/null
+++ b/mof/SUSE_SoftwareInstallationJob.mof
@@ -0,0 +1,158 @@
+//#pragma namespace ("root/cimv2")
+
+
+// -------------------------------------------------------------------
+// *******************************************************************
+// Classes
+// *******************************************************************
+// -------------------------------------------------------------------
+
+
+
+// ===================================================================
+// SUSE_SoftwareInstallationJob
+// ===================================================================
+
+[ Provider("cmpi:cmpi-zypp"),
+ Description ("A Class which provide SoftwareInstallationJob.")
+]
+class SUSE_SoftwareInstallationJob : CIM_ConcreteJob
+{
+ [Key, Override ( "InstanceID" ),
+ Description (
+ "Within the scope of the instantiating Namespace, "
+ "InstanceID opaquely and uniquely identifies an instance "
+ "of this class. In order to ensure uniqueness within the "
+ "NameSpace, the value of InstanceID SHOULD be constructed "
+ "using the following \'preferred\' algorithm: \n"
+ "<OrgID>:<LocalID> \n"
+ "Where <OrgID> and <LocalID> are separated by a colon "
+ "\':\', and where <OrgID> must include a copyrighted, "
+ "trademarked or otherwise unique name that is owned by "
+ "the business entity that is creating or defining the "
+ "InstanceID, or that is a registered ID that is assigned "
+ "to the business entity by a recognized global authority. "
+ "(This requirement is similar to the <Schema Name>_ structure of Schema class names.) In addition, to "
+ "ensure uniqueness <OrgID> must not contain a colon "
+ "(\':\'). When using this algorithm, the first colon to "
+ "appear in InstanceID must appear between <OrgID> and "
+ "<LocalID>. \n"
+ "<LocalID> is chosen by the business entity and should "
+ "not be re-used to identify different underlying "
+ "(real-world) elements. If the above \'preferred\' "
+ "algorithm is not used, the defining entity must assure "
+ "that the resulting InstanceID is not re-used across any "
+ "InstanceIDs produced by this or other providers for the "
+ "NameSpace of this instance. \n"
+ "For DMTF defined instances, the \'preferred\' algorithm "
+ "must be used with the <OrgID> set to \'CIM\'." )]
+ string InstanceID;
+
+ [Required, Override ( "Name" ),
+ Description (
+ "The user-friendly name for this instance of a Job. In "
+ "addition, the user-friendly name can be used as a "
+ "property for a search or query. (Note: Name does not "
+ "have to be unique within a namespace.)" )]
+ string Name;
+
+ [Override ("JobState"), Description (
+ "JobState is an integer enumeration that indicates the "
+ "operational state of a Job. It can also indicate "
+ "transitions between these states, for example, \'Shutting "
+ "Down\' and \'Starting\'. Following is a brief "
+ "description of the states: \n"
+ "New (2) indicates that the job has never been started. \n"
+ "Starting (3) indicates that the job is moving from the "
+ "\'New\', \'Suspended\', or \'Service\' states into the "
+ "\'Running\' state. \n"
+ "Running (4) indicates that the Job is running. \n"
+ "Suspended (5) indicates that the Job is stopped, but can "
+ "be restarted in a seamless manner. \n"
+ "Shutting Down (6) indicates that the job is moving to a "
+ "\'Completed\', \'Terminated\', or \'Killed\' state. \n"
+ "Completed (7) indicates that the job has completed "
+ "normally. \n"
+ "Terminated (8) indicates that the job has been stopped "
+ "by a \'Terminate\' state change request. The job and all "
+ "its underlying processes are ended and can be restarted "
+ "(this is job-specific) only as a new job. \n"
+ "Killed (9) indicates that the job has been stopped by a "
+ "\'Kill\' state change request. Underlying processes "
+ "might have been left running, and cleanup might be "
+ "required to free up resources. \n"
+ "Exception (10) indicates that the Job is in an abnormal "
+ "state that might be indicative of an error condition. "
+ "Actual status might be displayed though job-specific "
+ "objects. \n"
+ "Service (11) indicates that the Job is in a "
+ "vendor-specific state that supports problem discovery, "
+ "or resolution, or both.\n"
+ "Query pending (12) waiting for a client to resolve a "
+ "query." ),
+ ValueMap { "2", "3", "4", "5", "6", "7", "8", "9", "10",
+ "11", "12", "13..32767", "32768..65535" },
+ Values { "New", "Starting", "Running", "Suspended",
+ "Shutting Down", "Completed", "Terminated", "Killed",
+ "Exception", "Service", "Query Pending", "DMTF Reserved",
+ "Vendor Reserved" }]
+ uint16 JobState;
+
+ [Override ("PercentComplete"), Description (
+ "The percentage of the job that has completed at the time "
+ "that this value is requested. Note that this property is "
+ "also present in the JobProcessingStatistics class. This "
+ "class is necessary to capture the processing information "
+ "for recurring Jobs, because only the \'last\' run data "
+ "can be stored in this single-valued property. \n" ),
+ Units ( "Percent" ),
+ MinValue ( 0 ),
+ MaxValue ( 100 ),
+ PUnit ( "percent" )]
+ uint16 PercentComplete;
+
+ [Override ("ErrorCode"), Description (
+ "A vendor-specific error code. The value must be set to "
+ "zero if the Job completed without error. Note that this "
+ "property is also present in the JobProcessingStatistics "
+ "class. This class is necessary to capture the processing "
+ "information for recurring Jobs, because only the \'last\' "
+ "run error can be stored in this single-valued property." ),
+ ModelCorrespondence { "CIM_Job.ErrorDescription" }]
+ uint16 ErrorCode;
+
+ [Override ("ErrorDescription"), Description (
+ "A free-form string that contains the vendor error "
+ "description. Note that this property is also present in "
+ "the JobProcessingStatistics class. This class is "
+ "necessary to capture the processing information for "
+ "recurring Jobs, because only the \'last\' run error can "
+ "be stored in this single-valued property." ),
+ ModelCorrespondence { "CIM_Job.ErrorCode" }]
+ string ErrorDescription;
+
+ [Description (
+ "The question which needs an answer before the job can continue running."
+ "Null indicate that there is no question")]
+ string QueryQuestion;
+
+ [Description (
+ "Define which answers are possible to answer the current question"),
+ ValueMap { "0", "1", "2", "3", "4",
+ "..", "0x8000..0xFFFF" },
+ Values { "Unknown", "Other", "Yes", "No", "Cancel",
+ "DMTF Reserved", "Vendor Reserved" },
+ ArrayType ( "Indexed" )]
+ uint16 AllowedAnswers[];
+
+ [Description ("Method to answer a question. Unknown is set is an answer is provided "
+ "which is not part of the current AllowedAnswers array"),
+ ValueMap { "0", "1", "2" },
+ Values { "Success", "Unknown", "Error"}]
+ uint32 ProvideAnswer(
+ [IN, Description("The answer for the current question")]
+ uint16 answer);
+};
+
+
diff --git a/mof/SUSE_SoftwareInstallationJob.sfcb.reg b/mof/SUSE_SoftwareInstallationJob.sfcb.reg
new file mode 100644
index 0000000..7b87262
--- /dev/null
+++ b/mof/SUSE_SoftwareInstallationJob.sfcb.reg
@@ -0,0 +1,5 @@
+[SUSE_SoftwareInstallationJob]
+ provider: SUSE_SoftwareInstallationJobProvider
+ location: cmpi-zypp
+ type: instance method
+ namespace: root/cimv2
diff --git a/mof/deploy.mof b/mof/deploy.mof
index 2eec533..96946b9 100644
--- a/mof/deploy.mof
+++ b/mof/deploy.mof
@@ -12,4 +12,5 @@
#pragma include ("SUSE_SoftwareRepository.mof")
#pragma include ("SUSE_HostedRepository.mof")
#pragma include ("SUSE_InstallationServiceRepositoryDependency.mof")
-#pragma include ("SUSE_RepositoryAvailableForSoftwareIdentity.mof")
\ No newline at end of file
+#pragma include ("SUSE_RepositoryAvailableForSoftwareIdentity.mof")
+#pragma include ("SUSE_SoftwareInstallationJob.mof")
\ No newline at end of file
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 902176e..fb0dcdf 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -23,6 +23,7 @@ SET( CMPIZYPP_SRCS
SUSE_HostedRepositoryProvider.cc
SUSE_InstallationServiceRepositoryDependencyProvider.cc
SUSE_RepositoryAvailableForSoftwareIdentityProvider.cc
+ SUSE_SoftwareInstallationJobProvider.cc
)
SET( CMPIZYPP_HEADERS
SUSE_Common.h
@@ -42,6 +43,7 @@ SET( CMPIZYPP_HEADERS
SUSE_HostedRepositoryProvider.h
SUSE_InstallationServiceRepositoryDependencyProvider.h
SUSE_RepositoryAvailableForSoftwareIdentityProvider.h
+ SUSE_SoftwareInstallationJobProvider.h
)
ADD_LIBRARY(cmpi-zypp SHARED ${CMPIZYPP_SRCS})
diff --git a/src/SUSE_SoftwareInstallationJobProvider.cc b/src/SUSE_SoftwareInstallationJobProvider.cc
new file mode 100644
index 0000000..2159312
--- /dev/null
+++ b/src/SUSE_SoftwareInstallationJobProvider.cc
@@ -0,0 +1,156 @@
+
+#include <iostream>
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include "SUSE_zypp.h"
+#include "SUSE_Common.h"
+#include "SUSE_SoftwareInstallationJobProvider.h"
+
+using namespace zypp;
+using std::endl;
+
+namespace cmpizypp
+{
+ namespace
+ {
+ const char * _ClassName = "SUSE_SoftwareInstallationJob";
+ } // namespace
+
+
+SUSE_SoftwareInstallationJobProviderClass::SUSE_SoftwareInstallationJobProviderClass( const CmpiBroker & mbp, const CmpiContext & ctx )
+ : CmpiBaseMI( mbp, ctx )
+ , CmpiInstanceMI( mbp, ctx )
+ , CmpiMethodMI( mbp, ctx )
+{
+}
+
+CmpiStatus SUSE_SoftwareInstallationJobProviderClass::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", "SUSE:__dummy__");
+ rslt.returnData( op );
+
+ rslt.returnDone();
+ _CMPIZYPP_TRACE(1,("--- %s CMPI EnumInstanceNames() exited",_ClassName));
+ return CmpiStatus(CMPI_RC_OK);
+}
+
+CmpiStatus SUSE_SoftwareInstallationJobProviderClass::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", "SUSE:__dummy__" );
+
+ ci.setProperty( "Name", "Zypp Software Installation Job");
+ ci.setProperty( "JobState", 4 ); //Running
+ ci.setProperty( "PercentComplete", 12);
+ ci.setProperty( "TimeBeforeRemoval", CmpiDateTime() );
+ /*
+ ci.setProperty( "", "");
+ ci.setProperty( "", "");
+ ci.setProperty( "", "");
+ ci.setProperty( "", "");
+ ci.setProperty( "", "");
+ ci.setProperty( "", "");
+ */
+
+ rslt.returnData( ci );
+
+ rslt.returnDone();
+ _CMPIZYPP_TRACE(1,("--- %s CMPI EnumInstances() exited",_ClassName));
+ return CmpiStatus(CMPI_RC_OK);
+}
+
+
+CmpiStatus SUSE_SoftwareInstallationJobProviderClass::getInstance( const CmpiContext &ctx, CmpiResult &rslt, const CmpiObjectPath &cop, const char **properties )
+{
+ _CMPIZYPP_TRACE(1,("--- %s CMPI GetInstance() called",_ClassName));
+
+ CmpiObjectPath op( cop.getNameSpace(), _ClassName );
+ CmpiInstance ci( op );
+
+ const char * keys[] = { "InstanceID" };
+ ci.setPropertyFilter( properties, keys );
+
+ ci.setProperty( "InstanceID", "SUSE:__dummy__" );
+
+ ci.setProperty( "Name", "Zypp Software Installation Job");
+ ci.setProperty( "JobState", 4 ); //Running
+ ci.setProperty( "PercentComplete", 12);
+ ci.setProperty( "TimeBeforeRemoval", CmpiDateTime() );
+ /*
+ ci.setProperty( "", "");
+ ci.setProperty( "", "");
+ ci.setProperty( "", "");
+ ci.setProperty( "", "");
+ ci.setProperty( "", "");
+ ci.setProperty( "", "");
+ ci.setProperty( "", "");
+ */
+
+ rslt.returnData( ci );
+
+ rslt.returnDone();
+ _CMPIZYPP_TRACE(1,("--- %s CMPI GetInstance() exited",_ClassName));
+ return CmpiStatus(CMPI_RC_OK);
+}
+
+CmpiStatus SUSE_SoftwareInstallationJobProviderClass::invokeMethod (const CmpiContext &ctx, CmpiResult &rslt,
+ const CmpiObjectPath &ref, const char *methodName,
+ const CmpiArgs &in, CmpiArgs &out)
+{
+ _CMPIZYPP_TRACE(1,("--- %s CMPI invokeMethod() called with method: %s",_ClassName, methodName));
+
+ if( ::strcasecmp( ref.getClassName().charPtr(), _ClassName) != 0 )
+ {
+ return CmpiStatus(CMPI_RC_ERR_NOT_SUPPORTED, "invalid classname");
+ }
+ CmpiStatus st(CMPI_RC_ERR_NOT_SUPPORTED);
+
+ if( ::strcasecmp( methodName, "ProvideAnswer" ) == 0)
+ {
+ st = this->provideAnswer(ctx, rslt, ref, in, out);
+ }
+ _CMPIZYPP_TRACE(1,("--- %s CMPI invokeMethod() exited",_ClassName));
+ return st;
+}
+
+/* ========================= private ================================== */
+CmpiStatus SUSE_SoftwareInstallationJobProviderClass::provideAnswer(const CmpiContext &ctx,
+ CmpiResult &rslt,
+ const CmpiObjectPath &ref,
+ const CmpiArgs &in, CmpiArgs &out)
+{
+ CmpiStatus st(CMPI_RC_ERR_NOT_SUPPORTED);
+ _CMPIZYPP_TRACE(1,("--- %s CMPI provideAnswer() called.",_ClassName));
+
+
+ _CMPIZYPP_TRACE(1,("--- %s CMPI provideAnswer() exited.",_ClassName));
+ return st;
+}
+
+} // namespace cmpizypp
+
+CMProviderBase( SUSE_SoftwareInstallationJobProvider );
+
+CMInstanceMIFactory( cmpizypp::SUSE_SoftwareInstallationJobProviderClass, SUSE_SoftwareInstallationJobProvider );
+CMMethodMIFactory( cmpizypp::SUSE_SoftwareInstallationJobProviderClass, SUSE_SoftwareInstallationJobProvider );
diff --git a/src/SUSE_SoftwareInstallationJobProvider.h b/src/SUSE_SoftwareInstallationJobProvider.h
new file mode 100644
index 0000000..b006597
--- /dev/null
+++ b/src/SUSE_SoftwareInstallationJobProvider.h
@@ -0,0 +1,31 @@
+#ifndef SUSE_SOFTWAREINSTALLATIONJOBPROVIDER_H
+#define SUSE_SOFTWAREINSTALLATIONJOBPROVIDER_H
+
+#include
+#include
+
+namespace cmpizypp
+{
+ /**
+ */
+ class SUSE_SoftwareInstallationJobProviderClass : public CmpiInstanceMI, public CmpiMethodMI
+ {
+ public:
+ SUSE_SoftwareInstallationJobProviderClass( 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 );
+
+ virtual CmpiStatus invokeMethod (const CmpiContext &ctx, CmpiResult &rslt,
+ const CmpiObjectPath &ref, const char *methodName,
+ const CmpiArgs &in, CmpiArgs &out);
+
+ private:
+ CmpiStatus provideAnswer(const CmpiContext &ctx, CmpiResult &rslt,
+ const CmpiObjectPath &ref, const CmpiArgs &in, CmpiArgs &out);
+ };
+
+} // namespace cmpizypp
+
+#endif // SUSE_SOFTWAREINSTALLATIONJOBPROVIDER_H
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org