예제 #1
0
        /// <summary>
        /// Get the value of a property of an InstanceName
        /// </summary>
        /// <param name="cxw"></param>
        /// <param name="settings"></param>
        /// <param name="defaultNamespace"></param>
        public static void GetProperty(CimXmlWriter cxw, GetPropertyOpSettings settings, CimName defaultNamespace)
        {
            #region Actual XML Request
            /*
            <?xml version="1.0" encoding="utf-8" ?>
            <CIM CIMVERSION="2.0" DTDVERSION="2.0">
             <MESSAGE ID="87872" PROTOCOLVERSION="1.0">
              <SIMPLEREQ>
               <IMETHODCALL NAME="GetProperty">
                <LOCALNAMESPACEPATH>
                 <NAMESPACE NAME="root"/>
                 <NAMESPACE NAME="myNamespace"/>
                </LOCALNAMESPACEPATH>
                <IPARAMVALUE NAME="InstanceName">
                 <INSTANCENAME CLASSNAME="MyDisk">
                  <KEYBINDING NAME="DeviceID"><KEYVALUE>C:</KEYVALUE></KEYBINDING>
                 </INSTANCENAME>
                </IPARAMVALUE>
                <IPARAMVALUE NAME="PropertyName"><VALUE>FreeSpace</VALUE></IPARAMVALUE>
               </IMETHODCALL>
              </SIMPLEREQ>
             </MESSAGE>
            </CIM>
            */
            #endregion

            // Set the Method Name
            cxw.WriteIMethodCallStartElement("GetProperty");

            // Set the namespace
            cxw.WriteCimNamespace(defaultNamespace);

            cxw.WriteIParameterElement();
            cxw.WriteNameAttributeString("InstanceName");
            cxw.WriteCimInstanceName(settings.InstanceName);
            cxw.WriteEndElement();//</IPARAMVALUE>

            cxw.WriteIParameterElement();
            cxw.WriteNameAttributeString("PropertyName");
            cxw.WriteValueString(settings.PropertyName);
            cxw.WriteEndElement();//</IPARAMVALUE>

            //</IMETHODCALL>
            cxw.WriteEndElement();
        }
예제 #2
0
        /// <summary>
        /// <para>From DMTF Spec:</para>This operation is used to delete a single CIM Instance from the target Namespace.
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="defaultNamespace"></param>
        /// <returns>The CimXml request as a string.</returns>
        public static void DeleteInstance(CimXmlWriter cxw, DeleteInstanceOpSettings settings, CimName defaultNamespace)
        {
            #region Actual XML Request
            /*
            <?xml version="1.0" ?>
            <CIM CIMVERSION="2.0" DTDVERSION="2.0">
                <MESSAGE ID="24" PROTOCOLVERSION="1.0">
                    <SIMPLEREQ>
                        <IMETHODCALL NAME="DeleteInstance">
                            <LOCALNAMESPACEPATH>
                                <NAMESPACE NAME="smash"></NAMESPACE>
                            </LOCALNAMESPACEPATH>
                            <IPARAMVALUE NAME="InstanceName">
                                <INSTANCENAME CLASSNAME="CIM_NFS">
                                    <KEYBINDING NAME="CSCreationClassName">
                                        <KEYVALUE VALUETYPE="string">twiest-3</KEYVALUE>
                                    </KEYBINDING>
                                    <KEYBINDING NAME="CSName">
                                        <KEYVALUE VALUETYPE="string">twiest-3</KEYVALUE>
                                    </KEYBINDING>
                                    <KEYBINDING NAME="CreationClassName">
                                        <KEYVALUE VALUETYPE="string">twiest-3</KEYVALUE>
                                    </KEYBINDING>
                                    <KEYBINDING NAME="Name">
                                        <KEYVALUE VALUETYPE="string">twiest-3</KEYVALUE>
                                    </KEYBINDING>
                                </INSTANCENAME>
                            </IPARAMVALUE>
                        </IMETHODCALL>
                    </SIMPLEREQ>
                </MESSAGE>
            </CIM>
            */
            #endregion

            // Set the Method Name
            //<IMETHODCALL NAME="DeleteInstance">
            cxw.WriteIMethodCallStartElement("DeleteInstance");

            // Set the namespace
            cxw.WriteCimNamespace(defaultNamespace);

            //<IPARAMVALUE NAME="InstanceName">
            cxw.WriteIParameterElement();
            cxw.WriteCimNameAttributeString("InstanceName");

            cxw.WriteCimInstanceName(settings.InstanceName);

            //</IPARAMVALUE>
            cxw.WriteEndElement();

            //</IMETHODCALL>
            cxw.WriteEndElement();
        }
