version 1.56.4.3, 2013/06/03 22:36:18
|
version 1.57, 2011/01/25 11:24:27
|
|
|
#include <string.h> | #include <string.h> |
#include <new> | #include <new> |
#include <Pegasus/Common/Tracer.h> | #include <Pegasus/Common/Tracer.h> |
|
#include <Pegasus/Common/SCMODump.h> |
| |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
case SCMO_OK: | case SCMO_OK: |
{ | { |
CMPIType ct=type2CMPIType(type, isArray); | CMPIType ct=type2CMPIType(type, isArray); |
CMPISCMOUtilities::scmoValue2CMPIData(value, ct, &data, size); |
CMPISCMOUtilities::scmoValue2CMPIData( value, ct, &data ); |
if ((ct&~CMPI_ARRAY) == CMPI_string) | if ((ct&~CMPI_ARRAY) == CMPI_string) |
{ | { |
// We always receive strings as an array of pointers | // We always receive strings as an array of pointers |
|
|
CMSetStatus(rc, CMPI_RC_ERR_NO_SUCH_PROPERTY); | CMSetStatus(rc, CMPI_RC_ERR_NO_SUCH_PROPERTY); |
CMPIData rdata={0,CMPI_nullValue|CMPI_notFound,{0}}; | CMPIData rdata={0,CMPI_nullValue|CMPI_notFound,{0}}; |
return rdata; | return rdata; |
|
break; |
} | } |
| |
case SCMO_NULL_VALUE: | case SCMO_NULL_VALUE: |
|
|
{ | { |
case SCMO_NOT_FOUND: | case SCMO_NOT_FOUND: |
{ | { |
data.state = CMPI_nullValue | CMPI_notFound; |
|
CMSetStatus(rc, CMPI_RC_ERR_NO_SUCH_PROPERTY); | CMSetStatus(rc, CMPI_RC_ERR_NO_SUCH_PROPERTY); |
return data; | return data; |
} | } |
|
|
{ | { |
// A NullValue does not indicate an error, but simply that | // A NullValue does not indicate an error, but simply that |
// no value has been set for the property. | // no value has been set for the property. |
|
|
|
// TBD: Though the CMPI specification mandates to return a |
|
// nullvalue when a property exists on an instance but has |
|
// not yet been assigned a value, for compatibility with |
|
// previous versions we return CMPI_RC_ERR_NO_SUCH_PROPERTY |
|
// in this case. |
|
// If SCMO would distinguish between nullvalues and values |
|
// that have not been set at all on an instance, we could |
|
// be more precise here. |
|
/* |
|
// Correct code for nullvalues |
data.type = type2CMPIType(type, isArray); | data.type = type2CMPIType(type, isArray); |
data.value.uint64 = 0; |
|
data.state = CMPI_nullValue; | data.state = CMPI_nullValue; |
CMSetStatus(rc, CMPI_RC_OK); |
data.value.uint64 = 0; |
|
*/ |
|
// Code for properties that have not been set |
|
CMSetStatus(rc, CMPI_RC_ERR_NO_SUCH_PROPERTY); |
return data; | return data; |
|
|
} | } |
break; | break; |
| |
|
|
if (!(type&CMPI_ARRAY)) | if (!(type&CMPI_ARRAY)) |
{ | { |
CIMType cimType=type2CIMType(type); | CIMType cimType=type2CIMType(type); |
Boolean nullValue = false; |
SCMBUnion scmoData = value2SCMOValue(data, type); |
SCMBUnion scmoData = value2SCMOValue(data, type, nullValue); |
|
| |
rc = inst->setPropertyWithOrigin(name, | rc = inst->setPropertyWithOrigin(name, |
cimType, | cimType, |
nullValue ? 0 : &scmoData, |
&scmoData, |
false, // isArray | false, // isArray |
0, // arraySize | 0, // arraySize |
origin); | origin); |
|
|
{ | { |
scmbArray=&(scmbArrayBuf[0]); | scmbArray=&(scmbArrayBuf[0]); |
} | } |
Boolean nullValue = false; |
|
for (unsigned int x=0; x<arraySize; x++) | for (unsigned int x=0; x<arraySize; x++) |
{ | { |
// Note: First element is the array status information, | // Note: First element is the array status information, |
// therefore cmpi array starts at index 1!!! | // therefore cmpi array starts at index 1!!! |
scmbArray[x] = value2SCMOValue( | scmbArray[x] = value2SCMOValue( |
&(arrData[x+1].value), | &(arrData[x+1].value), |
arrData[x+1].type, |
arrData[x+1].type); |
nullValue); |
|
} | } |
| |
rc = inst->setPropertyWithOrigin( | rc = inst->setPropertyWithOrigin( |
|
|
if (rc != SCMO_OK) | if (rc != SCMO_OK) |
{ | { |
PEG_TRACE((TRC_CMPIPROVIDERINTERFACE,Tracer::LEVEL3, | PEG_TRACE((TRC_CMPIPROVIDERINTERFACE,Tracer::LEVEL3, |
"Property %s not set on created instance. SCMO_RC=%d", |
"Property %s not set on created instance." |
|
"Either the property is not part of the class or" |
|
"not part of the property list. SCMO_RC=%d", |
name, | name, |
rc)); | rc)); |
| |
|
|
cmpiRC.rc = CMPI_RC_ERR_INVALID_PARAMETER; | cmpiRC.rc = CMPI_RC_ERR_INVALID_PARAMETER; |
break; | break; |
case SCMO_NOT_FOUND: | case SCMO_NOT_FOUND: |
{ |
//TBD: Should return an error here, but previous impl. |
// Logical would be to return an error here, but previous |
// returned OK. Is this correct? |
// impl. returned OK since CMPI spec. is not specific about |
//cmpiRC.rc = CMPI_RC_ERR_NO_SUCH_PROPERTY; |
// this. Should become CMPI_RC_ERR_NO_SUCH_PROPERTY in |
|
// CMPI 2.1 or 3.0 |
|
cmpiRC.rc = CMPI_RC_OK; | cmpiRC.rc = CMPI_RC_OK; |
|
|
// Writing a message to log since provider tries to set a |
|
// non-existing property |
|
Logger::put_l( |
|
Logger::ERROR_LOG, |
|
System::CIMSERVER, |
|
Logger::WARNING, |
|
MessageLoaderParms( |
|
"ProviderManager.CMPI.CMPI_Instance." |
|
"NO_SUCH_PROPERTY", |
|
"Property $0 not set on the created instance of " |
|
"class $1", |
|
name, |
|
inst->getClassName())); |
|
break; | break; |
} |
|
case SCMO_WRONG_TYPE: | case SCMO_WRONG_TYPE: |
case SCMO_NOT_AN_ARRAY: | case SCMO_NOT_AN_ARRAY: |
case SCMO_IS_AN_ARRAY: | case SCMO_IS_AN_ARRAY: |
|
|
static CMPIStatus instSetPropertyFilter(CMPIInstance* eInst, | static CMPIStatus instSetPropertyFilter(CMPIInstance* eInst, |
const char** propertyList, const char **keys) | const char** propertyList, const char **keys) |
{ | { |
PEG_METHOD_ENTER( |
|
TRC_CMPIPROVIDERINTERFACE, |
|
"CMPI_Instance:instSetPropertyFilter()"); |
|
|
|
SCMOInstance* inst=(SCMOInstance*)eInst->hdl; |
|
|
|
PEG_METHOD_EXIT(); |
|
if (inst==NULL) |
|
{ |
|
CMReturn(CMPI_RC_ERR_INVALID_HANDLE); |
|
} |
|
//Property filtering is done by the CIMOM infrastructure. | //Property filtering is done by the CIMOM infrastructure. |
CMReturn(CMPI_RC_OK); | CMReturn(CMPI_RC_OK); |
} | } |