From: Chris B. <buc...@us...> - 2012-03-07 21:52:24
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "SFCB - Small Footprint CIM Broker". The branch, master has been updated via bd262159fae69092cd44011b6944d76e38059099 (commit) from f2188259d09fa722fc9d2ae1cfd9c3ca77e04f56 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bd262159fae69092cd44011b6944d76e38059099 Author: buccella <buc...@li...> Date: Wed Mar 7 16:52:05 2012 -0500 [ 3498932 ] Implement ModifyInstance for CIM_ListenerDestination ----------------------------------------------------------------------- Summary of changes: diff --git a/ChangeLog b/ChangeLog index f3d203a..97ccbe3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2012-03-07 Chris Buccella <buc...@li...> + * indCIMXMLHandler.c, interopProvider.c, test/xmltest/LD_modify*: + [ 3498932 ] Implement ModifyInstance for CIM_ListenerDestination + * 10_interop.mof, default.reg.in, interopServerProvider.c: [ 3498275 ] Remove __Namespace diff --git a/NEWS b/NEWS index 961d1f7..0c2f6f5 100644 --- a/NEWS +++ b/NEWS @@ -92,6 +92,7 @@ Changes in 1.3.14 New Features: - 3493493 Add sfcbsem +- 3498932 Implement ModifyInstance for CIM_ListenerDestination Bugs Fixed: diff --git a/indCIMXMLHandler.c b/indCIMXMLHandler.c index 053f1bb..5110005 100644 --- a/indCIMXMLHandler.c +++ b/indCIMXMLHandler.c @@ -464,6 +464,9 @@ IndCIMXMLHandlerCreateInstance(CMPIInstanceMI * mi, _SFCB_RETURN(st); } +/* + * ModifyInstance only for ListenerDestination.Destination + */ CMPIStatus IndCIMXMLHandlerModifyInstance(CMPIInstanceMI * mi, const CMPIContext *ctx, @@ -472,8 +475,41 @@ IndCIMXMLHandlerModifyInstance(CMPIInstanceMI * mi, const CMPIInstance *ci, const char **properties) { - CMPIStatus st = { CMPI_RC_ERR_NOT_SUPPORTED, NULL }; - _SFCB_ENTER(TRACE_INDPROVIDER, "IndCIMXMLHandlerSetInstance"); + 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); } diff --git a/interopProvider.c b/interopProvider.c index fb68a61..84b4cd9 100644 --- a/interopProvider.c +++ b/interopProvider.c @@ -358,6 +358,40 @@ removeHandler(Handler * ha, char *key) _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); +} + /* * ------------------------------------------------------------------------- */ @@ -1114,7 +1148,7 @@ InteropProviderCreateInstance(CMPIInstanceMI * mi, } /* - * ------------------------------------------------------------------------- + * ModifyInstance only for IndicationSubscription.SubscriptionState */ CMPIStatus @@ -1166,8 +1200,29 @@ InteropProviderModifyInstance(CMPIInstanceMI * mi, CMRelease(su->sci); 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); @@ -1418,6 +1473,15 @@ InteropProviderInvokeMethod(CMPIMethodMI * mi, 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); } diff --git a/test/xmltest/LD_modify01-create.lines b/test/xmltest/LD_modify01-create.lines new file mode 100644 index 0000000..4c216ca --- /dev/null +++ b/test/xmltest/LD_modify01-create.lines @@ -0,0 +1,3 @@ +<KEYBINDING NAME="CreationClassName"> +<KEYVALUE VALUETYPE="string">CIM_ListenerDestinationCIMXML</KEYVALUE> +</KEYBINDING> diff --git a/test/TestProviders/tests/IndTest2CreateHandler.xml b/test/xmltest/LD_modify01-create.xml similarity index 86% copy from test/TestProviders/tests/IndTest2CreateHandler.xml copy to test/xmltest/LD_modify01-create.xml index a67dedd..ceaba11 100644 --- a/test/TestProviders/tests/IndTest2CreateHandler.xml +++ b/test/xmltest/LD_modify01-create.xml @@ -8,7 +8,7 @@ <NAMESPACE NAME="interop"/> </LOCALNAMESPACEPATH> <IPARAMVALUE NAME="NewInstance"> - <INSTANCE CLASSNAME="CIM_IndicationHandlerCIMXML"> + <INSTANCE CLASSNAME="CIM_ListenerDestinationCIMXML"> <PROPERTY NAME="SystemName" TYPE="string"> <VALUE>localhost.localdomain</VALUE> </PROPERTY> @@ -16,7 +16,7 @@ <VALUE>Test_Indication_Handler_</VALUE> </PROPERTY> <PROPERTY NAME="Destination" TYPE="string"> - <VALUE>file:///tmp/SFCB_Listener.txt</VALUE> + <VALUE>file:///tmp/SFCB_Listener.tx</VALUE> </PROPERTY> </INSTANCE> </IPARAMVALUE> diff --git a/test/xmltest/modifyInstance_internalProv.lines b/test/xmltest/LD_modify02-modify.lines similarity index 100% copy from test/xmltest/modifyInstance_internalProv.lines copy to test/xmltest/LD_modify02-modify.lines diff --git a/test/xmltest/LD_modify02-modify.xml b/test/xmltest/LD_modify02-modify.xml new file mode 100644 index 0000000..657bd7d --- /dev/null +++ b/test/xmltest/LD_modify02-modify.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<CIM CIMVERSION="2.0" DTDVERSION="2.0"> +<MESSAGE ID="4711" PROTOCOLVERSION="1.0"><SIMPLEREQ><IMETHODCALL NAME="ModifyInstance"><LOCALNAMESPACEPATH><NAMESPACE NAME="root"></NAMESPACE><NAMESPACE NAME="interop"></NAMESPACE></LOCALNAMESPACEPATH> +<IPARAMVALUE NAME="ModifiedInstance"> + <VALUE.NAMEDINSTANCE> + <INSTANCENAME CLASSNAME="CIM_ListenerDestinationCIMXML"> + <KEYBINDING NAME="creationclassname"><KEYVALUE VALUETYPE="string">CIM_ListenerDestinationCIMXML</KEYVALUE></KEYBINDING> + <KEYBINDING NAME="name"><KEYVALUE VALUETYPE="string">Test_Indication_Handler_</KEYVALUE></KEYBINDING> + <KEYBINDING NAME="systemcreationclassname"><KEYVALUE VALUETYPE="string">CIM_ComputerSystem</KEYVALUE></KEYBINDING> + <KEYBINDING NAME="systemname"><KEYVALUE VALUETYPE="string">localhost.localdomain</KEYVALUE></KEYBINDING> + </INSTANCENAME> + <INSTANCE CLASSNAME="CIM_ListenerDestinationCIMXML"> + <PROPERTY NAME="Destination" TYPE="string"><VALUE>file:///tmp/SFCB_Listener.txt</VALUE></PROPERTY> + <PROPERTY NAME="SystemCreationClassName" TYPE="string"><VALUE>CIM_ComputerSystem</VALUE></PROPERTY> + <PROPERTY NAME="SystemName" TYPE="string"><VALUE>localhost.localdomain</VALUE></PROPERTY> + <PROPERTY NAME="CreationClassName" TYPE="string"><VALUE>CIM_ListenerDestinationCIMXML</VALUE></PROPERTY> + <PROPERTY NAME="Name" TYPE="string"><VALUE>Test_Indication_Handler_</VALUE></PROPERTY> + </INSTANCE> + </VALUE.NAMEDINSTANCE> +</IPARAMVALUE> +</IMETHODCALL></SIMPLEREQ> +</MESSAGE></CIM> diff --git a/test/xmltest/LD_modify03-enum.lines b/test/xmltest/LD_modify03-enum.lines new file mode 100644 index 0000000..a758c9e --- /dev/null +++ b/test/xmltest/LD_modify03-enum.lines @@ -0,0 +1,3 @@ +<PROPERTY NAME="Destination" TYPE="string"> +<VALUE>file:///tmp/SFCB_Listener.txt</VALUE> +</PROPERTY> diff --git a/test/xmltest/LD_modify03-enum.xml b/test/xmltest/LD_modify03-enum.xml new file mode 100644 index 0000000..39ceeae --- /dev/null +++ b/test/xmltest/LD_modify03-enum.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8" ?> +<CIM CIMVERSION="2.0" DTDVERSION="2.0"> +<MESSAGE ID="4711" PROTOCOLVERSION="1.0"><SIMPLEREQ><IMETHODCALL NAME="EnumerateInstances"><LOCALNAMESPACEPATH><NAMESPACE NAME="root"></NAMESPACE><NAMESPACE NAME="interop"></NAMESPACE></LOCALNAMESPACEPATH> +<IPARAMVALUE NAME="ClassName"><CLASSNAME NAME="cim_listenerdestination"/></IPARAMVALUE> +</IMETHODCALL></SIMPLEREQ> +</MESSAGE></CIM> diff --git a/test/xmltest/Indication11DeleteSubscription.OK b/test/xmltest/LD_modify04-delete.OK similarity index 100% copy from test/xmltest/Indication11DeleteSubscription.OK copy to test/xmltest/LD_modify04-delete.OK diff --git a/test/TestProviders/tests/IndTest6DeleteHandler.xml b/test/xmltest/LD_modify04-delete.xml similarity index 87% copy from test/TestProviders/tests/IndTest6DeleteHandler.xml copy to test/xmltest/LD_modify04-delete.xml index 0558efc..63b3e7b 100644 --- a/test/TestProviders/tests/IndTest6DeleteHandler.xml +++ b/test/xmltest/LD_modify04-delete.xml @@ -8,7 +8,7 @@ <NAMESPACE NAME="interop"/> </LOCALNAMESPACEPATH> <IPARAMVALUE NAME="InstanceName"> - <INSTANCENAME CLASSNAME="CIM_IndicationHandlerCIMXML"> + <INSTANCENAME CLASSNAME="CIM_ListenerDestinationCIMXML"> <KEYBINDING NAME="SystemCreationClassName"> <KEYVALUE>CIM_ComputerSystem</KEYVALUE> </KEYBINDING> @@ -16,7 +16,7 @@ <KEYVALUE>localhost.localdomain</KEYVALUE> </KEYBINDING> <KEYBINDING NAME="CreationClassName"> - <KEYVALUE>CIM_IndicationHandlerCIMXML</KEYVALUE> + <KEYVALUE>CIM_ListenerDestinationCIMXML</KEYVALUE> </KEYBINDING> <KEYBINDING NAME="Name"> <KEYVALUE>Test_Indication_Handler_</KEYVALUE> hooks/post-receive -- SFCB - Small Footprint CIM Broker |