Пример #1
0
        public static Schema BuildSchema(Connector connector,
            GetSupportedObjectClassesDelegate getSupportedObjectClassesDelegate,
            GetObjectClassInfoDelegate getObjectClassInfoDelegate,
            GetSupportedOperationsDelegate getSupportedOperationsDelegate,
            GetUnSupportedOperationsDelegate getUnSupportedOperationsDelegate)
        {
            SchemaBuilder schemaBuilder = new SchemaBuilder(SafeType<Connector>.Get(connector));

            //iterate through supported object classes
            foreach (ObjectClass oc in getSupportedObjectClassesDelegate()) {
                ObjectClassInfo ocInfo = getObjectClassInfoDelegate(oc);
                Assertions.NullCheck(ocInfo, "ocInfo");

                //add object class to schema
                schemaBuilder.DefineObjectClass(ocInfo);

                //add supported operations
                IList<SafeType<SPIOperation>> supportedOps = getSupportedOperationsDelegate(oc);
                if (supportedOps != null) {
                    foreach (SafeType<SPIOperation> op in supportedOps) {
                        schemaBuilder.AddSupportedObjectClass(op, ocInfo);
                    }
                }

                //remove unsupported operatons
                IList<SafeType<SPIOperation>> unSupportedOps = getUnSupportedOperationsDelegate(oc);
                if (unSupportedOps != null) {
                    foreach (SafeType<SPIOperation> op in unSupportedOps) {
                        schemaBuilder.RemoveSupportedObjectClass(op, ocInfo);
                    }
                }
            }
            LOGGER.TraceEvent(TraceEventType.Verbose, CAT_DEFAULT, "Finished retrieving schema");
            return schemaBuilder.Build();
        }
Пример #2
0
        public static Schema BuildSchema(Connector connector,
                                         GetSupportedObjectClassesDelegate getSupportedObjectClassesDelegate,
                                         GetObjectClassInfoDelegate getObjectClassInfoDelegate,
                                         GetSupportedOperationsDelegate getSupportedOperationsDelegate,
                                         GetUnSupportedOperationsDelegate getUnSupportedOperationsDelegate)
        {
            SchemaBuilder schemaBuilder = new SchemaBuilder(SafeType <Connector> .Get(connector));

            //iterate through supported object classes
            foreach (ObjectClass oc in getSupportedObjectClassesDelegate())
            {
                ObjectClassInfo ocInfo = getObjectClassInfoDelegate(oc);
                Assertions.NullCheck(ocInfo, "ocInfo");

                //add object class to schema
                schemaBuilder.DefineObjectClass(ocInfo);

                //add supported operations
                IList <SafeType <SPIOperation> > supportedOps = getSupportedOperationsDelegate(oc);
                if (supportedOps != null)
                {
                    foreach (SafeType <SPIOperation> op in supportedOps)
                    {
                        schemaBuilder.AddSupportedObjectClass(op, ocInfo);
                    }
                }

                //remove unsupported operatons
                IList <SafeType <SPIOperation> > unSupportedOps = getUnSupportedOperationsDelegate(oc);
                if (unSupportedOps != null)
                {
                    foreach (SafeType <SPIOperation> op in unSupportedOps)
                    {
                        schemaBuilder.RemoveSupportedObjectClass(op, ocInfo);
                    }
                }
            }
            LOG.Debug("Finished retrieving schema");
            return(schemaBuilder.Build());
        }