Search in sources :

Example 21 with SchemaObjectWrapper

use of org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper in project directory-ldap-api by apache.

the class DefaultSchemaLoader method updateSchemas.

private void updateSchemas(SchemaObject schemaObject) {
    String schemaName = schemaObject.getSchemaName();
    Schema schema;
    if (Strings.isEmpty(schemaName) || "null".equals(schemaName)) {
        schemaName = "default";
        schema = schemaMap.get(schemaName);
    } else {
        schema = schemaMap.get(schemaName);
    }
    if (schema == null) {
        schema = new DefaultSchema(this, schemaName);
        schemaMap.put(schemaName, schema);
    }
    schema.getContent().add(new SchemaObjectWrapper(schemaObject));
}
Also used : DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) Schema(org.apache.directory.api.ldap.model.schema.registries.Schema) DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) SchemaObjectWrapper(org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper)

Example 22 with SchemaObjectWrapper

use of org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper in project directory-ldap-api by apache.

the class DefaultSchemaLoader method loadNormalizers.

/**
 * {@inheritDoc}
 */
@Override
public List<Entry> loadNormalizers(Schema... schemas) throws LdapException, IOException {
    List<Entry> normalizerEntries = new ArrayList<>();
    if (schemas == null) {
        return normalizerEntries;
    }
    for (Schema schema : schemas) {
        Set<SchemaObjectWrapper> schemaObjectWrappers = schema.getContent();
        for (SchemaObjectWrapper schemaObjectWrapper : schemaObjectWrappers) {
            SchemaObject schemaObject = schemaObjectWrapper.get();
            if (schemaObject instanceof NormalizerDescription) {
                NormalizerDescription normalizerDescription = (NormalizerDescription) schemaObject;
                Entry normalizerEntry = getEntry(normalizerDescription);
                normalizerEntries.add(normalizerEntry);
            }
        }
    }
    return normalizerEntries;
}
Also used : NormalizerDescription(org.apache.directory.api.ldap.model.schema.parsers.NormalizerDescription) SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) DefaultEntry(org.apache.directory.api.ldap.model.entry.DefaultEntry) Entry(org.apache.directory.api.ldap.model.entry.Entry) DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) Schema(org.apache.directory.api.ldap.model.schema.registries.Schema) ArrayList(java.util.ArrayList) SchemaObjectWrapper(org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper)

Example 23 with SchemaObjectWrapper

use of org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper in project directory-ldap-api by apache.

the class DefaultSchemaLoader method loadComparators.

/**
 * {@inheritDoc}
 */
@Override
public List<Entry> loadComparators(Schema... schemas) throws LdapException, IOException {
    List<Entry> comparatorEntries = new ArrayList<>();
    if (schemas == null) {
        return comparatorEntries;
    }
    for (Schema schema : schemas) {
        Set<SchemaObjectWrapper> schemaObjectWrappers = schema.getContent();
        for (SchemaObjectWrapper schemaObjectWrapper : schemaObjectWrappers) {
            SchemaObject schemaObject = schemaObjectWrapper.get();
            if (schemaObject instanceof LdapComparatorDescription) {
                LdapComparatorDescription ldapComparatorDescription = (LdapComparatorDescription) schemaObject;
                Entry lcEntry = getEntry(ldapComparatorDescription);
                comparatorEntries.add(lcEntry);
            }
        }
    }
    return comparatorEntries;
}
Also used : SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) DefaultEntry(org.apache.directory.api.ldap.model.entry.DefaultEntry) Entry(org.apache.directory.api.ldap.model.entry.Entry) DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) Schema(org.apache.directory.api.ldap.model.schema.registries.Schema) ArrayList(java.util.ArrayList) SchemaObjectWrapper(org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper) LdapComparatorDescription(org.apache.directory.api.ldap.model.schema.parsers.LdapComparatorDescription)

Example 24 with SchemaObjectWrapper

use of org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper in project directory-ldap-api by apache.

the class DefaultSchemaLoader method loadSyntaxCheckers.

/**
 * {@inheritDoc}
 */
