Search in sources :

Example 6 with JarLdifSchemaLoader

use of org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader in project directory-ldap-api by apache.

the class ACIItemParserTest method init.

/**
 * Initialization
 */
@BeforeClass
public static void init() throws Exception {
    JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
    SchemaManager schemaManager = new DefaultSchemaManager(loader);
    schemaManager.loadAllEnabled();
    parser = new ACIItemParser(schemaManager);
}
Also used : JarLdifSchemaLoader(org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader) DefaultSchemaManager(org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager) SchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager) DefaultSchemaManager(org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager) BeforeClass(org.junit.BeforeClass)

Example 7 with JarLdifSchemaLoader

use of org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader in project directory-ldap-api by apache.

the class ApiLdapSchemaDataOsgiTest method useBundleClasses.

@Override
protected void useBundleClasses() throws LdapException, IOException {
    JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
    loader.getAllEnabled();
    loader.getAllSchemas();
    SchemaManager schemaManager = new DefaultSchemaManager();
    schemaManager.getEnabled();
    schemaManager.getDisabled();
}
Also used : JarLdifSchemaLoader(org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader) DefaultSchemaManager(org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager) SchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager) DefaultSchemaManager(org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager)

Example 8 with JarLdifSchemaLoader

use of org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader in project directory-ldap-api by apache.

the class ACIItemCheckerTest method init.

/**
 * Initialization
 */
@BeforeClass
public static void init() throws Exception {
    JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
    SchemaManager schemaManager = new DefaultSchemaManager(loader);
    schemaManager.loadAllEnabled();
    checker = new ACIItemChecker(schemaManager);
}
Also used : JarLdifSchemaLoader(org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader) DefaultSchemaManager(org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager) SchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager) DefaultSchemaManager(org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager) BeforeClass(org.junit.BeforeClass)

Example 9 with JarLdifSchemaLoader

use of org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader in project directory-ldap-api by apache.

the class JarLdifSchemaLoaderTest method testJarLdifSchemaLoader.

@Test
public void testJarLdifSchemaLoader() throws Exception {
    JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
    SchemaManager sm = new DefaultSchemaManager(loader);
    sm.loadWithDeps("system");
    assertTrue(sm.getRegistries().getAttributeTypeRegistry().contains("cn"));
    assertFalse(sm.getRegistries().getAttributeTypeRegistry().contains("m-aux"));
    sm.loadWithDeps("apachemeta");
    assertTrue(sm.getRegistries().getAttributeTypeRegistry().contains("m-aux"));
}
Also used : JarLdifSchemaLoader(org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader) DefaultSchemaManager(org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager) SchemaManager(org.apache.directory.api.ldap.model.schema.SchemaManager) DefaultSchemaManager(org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager) Test(org.junit.Test)

Example 10 with JarLdifSchemaLoader

use of org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader in project cloudstack by apache.

the class EmbeddedLdapServer method addSchemaFromClasspath.

/**
 * Add additional schemas to the directory server. This uses
 * JarLdifSchemaLoader, which will search for the "ou=schema" directory
 * within "/schema" on the classpath. If packaging the schema as part of
 * a jar using Gradle or Maven, you'd probably want to put your
 * "ou=schema" directory in src/main/resources/schema.
 * <p/>
 * It's also required that a META-INF/apacheds-schema.index be present in
 * your classpath that lists each LDIF file in your schema directory.
 *
 * @param schemaName The name of the schema
 * @return true if the schemas have been loaded and the registries is
 * consistent
 */
public boolean addSchemaFromClasspath(String schemaName) throws LdapException, IOException {
    // To debug if your apacheds-schema.index isn't found:
    // Enumeration<URL> indexes = getClass().getClassLoader().getResources("META-INF/apacheds-schema.index");
    JarLdifSchemaLoader schemaLoader = new JarLdifSchemaLoader();
    Schema schema = schemaLoader.getSchema(schemaName);
    return schema != null && getDirectoryService().getSchemaManager().load(schema);
}
Also used : JarLdifSchemaLoader(org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader) DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) Schema(org.apache.directory.api.ldap.model.schema.registries.Schema)

Aggregations

JarLdifSchemaLoader (org.apache.directory.api.ldap.schema.loader.JarLdifSchemaLoader)10 DefaultSchemaManager (org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager)9 SchemaManager (org.apache.directory.api.ldap.model.schema.SchemaManager)8 BeforeClass (org.junit.BeforeClass)5 File (java.io.File)2 IOException (java.io.IOException)2 CacheManager (net.sf.ehcache.CacheManager)2 CacheConfiguration (net.sf.ehcache.config.CacheConfiguration)2 Configuration (net.sf.ehcache.config.Configuration)2 NormalizingComparator (org.apache.directory.api.ldap.model.schema.comparators.NormalizingComparator)2 ComparatorRegistry (org.apache.directory.api.ldap.model.schema.registries.ComparatorRegistry)2 SchemaLoader (org.apache.directory.api.ldap.model.schema.registries.SchemaLoader)2 CacheService (org.apache.directory.server.core.api.CacheService)2 InstanceLayout (org.apache.directory.server.core.api.InstanceLayout)2 Partition (org.apache.directory.server.core.api.partition.Partition)2 SchemaPartition (org.apache.directory.server.core.api.schema.SchemaPartition)2 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)1 DefaultSchema (org.apache.directory.api.ldap.model.schema.registries.DefaultSchema)1 Schema (org.apache.directory.api.ldap.model.schema.registries.Schema)1 SubtreeSpecificationParser (org.apache.directory.api.ldap.model.subtree.SubtreeSpecificationParser)1