version 1.5, 2003/12/02 23:16:42
|
version 1.5.6.3, 2004/04/02 11:02:44
|
|
|
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#define CMPI_VER_86 1 |
#include "CMPI_Version.h" |
| |
#include "CMPI_Broker.h" | #include "CMPI_Broker.h" |
#include "CMPI_Object.h" | #include "CMPI_Object.h" |
|
|
#include "CMPI_Enumeration.h" | #include "CMPI_Enumeration.h" |
#include "CMPI_Value.h" | #include "CMPI_Value.h" |
#include "CMPIProviderManager.h" | #include "CMPIProviderManager.h" |
|
#include "CMPI_String.h" |
| |
#include <Pegasus/Common/CIMName.h> | #include <Pegasus/Common/CIMName.h> |
#include <Pegasus/Common/CIMPropertyList.h> | #include <Pegasus/Common/CIMPropertyList.h> |
|
|
CM_IncludeQualifiers(flgs), | CM_IncludeQualifiers(flgs), |
CM_ClassOrigin(flgs), | CM_ClassOrigin(flgs), |
*props); | *props); |
|
if (ci.getPath().getKeyBindings().size()==0) |
|
ci.setPath(qop); |
delete props; | delete props; |
if (rc) CMSetStatus(rc,CMPI_RC_OK); | if (rc) CMSetStatus(rc,CMPI_RC_OK); |
return (CMPIInstance*)new CMPI_Object(new CIMInstance(ci)); | return (CMPIInstance*)new CMPI_Object(new CIMInstance(ci)); |
} | } |
catch (CIMException &e) { | catch (CIMException &e) { |
DDD(cout<<"### exception: mbGetInstance - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); | DDD(cout<<"### exception: mbGetInstance - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); |
if (rc) CMSetStatus(rc,(CMPIrc)e.getCode()); |
if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), |
|
(CMPIString*)string2CMPIString(e.getMessage())); |
|
delete props; |
|
return NULL; |
} | } |
|
if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-0"); |
delete props; | delete props; |
return NULL; | return NULL; |
} | } |
|
|
} | } |
catch (CIMException &e) { | catch (CIMException &e) { |
DDD(cout<<"### exception: mbCreateInstance - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); | DDD(cout<<"### exception: mbCreateInstance - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); |
if (rc) CMSetStatus(rc,(CMPIrc)e.getCode()); |
if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), |
|
(CMPIString*)string2CMPIString(e.getMessage())); |
|
return NULL; |
} | } |
if (rc) CMSetStatus(rc,CMPI_RC_ERROR); |
if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-1"); |
return NULL; | return NULL; |
} | } |
| |
|
|
} | } |
catch (CIMException &e) { | catch (CIMException &e) { |
DDD(cout<<"### exception: mbSetInstance - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); | DDD(cout<<"### exception: mbSetInstance - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); |
CMReturn((CMPIrc)e.getCode()); |
CMReturnWithString((CMPIrc)e.getCode(), |
|
(CMPIString*)string2CMPIString(e.getMessage())); |
} | } |
CMReturn(CMPI_RC_ERR_FAILED); |
CMReturnWithChars(mb,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-2"); |
} | } |
| |
static CMPIStatus mbDeleteInstance (CMPIBroker *mb, CMPIContext *ctx, | static CMPIStatus mbDeleteInstance (CMPIBroker *mb, CMPIContext *ctx, |
|
|
} | } |
catch (CIMException &e) { | catch (CIMException &e) { |
DDD(cout<<"### exception: mbDeleteInstance - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); | DDD(cout<<"### exception: mbDeleteInstance - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); |
CMReturn((CMPIrc)e.getCode()); |
CMReturnWithString((CMPIrc)e.getCode(), |
|
(CMPIString*)string2CMPIString(e.getMessage())); |
} | } |
CMReturn(CMPI_RC_ERROR); |
CMReturnWithChars(mb,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-3"); |
} | } |
| |
static CMPIEnumeration* mbExecQuery(CMPIBroker *mb, CMPIContext *ctx, | static CMPIEnumeration* mbExecQuery(CMPIBroker *mb, CMPIContext *ctx, |
CMPIObjectPath *cop, char *query, char *lang, CMPIStatus *rc) { |
CMPIObjectPath *cop, const char *query, const char *lang, CMPIStatus *rc) { |
DDD(cout<<"--- mbExecQuery()"<<endl); | DDD(cout<<"--- mbExecQuery()"<<endl); |
| |
AutoMutex mtx(((CMPI_Broker*)mb)->mtx); | AutoMutex mtx(((CMPI_Broker*)mb)->mtx); |
|
|
} | } |
catch (CIMException &e) { | catch (CIMException &e) { |
DDD(cout<<"### exception: mbExecQuery - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); | DDD(cout<<"### exception: mbExecQuery - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); |
if (rc) CMSetStatus(rc,(CMPIrc)e.getCode()); |
if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), |
|
(CMPIString*)string2CMPIString(e.getMessage())); |
} | } |
if (rc) CMSetStatus(rc,CMPI_RC_ERR_FAILED); |
if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERR_FAILED,"Internal error - CMPIBoker.cpp-4"); |
return NULL; | return NULL; |
} | } |
| |
|
|
} | } |
catch (CIMException &e) { | catch (CIMException &e) { |
DDD(cout<<"### exception: mbEnumInstances - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); | DDD(cout<<"### exception: mbEnumInstances - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); |
if (rc) CMSetStatus(rc,(CMPIrc)e.getCode()); |
if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), |
|
(CMPIString*)string2CMPIString(e.getMessage())); |
|
delete props; |
|
return NULL; |
} | } |
if (rc) CMSetStatus(rc,CMPI_RC_ERR_FAILED); |
if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-5"); |
delete props; | delete props; |
return NULL; | return NULL; |
} | } |
|
|
} | } |
catch (CIMException &e) { | catch (CIMException &e) { |
DDD(cout<<"### exception: mbEnumInstances - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); | DDD(cout<<"### exception: mbEnumInstances - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); |
if (rc) CMSetStatus(rc,(CMPIrc)e.getCode()); |
if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), |
|
(CMPIString*)string2CMPIString(e.getMessage())); |
} | } |
if (rc) CMSetStatus(rc,CMPI_RC_ERR_FAILED); |
if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-6"); |
return NULL; | return NULL; |
} | } |
| |
static CMPIEnumeration* mbAssociators(CMPIBroker *mb, CMPIContext *ctx, | static CMPIEnumeration* mbAssociators(CMPIBroker *mb, CMPIContext *ctx, |
CMPIObjectPath *cop, char *assocClass, char *resultClass, |
CMPIObjectPath *cop, const char *assocClass, const char *resultClass, |
char *role, char *resultRole, char **properties, CMPIStatus *rc) { |
const char *role, const char *resultRole, char **properties, CMPIStatus *rc) { |
DDD(cout<<"--- mbAssociators()"<<endl); | DDD(cout<<"--- mbAssociators()"<<endl); |
CMPIFlags flgs=ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32; | CMPIFlags flgs=ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32; |
CIMPropertyList *props=getList(properties); | CIMPropertyList *props=getList(properties); |
|
|
} | } |
catch (CIMException &e) { | catch (CIMException &e) { |
DDD(cout<<"### exception: mbAssociators - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); | DDD(cout<<"### exception: mbAssociators - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); |
if (rc) CMSetStatus(rc,(CMPIrc)e.getCode()); |
if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), |
|
(CMPIString*)string2CMPIString(e.getMessage())); |
|
delete props; |
|
return NULL; |
} | } |
if (rc) CMSetStatus(rc,CMPI_RC_ERR_FAILED); |
if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-7"); |
delete props; | delete props; |
return NULL; | return NULL; |
} | } |
| |
static CMPIEnumeration* mbAssociatorNames(CMPIBroker *mb, CMPIContext *ctx, | static CMPIEnumeration* mbAssociatorNames(CMPIBroker *mb, CMPIContext *ctx, |
CMPIObjectPath *cop, char *assocClass, char *resultClass, |
CMPIObjectPath *cop, const char *assocClass, const char *resultClass, |
char *role, char *resultRole, CMPIStatus *rc) { |
const char *role, const char *resultRole, CMPIStatus *rc) { |
DDD(cout<<"--- mbAssociatorsNames()"<<endl); | DDD(cout<<"--- mbAssociatorsNames()"<<endl); |
CIMObjectPath qop(String::EMPTY,CIMNamespaceName(), | CIMObjectPath qop(String::EMPTY,CIMNamespaceName(), |
CM_ObjectPath(cop)->getClassName(), | CM_ObjectPath(cop)->getClassName(), |
|
|
} | } |
catch (CIMException &e) { | catch (CIMException &e) { |
DDD(cout<<"### exception: mbAssociatorsNames - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); | DDD(cout<<"### exception: mbAssociatorsNames - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); |
if (rc) CMSetStatus(rc,(CMPIrc)e.getCode()); |
if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), |
|
(CMPIString*)string2CMPIString(e.getMessage())); |
} | } |
if (rc) CMSetStatus(rc,CMPI_RC_ERR_FAILED); |
if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-8"); |
return NULL; | return NULL; |
} | } |
| |
static CMPIEnumeration* mbReferences(CMPIBroker *mb, CMPIContext *ctx, | static CMPIEnumeration* mbReferences(CMPIBroker *mb, CMPIContext *ctx, |
CMPIObjectPath *cop, char *resultClass, char *role , |
CMPIObjectPath *cop, const char *resultClass, const char *role , |
char **properties, CMPIStatus *rc) { | char **properties, CMPIStatus *rc) { |
DDD(cout<<"--- mbReferences()"<<endl); | DDD(cout<<"--- mbReferences()"<<endl); |
CMPIFlags flgs=ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32; | CMPIFlags flgs=ctx->ft->getEntry(ctx,CMPIInvocationFlags,NULL).value.uint32; |
|
|
} | } |
catch (CIMException &e) { | catch (CIMException &e) { |
DDD(cout<<"### exception: mbReferences - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); | DDD(cout<<"### exception: mbReferences - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); |
if (rc) CMSetStatus(rc,(CMPIrc)e.getCode()); |
if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), |
|
(CMPIString*)string2CMPIString(e.getMessage())); |
|
delete props; |
|
return NULL; |
} | } |
if (rc) CMSetStatus(rc,CMPI_RC_ERR_FAILED); |
if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-10"); |
delete props; | delete props; |
return NULL; | return NULL; |
} | } |
| |
static CMPIEnumeration* mbReferenceNames(CMPIBroker *mb, CMPIContext *ctx, | static CMPIEnumeration* mbReferenceNames(CMPIBroker *mb, CMPIContext *ctx, |
CMPIObjectPath *cop, char *resultClass, char *role, |
CMPIObjectPath *cop, const char *resultClass, const char *role, |
CMPIStatus *rc) { | CMPIStatus *rc) { |
DDD(cout<<"--- mbReferencesNames()"<<endl); | DDD(cout<<"--- mbReferencesNames()"<<endl); |
CIMObjectPath qop(String::EMPTY,CIMNamespaceName(), | CIMObjectPath qop(String::EMPTY,CIMNamespaceName(), |
|
|
} | } |
catch (CIMException &e) { | catch (CIMException &e) { |
DDD(cout<<"### exception: mbReferencesNames - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); | DDD(cout<<"### exception: mbReferencesNames - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); |
if (rc) CMSetStatus(rc,(CMPIrc)e.getCode()); |
if (rc) CMSetStatusWithString(rc,(CMPIrc)e.getCode(), |
|
(CMPIString*)string2CMPIString(e.getMessage())); |
} | } |
if (rc) CMSetStatus(rc,CMPI_RC_ERR_FAILED); |
if (rc) CMSetStatusWithChars(mb,rc,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-11"); |
return NULL; | return NULL; |
} | } |
| |
static CMPIData mbInvokeMethod(CMPIBroker *mb, CMPIContext *ctx, | static CMPIData mbInvokeMethod(CMPIBroker *mb, CMPIContext *ctx, |
CMPIObjectPath *cop, char *method, CMPIArgs *in, CMPIArgs *out, |
CMPIObjectPath *cop, const char *method, CMPIArgs *in, CMPIArgs *out, |
CMPIStatus *rc) { | CMPIStatus *rc) { |
CMPIData data={0,0,{0}}; | CMPIData data={0,0,{0}}; |
if (rc) CMSetStatus(rc,CMPI_RC_ERR_NOT_SUPPORTED); | if (rc) CMSetStatus(rc,CMPI_RC_ERR_NOT_SUPPORTED); |
|
|
} | } |
| |
static CMPIStatus mbSetProperty(CMPIBroker *mb, CMPIContext *ctx, | static CMPIStatus mbSetProperty(CMPIBroker *mb, CMPIContext *ctx, |
CMPIObjectPath *cop, char *name, CMPIValue *val, |
CMPIObjectPath *cop, const char *name, CMPIValue *val, |
CMPIType type) { | CMPIType type) { |
DDD(cout<<"--- mbSetProperty()"<<endl); | DDD(cout<<"--- mbSetProperty()"<<endl); |
CMPIrc rc; | CMPIrc rc; |
|
|
} | } |
catch (CIMException &e) { | catch (CIMException &e) { |
DDD(cout<<"### exception: mbSetProperty - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); | DDD(cout<<"### exception: mbSetProperty - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); |
CMReturn((CMPIrc)e.getCode()); |
CMReturnWithString((CMPIrc)e.getCode(), |
|
(CMPIString*)string2CMPIString(e.getMessage())); |
} | } |
CMReturn(CMPI_RC_ERR_FAILED); |
CMReturnWithChars(mb,CMPI_RC_ERROR,"Internal error - CMPIBoker.cpp-12"); |
} | } |
| |
static CMPIData mbGetProperty(CMPIBroker *mb, CMPIContext *ctx, | static CMPIData mbGetProperty(CMPIBroker *mb, CMPIContext *ctx, |
CMPIObjectPath *cop,char *name, CMPIStatus *rc) { |
CMPIObjectPath *cop, const char *name, CMPIStatus *rc) { |
DDD(cout<<"--- mbGetProperty()"<<endl); | DDD(cout<<"--- mbGetProperty()"<<endl); |
CMPIData data={0,0,{0}}; | CMPIData data={0,0,{0}}; |
| |
|
|
CMReturn(CMPI_RC_OK); | CMReturn(CMPI_RC_OK); |
} | } |
| |
static CMPIStatus mbDeliverIndication(CMPIBroker* eMb, CMPIContext* eCtx, |
static CMPIStatus mbDeliverIndication(CMPIBroker* eMb, CMPIContext* ctx, |
char* ns, CMPIInstance* ind) { |
const char *ns, CMPIInstance* ind) { |
DDD(cout<<"--- mbDeliverIndication()"<<endl); | DDD(cout<<"--- mbDeliverIndication()"<<endl); |
CMPI_Broker *mb=(CMPI_Broker*)eMb; | CMPI_Broker *mb=(CMPI_Broker*)eMb; |
CMPIProviderManager::indProvRecord *prec; | CMPIProviderManager::indProvRecord *prec; |
|
OperationContext* context=CM_Context(ctx); |
| |
if (CMPIProviderManager::provTab.lookup(mb->name,prec)) { | if (CMPIProviderManager::provTab.lookup(mb->name,prec)) { |
if (prec->enabled) { | if (prec->enabled) { |
|
try { |
|
context->get(SubscriptionInstanceNamesContainer::NAME); |
|
} |
|
catch (Exception& e) { |
|
Array<CIMObjectPath> subscriptionInstanceNames; |
|
context->insert(SubscriptionInstanceNamesContainer(subscriptionInstanceNames)); |
|
} |
CIMIndication cimIndication(*CM_Instance(ind)); | CIMIndication cimIndication(*CM_Instance(ind)); |
prec->handler->deliver(cimIndication); |
AutoMutex mtx(((CMPI_Broker*)mb)->mtx); |
|
try { |
|
prec->handler->deliver( |
|
*context, |
|
// OperationContext(*CM_Context(ctx)), |
|
cimIndication); |
CMReturn(CMPI_RC_OK); | CMReturn(CMPI_RC_OK); |
} | } |
|
catch (CIMException &e) { |
|
DDD(cout<<"### exception: mbSetProperty - code: "<<e.getCode()<<" msg: "<<e.getMessage()<<endl); |
|
CMReturn((CMPIrc)e.getCode()); |
|
} |
|
} |
} | } |
CMReturn(CMPI_RC_ERR_FAILED); | CMReturn(CMPI_RC_ERR_FAILED); |
} | } |