private void ParseObjectClass()
        {
            int row = (int)NodesTableView.SelectedRow;

            ObjectClassDiff.Clear();
            if (row >= 0)
            {
                KeyValuePair <String, SchemaDefinitionDiff> p = attrTypediff.ElementAt(row);
                {
                    CurrentNode = p.Key;
                    SchemaDefinitionDiff diff = p.Value;

                    if (diff != null)
                    {
                        foreach (VmDirInterop.Schema.Utils.Tuple <ObjectClass, ObjectClass> t in diff.GetObjectClassDiff())
                        {
                            string baseObject    = (t.item1 != null) ? t.item1.ToString() : VMDirSchemaConstants.MISING_OBJECTCLASS;
                            string currentObject = (t.item2 != null) ? t.item2.ToString() : VMDirSchemaConstants.MISING_OBJECTCLASS;
                            ObjectClassDiff.Add(new KeyValuePair <string, string>(baseObject, currentObject));
                        }
                    }
                    else
                    {
                        throw new Exception(VMDirSchemaConstants.NO_DATA_FOUND);
                    }
                }
            }
        }
        private void ParseAttrType()
        {
            int row = (int)NodesTableView.SelectedRow;

            AttrDiff.Clear();
            if (row >= 0)
            {
                KeyValuePair <String, SchemaDefinitionDiff> p = attrTypediff.ElementAt(row);
                {
                    CurrentNode = p.Key;
                    SchemaDefinitionDiff diff = p.Value;

                    if (diff != null)
                    {
                        foreach (VmDirInterop.Schema.Utils.Tuple <AttributeType, AttributeType> t in diff.GetAttributeTypeDiff())
                        {
                            string baseAttr    = (t.item1 != null) ? t.item1.ToString() : VMDirSchemaConstants.MISSING_ATTRIBUTETYPE;
                            string currentAttr = (t.item2 != null) ? t.item2.ToString() : VMDirSchemaConstants.MISSING_ATTRIBUTETYPE;
                            AttrDiff.Add(new KeyValuePair <string, string>(baseAttr, currentAttr));
                        }
                    }
                    else
                    {
                        throw new Exception(VMDirSchemaConstants.NO_DATA_FOUND);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public IDictionary <String, SchemaDefinitionDiff> GetAllSchemaDefinitionDiffs()
        {
            IDictionary <String, SchemaDefinitionDiff> diffs =
                new Dictionary <String, SchemaDefinitionDiff>();

            SubSchemaSubEntry baseSubSchema = baseEntryFetcher.GetSubSchemaSubEntry();

            foreach (KeyValuePair <String, IEntryFetcher> p in entryFetchers)
            {
                String               serverName = p.Key;
                IEntryFetcher        fetcher    = p.Value;
                SchemaDefinitionDiff diff       = null;
                if (fetcher != null)
                {
                    SubSchemaSubEntry otherSubSchema = fetcher.GetSubSchemaSubEntry();
                    diff = new SchemaDefinitionDiff(baseSubSchema, otherSubSchema);
                }
                diffs.Add(serverName, diff);
            }
            return(diffs);
        }
Ejemplo n.º 4
0
        private static void listSchemaDefinitionDiff(ISchemaConnection conn)
        {
            Console.WriteLine("SCHEMA DEFINITION DIFF");
            Console.WriteLine("---------");

            String baseServer = conn.GetBaseServerName();
            IDictionary <String, SchemaDefinitionDiff> diffs = conn.GetAllSchemaDefinitionDiffs();

            foreach (KeyValuePair <String, SchemaDefinitionDiff> p in diffs)
            {
                String server             = p.Key;
                SchemaDefinitionDiff diff = p.Value;

                Console.WriteLine("Schema comparsion between {0} and {1}", baseServer, server);
                if (diff != null)
                {
                    foreach (Tuple <AttributeType, AttributeType> t in diff.GetAttributeTypeDiff())
                    {
                        Console.WriteLine("\tBASE: {0}", t.Item1);
                        Console.WriteLine("\tOTHE: {0}", t.Item2);
                        Console.WriteLine("\t-----");
                    }
                    foreach (Tuple <ObjectClass, ObjectClass> t in diff.GetObjectClassDiff())
                    {
                        Console.WriteLine("\tBASE: {0}", t.Item1);
                        Console.WriteLine("\tOTHE: {0}", t.Item2);
                        Console.WriteLine("\t-----");
                    }
                }
                else
                {
                    Console.WriteLine("\tServer not reachable {0}", server);
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }