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; }
static void TCPCOMM_enumInstanceNames(int socket, CONST CMPIBroker * broker, CONST CMPIContext * context) { CMPIEnumeration *e; CMPIStatus rc; CMPIObjectPath *cop; cop = (__sft)->deserialize_CMPIObjectPath(socket, broker); e = CBEnumInstanceNames(broker, context, cop, &rc); (__sft)->serialize_CMPIStatus(socket, &rc); (__sft)->serialize_CMPIArray(socket, (e) ? CMToArray(e, NULL) : NULL); }
void ElementCapabilitiesInitInstances(const CMPIContext *ctx) { CMPIObjectPath *op = NULL, *opLeft = NULL, *opRight = NULL, *left = NULL, *right = NULL; CMPIValue val; CMPIEnumeration *enm = NULL; CMPIInstance *ci = NULL; CMPIContext *ctxLocal; ctxLocal = native_clone_CMPIContext(ctx); val.string = sfcb_native_new_CMPIString("$DefaultProvider$", NULL, 0); ctxLocal->ft->addEntry(ctxLocal, "rerouteToProvider", &val, CMPI_string); op = CMNewObjectPath(_broker, "root/interop", "SFCB_ElementCapabilities", NULL); ci = CMNewInstance(_broker, op, NULL); opLeft = CMNewObjectPath(_broker, "root/interop", "CIM_IndicationService", NULL); enm = CBEnumInstanceNames(_broker, ctx, opLeft, NULL); left = CMGetNext(enm, NULL).value.ref; opRight = CMNewObjectPath(_broker, "root/interop", "SFCB_IndicationServiceCapabilities", NULL); enm = CBEnumInstanceNames(_broker, ctx, opRight, NULL); right = CMGetNext(enm, NULL).value.ref; CMAddKey(op, "ManagedElement", &left, CMPI_ref); CMAddKey(op, "Capabilities", &right, CMPI_ref); CMSetProperty(ci, "ManagedElement", &left, CMPI_ref); CMSetProperty(ci, "Capabilities", &right, CMPI_ref); CBCreateInstance(_broker, ctxLocal, op, ci, NULL); CMRelease(ctxLocal); return; }
CMPIStatus TestAssociationProviderReferenceNames(CMPIAssociationMI * mi, const CMPIContext *ctx, const CMPIResult *rslt, const CMPIObjectPath * ref, const char *resultClass, const char *role) { CMPIInstance *ci = NULL; CMPIObjectPath *op = NULL; CMPIObjectPath *rop = NULL; CMPIObjectPath *cop = NULL; CMPIEnumeration *en = NULL; CMPIData data; const char *targetName = NULL; const char *_thisClassName; const char *_RefLeftClass = NULL; const char *_RefRightClass = NULL; CMPIStatus rc = { CMPI_RC_OK, NULL }; _thisClassName = _ClassName; /* * get object path of the target class */ op = get_assoc_targetClass_ObjectPath(_broker, ref, _RefLeftClass, _RefRightClass, &rc); /* * check for a failure in creating the object path */ if (rc.rc != CMPI_RC_OK) return rc; /* * the target class does not belong to us so just return CMPI_RC_OK */ if (!op) { CMSetStatusWithChars( _broker, &rc, CMPI_RC_OK, NULL ); return rc; } /* * create new object path of association */ rop = CMNewObjectPath(_broker, CMGetCharsPtr(CMGetNameSpace(ref, &rc), NULL), _thisClassName, &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 */ if (!rc.rc) while (CMHasNext(en, &rc)) { /* * get the object path */ data = CMGetNext(en, &rc); /* * create new instance of the association */ ci = CMNewInstance(_broker, rop, &rc); /* * get name of the target class */ targetName = get_assoc_targetClass_Name(_broker, ref, _RefLeftClass, _RefRightClass, &rc); /* * set the properties of the association instance depending on the * constellation of the source class (parameter ref) and the target * class (see targetName) */ if (strcmp(targetName, "CMPI_TEST_Person") == 0) { CMSetProperty(ci, "model", (CMPIValue *) & (data.value.ref), CMPI_ref); CMSetProperty(ci, "driver", (CMPIValue *) & (ref), CMPI_ref); } else if (strcmp(targetName, "CMPI_TEST_Vehicle") == 0) { CMSetProperty(ci, "model", (CMPIValue *) & (data.value.ref), CMPI_ref); CMSetProperty(ci, "driver", (CMPIValue *) & (ref), CMPI_ref); } /* * get object path of association instance */ cop = CMGetObjectPath(ci, &rc); /* * set namespace in object path of association */ CMSetNameSpace(cop, CMGetCharsPtr(CMGetNameSpace(ref, &rc), NULL)); /* * and return the association object path as result of the * referenceNames() call */ CMReturnObjectPath(rslt, cop); } return rc; }
CMPIStatus TestAssociationProviderAssociatorNames(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 }; /* * get object path of the target class */ op = get_assoc_targetClass_ObjectPath(_broker, ref, _RefLeftClass, _RefRightClass, &rc); /* * check for a failure in creating the object path */ if (rc.rc != CMPI_RC_OK) return rc; /* * the target class does not belong to us so just return CMPI_RC_OK */ if (!op) { CMSetStatusWithChars( _broker, &rc, CMPI_RC_OK, NULL ); return rc; } /* * 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 */ if (!rc.rc) 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); } return rc; }
CMPIStatus TestCMPIAssociationProviderReferences( CMPIAssociationMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, const CMPIObjectPath * ref, const char *resultClass, const char *role , const char** properties) { CMPIInstance * ci = NULL; CMPIObjectPath * op = NULL; CMPIObjectPath * rop = NULL; CMPIEnumeration * en = NULL; CMPIData data ; const char * targetName = NULL; char * _thisClassName; char * _RefLeftClass = NULL; char * _RefRightClass = NULL; CMPIStatus rc = {CMPI_RC_OK, NULL}; _thisClassName=_ClassName; PROV_LOG_OPEN (_thisClassName, _ProviderLocation); PROV_LOG ("\n\n********************* %s CMPI References() called", _thisClassName); /* 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), _thisClassName, &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); { /* create new instance of the association */ ci = CMNewInstance( _broker, rop, &rc); /* get name of the target class */ targetName = get_assoc_targetClass_Name( _broker, ref, _RefLeftClass, _RefRightClass, &rc); /* set the properties of the association instance depending on the * constellation of the source class (parameter ref) and the target * class (see targetName) */ if(strcmp (targetName, "CMPI_TEST_Person")== 0) { CMSetProperty( ci, "model", (CMPIValue*)&(data.value.ref), CMPI_ref ); CMSetProperty( ci, "driver", (CMPIValue*)&(ref), CMPI_ref ); } else if( strcmp( targetName,"CMPI_TEST_Vehicle") == 0 ) { CMSetProperty( ci, "model", (CMPIValue*)&(data.value.ref), CMPI_ref ); CMSetProperty( ci, "driver", (CMPIValue*)&(ref), CMPI_ref ); } CMReturnInstance( rslt, ci ); } } PROV_LOG ("\n\n********************* %s CMPI References() exited", _thisClassName); PROV_LOG_CLOSE (); return rc; }