本文整理汇总了C++中CMNewObjectPath函数的典型用法代码示例。如果您正苦于以下问题:C++ CMNewObjectPath函数的具体用法?C++ CMNewObjectPath怎么用?C++ CMNewObjectPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CMNewObjectPath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IndCIMXMLHandlerEnumInstanceNames
CMPIStatus IndCIMXMLHandlerEnumInstanceNames(CMPIInstanceMI * mi,
const CMPIContext * ctx,
const CMPIResult * rslt,
const CMPIObjectPath * ref)
{
CMPIStatus st;
CMPIEnumeration *enm;
CMPIContext *ctxLocal;
_SFCB_ENTER(TRACE_INDPROVIDER, "IndCIMXMLHandlerEnumInstanceNames");
if (interOpNameSpace(ref,&st)!=1) _SFCB_RETURN(st);
ctxLocal = prepareUpcall((CMPIContext *)ctx);
#ifdef HAVE_OPTIMIZED_ENUMERATION
CMPIString* cn;
CMPIObjectPath* refLocal;
cn = CMGetClassName(ref, &st);
if (strcasecmp(CMGetCharPtr(cn), "cim_listenerdestination") == 0) {
enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, ref, &st);
while(enm && enm->ft->hasNext(enm, &st)) {
CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref);
}
refLocal = CMNewObjectPath(_broker,"root/interop","cim_listenerdestinationcimxml",&st);
enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, refLocal, &st);
while(enm && enm->ft->hasNext(enm, &st)) {
CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref);
}
refLocal = CMNewObjectPath(_broker,"root/interop","cim_indicationhandlercimxml",&st);
enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, refLocal, &st);
while(enm && enm->ft->hasNext(enm, &st)) {
CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref);
}
CMRelease(refLocal);
}
else {
enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, ref, &st);
while(enm && enm->ft->hasNext(enm, &st)) {
CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref);
}
}
#else
enm = _broker->bft->enumerateInstanceNames(_broker, ctxLocal, ref, &st);
while(enm && enm->ft->hasNext(enm, &st)) {
CMReturnObjectPath(rslt, (enm->ft->getNext(enm, &st)).value.ref);
}
#endif
CMRelease(ctxLocal);
if(enm) CMRelease(enm);
_SFCB_RETURN(st);
}
示例2: get_assoc_targetClass_ObjectPath
CMPIObjectPath *
get_assoc_targetClass_ObjectPath(const CMPIBroker * broker,
const CMPIObjectPath * ref,
const char *_RefLeftClass,
const char *_RefRightClass,
CMPIStatus *rc)
{
CMPIObjectPath *op = NULL;
const char *targetName = NULL;
/*
* get name of the target class
*/
targetName = get_assoc_targetClass_Name(broker,
ref,
_RefLeftClass,
_RefRightClass, rc);
if (targetName != NULL) {
/*
* create new object path of the target class
*/
op = CMNewObjectPath(broker,
CMGetCharsPtr(CMGetNameSpace(ref, rc), NULL),
targetName, rc);
}
return op;
}
示例3: _makeInst_ServiceProcess
CMPIInstance * _makeInst_ServiceProcess( const CMPIBroker * _broker,
const CMPIObjectPath * service,
CMPIObjectPath * process,
CMPIStatus * rc) {
CMPIObjectPath * op = NULL;
CMPIInstance * ci = NULL;
_OSBASE_TRACE(4,("--- _makeInst_ServiceProcess() called"));
/* create CMPIObjectPath of this association <_ClassName> */
op = CMNewObjectPath( _broker, CMGetCharPtr(CMGetNameSpace(service,rc)),
_ClassName, rc );
if( CMIsNullObject(op) ) {
CMSetStatusWithChars( _broker, rc,
CMPI_RC_ERR_FAILED, "Create CMPIObjectPath failed." );
goto exit;
}
ci = CMNewInstance( _broker, op, rc);
if( CMIsNullObject(ci) ) {
CMSetStatusWithChars( _broker, rc,
CMPI_RC_ERR_FAILED, "Create CMPIInstance failed." );
_OSBASE_TRACE(4,("--- _makeInst_ServiceProcess() failed : %s",CMGetCharPtr(rc->msg)));
goto exit;
}
CMSetProperty( ci, _RefLeft, (CMPIValue*)&(service), CMPI_ref );
CMSetProperty( ci, _RefRight, (CMPIValue*)&(process), CMPI_ref );
exit:
_OSBASE_TRACE(4,("--- _makeInst_ServiceProcess() exited"));
return ci;
}
示例4: Linux_FanAssociatedSensorProviderAssociators
CMPIStatus Linux_FanAssociatedSensorProviderAssociators(
CMPIAssociationMI * mi,
const CMPIContext * ctx,
const CMPIResult * rslt,
const CMPIObjectPath * cop,
const char * assocClass,
const char * resultClass,
const char * role,
const char * resultRole,
const char ** propertyList)
{
UNUSED(mi); UNUSED(propertyList);
CMPIStatus rc = {CMPI_RC_OK, NULL};
CMPIObjectPath * op = NULL;
int refrc = 0;
_OSBASE_TRACE(1,("--- %s CMPI Associators() called",_ClassName));
if( assocClass ) {
op = CMNewObjectPath( _broker, CMGetCharPtr(CMGetNameSpace(cop,&rc)),
_ClassName, &rc );
if( op==NULL ) {
CMSetStatusWithChars( _broker, &rc,
CMPI_RC_ERR_FAILED, "Create CMPIObjectPath failed." );
_OSBASE_TRACE(2,
("--- %s CMPI Associators() failed : %s",CMGetCharPtr(rc.msg)));
return rc;
}
}
if ( (assocClass == NULL)
|| (CMClassPathIsA(_broker,op,assocClass,&rc) == 1))
{
if( _assoc_check_parameter_const( _broker,cop,_RefLeft,_RefRight,
_RefLeftClass,_RefRightClass,
resultClass,role,resultRole,
&rc ) == 0 ) { goto exit; }
refrc = _assoc_create_refs_1toN(_broker, ctx, rslt, cop,
_ClassName,_RefLeftClass,_RefRightClass,
_RefLeft,_RefRight,
1, 1, &rc);
if( refrc != 0 ) {
if( rc.msg != NULL ) {
_OSBASE_TRACE(1, ("--- %s CMPI Associators() failed : %s",
_ClassName,CMGetCharPtr(rc.msg)));
}
else {
_OSBASE_TRACE(1,("--- %s CMPI Associators() failed",_ClassName));
}
return rc;
}
}
exit:
CMReturnDone( rslt );
_OSBASE_TRACE(1,("--- %s CMPI Associators() exited",_ClassName));
CMReturn(CMPI_RC_OK);
}
示例5: get_assoc_targetClass_ObjectPath
CMPIObjectPath *
get_assoc_targetClass_ObjectPath(const CMPIBroker * broker,
const CMPIObjectPath * ref,
const char *_RefLeftClass,
const char *_RefRightClass,
CMPIStatus *rc)
{
CMPIObjectPath *op = NULL;
const char *targetName = NULL;
/*
* get name of the target class
*/
targetName = get_assoc_targetClass_Name(broker,
ref,
_RefLeftClass,
_RefRightClass, rc);
if (targetName != NULL) {
/*
* create new object path of the target class
*/
op = CMNewObjectPath(broker,
CMGetCharsPtr(CMGetNameSpace(ref, rc), NULL),
targetName, rc);
if (!op)
CMSetStatusWithChars(_broker, rc, CMPI_RC_ERR_FAILED,
"Create CMPIObjectPath failed in cmpiTestAssociationProvider");
}
return op;
}
示例6: dqRetry
int
dqRetry(CMPIContext * ctx, RTElement * cur)
{
_SFCB_ENTER(TRACE_INDPROVIDER, "dqRetry");
// Delete the instance in the repo
CMPIObjectPath * op=CMNewObjectPath(_broker,"root/interop","SFCB_IndicationElement",NULL);
CMAddKey(op,"IndicationID",&cur->instanceID,CMPI_uint32);
CBDeleteInstance(_broker,ctx,op);
CBDeleteInstance(_broker,ctx,cur->ind);
CMRelease(op);
// Remove the entry from the queue, closing the hole
if (cur->next == cur) {
// queue is empty
free(cur);
RQhead = NULL;
} else {
// not last
cur->prev->next = cur->next;
cur->next->prev = cur->prev;
CMRelease(cur->ref);
CMRelease(cur->sub);
if (cur)
free(cur);
}
_SFCB_RETURN(0);
}
示例7: get_assoc_targetClass_Name
const char *
get_assoc_targetClass_Name(const CMPIBroker * broker,
const CMPIObjectPath * ref,
const char *_RefLeftClass,
const char *_RefRightClass, CMPIStatus *rc)
{
CMPIString *sourceClass = NULL;
CMPIObjectPath *op = NULL;
/*
* get name of source class
*/
sourceClass = CMGetClassName(ref, rc);
op = CMNewObjectPath(broker,
CMGetCharsPtr(CMGetNameSpace(ref, rc), NULL),
_RefLeftClass, rc);
if (strcmp(CMGetCharsPtr(sourceClass, NULL), "CMPI_TEST_Person") == 0) {
return "CMPI_TEST_Vehicle";
} else if (strcmp(CMGetCharsPtr(sourceClass, NULL),
"CMPI_TEST_Vehicle") == 0) {
return "CMPI_TEST_Person";
} else {
return NULL;
}
}
示例8: IndCIMXMLHandlerDeleteInstance
CMPIStatus
IndCIMXMLHandlerDeleteInstance(CMPIInstanceMI * mi,
const CMPIContext *ctx,
const CMPIResult *rslt,
const CMPIObjectPath * cop)
{
CMPIStatus st = { CMPI_RC_OK, NULL };
CMPIArgs *in,
*out = NULL;
CMPIObjectPath *op;
CMPIData rv;
_SFCB_ENTER(TRACE_INDPROVIDER, "IndCIMXMLHandlerDeleteInstance");
if (interOpNameSpace(cop, &st) == 0)
_SFCB_RETURN(st);
internalProviderGetInstance(cop, &st);
if (st.rc)
_SFCB_RETURN(st);
in = CMNewArgs(_broker, NULL);
CMAddArg(in, "key", &cop, CMPI_ref);
op = CMNewObjectPath(_broker, "root/interop",
"cim_indicationsubscription", &st);
rv = CBInvokeMethod(_broker, ctx, op, "_removeHandler", in, out, &st);
if (st.rc == CMPI_RC_OK) {
st = InternalProviderDeleteInstance(NULL, ctx, rslt, cop);
}
_SFCB_RETURN(st);
}
示例9: generateIndication2
static void
generateIndication2(const char *methodname, const CMPIContext *ctx)
{
CMPIInstance *inst;
CMPIObjectPath *cop;
CMPIDateTime *dat;
CMPIArray *ar;
CMPIStatus rc;
char buffer[32];
if (enabled && activated2) {
cop = CMNewObjectPath(broker, "root/interop2", "Test_Indication", &rc);
inst = CMNewInstance(broker, cop, &rc);
sprintf(buffer, "%d", _nextUID++);
CMSetProperty(inst, "IndicationIdentifier", buffer, CMPI_chars);
dat = CMNewDateTime(broker, &rc);
CMSetProperty(inst, "IndicationTime", &dat, CMPI_dateTime);
CMSetProperty(inst, "MethodName", methodname, CMPI_chars);
ar = CMNewArray(broker, 0, CMPI_string, &rc);
CMSetProperty(inst, "CorrelatedIndications", &ar, CMPI_stringA);
rc = CBDeliverIndication(broker, ctx, "root/interop", inst);
if (rc.rc != CMPI_RC_OK) {
fprintf(stderr, "+++ Could not send the indication!\n");
}
gen2++;
}
fprintf(stderr, "+++ generateIndication2() done %d\n", gen2);
}
示例10: TestCMPIAssociationProviderAssociatorNames
CMPIStatus TestCMPIAssociationProviderAssociatorNames(
CMPIAssociationMI* mi,
const CMPIContext* ctx,
const CMPIResult* rslt,
const CMPIObjectPath* ref,
const char* _RefLeftClass,
const char* _RefRightClass,
const char* role,
const char* resultRole)
{
CMPIObjectPath* op = NULL;
CMPIObjectPath* rop = NULL;
CMPIEnumeration* en = NULL;
CMPIData data ;
CMPIStatus rc = { CMPI_RC_OK, NULL };
PROV_LOG_OPEN (_ClassName, _ProviderLocation);
PROV_LOG ("\n\n********************* %s CMPI AssociatorNames() called",
_ClassName);
/* get object path of the target class */
op = get_assoc_targetClass_ObjectPath(
_broker,
ref,
_RefLeftClass,
_RefRightClass,
&rc);
PROV_LOG (" New Object Path [%s]",
CMGetCharsPtr (CMGetNameSpace (ref, &rc),NULL));
/* create new object path of association */
rop = CMNewObjectPath(
_broker,
CMGetCharsPtr(CMGetNameSpace(ref,&rc),NULL),
_ClassName,
&rc );
/* upcall to CIMOM; call enumInstanceNames() of the target class */
en = CBEnumInstanceNames( _broker, ctx, op, &rc);
/* as long as object path entries are found in the enumeration */
while( CMHasNext( en, &rc) )
{
/* get the object path */
data = CMGetNext(en, &rc);
/* and return the target class object path as result of the
* associatorNames() call
*/
CMReturnObjectPath( rslt, data.value.ref );
}
PROV_LOG ("\n\n********************* %s CMPI AssociatorNames() exited",
_ClassName);
PROV_LOG_CLOSE ();
return rc;
}
示例11: _SMI_TRACE
CMPIObjectPath *RegisteredProfileCreateObjectPath(
const char *ns,
const char *name,
CMPIStatus *status)
{
CMPIObjectPath *cop;
char buf[256];
_SMI_TRACE(1,("RegisteredProfileCreateObjectPath() called"));
if (strcasecmp(name, VolumeManagementName) == 0 ||
strcasecmp(name, ArrayName) == 0 ||
strcasecmp(name, ServerName) == 0)
{
cop = CMNewObjectPath(
_BROKER, ns,
RegisteredProfileName,
status);
}
else
{
cop = CMNewObjectPath(
_BROKER, ns,
RegisteredSubProfileName,
status);
}
if ((status->rc != CMPI_RC_OK) || CMIsNullObject(cop))
{
_SMI_TRACE(1,("RegisteredProfileCreateObjectPath(): CMNewObjectPath() failed - %s", CMGetCharPtr(status->msg)));
CMSetStatusWithChars(_BROKER, status, CMPI_RC_ERROR_SYSTEM, "Cannot create new objectpath");
goto exit;
}
CMAddKey(cop, InstanceIDName, cmpiutilMakeInstanceID(name, buf, 256), CMPI_chars);
/* *buf = 0;
strncat(buf, "SNIA:", 256);
strncat(buf, name , 256);
CMAddKey(cop, "InstanceID", buf , CMPI_chars);
*/
exit:
_SMI_TRACE(1,("RegisteredProfileCreateObjectPath() done"));
return cop;
}
示例12: make_ObjectPath
CMPIObjectPath *
make_ObjectPath(const CMPIBroker * broker,
const char *ns, const char *className)
{
CMPIObjectPath *objPath = NULL;
CMPIStatus rc = { CMPI_RC_OK, NULL };
objPath = CMNewObjectPath(broker, ns, className, &rc);
CMAddKey(objPath, "ElementName", (CMPIValue *) className, CMPI_chars);
return objPath;
}
示例13: enqRetry
int
enqRetry(RTElement * element, const CMPIContext * ctx, int repo)
{
_SFCB_ENTER(TRACE_INDPROVIDER, "enqRetry");
// Put this one on the retry queue
if (pthread_mutex_lock(&RQlock) != 0) {
// lock failed
return 1;
}
if (RQhead == NULL) {
// Queue is empty
_SFCB_TRACE(1,("--- Adding indication to new retry queue."));
RQhead = element;
RQtail = element;
RQtail->next = element;
RQtail->prev = element;
} else {
_SFCB_TRACE(1,("--- Adding indication to retry queue."));
element->next = RQtail->next;
element->next->prev = element;
RQtail->next = element;
element->prev = RQtail;
RQtail = element;
}
if (repo==1) {
// If this needs to be persisted in the repo
// (not the initial fill from refillRetryQ)
_SFCB_TRACE(1,("--- Creating SFCB_IndicationElement instance."));
CMPIObjectPath * op=CMNewObjectPath(_broker,"root/interop","SFCB_IndicationElement",NULL);
// Add the indID as the only key
CMAddKey(op,"IndicationID",&element->instanceID,CMPI_uint32);
// Create the instance
//element->SFCBIndEle=op;
element->SFCBIndEle=op->ft->clone(op,NULL);
CMPIInstance * ci=CMNewInstance(_broker,op,NULL);
// Set all the properties
CMSetProperty(ci,"IndicationID",&element->instanceID,CMPI_uint32);
CMSetProperty(ci,"RetryCount",&(RQtail->count),CMPI_uint32);
CMSetProperty(ci,"LastDelivery",&(RQtail->lasttry),CMPI_sint32);
CMSetProperty(ci,"ld",&(element->ref),CMPI_ref);
CMSetProperty(ci,"ind",&element->ind,CMPI_ref);
CMSetProperty(ci,"sub",&element->sub,CMPI_ref);
CBCreateInstance(_broker, ctx, op, ci, NULL);
CMRelease(op);
CMRelease(ci);
}
if (pthread_mutex_unlock(&RQlock) != 0) {
// lock failed
return 1;
}
_SFCB_RETURN(0);
}
示例14: loopOnChildNames
static void loopOnChildNames(ClassRegister *cReg, char *cn, CMPIResult * rslt)
{
CMPIObjectPath *op;
UtilList *ul = getChildren(cReg,cn);
char *child;
if (ul) for (child = (char *) ul->ft->getFirst(ul); child; child = (char *) ul->ft->getNext(ul)) {
op=CMNewObjectPath(_broker,NULL,child,NULL);
CMReturnObjectPath(rslt,op);
loopOnChildNames(cReg,child,rslt);
}
}
示例15: KBase_ToObjectPath
CMPIObjectPath* KBase_ToObjectPath(
const KBase* self,
CMPIStatus* st)
{
KPos pos;
CMPIObjectPath* cop;
/* Check parameters */
if (self->magic != KMAGIC)
{
KSetStatus(st, ERR_FAILED);
return NULL;
}
/* Create object path */
KFirst(&pos, self);
if (!(cop = CMNewObjectPath(self->cb, KChars(self->ns), pos.classname,
st)))
{
return NULL;
}
/* Set keys */
while (KMore(&pos))
{
CMPIData cd;
const KValue* value = (const KValue*)pos.field;
if (value->exists && (pos.tag & KTAG_KEY))
{
CMPIStatus st;
cd = _data(value, pos.tag);
if (value->null)
st = CMAddKey(cop, pos.name, NULL, cd.type);
else
st = CMAddKey(cop, pos.name, &cd.value, cd.type);
if (!KOkay(st))
{
/* ATTN: log this but do not return! */
}
}
KNext(&pos);
}
return cop;
}