Exemplo n.º 1
0
        public SchemaDefinitionDiff(SubSchemaSubEntry baseSubSchema, SubSchemaSubEntry otherSubSchema)
        {
            SchemaComparableList <AttributeType> baseAtList  = baseSubSchema.GetAttributeTypeList();
            SchemaComparableList <AttributeType> otherAtList = otherSubSchema.GetAttributeTypeList();

            attributeTypeDiff = baseAtList.GetDiff(otherAtList);

            SchemaComparableList <ObjectClass> baseOcList  = baseSubSchema.GetObjectClassList();
            SchemaComparableList <ObjectClass> otherOcList = otherSubSchema.GetObjectClassList();

            objectClassDiff = baseOcList.GetDiff(otherOcList);
        }
Exemplo n.º 2
0
        public void ExportToXML(String filepath)
        {
            using (XmlTextWriter writer = new XmlTextWriter(filepath, null))
            {
                writer.Formatting = Formatting.Indented;
                writer.WriteStartDocument();
                writer.WriteStartElement("Node");

                // host name
                writer.WriteElementString("HostName", baseServerName);

                // host status
                writer.WriteElementString("Status", "1");

                // dse root
                DseRootEntry dseRootEntry = baseEntryFetcher.GetDseRootEntry();
                writer.WriteStartElement("DseRootEntry");
                writer.WriteElementString("Domain", dseRootEntry.domain);
                writer.WriteElementString("ServerDn", dseRootEntry.serverDn);
                writer.WriteEndElement();

                // list of server nodes
                IList <ServerEntry> serverEntries = baseEntryFetcher.GetServerEntries();
                writer.WriteStartElement("ServerEntries");
                foreach (ServerEntry e in serverEntries)
                {
                    writer.WriteStartElement("ServerEntry");
                    writer.WriteElementString("DN", e.dn);
                    writer.WriteElementString("ServerName", e.serverName);
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();

                // subschema subentry
                SubSchemaSubEntry baseSubSchema = baseEntryFetcher.GetSubSchemaSubEntry();
                writer.WriteStartElement("SubSchemaSubEntry");
                writer.WriteStartElement("AttributeTypes");
                foreach (AttributeType at in baseSubSchema.GetAttributeTypeList())
                {
                    writer.WriteElementString("AttributeType", at.ToString());
                }
                writer.WriteEndElement();
                writer.WriteStartElement("ObjectClasses");
                foreach (ObjectClass oc in baseSubSchema.GetObjectClassList())
                {
                    writer.WriteElementString("ObjectClass", oc.ToString());
                }
                writer.WriteEndElement();
                writer.WriteEndElement();

                // list of attribute schema entries
                SchemaComparableList <SchemaEntry> baseAtEntries =
                    baseEntryFetcher.GetAttributeSchemaEntries();
                SchemaComparableList <SchemaEntry> baseOcEntries =
                    baseEntryFetcher.GetClassSchemaEntries();
                writer.WriteStartElement("SchemaEntries");
                writer.WriteStartElement("AttributeSchemaEntries");
                foreach (SchemaEntry ae in baseAtEntries)
                {
                    writer.WriteStartElement("AttributeSchemaEntry");
                    writer.WriteElementString("Name", ae.defName);
                    writer.WriteStartElement("AttributeMetadata");
                    foreach (AttributeMetadata m in ae.GetMetadataList())
                    {
                        writer.WriteElementString("Value", m.raw);
                    }
                    writer.WriteEndElement();
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();

                // list of class schema entries
                writer.WriteStartElement("ClassSchemaEntries");
                foreach (SchemaEntry ce in baseOcEntries)
                {
                    writer.WriteStartElement("ClassSchemaEntry");
                    writer.WriteElementString("Name", ce.defName);
                    writer.WriteStartElement("AttributeMetadata");
                    foreach (AttributeMetadata m in ce.GetMetadataList())
                    {
                        writer.WriteElementString("Value", m.raw);
                    }
                    writer.WriteEndElement();
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
                writer.WriteEndElement();

                // end node
                writer.WriteEndElement();
                writer.WriteEndDocument();
            }
        }