Package org.apache.ldap.common.ldif

Examples of org.apache.ldap.common.ldif.LdifParserImpl


    {
        list = new ArrayList();

        Attributes attributes = new LockableAttributesImpl();

        LdifParserImpl parser = new LdifParserImpl();

        try
        {
            parser.parse( attributes, LDIF );
        }
        catch ( NamingException e )
        {
            e.printStackTrace();
View Full Code Here


        env.putAll( sysRoot.getEnvironment() );

        LdapContext ctx = new InitialLdapContext( env, null );

        LdifParser parser = new LdifParserImpl();

        try
        {
            LdifIterator iterator = new LdifIterator( in );

            while ( iterator.hasNext() )
            {
                Attributes attributes = new LockableAttributesImpl();

                String ldif = ( String ) iterator.next();

                parser.parse( attributes, ldif );

                Name dn = new LdapName( ( String ) attributes.remove( "dn" ).get() );

                dn.remove( 0 );
View Full Code Here

        env.putAll( sysRoot.getEnvironment() );

        LdapContext ctx = new InitialLdapContext( env, null );

        LdifParser parser = new LdifParserImpl();

        try
        {
            LdifIterator iterator = new LdifIterator( in );

            while ( iterator.hasNext() )
            {
                Attributes attributes = new LockableAttributesImpl();

                String ldif = ( String ) iterator.next();

                parser.parse( attributes, ldif );

                Name dn = new LdapName( ( String ) attributes.remove( "dn" ).get() );

                dn.remove( 0 );
View Full Code Here

    public void doImport()
    {
        FileReader in = null;
        LdifIterator list = null;
        LdifParser parser = new LdifParserImpl();
        JFileChooser chooser = new JFileChooser();
        int choice = chooser.showOpenDialog( this );
        File selected = chooser.getSelectedFile();
       
        if ( JFileChooser.APPROVE_OPTION != choice )
        {
            return;
        }

        try
        {
            in = new FileReader( selected );
            list = new LdifIterator( in );
           
            while ( list.hasNext() )
            {
                String dif = ( String ) list.next();
                LockableAttributesImpl attrs = new LockableAttributesImpl();
                parser.parse( attrs, dif );
                String updn = ( String ) attrs.get( "dn" ).get();
                LdapName ndn =
                    new LdapName( StringTools.deepTrimToLower( updn ) );
                attrs.remove( "dn" );
View Full Code Here

    public void doImport()
    {
        FileReader in = null;
        LdifIterator list = null;
        LdifParser parser = new LdifParserImpl();
        JFileChooser chooser = new JFileChooser();
        int choice = chooser.showOpenDialog( this );
        File selected = chooser.getSelectedFile();
       
        if ( JFileChooser.APPROVE_OPTION != choice )
        {
            return;
        }

        try
        {
            in = new FileReader( selected );
            list = new LdifIterator( in );
           
            while ( list.hasNext() )
            {
                String dif = ( String ) list.next();
                LockableAttributesImpl attrs = new LockableAttributesImpl();
                parser.parse( attrs, dif );
                String updn = ( String ) attrs.get( "dn" ).get();
                LdapName ndn =
                    new LdapName( StringTools.deepTrimToLower( updn ) );
                attrs.remove( "dn" );
View Full Code Here

        {
            text = "";
        }

        Attributes attrs = new BasicAttributes( true );
        LdifParser parser = new LdifParserImpl();
        try
        {
            parser.parse( attrs, text.trim() );
            setValue( attrs );
        }
        catch( NamingException e )
        {
            throw ( IllegalArgumentException ) new IllegalArgumentException().initCause( e );
View Full Code Here

        // Add a single test entry
        // -------------------------------------------------------------------

        Attributes attributes = new LockableAttributesImpl();

        LdifParserImpl parser = new LdifParserImpl();

        try
        {
            parser.parse( attributes, LDIF );
        }
        catch ( NamingException e )
        {
            throw new NestableRuntimeException( e );
        }

        testEntries.add( attributes );

        // -------------------------------------------------------------------
        // Add more from an optional LDIF file if they exist
        // -------------------------------------------------------------------

        InputStream in = null;

        if ( loadClass == null && ldifPath != null )
        {
            File ldifFile = new File( ldifPath );

            if ( ldifFile.exists() )
            {
                in = new FileInputStream( ldifPath );
            }
            else
            {
                in = getClass().getResourceAsStream( ldifPath );
            }

            throw new FileNotFoundException( ldifPath );
        }
        else if ( loadClass != null && ldifPath != null )
        {
            in = loadClass.getResourceAsStream( ldifPath );
        }

        if ( in != null )
        {
            LdifIterator list = new LdifIterator( in );

            while ( list.hasNext() )
            {
                String ldif = ( String ) list.next();

                attributes = new LockableAttributesImpl();

                parser.parse( attributes, ldif );

                testEntries.add( attributes );
            }
        }
View Full Code Here

        env.putAll( sysRoot.getEnvironment() );

        LdapContext ctx = new InitialLdapContext( env, null );

        LdifParser parser = new LdifParserImpl();

        try
        {
            LdifIterator iterator = new LdifIterator( in );

            while ( iterator.hasNext() )
            {
                Attributes attributes = new LockableAttributesImpl();

                String ldif = ( String ) iterator.next();

                parser.parse( attributes, ldif );

                Name dn = new LdapName( ( String ) attributes.remove( "dn" ).get() );

                dn.remove( 0 );
View Full Code Here

    public void doImport()
    {
        FileReader in = null;
        LdifIterator list = null;
        LdifParser parser = new LdifParserImpl();
        JFileChooser chooser = new JFileChooser();
        int choice = chooser.showOpenDialog( this );
        File selected = chooser.getSelectedFile();
       
        if ( JFileChooser.APPROVE_OPTION != choice )
        {
            return;
        }

        try
        {
            in = new FileReader( selected );
            list = new LdifIterator( in );
           
            while ( list.hasNext() )
            {
                String dif = ( String ) list.next();
                LockableAttributesImpl attrs = new LockableAttributesImpl();
                parser.parse( attrs, dif );
                String updn = ( String ) attrs.get( "dn" ).get();
                LdapName ndn =
                    new LdapName( StringTools.deepTrimToLower( updn ) );
                attrs.remove( "dn" );
View Full Code Here

        {
            text = "";
        }

        Attributes attrs = new BasicAttributes( true );
        LdifParser parser = new LdifParserImpl();
        try
        {
            parser.parse( attrs, text.trim() );
            setValue( attrs );
        }
        catch( NamingException e )
        {
            throw ( IllegalArgumentException ) new IllegalArgumentException().initCause( e );
View Full Code Here

TOP

Related Classes of org.apache.ldap.common.ldif.LdifParserImpl

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.