Exemplo n.º 1
0
        public CimInstanceForm(CimInstance instance)
        {
            IsCreateForm = ! instance.InstanceName.IsSet;
            DisplayInstance = instance;

            PopulateGUI();
        }
        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);
        }
        public ModifyInstanceOpSettings(CimInstance modifiedInstance)
        {
            ReqType = RequestType.ModifyInstance;

            ModifiedInstance = modifiedInstance;
            IncludeQualifiers = true;
            PropertyList = null;
        }
Exemplo n.º 4
0
        public static List<ListViewItem> ToList(CimInstance curInstance)
        {
            List<ListViewItem> list = new List<ListViewItem>();

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

            return list;
        }
Exemplo n.º 5
0
 private void DisplayList(CimInstance curInstance)
 {
     DisplayListStart();
     statusStrip1.Items[0].Text = "Count: 1";
     List<ListViewItem> list = ListViewUtils.ToList(curInstance);
     uxLstView_Class.Items.AddRange(list.ToArray());
     DisplayListEnd();
 }
        public CreateInstanceOpSettings(CimInstance instance)
        {
            ReqType = RequestType.CreateInstance;

            Instance = instance;
        }
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;
        }
Exemplo n.º 8
0
 public CimInstance CreateInstance(CimInstance instance)
 {
     return CreateInstance(new CreateInstanceOpSettings(instance));
 }
Exemplo n.º 9
0
        private CimInstance CombineInstanceAndInstanceName(CimInstance instance, CimInstanceName instanceName)
        {
            if (instance.ClassName != instanceName.ClassName)
                throw new Exception("InstanceName.ClassName != Instance.ClassName");

            instance.InstanceName = instanceName;

            return instance;
        }
Exemplo n.º 10
0
 public void ModifyInstance(CimInstance instance)
 {
     ModifyInstanceOpSettings settings = new ModifyInstanceOpSettings(instance);
     ModifyInstance(settings);
 }
Exemplo n.º 11
0
        private void uxbtnCreate_Click(object sender, EventArgs e)
        {
            //throw new Exception("Not implemented yet");
            Instance = new CimInstance(DisplayClass.ClassName);

            int numProps = DisplayClass.Properties.GetKeyProperties().Count;
            for (int i = 0; i < numProps; ++i)
            {
                CimProperty prop = new CimProperty(lblNames[i].Text, CimTypeUtils.StrToCimType(lblTypes[i].Text));
                prop.Value = txtValues[i].Text;
                prop.Qualifiers.Add(GetKeyQualifier());
                Instance.Properties.Add(prop);
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Exemplo n.º 12
0
 public CimInstancePath(CimInstance instance, CimNamespacePath namespacePath)
 {
     Instance = instance;
     NamespacePath = namespacePath;
 }