예제 #3
0
        /// <summary>
        /// <para>From DMTF Spec:</para>This operation is used to return a single CIM Instance from the target Namespace.
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="defaultNamespace"></param>
        /// <returns>The CimXml request as a string.</returns>
        public static void GetInstance(CimXmlWriter cxw, GetInstanceOpSettings settings, CimName defaultNamespace)
        {
            #region Actual XML Request
            /*
            [...]
            <IMETHODCALL NAME="GetInstance">
                <LOCALNAMESPACEPATH>
                    <NAMESPACE NAME="smash"/>
                </LOCALNAMESPACEPATH>
                <IPARAMVALUE NAME="IncludeClassOrigin">
                    <VALUE>TRUE</VALUE>
                </IPARAMVALUE>
                <IPARAMVALUE NAME="IncludeQualifiers">
                    <VALUE>TRUE</VALUE>
                </IPARAMVALUE>
                <IPARAMVALUE NAME="LocalOnly">
                    <VALUE>FALSE</VALUE>
                </IPARAMVALUE>
                <IPARAMVALUE NAME="PropertyList">
                    <VALUE.ARRAY>
                        <VALUE>Caption</VALUE>
                        <VALUE>InstanceID</VALUE>
                        <VALUE>ElementName</VALUE>
                    </VALUE.ARRAY>
                </IPARAMVALUE>
                <IPARAMVALUE NAME="InstanceName">
                    <INSTANCENAME CLASSNAME="OMC_InstalledOS">
                        <KEYBINDING NAME="GroupComponent">
                            <VALUE.REFERENCE>
                                <LOCALINSTANCEPATH>
                                    <LOCALNAMESPACEPATH>
                                        <NAMESPACE NAME="smash"/>
                                    </LOCALNAMESPACEPATH>
                                    <INSTANCENAME CLASSNAME="OMC_UnitaryComputerSystem">
                                        <KEYBINDING NAME="CreationClassName">
                                            <KEYVALUE VALUETYPE="string">OMC_UnitaryComputerSystem</KEYVALUE>
                                        </KEYBINDING>
                                        <KEYBINDING NAME="Name">
                                            <KEYVALUE VALUETYPE="string">d1850.cim.lab.novell.com</KEYVALUE>
                                        </KEYBINDING>
                                    </INSTANCENAME>
                                </LOCALINSTANCEPATH>
                            </VALUE.REFERENCE>
                        </KEYBINDING>
                        <KEYBINDING NAME="PartComponent">
                            <VALUE.REFERENCE>
                                <LOCALINSTANCEPATH>
                                    <LOCALNAMESPACEPATH>
                                        <NAMESPACE NAME="smash"/>
                                    </LOCALNAMESPACEPATH>
                                    <INSTANCENAME CLASSNAME="OMC_OperatingSystem">
                                        <KEYBINDING NAME="CSName">
                                            <KEYVALUE VALUETYPE="string">d1850.cim.lab.novell.com</KEYVALUE>
                                        </KEYBINDING>
                                        <KEYBINDING NAME="CreationClassName">
                                            <KEYVALUE VALUETYPE="string">OMC_OperatingSystem</KEYVALUE>
                                        </KEYBINDING>
                                        <KEYBINDING NAME="Name">
                                            <KEYVALUE VALUETYPE="string">Linux</KEYVALUE>
                                        </KEYBINDING>
                                        <KEYBINDING NAME="CSCreationClassName">
                                            <KEYVALUE VALUETYPE="string">OMC_UnitaryComputerSystem</KEYVALUE>
                                        </KEYBINDING>
                                    </INSTANCENAME>
                                </LOCALINSTANCEPATH>
                            </VALUE.REFERENCE>
                        </KEYBINDING>
                    </INSTANCENAME>
                </IPARAMVALUE>
            </IMETHODCALL>
            [...]
            */
            #endregion

            // Set the Method Name
            cxw.WriteIMethodCallStartElement("GetInstance");

            // Set the namespace
            cxw.WriteCimNamespace(defaultNamespace);

            // Set the OpSettings
            cxw.WriteLocalOnly(settings.LocalOnly);
            cxw.WriteIncludeQualifiers(settings.IncludeQualifiers);
            cxw.WriteIncludeClassOrigin(settings.IncludeClassOrigin);
            cxw.WritePropertyList(settings.PropertyList);

            cxw.WriteIParameterElement();                   //  <IPARAMVALUE NAME="InstanceName">
            cxw.WriteCimNameAttributeString("InstanceName");
            cxw.WriteCimInstanceName(settings.InstanceName);   //      <INSTANCENAME CLASSNAME="OMC_InstalledOS">[...]
            cxw.WriteEndElement();                          //  </IPARAMVALUE>

            //</IMETHODCALL>
            cxw.WriteEndElement();
        }
예제 #4
0
        /// <summary>
        /// Sets the value of a property on the Cimom
        /// </summary>
        /// <param name="cxw"></param>
        /// <param name="settings"></param>
        /// <param name="defaultNamespace"></param>
        public static void SetProperty(CimXmlWriter cxw, SetPropertyOpSettings settings, CimName defaultNamespace)
        {
            // Set the Method Name
            cxw.WriteIMethodCallStartElement("SetProperty");

            // Set the namespace
            cxw.WriteCimNamespace(defaultNamespace);

            cxw.WriteIParameterElement();
            cxw.WriteNameAttributeString("InstanceName");
            cxw.WriteCimInstanceName(settings.InstanceName);
            cxw.WriteEndElement();//</IPARAMVALUE>

            cxw.WriteIParameterElement();
            cxw.WriteNameAttributeString("PropertyName");
            cxw.WriteValueString(settings.PropertyName);
            cxw.WriteEndElement();//</IPARAMVALUE>

            cxw.WriteIParameterElement();
            cxw.WriteNameAttributeString("NewValue");
            cxw.WriteValueString(settings.NewValue);
            cxw.WriteEndElement();//</IPARAMVALUE>

            //</IMETHODCALL>
            cxw.WriteEndElement();
        }