Package org.apache.directory.api.ldap.model.schema

Examples of org.apache.directory.api.ldap.model.schema.SchemaManager


        {
            // The schema has already been extracted, bypass
        }

        SchemaLoader loader = new LdifSchemaLoader( schemaRepository );
        SchemaManager schemaManager = new DefaultSchemaManager( loader );

        // We have to load the schema now, otherwise we won't be able
        // to initialize the Partitions, as we won't be able to parse
        // and normalize their suffix Dn
        schemaManager.loadAllEnabled();

        directoryService.setSchemaManager( schemaManager );

        // Init the LdifPartition
        LdifPartition ldifPartition = new LdifPartition( schemaManager );
        ldifPartition.setPartitionPath( new File( workingDirectory, "schema" ).toURI() );
        SchemaPartition schemaPartition = new SchemaPartition( schemaManager );
        schemaPartition.setWrappedPartition( ldifPartition );
        directoryService.setSchemaPartition( schemaPartition );

        List<Throwable> errors = schemaManager.getErrors();

        if ( errors.size() != 0 )
        {
            throw new Exception( I18n.err( I18n.ERR_317, Exceptions.printErrors( errors ) ) );
        }
View Full Code Here


            partition.setSchemaManager( service.getSchemaManager() );

            // Inject the partition into the DirectoryService
            service.addPartition( partition );

            SchemaManager schemaManager = service.getSchemaManager();

            // process the schemas
            for ( LoadSchema loadedSchema : dsBuilder.loadedSchemas() )
            {
                String schemaName = loadedSchema.name();
                Boolean enabled = loadedSchema.enabled();

                // Check if the schema is loaded or not
                boolean isLoaded = schemaManager.isSchemaLoaded( schemaName );

                if ( !isLoaded )
                {
                    // We have to load the schema, if it exists
                    try
                    {
                        isLoaded = schemaManager.load( schemaName );
                    }
                    catch ( LdapUnwillingToPerformException lutpe )
                    {
                        // Cannot load the schema, it does not exists
                        LOG.error( lutpe.getMessage() );
                        continue;
                    }
                }

                if ( isLoaded )
                {
                    if ( enabled )
                    {
                        schemaManager.enable( schemaName );

                        if ( schemaManager.isDisabled( schemaName ) )
                        {
                            LOG.error( "Cannot enable " + schemaName );
                        }
                    }
                    else
                    {
                        schemaManager.disable( schemaName );

                        if ( schemaManager.isEnabled( schemaName ) )
                        {
                            LOG.error( "Cannot disable " + schemaName );
                        }
                    }
                }
View Full Code Here

        if ( request.getDerefAliases() != previousSearchRequest.getDerefAliases() )
        {
            return false;
        }

        SchemaManager schemaManager =
            session.getLdapServer().getDirectoryService().getSchemaManager();

        // Compares the attributes
        if ( request.getAttributes() == null )
        {
View Full Code Here

            return;
        }

        try
        {
            SchemaManager schemaManager = session.getCoreSession().getDirectoryService().getSchemaManager();
            Dn newRdn = new Dn( schemaManager, req.getNewRdn().getName() );

            Dn oldRdn = new Dn( schemaManager, req.getName().getRdn().getName() );

            boolean rdnChanged = req.getNewRdn() != null &&
View Full Code Here

     * @throws LdapException with problems initializing cache
     */
    public TriggerSpecCache( DirectoryService directoryService ) throws LdapException
    {
        this.nexus = directoryService.getPartitionNexus();
        final SchemaManager schemaManager = directoryService.getSchemaManager();

        triggerSpecParser = new TriggerSpecificationParser( new NormalizerMappingResolver()
        {
            public Map<String, OidNormalizer> getNormalizerMapping() throws Exception
            {
                return schemaManager.getNormalizerMapping();
            }
        } );

        initialize( directoryService );
    }
View Full Code Here

        for ( Modification mod : mods )
        {
            newModsList.add( mod );
        }

        SchemaManager schemaManager = modContext.getSession()
            .getDirectoryService().getSchemaManager();

        // Add our modification items.
        newModsList.add(
            new DefaultModification(
                ModificationOperation.REPLACE_ATTRIBUTE,
                new DefaultAttribute(
                    KerberosAttribute.KRB5_PRINCIPAL_NAME_AT,
                    schemaManager.lookupAttributeTypeRegistry( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ),
                    principalName ) ) );
        newModsList.add(
            new DefaultModification(
                ModificationOperation.REPLACE_ATTRIBUTE,
                new DefaultAttribute(
                    KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT,
                    schemaManager.lookupAttributeTypeRegistry( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ),
                    Integer.toString( kvno ) ) ) );

        Attribute attribute = getKeyAttribute( modContext.getSession()
            .getDirectoryService().getSchemaManager(), keys );
        newModsList.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute ) );
View Full Code Here

     * @param registrations The list of Registrations
     */
    public DefaultEventService( DirectoryService directoryService )
    {
        this.directoryService = directoryService;
        SchemaManager schemaManager = directoryService.getSchemaManager();
        NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager );
        filterNormalizer = new FilterNormalizingVisitor( ncn, schemaManager );
    }
View Full Code Here

     * @param session the session with the directory core services
     * @throws LdapException if initialization fails
     */
    public TupleCache( CoreSession session ) throws LdapException
    {
        SchemaManager schemaManager = session.getDirectoryService().getSchemaManager();
        this.dnFactory = session.getDirectoryService().getDnFactory();
        this.nexus = session.getDirectoryService().getPartitionNexus();
        NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager );
        aciParser = new ACIItemParser( ncn, schemaManager );
        PRESCRIPTIVE_ACI_AT = schemaManager.getAttributeType( SchemaConstants.PRESCRIPTIVE_ACI_AT );
        OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
        initialize( session );
    }
View Full Code Here

     * @param replicaId The replica ID
     */
    public ReplicaEventLog( DirectoryService directoryService, int replicaId ) throws IOException
    {
        PROVIDER_LOG.debug( "Creating the replication queue for replica {}", replicaId );
        SchemaManager schemaManager = directoryService.getSchemaManager();
        this.replicaId = replicaId;
        this.searchCriteria = new NotificationCriteria();
        this.searchCriteria.setEventMask( EventType.ALL_EVENT_TYPES_MASK );

        // Create the journal file, or open if already exists
View Full Code Here

    {
        LOG.debug( "Starting the server" );

        initSchema();

        SchemaManager schemaManager = directoryService.getSchemaManager();

        if ( !directoryService.isStarted() )
        {
            // inject the schema manager and set the partition directory
            // once the CiDIT gets done we need not do this kind of dirty hack
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.schema.SchemaManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.