Package org.apache.directory.ldap.client.template

Examples of org.apache.directory.ldap.client.template.LdapConnectionTemplate


                        && classCreateLdapConnectionPoolRule.getLdapServer() != ldapServer )
                    {
                        LOG.trace( "Creating connection pool to new ldap server" );

                        LdapConnectionPool oldLdapConnectionPool = ldapConnectionPool;
                        LdapConnectionTemplate oldLdapConnectionTemplate = ldapConnectionTemplate;

                        ldapConnectionPool = classCreateLdapConnectionPoolRule
                            .createLdapConnectionPool( ldapServer );
                        ldapConnectionTemplate = new LdapConnectionTemplate( ldapConnectionPool );

                        try
                        {
                            base.evaluate();
                        }
                        finally
                        {
                            LOG.trace( "Reverting to old connection pool" );
                            ldapConnectionPool = oldLdapConnectionPool;
                            ldapConnectionTemplate = oldLdapConnectionTemplate;
                        }
                    }
                    else
                    {
                        LOG.trace( "no @CreateLdapConnectionPool on: {}", description );
                        base.evaluate();
                    }
                }
            };
        }
        else
        {
            return new Statement()
            {
                @Override
                public void evaluate() throws Throwable
                {
                    LOG.trace( "Creating ldap connection pool" );
                    ldapConnectionPool = createLdapConnectionPool( getLdapServer() );
                    ldapConnectionTemplate = new LdapConnectionTemplate( ldapConnectionPool );

                    try
                    {
                        base.evaluate();
                    }
View Full Code Here


   
    @Test
    public void testLdapConnectionTemplate()
    {
        LOG.trace( "checking ldap connection template" );
        LdapConnectionTemplate ldapConnectionTemplate =
            createLdapConnectionPoolRule.getLdapConnectionTemplate();
        assertNotNull( ldapConnectionTemplate );
       
        ldapConnectionTemplate.execute(
            new ConnectionCallback<Object>()
            {
                @Override
                public Object doWithConnection( LdapConnection connection ) throws LdapException
                {
View Full Code Here

TOP

Related Classes of org.apache.directory.ldap.client.template.LdapConnectionTemplate

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.