Package org.apache.directory.shared.ldap.schema

Examples of org.apache.directory.shared.ldap.schema.SchemaManager


        if ( principal == null )
        {
            return null;
        }

        SchemaManager schemaManager = session.getDirectoryService().getSchemaManager();
       
        List<Modification> mods = new ArrayList<Modification>(2);
       
        EntryAttribute newPasswordAttribute = new DefaultServerAttribute(
            schemaManager.lookupAttributeTypeRegistry( SchemaConstants.USER_PASSWORD_AT ), StringTools.getBytesUtf8( newPassword ) );
        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, newPasswordAttribute ) );
       
        EntryAttribute principalAttribute = new DefaultServerAttribute(
            schemaManager.lookupAttributeTypeRegistry( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ), principal.getName() );
        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, principalAttribute ) );
       
        //FIXME check if keyderivation is necessary
       
        ServerEntry entry = StoreUtils.findPrincipalEntry( session, searchBaseDn, principal.getName() );
View Full Code Here


    {
        EntryFilteringCursor cursor = null;
       
        try
        {
            SchemaManager schemaManager = session.getDirectoryService().getSchemaManager();
            cursor = session.search( searchBaseDn, SearchScope.SUBTREE,
                getFilter( schemaManager, principal ), AliasDerefMode.DEREF_ALWAYS, null );
   
            cursor.beforeFirst();
            if ( cursor.next() )
View Full Code Here

    @BeforeClass
    public static void init() throws Exception
    {
        JarLdifSchemaLoader loader = new JarLdifSchemaLoader();

        SchemaManager sm = new DefaultSchemaManager( loader );

        boolean loaded = sm.loadAllEnabled();

        if ( !loaded )
        {
            fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
        }

        registries = sm.getRegistries();
    }
View Full Code Here

    @BeforeClass
    public static void init() throws Exception
    {
        JarLdifSchemaLoader loader = new JarLdifSchemaLoader();

        SchemaManager sm = new DefaultSchemaManager( loader );

        boolean loaded = sm.loadAllEnabled();

        if ( !loaded )
        {
            fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
        }

        registries = sm.getRegistries();
       
        OBJECT_CLASS = registries.getAttributeTypeRegistry().lookup( "objectClass" );
    }
View Full Code Here

        extractor.extractOrCopy();

        schemaPartition.setWrappedPartition( ldifPartition );

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

        // 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();

        schemaPartition.setSchemaManager( schemaManager );

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

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

        LOG.info( "Initializing ..." );
        super.init( ds );
       
        this.ds = ds;
        OidRegistry oidRegistry = ds.getSchemaManager().getGlobalOidRegistry();
        SchemaManager schemaManager = ds.getSchemaManager();
        NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager );
        filterNormalizer = new FilterNormalizingVisitor( ncn, schemaManager );
        evaluator = new ExpressionEvaluator( oidRegistry, schemaManager );
        executor = new ThreadPoolExecutor( 1, 10, 1000, TimeUnit.MILLISECONDS,
            new ArrayBlockingQueue<Runnable>( 100 ) );
View Full Code Here

     * @param directoryService the context factory configuration for the server
     * @throws NamingException if initialization fails
     */
    public TupleCache( CoreSession session ) throws Exception
    {
        SchemaManager schemaManager = session.getDirectoryService().getSchemaManager();
        this.nexus = session.getDirectoryService().getPartitionNexus();
        NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager );
        aciParser = new ACIItemParser( ncn, schemaManager.getNormalizerMapping() );
        prescriptiveAciAT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.PRESCRIPTIVE_ACI_AT );
        initialize( session );
    }
View Full Code Here

        for ( Modification mod:mods )
        {
            newModsList.add( mod );
        }
       
        SchemaManager schemaManager = modContext.getSession()
            .getDirectoryService().getSchemaManager();

        // Add our modification items.
        newModsList.add(
            new ServerModification(
                ModificationOperation.REPLACE_ATTRIBUTE,
                new DefaultServerAttribute(
                    KerberosAttribute.KRB5_PRINCIPAL_NAME_AT,
                    schemaManager.lookupAttributeTypeRegistry( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ),
                    principalName ) ) );
        newModsList.add(
            new ServerModification(
                ModificationOperation.REPLACE_ATTRIBUTE,
                new DefaultServerAttribute(
                    KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT,
                    schemaManager.lookupAttributeTypeRegistry( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ),
                    Integer.toString( kvno ) ) ) );
       
        EntryAttribute attribute = getKeyAttribute( modContext.getSession()
            .getDirectoryService().getSchemaManager(), keys );
        newModsList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute ) );
View Full Code Here

        if ( request.getDerefAliases() != previousSearchRequest.getDerefAliases() )
        {
            return false;
        }
       
        SchemaManager schemaManager =
            session.getLdapServer().getDirectoryService().getSchemaManager();

        // Compares the attributes
        if ( request.getAttributes() == null )
        {
            if ( previousSearchRequest.getAttributes() != null )
            {
                return false;
            }
        }
        else
        {
            if ( previousSearchRequest.getAttributes() == null )
            {
                return false;
            }
            else
            {
                // We have to normalize the attributes in order to compare them
                if ( request.getAttributes().size() != previousSearchRequest.getAttributes().size() )
                {
                    return false;
                }
               
                // Build the set of attributeType from both requests
                Set<String> requestSet = buildAttributeSet( request, session, schemaManager );
                Set<String> previousRequestSet = buildAttributeSet( previousSearchRequest, session, schemaManager );
               
                // Check that both sets have the same size again after having converted
                // the attributes to OID
                if ( requestSet.size() != previousRequestSet.size() )
                {
                    return false;
                }
               
                for ( String attribute:requestSet )
                {
                    previousRequestSet.remove( attribute );
                }
               
                // The other set must be empty
                if ( !previousRequestSet.isEmpty() )
                {
                    return false;
                }
            }
        }
       
        // Compare the baseDN
        try
        {
            request.getBase().normalize( schemaManager.getNormalizerMapping() );
           
            if ( !previousSearchRequest.getBase().isNormalized() )
            {
                previousSearchRequest.getBase().normalize( schemaManager.getNormalizerMapping() );
            }
           
            if ( !request.getBase().equals( previousSearchRequest.getBase() ) )
            {
                return false;
View Full Code Here

     * @throws NamingException with problems initializing cache
     */
    public TriggerSpecCache( DirectoryService directoryService ) throws Exception
    {
        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

TOP

Related Classes of org.apache.directory.shared.ldap.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.