@Override
public List<Entry> loadSyntaxCheckers(Schema... schemas) throws LdapException, IOException {
    List<Entry> syntaxCheckerEntries = new ArrayList<>();
    if (schemas == null) {
        return syntaxCheckerEntries;
    }
    for (Schema schema : schemas) {
        Set<SchemaObjectWrapper> schemaObjectWrappers = schema.getContent();
        for (SchemaObjectWrapper schemaObjectWrapper : schemaObjectWrappers) {
            SchemaObject schemaObject = schemaObjectWrapper.get();
            if (schemaObject instanceof SyntaxCheckerDescription) {
                SyntaxCheckerDescription syntaxCheckerDescription = (SyntaxCheckerDescription) schemaObject;
                Entry syntaxCheckerEntry = getEntry(syntaxCheckerDescription);
                syntaxCheckerEntries.add(syntaxCheckerEntry);
            }
        }
    }
    return syntaxCheckerEntries;
}
Also used : SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) DefaultEntry(org.apache.directory.api.ldap.model.entry.DefaultEntry) Entry(org.apache.directory.api.ldap.model.entry.Entry) SyntaxCheckerDescription(org.apache.directory.api.ldap.model.schema.parsers.SyntaxCheckerDescription) DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) Schema(org.apache.directory.api.ldap.model.schema.registries.Schema) ArrayList(java.util.ArrayList) SchemaObjectWrapper(org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper)

Example 25 with SchemaObjectWrapper

use of org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper in project directory-ldap-api by apache.

the class DefaultSchemaLoader method loadDitContentRules.

/**
 * {@inheritDoc}
 */
@Override
public List<Entry> loadDitContentRules(Schema... schemas) throws LdapException, IOException {
    List<Entry> ditContentRuleEntries = new ArrayList<>();
    if (schemas == null) {
        return ditContentRuleEntries;
    }
    AttributesFactory factory = new AttributesFactory();
    for (Schema schema : schemas) {
        Set<SchemaObjectWrapper> schemaObjectWrappers = schema.getContent();
        for (SchemaObjectWrapper schemaObjectWrapper : schemaObjectWrappers) {
            SchemaObject schemaObject = schemaObjectWrapper.get();
            if (schemaObject instanceof DitContentRule) {
                DitContentRule ditContentRule = (DitContentRule) schemaObject;
                Entry ditContentRuleEntry = factory.convert(ditContentRule, schema, null);
                ditContentRuleEntries.add(ditContentRuleEntry);
            }
        }
    }
    return ditContentRuleEntries;
}
Also used : SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) DefaultEntry(org.apache.directory.api.ldap.model.entry.DefaultEntry) Entry(org.apache.directory.api.ldap.model.entry.Entry) AttributesFactory(org.apache.directory.api.ldap.model.schema.AttributesFactory) DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) Schema(org.apache.directory.api.ldap.model.schema.registries.Schema) ArrayList(java.util.ArrayList) SchemaObjectWrapper(org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper) DitContentRule(org.apache.directory.api.ldap.model.schema.DitContentRule)

Aggregations

SchemaObjectWrapper (org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper)27 SchemaObject (org.apache.directory.api.ldap.model.schema.SchemaObject)14 Schema (org.apache.directory.api.ldap.model.schema.registries.Schema)13 ArrayList (java.util.ArrayList)12 DefaultSchema (org.apache.directory.api.ldap.model.schema.registries.DefaultSchema)12 DefaultEntry (org.apache.directory.api.ldap.model.entry.DefaultEntry)11 Entry (org.apache.directory.api.ldap.model.entry.Entry)11 AttributesFactory (org.apache.directory.api.ldap.model.schema.AttributesFactory)8 LoadableSchemaObject (org.apache.directory.api.ldap.model.schema.LoadableSchemaObject)6 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)5 HashSet (java.util.HashSet)4 Set (java.util.Set)4 LdapUnwillingToPerformException (org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformException)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 LdapProtocolErrorException (org.apache.directory.api.ldap.model.exception.LdapProtocolErrorException)3 LdapSchemaException (org.apache.directory.api.ldap.model.exception.LdapSchemaException)2 LdapSchemaViolationException (org.apache.directory.api.ldap.model.exception.LdapSchemaViolationException)2 AttributeType (org.apache.directory.api.ldap.model.schema.AttributeType)2 DitContentRule (org.apache.directory.api.ldap.model.schema.DitContentRule)2