Ejemplo n.º 1
0
 private TreeNode ConstructRDFTree(XmlDocument document)
 {
     if (!document.DocumentElement.Name.Equals(MaskViewList.NAME))
         throw new EditorException("The XML is not of type RDFMasking or TestReplicaMasking.");
     TreeNode root = new MaskViewList();
     XmlNode versionElem = document.DocumentElement.SelectSingleNode(XMLEditor.Tree.Version.NAME);
     TreeNode version = new XMLEditor.Tree.Version(versionElem.InnerText);
     root.AddChild(version);
     foreach (XmlNode element in document.DocumentElement.SelectNodes(MaskView.NAME))
     {
         TreeNode maskView = new MaskView();
         root.AddChild(maskView);
         XmlNode arrayIdElem = element.SelectSingleNode(ArrayId.NAME);
         XmlNode storageGroupElem = element.SelectSingleNode(StorageGroup.NAME);
         TreeNode arrayId = new ArrayId(arrayIdElem.InnerText);
         TreeNode storageGroup = new StorageGroup(storageGroupElem.InnerText);
         maskView.AddChild(arrayId);
         maskView.AddChild(storageGroup);
         TreeNode deviceList = new XMLEditor.Tree.RDF_Replica.DeviceList();
         maskView.AddChild(deviceList);
         foreach (XmlNode node in element.SelectNodes(@"//" + Device.NAME))
         {
             XmlNode deviceElem = node.SelectSingleNode(Device.NAME);
             TreeNode device = new Device(deviceElem.InnerText);
             deviceList.AddChild(device);
         }
     }
     return root;
 }
Ejemplo n.º 2
0
 private TreeNode ConstructFailoverTree(XmlDocument document)
 {
     if (!document.DocumentElement.Name.Equals(TestFailoverInfo.NAME))
         throw new EditorException("The XML is not of type Failover or GoldCopy.");
     TreeNode root = new TestFailoverInfo();
     XmlNode versionElem = document.DocumentElement.SelectSingleNode(XMLEditor.Tree.Version.NAME);
     TreeNode version = new XMLEditor.Tree.Version(versionElem.InnerText);
     root.AddChild(version);
     foreach (XmlNode element in document.DocumentElement.SelectNodes(CopyInfo.NAME))
     {
         TreeNode copyInfo = new CopyInfo();
         root.AddChild(copyInfo);
         XmlNode arrayIdElem = element.SelectSingleNode(ArrayId.NAME);
         XmlNode copyTypeElem = element.SelectSingleNode(CopyType.NAME);
         XmlNode copyModeElem = element.SelectSingleNode(CopyMode.NAME);
         XmlNode snapPoolElem = element.SelectSingleNode(SnapPool.NAME);
         TreeNode arrayId = new ArrayId(arrayIdElem.InnerText);
         TreeNode copyType = new CopyType(copyTypeElem.InnerText);
         copyInfo.AddChild(arrayId);
         copyInfo.AddChild(copyType);
         if (copyModeElem != null)
         {
             TreeNode copyMode = new CopyMode(copyModeElem.InnerText);
             copyInfo.AddChild(copyMode);
         }
         if (snapPoolElem != null)
         {
             TreeNode snapPool = new SnapPool(snapPoolElem.InnerText);
             copyInfo.AddChild(snapPool);
         }
         TreeNode deviceList = new XMLEditor.Tree.Failover_GoldCopy.DeviceList();
         copyInfo.AddChild(deviceList);
         foreach (XmlNode node in element.SelectNodes(@"//" + DevicePair.NAME))
         {
             TreeNode devicePair = new DevicePair();
             deviceList.AddChild(devicePair);
             XmlNode sourceElem = node.SelectSingleNode(Source.NAME);
             XmlNode targetElem = node.SelectSingleNode(Target.NAME);
             TreeNode source = new Source(sourceElem.InnerText);
             TreeNode target = new Target(targetElem.InnerText);
             devicePair.AddChild(source);
             devicePair.AddChild(target);
         }
     }
     return root;
 }