Search in sources :

Example 1 with NormalizerDescription

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

the class DefaultSchemaLoader method loadNormalizers.

private void loadNormalizers(Attribute normalizers) throws LdapException {
    if (normalizers == null) {
        return;
    }
    for (Value value : normalizers) {
        String desc = value.getValue();
        try {
            NormalizerDescription normalizer = N_DESCR_SCHEMA_PARSER.parseNormalizerDescription(desc);
            updateSchemas(normalizer);
        } catch (ParseException pe) {
            throw new LdapException(pe);
        }
    }
}
Also used : NormalizerDescription(org.apache.directory.api.ldap.model.schema.parsers.NormalizerDescription) Value(org.apache.directory.api.ldap.model.entry.Value) ParseException(java.text.ParseException) LdapException(org.apache.directory.api.ldap.model.exception.LdapException)

Example 2 with NormalizerDescription

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

the class NormalizerDescriptionSchemaParserTest method testFqcn.

@Test
public void testFqcn() throws ParseException {
    String value = null;
    NormalizerDescription nd = null;
    // FQCN simple p
    value = "( 1.1 FQCN org.apache.directory.SimpleNormalizer )";
    nd = parser.parseNormalizerDescription(value);
    assertNotNull(nd.getFqcn());
    assertEquals("org.apache.directory.SimpleNormalizer", nd.getFqcn());
}
Also used : NormalizerDescription(org.apache.directory.api.ldap.model.schema.parsers.NormalizerDescription) Test(org.junit.Test)

Example 3 with NormalizerDescription

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

the class NormalizerDescriptionSchemaParserTest method testBytecode.

@Test
public void testBytecode() throws ParseException {
    String value = null;
    NormalizerDescription nd = null;
    // FQCN simple p
    value = "( 1.1 FQCN org.apache.directory.SimpleNormalizer BYTECODE ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789==== )";
    nd = parser.parseNormalizerDescription(value);
    assertNotNull(nd.getBytecode());
    assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====", nd.getBytecode());
}
Also used : NormalizerDescription(org.apache.directory.api.ldap.model.schema.parsers.NormalizerDescription) Test(org.junit.Test)

Example 4 with NormalizerDescription

use of org.apache.directory.api.ldap.model.schema.parsers.NormalizerDescription 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)

Aggregations

NormalizerDescription (org.apache.directory.api.ldap.model.schema.parsers.NormalizerDescription)4 Test (org.junit.Test)2 ParseException (java.text.ParseException)1 ArrayList (java.util.ArrayList)1 DefaultEntry (org.apache.directory.api.ldap.model.entry.DefaultEntry)1 Entry (org.apache.directory.api.ldap.model.entry.Entry)1 Value (org.apache.directory.api.ldap.model.entry.Value)1 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)1 SchemaObject (org.apache.directory.api.ldap.model.schema.SchemaObject)1 SchemaObjectWrapper (org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper)1 DefaultSchema (org.apache.directory.api.ldap.model.schema.registries.DefaultSchema)1 Schema (org.apache.directory.api.ldap.model.schema.registries.Schema)1