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);

            // Connect to the cimom and create the CIM_Dummy class
            Console.Write("Creating Class: CIM_Dummy... ");

            CimClass myClass = new CimClass("CIM_Dummy");
            myClass.Properties.Add(new CimProperty("Prop1",CimType.BOOLEAN));
            myClass.Properties.Add(new CimProperty("Prop2",CimType.SINT32));

            client.CreateClass(myClass);

            Console.WriteLine("Done.\n");
        }
Esempio n. 2
0
        public static List<ListViewItem> ToList(CimClass curClass)
        {
            List<ListViewItem> list = new List<ListViewItem>();

            list.Add(new ListViewItem(new string[] { "HasKeyProperties", "Attribute", curClass.HasKeyProperty.ToString() }, (int)ImageUtils.ImageIndex.Attribute));
            list.Add(new ListViewItem(new string[] { "IsAssociation", "Attribute", curClass.IsAssociation.ToString() }, (int)ImageUtils.ImageIndex.Attribute));
            list.Add(new ListViewItem(new string[] { "IsKeyed", "Attribute", curClass.IsKeyed.ToString() }, (int)ImageUtils.ImageIndex.Attribute));
            list.AddRange(ToList(curClass.Qualifiers));
            list.AddRange(ToList(curClass.Properties,curClass.ClassName));
            list.AddRange(ToList(curClass.Methods, curClass.ClassName));

            return list;
        }
Esempio n. 3
0
        public NewInstanceForm(CimClass theClass)
        {
            InitializeComponent();

            _theClass = theClass;

            this.Text = "New instance of " + DisplayClass.ClassName;

            lblClassName.Text = DisplayClass.ClassName.ToString();
            lblSuperClass.Text = DisplayClass.SuperClass.ToString();
            lblClassName.Width = nameWidth;
            lblSuperClass.Width = nameWidth;
        }
Esempio n. 4
0
        public static TreeNode CimToNode(CimClass curClass)
        {
            TreeNode root = new TreeNode(curClass.ClassName.ToString());
            if (curClass.SuperClass != null)
                root.Nodes.Add(new TreeNode("SuperClass - " + curClass.SuperClass.ToString()));
            root.Nodes.Add(new TreeNode("Keyed - " + curClass.IsKeyed.ToString()));
            root.Nodes.Add(new TreeNode("Association - " + curClass.IsAssociation.ToString()));

            root.Nodes.Add(CimToNode(curClass.Qualifiers));
            root.Nodes.Add(CimToNode(curClass.Properties));
            root.Nodes.Add(CimToNode(curClass.Methods));

            return root;
        }
Esempio n. 5
0
        public void CtorTest()
        {
            CimClass a = new CimClass();
            Assert.AreEqual(a.ClassName,new CimName(null));
            Assert.AreEqual(a.SuperClass,new CimName(null));

            CimClass b = new CimClass("myclass");
            Assert.AreEqual(b.ClassName,new CimName("myclass"));
            Assert.AreEqual(b.SuperClass,new CimName(null));

            CimClass c = new CimClass("myclass","CIM_NFS");
            Assert.AreEqual(c.SuperClass,new CimName("CIM_NFS"));
            Assert.AreNotEqual(c.SuperClass,new CimName("xCIM_NFS"));
        }
        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);

            CimClass myClass = new CimClass("CIM_Dummy");

            client.ModifyClass(myClass);

            Console.WriteLine("Done");
        }
Esempio n. 7
0
 /// <summary>
 /// Creates a CimClassPath object with the CimClass and the NamespacePath set
 /// </summary>
 /// <param name="mClass"></param>
 /// <param name="namespacepath"></param>
 public CimClassPath(CimClass mClass, CimNamespacePath namespacepath)
 {
     Class = mClass;
     NamespacePath = namespacepath;
 }
        public CreateClassOpSettings(CimClass newClass)
        {
            ReqType = RequestType.CreateClass;

            NewClass = newClass;
        }
Esempio n. 9
0
 private void DisplayList(CimClass curClass)
 {
     DisplayListStart();
     statusStrip1.Items[0].Text = "Count: 1";
     List<ListViewItem> list = ListViewUtils.ToList(curClass);
     uxLstView_Class.Items.AddRange(list.ToArray());
     DisplayListEnd();
 }
Esempio n. 10
0
        private void DisplayCimClass(CimClass curClass)
        {
            statusStrip1.Items[0].Text = "Count: 1";

            TreeNode root = TreeNodeUtils.CimToNode(curClass);
            treeView1.Nodes.Clear();
            treeView1.Nodes.Add(root);

            ResizeColumns();
        }
Esempio n. 11
0
        private void ctxCreateDerivedClass_Click(object sender, EventArgs e)
        {
            //MessageBox.Show("The 'Create Derived Class' wizard is not implemented yet");
            CimName baseClassName = new CimName(treeView1.SelectedNode.Text);
            string className = "newClass";
            CimClass newClass = new CimClass(className, baseClassName);
            mainWbemClient.CreateClass(newClass);

            RefreshTree(className);
        }
        public ModifyClassOpSettings(CimClass modifiedClass)
        {
            ReqType = RequestType.ModifyClass;

            ModifiedClass = modifiedClass;
        }
Esempio n. 13
0
 /// <summary>
 /// Creates a class on the Cimom
 /// </summary>
 /// <param name="newClass">CimClass to create</param>
 public void CreateClass(CimClass newClass)
 {
     CreateClass(new CreateClassOpSettings(newClass));
 }
Esempio n. 14
0
 /// <summary>
 /// Modify a class on the Cimom
 /// </summary>
 /// <param name="modifiedClass">Class to modify</param>
 public void ModifyClass(CimClass modifiedClass)
 {
     ModifyClass(new ModifyClassOpSettings(modifiedClass));
 }
Esempio n. 15
0
        /// <summary>
        /// Returns the string with the name and key property values of the instance. It requires the class
        /// definition in order to find the required properties, and the instance itself doesn't have the needed
        /// qualifiers attached to the properties.
        /// </summary>
        /// <param name="classDef">class definition of the instance</param>
        /// <returns></returns>
        public string ToString(CimClass classDef)
        {
            string retval = this.ClassName.ToString();

            //In case they pass in the wrong class def
            if (classDef.ClassName != this.ClassName)
            {
                return retval;
            }

            retval += " [";

            //Changed for MONO
            CimPropertyList keyprops = classDef.Properties.GetKeyProperties();
            for (int i = 0; i < keyprops.Count; ++i)
            {
                CimProperty keyprop = keyprops[i];
                CimProperty localProp = this.Properties[keyprop.Name];
                if (localProp != null)
                {
                    retval += " " + localProp.Name + "=" + localProp.Value;
                }
                else
                {
                    retval += " " + keyprop.Name + "=" + "{NOT SET}";
                }
            }
            retval += "]";

            return retval;
        }