Package org.apache.directory.server.core.interceptor.context

Examples of org.apache.directory.server.core.interceptor.context.AddOperationContext


        ctxEntry.put( "objectClass", "top" );
        ctxEntry.get( "objectClass" ).add( "organizationalUnit" );
        ctxEntry.put( "ou", "removable" );
        ctxEntry.put( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
        ctxEntry.put( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
        partition.add( new AddOperationContext( service.getAdminSession(), ctxEntry ) );
       
        Hashtable<String,Object> env = new Hashtable<String,Object>();
        env.put( Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName() );
        env.put( DirectoryService.JNDI_KEY, service );
        env.put( Context.SECURITY_CREDENTIALS, "secret" );
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public void add( ServerEntry entry, LogChange log ) throws Exception
    {
        AddOperationContext opContext = new AddOperationContext( this, entry );

        opContext.setLogChange( log );
       
        OperationManager operationManager = directoryService.getOperationManager();
        operationManager.add( opContext );
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void add( ServerEntry entry, boolean ignoreReferral, LogChange log ) throws Exception
    {
        AddOperationContext opContext = new AddOperationContext( this, entry );

        opContext.setLogChange( log );
        setReferralHandling( opContext, ignoreReferral );
       
        OperationManager operationManager = directoryService.getOperationManager();
        operationManager.add( opContext );
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void add( InternalAddRequest addRequest, LogChange log ) throws Exception
    {
        AddOperationContext opContext = new AddOperationContext( this, addRequest );

        opContext.setLogChange( log );
       
        OperationManager operationManager = directoryService.getOperationManager();
        operationManager.add( opContext );
        addRequest.getResultResponse().addAll( opContext.getResponseControls() );
    }
View Full Code Here

            NamespaceTools.getRdnValue( ServerDNConstants.SYSTEM_DN ) );
        LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
        adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
        CoreSession adminSession = new DefaultCoreSession(
            new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
        AddOperationContext addOperationContext = new AddOperationContext( adminSession, systemEntry );
       
        if ( !system.hasEntry( new EntryOperationContext( adminSession, systemEntry.getDn() ) ) )
        {
            system.add( addOperationContext );
        }
View Full Code Here

        ctxEntry.put( "objectClass", "top" );
        ctxEntry.get( "objectClass" ).add( "organizationalUnit" );
        ctxEntry.put( "ou", "removable" );
        ctxEntry.put( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
        ctxEntry.put( "entryUUID", UUID.randomUUID().toString() );
        partition.add( new AddOperationContext( service.getAdminSession(), ctxEntry ) );
       
        Hashtable<String,Object> env = new Hashtable<String,Object>();
        env.put( Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName() );
        env.put( DirectoryService.JNDI_KEY, service );
        env.put( Context.SECURITY_CREDENTIALS, "secret" );
View Full Code Here

    public void testControlCharacters() throws Exception
    {
        Dn adminDn = new Dn( schemaManager, "uid=admin,ou=system" );
        CoreSession session = new MockCoreSession( new LdapPrincipal( schemaManager, adminDn, AuthenticationLevel.STRONG ),
            new MockDirectoryService( 1 ) );
        AddOperationContext addCtx = new AddOperationContext( session );

        String rdnWithControlChars = "userPassword=-\u0000-\u0001-\u0002-\u0003-\u0004-\u0005-\u0006-\u0007" +
                "-\u0008-\u0009-\n-\u000B-\u000C-\r-\u000E-\u000F" +
                "-\u0010-\u0011-\u0012-\u0013-\u0014-\u0015-\u0016-\u0017" +
                "-\u0018-\u0019-\u001A-\u001B-\u001C-\u001D-\u001E-\u001F" +
                "-\u007F";

        String rdnWithEscapedChars = "userpassword=-%00-%01-%02-%03-%04-%05-%06-%07-%08-%09-%0a-%0b-%0c-%0d-%0e-%0f" +
                "-%10-%11-%12-%13-%14-%15-%16-%17-%18-%19-%1a-%1b-%1c-%1d-%1e-%1f-%7f";

        ClonedServerEntry entry1 = createEntry( rdnWithControlChars + ",ou=test,ou=system" );
        entry1.put( "objectClass", "top", "person" );
        entry1.put( "cn", "test" );
        entry1.put( "sn", "test" );
        addCtx.setEntry( entry1 );

        partition.add( addCtx );

        assertTrue( new File( wkdir, "ou=test,ou=system" ).exists() );
        assertTrue( new File( wkdir, "ou=test,ou=system.ldif" ).exists() );
View Full Code Here

            ldifReader.close();

            // inject the entry
            Entry entry = new DefaultEntry( schemaManager, ldifEntry.getEntry() );
            AddOperationContext addContext = new AddOperationContext( null, entry );
            partition.add( addContext );
        }
        catch ( LdapLdifException ne )
        {
            String msg = I18n.err( I18n.ERR_08004, source, ne.getLocalizedMessage() );
View Full Code Here

    private CoreSession injectEntries() throws Exception
    {
        Dn adminDn = new Dn( schemaManager, "uid=admin,ou=system" );
        CoreSession session = new MockCoreSession( new LdapPrincipal( schemaManager, adminDn, AuthenticationLevel.STRONG ),
            new MockDirectoryService( 1 ) );
        AddOperationContext addCtx = new AddOperationContext( session );

        ClonedServerEntry childEntry1 = createEntry( "dc=child1,ou=test,ou=system" );
        childEntry1.put( "ObjectClass", "top", "domain" );
        childEntry1.put( "dc", "child1" );
        addCtx.setEntry( childEntry1 );

        partition.add( addCtx );

        ClonedServerEntry childEntry2 = createEntry( "dc=child2,ou=test,ou=system" );
        childEntry2.put( "ObjectClass", "top", "domain" );
        childEntry2.put( "dc", "child2" );
        addCtx.setEntry( childEntry2 );

        partition.add( addCtx );

        ClonedServerEntry grandChild11 = createEntry( "dc=grandChild11,dc=child1,ou=test,ou=system" );
        grandChild11.put( "ObjectClass", "top", "domain" );
        grandChild11.put( "dc", "grandChild11" );
        addCtx.setEntry( grandChild11 );

        partition.add( addCtx );

        ClonedServerEntry grandChild12 = createEntry( "dc=grandChild12,dc=child1,ou=test,ou=system" );
        grandChild12.put( "ObjectClass", "top", "domain" );
        grandChild12.put( "dc", "grandChild12" );
        addCtx.setEntry( grandChild12 );

        partition.add( addCtx );

        ClonedServerEntry greatGrandChild111 = createEntry( "dc=greatGrandChild111,dc=grandChild11,dc=child1,ou=test,ou=system" );
        greatGrandChild111.put( "ObjectClass", "top", "domain" );
        greatGrandChild111.put( "dc", "greatGrandChild111" );
        addCtx.setEntry( greatGrandChild111 );

        partition.add( addCtx );

        assertTrue( new File( wkdir, "ou=test,ou=system" ).exists() );
        assertTrue( new File( wkdir, "ou=test,ou=system.ldif" ).exists() );
View Full Code Here

    @Test
    public void testAddContextEntry() throws Exception
    {
        SingleFileLdifPartition partition = createPartition( null, true );
        AddOperationContext addCtx = new AddOperationContext( mockSession );
        addCtx.setEntry( contextEntry );

        partition.add( addCtx );

        Long id = partition.getEntryId( contextEntry.getDn() );
        assertNotNull( id );
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.interceptor.context.AddOperationContext

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.