| | |
| | | String schemaFile, boolean failOnError, List<Attribute> ldapSyntaxList) |
| | | throws ConfigException |
| | | { |
| | | if (ldapSyntaxList != null) |
| | | { |
| | | for (Attribute a : ldapSyntaxList) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | } |
| | | else |
| | | { |
| | | LocalizableMessage message = WARN_CONFIG_SCHEMA_CANNOT_PARSE_LDAP_SYNTAX.get( |
| | | schemaFile, de.getMessageObject()); |
| | | LocalizableMessage message = |
| | | WARN_CONFIG_SCHEMA_CANNOT_PARSE_LDAP_SYNTAX.get(schemaFile, de.getMessageObject()); |
| | | reportError(failOnError, de, message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** Parse the attribute type definitions if there are any. */ |
| | | private static void parseAttributeTypeDefinitions( |
| | | Schema schema, String schemaFile, boolean failOnError, List<Attribute> attrList) |
| | | throws ConfigException |
| | | { |
| | | if (attrList != null) |
| | | { |
| | | List<String> definitions = new ArrayList<>(); |
| | | for (Attribute a : attrList) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | | definitions.add(v.toString()); |
| | | } |
| | | } |
| | | List<String> definitions = toStrings(attrList); |
| | | try |
| | | { |
| | | schema.registerAttributeTypes(definitions, schemaFile, !failOnError); |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** Parse the objectclass definitions if there are any. */ |
| | | private static void parseObjectclassDefinitions(Schema schema, |
| | | String schemaFile, boolean failOnError, List<Attribute> ocList) |
| | | throws ConfigException |
| | | { |
| | | if (ocList != null) |
| | | { |
| | | List<String> definitions = new ArrayList<>(); |
| | | for (Attribute a : ocList) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | | definitions.add(v.toString()); |
| | | } |
| | | } |
| | | List<String> definitions = toStrings(ocList); |
| | | try |
| | | { |
| | | schema.registerObjectClasses(definitions, schemaFile, !failOnError); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private static List<String> toStrings(List<Attribute> attributes) |
| | | { |
| | | List<String> results = new ArrayList<>(); |
| | | for (Attribute attr : attributes) |
| | | { |
| | | for (ByteString v : attr) |
| | | { |
| | | results.add(v.toString()); |
| | | } |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | /** Parse the name form definitions if there are any. */ |
| | |
| | | String schemaFile, boolean failOnError, List<Attribute> nfList) |
| | | throws ConfigException |
| | | { |
| | | if (nfList != null) |
| | | { |
| | | for (Attribute a : nfList) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** Parse the DIT content rule definitions if there are any. */ |
| | | private static void parseDITContentRuleDefinitions(Schema schema, |
| | | String schemaFile, boolean failOnError, List<Attribute> dcrList) |
| | | throws ConfigException |
| | | { |
| | | if (dcrList != null) |
| | | { |
| | | for (Attribute a : dcrList) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private static void reportError(boolean failOnError, Exception e, |
| | | LocalizableMessage message) throws ConfigException |
| | |
| | | String schemaFile, boolean failOnError, List<Attribute> dsrList) |
| | | throws ConfigException |
| | | { |
| | | if (dsrList != null) |
| | | { |
| | | for (Attribute a : dsrList) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** Parse the matching rule use definitions if there are any. */ |
| | | private static void parseMatchingRuleUseDefinitions(Schema schema, |
| | | String schemaFile, boolean failOnError, List<Attribute> mruList) |
| | | throws ConfigException |
| | | { |
| | | if (mruList != null) |
| | | { |
| | | for (Attribute a : mruList) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | // Register it with the schema. We will allow duplicates, with the |
| | | // later definition overriding any earlier definition, but we want |
| | | // to trap them and log a warning. |
| | | String definition = v.toString(); |
| | | try |
| | | { |
| | | schema.registerMatchingRuleUse(v.toString(), schemaFile, failOnError); |
| | | schema.registerMatchingRuleUse(definition, schemaFile, failOnError); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | |
| | | try |
| | | { |
| | | schema.registerMatchingRuleUse(v.toString(), schemaFile, true); |
| | | schema.registerMatchingRuleUse(definition, schemaFile, true); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * This method checks if a given attribute is an attribute that |