public static void Main(string[] args)
        {
            // This first part is to simply setup the connection to the Cimom
            string progName = System.AppDomain.CurrentDomain.FriendlyName;
            if (args.Length != 4)
            {
                Console.WriteLine("Usage: " + progName + " <server name> <username> <password> <namespace>");
                return;
            }
            string host = args[0];
            string user = args[1];
            string pwd = args[2];
            string defaultNamespace = args[3];

            // This is the line that defines our wbem client. No connection is made
            // to the Cimom until a call is made.
            WbemClient client = new WbemClient(host, user, pwd, defaultNamespace);

            GetClassOpSettings settings = new GetClassOpSettings("CIM_NFS");
            settings.LocalOnly = false;

            CimClass mclass = client.GetClass(settings);

            CimInstance newInstance = new CimInstance("CIM_NFS");

            client.CreateInstance(newInstance);
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            // This first part is to simply setup the connection to the Cimom
            string progName = System.AppDomain.CurrentDomain.FriendlyName;
            if (args.Length != 4)
            {
                Console.WriteLine("Usage: " + progName + " <server name> <username> <password> <namespace>");
                return;
            }
            string host = args[0];
            string user = args[1];
            string pwd = args[2];
            string defaultNamespace = args[3];

            // This is the line that defines our wbem client. No connection is made
            // to the Cimom until a call is made.
            WbemClient client = new WbemClient(host, user, pwd, defaultNamespace);

            GetClassOpSettings gcos = new GetClassOpSettings("CIM_NFS");
            EnumerateClassNamesOpSettings ecnos = new EnumerateClassNamesOpSettings();

            GetClassOpSettings gcos2 = new GetClassOpSettings("CIM_Component");

            BatchRequest batch = new BatchRequest("root/cimv2");
            batch.Add(gcos);
            batch.Add(ecnos);
            batch.Add(gcos2);

            BatchResponse response = client.ExecuteBatchRequest(batch);
        }
Exemplo n.º 3
0
        private void uxLstView_Class_DoubleClick(object sender, EventArgs e)
        {
            // Get the selected Property / Method / Qualifier's name
            string itemName = uxLstView_Class.SelectedItems[0].SubItems[0].Text;

            GetClassOpSettings gcs = new GetClassOpSettings(treeView1.SelectedNode.Text);
            gcs.IncludeClassOrigin = true;
            gcs.IncludeQualifiers = true;
            gcs.LocalOnly = false;

            CimClass tmpClass = mainWbemClient.GetClass(gcs);

            Form tmpForm = null;
            switch (uxLstView_Class.SelectedItems[0].SubItems[1].Text.ToLower())
            {
                case "qualifier":
                    tmpForm = new CimQualifierForm(tmpClass.Qualifiers[itemName]);
                    tmpForm.ShowDialog();
                    break;

                case "key property":
                case "property":
                    tmpForm = new CimPropertyForm(tmpClass.Properties[itemName]);
                    tmpForm.ShowDialog();
                    break;

                case "method":
                    tmpForm = new CimMethodForm(tmpClass.Methods[itemName]);
                    tmpForm.ShowDialog();
                    break;
            }
        }
Exemplo n.º 4
0
        private void GetClass(string className)
        {
            GetClassOpSettings gcs = new GetClassOpSettings(className);
            gcs.IncludeClassOrigin = true;
            gcs.IncludeQualifiers = true;
            gcs.LocalOnly = false;

            CimClass tmpClass;
            try
            {
                tmpClass = mainWbemClient.GetClass(gcs);
                DisplayList(tmpClass);
            }
            catch (Exception e)
            {
                MessageBox.Show("Exception: " + e.Message);
                return;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="settings"></param>
        /// <returns></returns>
        public CimClass GetClass(GetClassOpSettings settings)
        {
            SingleResponse response = MakeSingleRequest("GetClass", settings);

            if (response.Value == null)
            {
                return null;
            }

            CheckSingleResponse(response, typeof(CimClassList));

            return ((CimClassList)response.Value)[0];
        }
Exemplo n.º 6
0
        /// <summary>
        /// Gets the base class of the class
        /// </summary>
        /// <param name="className"></param>
        /// <returns>Returns the name of the class</returns>
        public CimName GetBaseKeyClassName(CimName className)
        {
            GetClassOpSettings gcop = new GetClassOpSettings(className);
            gcop.LocalOnly = false;

            CimClass curClass = this.GetClass(gcop);

            CimClass startClass = curClass;
            CimName lastClassName = null;   // default value if className doesn't have a BKC

            while (curClass.HasKeyProperty == true)
            {
                lastClassName = curClass.ClassName;

                if (curClass.SuperClass != string.Empty)
                {
                    gcop.ClassName = curClass.SuperClass;

                    curClass = this.GetClass(gcop);
                }
                else
                    break;
            }

            return lastClassName;
        }
Exemplo n.º 7
0
        public CimInstance CreateTemplateInstance(CimName className)
        {
            GetClassOpSettings gcos = new GetClassOpSettings(className);
            gcos.IncludeQualifiers = false;
            gcos.LocalOnly = false;
            gcos.IncludeClassOrigin = false;

            CimClass tmpClass = this.GetClass(gcos);

            CimInstance retVal = new CimInstance(className);
            retVal.Properties = tmpClass.Properties;

            return retVal;
        }