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

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


                "objectClass: referral\n" +
                "objectClass: extensibleObject\n" +
                "c: america\n" +
                "ref: ldap://localhost:52489/c=usa,ou=system\n\n";
   
        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


                "objectClass: referral\n" +
                "objectClass: extensibleObject\n" +
                "c: america\n" +
                "ref: ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system\n\n";

        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();
    }
View Full Code Here

                if ( contextEntry == null )
                {
                    if ( contextEntryFile.exists() )
                    {
                        LdifReader reader = new LdifReader( contextEntryFile );
                        contextEntry = new DefaultEntry( schemaManager, reader.next().getEntry() );
                        reader.close();
                    }
                    else
                    {
                        // No context entry and no LDIF file exists.
                        // Skip initialization of context entry here, it will be added later.
View Full Code Here

        // First, load the entries
        File[] entries = entryDir.listFiles( entryFilter );

        if ( ( entries != null ) && ( entries.length != 0 ) )
        {
            LdifReader ldifReader = new LdifReader();

            for ( File entry : entries )
            {
                LOG.debug( "parsing ldif file {}", entry.getName() );
                List<LdifEntry> ldifEntries = ldifReader.parseLdifFile( entry.getAbsolutePath() );
                ldifReader.close();

                if ( ( ldifEntries != null ) && !ldifEntries.isEmpty() )
                {
                    // this ldif will have only one entry
                    LdifEntry ldifEntry = ldifEntries.get( 0 );
View Full Code Here

                "objectClass: referral\n" +
                "objectClass: extensibleObject\n" +
                "c: america\n" +
                "ref: ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system\n\n";

        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();
    }
View Full Code Here

                "objectClass: referral\n" +
                "objectClass: extensibleObject\n" +
                "c: america\n" +
                "ref: ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system\n\n";

        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();
    }
View Full Code Here

                    throw new FileNotFoundException( "LDIF file '" + ldifFile
                        + "' not found." );
                }
                else
                {
                    LdifReader ldifReader = new LdifReader( is );

                    for ( LdifEntry entry : ldifReader )
                    {
                        injectEntry( entry, service );
                    }

                    ldifReader.close();
                }
            }
        }
    }
View Full Code Here

     *             if there is a problem adding the entries from the LDIF
     */
    public static void injectEntries( DirectoryService service, String ldif )
        throws Exception
    {
        LdifReader reader = new LdifReader();
        List<LdifEntry> entries = reader.parseLdif( ldif );

        for ( LdifEntry entry : entries )
        {
            injectEntry( entry, service );
        }

        // And close the reader
        reader.close();
    }
View Full Code Here

    {
        try
        {
            if ( reader == null )
            {
                reader = new LdifReader( in );
            }
        }
        catch ( Exception e )
        {
            String msg = "Failed to open the LDIF input stream";
View Full Code Here

        // Creating the config writer
        ConfigWriter configWriter = new ConfigWriter( schemaManager, configBean );

        // Reading the original config file
        LdifReader ldifReader = new LdifReader( configFile );
        List<LdifEntry> originalConfigEntries = new ArrayList<LdifEntry>();

        while ( ldifReader.hasNext() )
        {
            originalConfigEntries.add( ldifReader.next() );
        }

        ldifReader.close();

        // Getting the list of entries of generated config
        List<LdifEntry> generatedConfigEntries = configWriter.getConvertedLdifEntries();

        // Comparing the number of entries
View Full Code Here

TOP

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

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.