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

Examples of org.apache.directory.api.ldap.model.ldif.LdifEntry


    LdifReader reader = new LdifReader( new StringReader( ldif ) );

    while ( reader.hasNext() )
    {
        LdifEntry entry = reader.next();
        getLdapServer().getDirectoryService().getAdminSession().add(
            new DefaultEntry( getLdapServer().getDirectoryService().getSchemaManager(), entry.getEntry() ) );
    }

    reader.close();

    connection = ( LdapNetworkConnection ) LdapApiIntegrationUtils.getPooledAdminConnection( getLdapServer() );
View Full Code Here


        final Map<String, Boolean> resMap = ResourceMap.getResources(Pattern.compile("schema[/\\Q\\\\E]ou=schema.*"));
        for (String resourcePath : new TreeSet<String>(resMap.keySet())) {
            if (resourcePath.endsWith(".ldif")) {
                URL resource = DefaultSchemaLdifExtractor.getUniqueResource(resourcePath, "Schema LDIF file");
                LdifReader reader = new LdifReader(resource.openStream());
                LdifEntry ldifEntry = reader.next();
                reader.close();

                Entry entry = new DefaultEntry(schemaManager, ldifEntry.getEntry());
                // add mandatory attributes
                if (entry.get(SchemaConstants.ENTRY_CSN_AT) == null) {
                    entry.add(SchemaConstants.ENTRY_CSN_AT, defaultCSNFactory.newInstance().toString());
                }
                if (entry.get(SchemaConstants.ENTRY_UUID_AT) == null) {
View Full Code Here

                entry.add( SchemaConstants.DC_AT, rdn.getValue() );
            }

            entry.add( rdn.getType(), rdn.getValue() );

            LdifEntry ldifEntry = new LdifEntry( entry );

            return ldifEntry.toString();
        }
        catch ( Exception e )
        {
            return null;
        }
View Full Code Here

            input.setJdbmPartitionOptimizerEnabled( enableOptimizerCheckbox.getSelection() );
            input.setPartitionSyncOnWrite( synchOnWriteCheckbox.getSelection() );

            if ( contextEntry.size() > 0 )
            {
                LdifEntry ldifEntry = new LdifEntry( contextEntry );
                ldifEntry.setDn( input.getPartitionSuffix() );
                input.setContextEntry( ldifEntry.toString() );
            }
            else
            {
                input.setContextEntry( null );
            }
View Full Code Here

        reader.close();

        assertEquals( 1, reader.getVersion() );
        assertNotNull( entries );

        LdifEntry entry = entries.get( 0 );

        assertTrue( entry.isLdifContent() );

        assertEquals( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", entry.getDn().getName() );

        Attribute attr = entry.get( "displayname" );
        assertTrue( attr.contains( "app1" ) );
    }
View Full Code Here

        List<LdifEntry> entries = reader.parseLdif( ldif );
        reader.close();

        assertNotNull( entries );

        LdifEntry entry = entries.get( 0 );

        assertTrue( entry.isLdifContent() );

        assertEquals( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", entry.getDn().getName() );

        Attribute attr = entry.get( "displayname" );
        assertTrue( attr.contains( "app1" ) );

    }
View Full Code Here

        List<LdifEntry> entries = reader.parseLdif( ldif );
        assertNotNull( entries );
        reader.close();

        LdifEntry entry = entries.get( 0 );

        assertTrue( entry.isChangeModify() );

        assertEquals( "dc=example,dc=com", entry.getDn().getName() );

        List<Modification> mods = entry.getModifications();
        assertTrue( mods.size() == 1 );
        Attribute attr = mods.get( 0 ).getAttribute();
        assertTrue( attr.getId().equals( "administrativerole" ) );
        assertEquals( attr.getString(), "accessControlSpecificArea" );
    }
View Full Code Here

        List<LdifEntry> entries = reader.parseLdif( ldif );
        reader.close();

        assertNotNull( entries );

        LdifEntry entry = entries.get( 0 );
        assertTrue( entry.isLdifContent() );

        assertEquals( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", entry.getDn().getName() );

        Attribute attr = entry.get( "cn" );
        assertTrue( attr.contains( "app1" ) );

        attr = entry.get( "objectclass" );
        assertTrue( attr.contains( "top" ) );
        assertTrue( attr.contains( "apApplication" ) );

        attr = entry.get( "displayname" );
        assertTrue( attr.contains( "app1" ) );

        attr = entry.get( "dependencies" );
        assertNull( attr.get().getValue() );

        attr = entry.get( "envvars" );
        assertNull( attr.get().getValue() );
    }
View Full Code Here

        List<LdifEntry> entries = reader.parseLdif( ldif );
        reader.close();

        assertNotNull( entries );

        LdifEntry entry = entries.get( 0 );
        assertTrue( entry.isLdifContent() );

        assertEquals( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", entry.getDn().getName() );

        Attribute attr = entry.get( "cn" );
        assertTrue( attr.contains( "app1#another comment" ) );

        attr = entry.get( "objectclass" );
        assertTrue( attr.contains( "top" ) );
        assertTrue( attr.contains( "apApplication" ) );

        attr = entry.get( "displayname" );
        assertTrue( attr.contains( "app1" ) );

        attr = entry.get( "dependencies" );
        assertNull( attr.get().getValue() );

        attr = entry.get( "envvars" );
        assertNull( attr.get().getValue() );
    }
View Full Code Here

        List<LdifEntry> entries = reader.parseLdif( ldif );
        reader.close();

        assertNotNull( entries );

        LdifEntry entry = entries.get( 0 );
        assertTrue( entry.isLdifContent() );

        assertEquals( "cn=app1,ou=applications,ou=conf,dc=apache,dc=org", entry.getDn().getName() );

        Attribute attr = entry.get( "cn" );
        assertTrue( attr.contains( "app1#another comment" ) );

        attr = entry.get( "objectclass" );
        assertTrue( attr.contains( "top" ) );
        assertTrue( attr.contains( "apApplication" ) );

        attr = entry.get( "displayname" );
        assertTrue( attr.contains( "app1" ) );

        attr = entry.get( "dependencies" );
        assertNull( attr.get().getValue() );

        attr = entry.get( "envvars" );
        assertNull( attr.get().getValue() );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.ldif.LdifEntry

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.