From: Chris B. <buc...@us...> - 2012-03-07 20:59:45
|
Update of /cvsroot/sblim/sfcb In directory vz-cvs-3.sog:/tmp/cvs-serv12144 Modified Files: indCIMXMLHandler.c interopProvider.c ChangeLog NEWS Log Message: [ 3498932 ] Implement ModifyInstance for CIM_ListenerDestination Index: NEWS =================================================================== RCS file: /cvsroot/sblim/sfcb/NEWS,v retrieving revision 1.656 retrieving revision 1.657 diff -u -d -r1.656 -r1.657 --- NEWS 7 Mar 2012 17:12:39 -0000 1.656 +++ NEWS 7 Mar 2012 20:59:42 -0000 1.657 @@ -13,6 +13,7 @@ - 3488688 Don't spawn logger for clients - 3493493 Add sfcbsem - 3495060 Verify filter and handler information during subscription +- 3498932 Implement ModifyInstance for CIM_ListenerDestination Bugs fixed: Index: indCIMXMLHandler.c =================================================================== RCS file: /cvsroot/sblim/sfcb/indCIMXMLHandler.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- indCIMXMLHandler.c 7 Mar 2012 17:12:39 -0000 1.46 +++ indCIMXMLHandler.c 7 Mar 2012 20:59:42 -0000 1.47 @@ -417,6 +417,9 @@ _SFCB_RETURN(st); } +/* + * ModifyInstance only for ListenerDestination.Destination + */ CMPIStatus IndCIMXMLHandlerModifyInstance(CMPIInstanceMI * mi, const CMPIContext * ctx, const CMPIResult * rslt, @@ -424,9 +427,43 @@ const CMPIInstance * ci, const char **properties) { - CMPIStatus st = { CMPI_RC_ERR_NOT_SUPPORTED, NULL }; - _SFCB_ENTER(TRACE_INDPROVIDER, "IndCIMXMLHandlerSetInstance"); - _SFCB_RETURN(st); + + CMPIStatus st = { CMPI_RC_OK, NULL }; + CMPIString *cn = CMGetClassName(cop, NULL); + const char *cns = cn->ft->getCharPtr(cn,NULL); + CMPIArgs *in; + CMPIData rv; + + _SFCB_ENTER(TRACE_INDPROVIDER, "IndCIMXMLHandlerModifyInstance"); + + if(isa("root/interop", cns, "cim_listenerdestination")) { + _SFCB_TRACE(1,("--- modify %s", cns)); + + CMPIData newDest = CMGetProperty(ci, "Destination", &st); + fprintf(stderr, "new dest is %s\n", CMGetCharPtr(newDest.value.string)); + + if(newDest.state != CMPI_goodValue) { + st.rc = CMPI_RC_ERR_FAILED; + return st; + } + + in=CMNewArgs(_broker,NULL); + CMAddArg(in,"handler",&ci,CMPI_instance); + CMAddArg(in,"key",&cop,CMPI_ref); + /* cn needs to be IndicationSub to route the IM call to interopProv */ + CMPIObjectPath* sop=CMNewObjectPath(_broker,"root/interop","cim_indicationsubscription",&st); + rv = CBInvokeMethod(_broker,ctx,sop,"_updateHandler",in,NULL,&st); + + if (st.rc==CMPI_RC_OK) { + st=InternalProviderModifyInstance(NULL,ctx,rslt,cop,ci,properties); + } + else { + rv=CBInvokeMethod(_broker,ctx,sop,"_removeHandler",in,NULL,NULL); + } + + } + + _SFCB_RETURN(st); } CMPIStatus IndCIMXMLHandlerDeleteInstance(CMPIInstanceMI * mi, Index: interopProvider.c =================================================================== RCS file: /cvsroot/sblim/sfcb/interopProvider.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- interopProvider.c 2 Mar 2012 21:37:59 -0000 1.54 +++ interopProvider.c 7 Mar 2012 20:59:42 -0000 1.55 @@ -330,6 +330,40 @@ _SFCB_EXIT(); } +/* + * Similar to addHandler(), but useCount is maintained + * don't need to check for handlerHt because we only get here + * if getHandler does not return NULL + */ + +static Handler *updateHandler( + CMPIInstance *ci, + CMPIObjectPath * op) +{ + Handler *ha; + char *key; + + _SFCB_ENTER(TRACE_INDPROVIDER, "updateHandler"); + + key=normalizeObjectPathCharsDup(op); + + _SFCB_TRACE(1,("--- Handler: %s",key)); + + // do we need to check?? + if ((ha=handlerHt->ft->get(handlerHt,key))==NULL) { + _SFCB_TRACE(1,("--- No handler %p",ha)); + if(key) free(key); + _SFCB_RETURN(NULL); + } + + CMRelease(ha->hci); + ha->hci=CMClone(ci,NULL); + ha->hop=CMClone(op,NULL); + handlerHt->ft->put(handlerHt,key,ha); + + _SFCB_RETURN(ha); +} + /* ------------------------------------------------------------------------- */ extern int isChild(const char *ns, const char *parent, const char* child); @@ -1016,8 +1050,9 @@ _SFCB_RETURN(st); } -/* ------------------------------------------------------------------------- */ - +/* + * ModifyInstance only for IndicationSubscription.SubscriptionState + */ CMPIStatus InteropProviderModifyInstance( CMPIInstanceMI * mi, const CMPIContext * ctx, @@ -1065,7 +1100,29 @@ su->sci=CMClone(ci,NULL); } - else setStatus(&st,CMPI_RC_ERR_NOT_SUPPORTED,"Class not supported"); + else if(isa("root/interop", cns, "cim_listenerdestination")) { + char *key = normalizeObjectPathCharsDup(cop); + _SFCB_TRACE(1,("--- modify cim_indicationsubscription %s",key)); + Handler *ha; + + ha = getHandler(key); + free(key); + if(!ha) { + st.rc = CMPI_RC_ERR_NOT_FOUND; + return st; + } + CMPIData newDest = CMGetProperty(ci, "Destination", &st); + + if(newDest.state != CMPI_goodValue) { + st.rc = CMPI_RC_ERR_FAILED; + return st; + } + /*replace the instance in the hashtable*/ + CMRelease(ha->hci); + ha->hci=CMClone(ci,NULL); + + } + else setStatus(&st,CMPI_RC_ERR_NOT_SUPPORTED,"ModifyInstance for class not supported"); if (st.rc==CMPI_RC_OK) { ctxLocal = prepareUpcall((CMPIContext *)ctx); @@ -1287,6 +1344,15 @@ if(key) free(key); } + else if (strcasecmp(methodName, "_updateHandler") == 0) { + CMPIInstance *ci=in->ft->getArg(in,"handler",&st).value.inst; + CMPIObjectPath *op=in->ft->getArg(in,"key",&st).value.ref; + CMPIString *str=CDToString(_broker,op,NULL); + CMPIString *ns=CMGetNameSpace(op,NULL); + _SFCB_TRACE(1,("--- _updateHandler %s %s",(char*)ns->hdl,(char*)str->hdl)); + updateHandler(ci,op); + } + else if (strcasecmp(methodName, "_startup") == 0) { initInterOp(_broker,ctx); } Index: ChangeLog =================================================================== RCS file: /cvsroot/sblim/sfcb/ChangeLog,v retrieving revision 1.733 retrieving revision 1.734 diff -u -d -r1.733 -r1.734 --- ChangeLog 7 Mar 2012 17:12:39 -0000 1.733 +++ ChangeLog 7 Mar 2012 20:59:42 -0000 1.734 @@ -1,3 +1,8 @@ +2012-03-07 Chris Buccella <buc...@li...> + + * interopProvider.c, indCIMXMLHandler.c, test/xmltest/LD_modify*: + [ 3498932 ] Implement ModifyInstance for CIM_ListenerDestination + 2012-03-07 Michael Chase-Salerno <br...@li...> * indCIMXMLHandler.c: |