version 1.28.4.3, 2009/09/24 13:33:48
|
version 1.28.4.4, 2009/10/01 09:33:41
|
|
|
#include "CMPI_Ftabs.h" | #include "CMPI_Ftabs.h" |
#include "CMPI_Value.h" | #include "CMPI_Value.h" |
#include "CMPI_String.h" | #include "CMPI_String.h" |
|
#include "CMPI_Broker.h" |
#include "CMPISCMOUtilities.h" | #include "CMPISCMOUtilities.h" |
#include <Pegasus/Common/Tracer.h> | #include <Pegasus/Common/Tracer.h> |
| |
|
|
static CMPIStatus refRelease(CMPIObjectPath* eRef) | static CMPIStatus refRelease(CMPIObjectPath* eRef) |
{ | { |
SCMOInstance* ref = (SCMOInstance*)eRef->hdl; | SCMOInstance* ref = (SCMOInstance*)eRef->hdl; |
//fprintf(stderr, "refRelease(%p)\n",ref); |
|
if (ref) | if (ref) |
{ | { |
delete ref; | delete ref; |
|
|
CMReturn(CMPI_RC_ERR_INVALID_PARAMETER); | CMReturn(CMPI_RC_ERR_INVALID_PARAMETER); |
} | } |
| |
// --rk-->TBD: Implement this |
|
/*const char* prevNamespace = ref->getNameSpace(); |
|
const char* className = ref->getClassName(); |
|
| |
if (prevNamespace && |
// Check if the namespace is at all different from the one already set |
0==strcasecmp(prevNamespace,ns) |
const char* prevNamespace = ref->getNameSpace(); |
|
if (prevNamespace && 0==strcasecmp(prevNamespace,ns)) |
{ | { |
|
CMReturn(CMPI_RC_OK); |
} | } |
| |
|
// If we got here, we need to create a new objectpath to accomodate |
|
// the different namespace. |
|
// This whole processing seems a bit overkill |
|
// --> Alternate design would be to implement CMPIObjectPath via a |
|
// separate encapsulation object. |
|
const char* cls = ref->getClassName(); |
|
SCMOClass* scmoClass = mbGetSCMOClass(0, ns, cls); |
|
if (0 == scmoClass) |
|
{ |
|
PEG_TRACE(( |
|
TRC_CMPIPROVIDERINTERFACE, |
|
Tracer::LEVEL1, |
|
"Class %s does not exist in namespace %s", |
|
cls,ns)); |
|
CMReturn(CMPI_RC_ERR_INVALID_PARAMETER); |
|
} |
|
|
|
// TBD: Need a new copy constructor here, that lets me create an |
|
// instance from an existing one with a new class. |
|
SCMOInstance* scmoInst = new SCMOInstance(*scmoClass/*ref*/); |
|
|
|
delete(ref); |
|
eRef->hdl = scmoInst; |
| |
ref->setNameSpace(String(ns));*/ |
|
CMReturn(CMPI_RC_OK); | CMReturn(CMPI_RC_OK); |
} | } |
| |
|
|
CMPIObjectPath:refSetClassName", cn)); | CMPIObjectPath:refSetClassName", cn)); |
CMReturn(CMPI_RC_ERR_INVALID_PARAMETER); | CMReturn(CMPI_RC_ERR_INVALID_PARAMETER); |
} | } |
// --rk-->TBD: Implement this |
|
//ref->setClassName(String(cn)); |
// Check if the classname is at all different from the one already set |
|
const char* prevCls = ref->getClassName(); |
|
if (prevCls && 0==strcasecmp(prevCls,cn)) |
|
{ |
|
CMReturn(CMPI_RC_OK); |
|
} |
|
|
|
// If we got here, we need to create a new objectpath to accomodate |
|
// the different namespace. |
|
// This whole processing seems a bit overkill |
|
// --> Alternate design would be to implement CMPIObjectPath via a |
|
// separate encapsulation object. |
|
const char* ns = ref->getNameSpace(); |
|
SCMOClass* scmoClass = mbGetSCMOClass(0, ns, cn); |
|
if (0 == scmoClass) |
|
{ |
|
PEG_TRACE(( |
|
TRC_CMPIPROVIDERINTERFACE, |
|
Tracer::LEVEL1, |
|
"Class %s does not exist in namespace %s", |
|
cn,ns)); |
|
CMReturn(CMPI_RC_ERR_INVALID_PARAMETER); |
|
} |
|
|
|
// TBD: Need a new copy constructor here, that lets me create an |
|
// instance from an existing one with a new class. |
|
SCMOInstance* scmoInst = new SCMOInstance(*scmoClass/*ref*/); |
|
|
|
delete(ref); |
|
eRef->hdl = scmoInst; |
|
|
CMReturn(CMPI_RC_OK); | CMReturn(CMPI_RC_OK); |
} | } |
| |
|
|
CMPIObjectPath* eRef, | CMPIObjectPath* eRef, |
const CMPIObjectPath* eSrc) | const CMPIObjectPath* eSrc) |
{ | { |
CIMObjectPath* ref = (CIMObjectPath*)eRef->hdl; |
SCMOInstance* src = (SCMOInstance*)eSrc->hdl; |
CIMObjectPath* src = (CIMObjectPath*)eSrc->hdl; |
if (!src) |
if (!ref || !src) |
|
{ | { |
PEG_TRACE_CSTRING( | PEG_TRACE_CSTRING( |
TRC_CMPIPROVIDERINTERFACE, | TRC_CMPIPROVIDERINTERFACE, |
|
|
CMPIObjectPath:refSetNameSpaceFromObjectPath"); | CMPIObjectPath:refSetNameSpaceFromObjectPath"); |
CMReturn(CMPI_RC_ERR_INVALID_HANDLE); | CMReturn(CMPI_RC_ERR_INVALID_HANDLE); |
} | } |
ref->setNameSpace(src->getNameSpace()); |
// Warning, this call will replace eRef->hdl |
CMReturn(CMPI_RC_OK); |
return refSetNameSpace(eRef, |
|
src->getNameSpace()); |
} | } |
| |
static CMPIStatus refSetHostAndNameSpaceFromObjectPath( | static CMPIStatus refSetHostAndNameSpaceFromObjectPath( |
CMPIObjectPath* eRef, | CMPIObjectPath* eRef, |
const CMPIObjectPath* eSrc) | const CMPIObjectPath* eSrc) |
{ | { |
CIMObjectPath* ref = (CIMObjectPath*)eRef->hdl; |
SCMOInstance* src = (SCMOInstance*)eSrc->hdl; |
CIMObjectPath* src = (CIMObjectPath*)eSrc->hdl; |
if (!src) |
if (!ref || !src) |
|
{ | { |
PEG_TRACE_CSTRING( | PEG_TRACE_CSTRING( |
TRC_CMPIPROVIDERINTERFACE, | TRC_CMPIPROVIDERINTERFACE, |
|
|
CMPIObjectPath:refSetHostAndNameSpaceFromObjectPath"); | CMPIObjectPath:refSetHostAndNameSpaceFromObjectPath"); |
CMReturn(CMPI_RC_ERR_INVALID_HANDLE); | CMReturn(CMPI_RC_ERR_INVALID_HANDLE); |
} | } |
ref->setNameSpace(src->getNameSpace()); |
|
ref->setHost(src->getHost()); |
// Warning, this call will replace eRef->hdl |
|
CMPIStatus rc = refSetNameSpace(eRef, |
|
src->getNameSpace()); |
|
|
|
if (rc.rc != CMPI_RC_OK) |
|
{ |
|
return rc; |
|
} |
|
|
|
SCMOInstance* ref = (SCMOInstance*)eRef->hdl; |
|
if (ref) |
|
{ |
|
ref->setHostName(src->getHostName()); |
|
} |
|
|
CMReturn(CMPI_RC_OK); | CMReturn(CMPI_RC_OK); |
} | } |
| |