Package org.apache.directory.shared.ldap.codec.util

Examples of org.apache.directory.shared.ldap.codec.util.LdapURL


                        {
                            ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo );
                            UrlAndDn urlAndDn = newReferralsInfo.getNext();
                            if ( urlAndDn != null )
                            {
                                LdapURL url = urlAndDn.getUrl();
                                Connection referralConnection = getReferralConnection( url, monitor, this );
                                if ( referralConnection != null )
                                {
                                    String referralSearchBase = url.getDn() != null && !url.getDn().isEmpty() ? url
                                        .getDn().getUpName() : searchBase;
                                    String referralFilter = url.getFilter() != null && url.getFilter().length() == 0 ? url
                                        .getFilter()
                                        : filter;
                                    SearchControls referralSearchControls = new SearchControls();
                                    referralSearchControls.setSearchScope( url.getScope() > -1 ? url.getScope()
                                        : searchControls.getSearchScope() );
                                    referralSearchControls.setReturningAttributes( url.getAttributes() != null
                                        && url.getAttributes().size() > 0 ? url.getAttributes().toArray(
                                        new String[url.getAttributes().size()] ) : searchControls
                                        .getReturningAttributes() );
                                    referralSearchControls.setCountLimit( searchControls.getCountLimit() );
                                    referralSearchControls.setTimeLimit( searchControls.getTimeLimit() );
                                    referralSearchControls.setDerefLinkFlag( searchControls.getDerefLinkFlag() );
                                    referralSearchControls.setReturningObjFlag( searchControls.getReturningObjFlag() );
View Full Code Here


        try
        {
            String info = ( String ) referralException.getReferralInfo();
            String name = referralException.getRemainingName().toString();
            LdapURL url = new LdapURL( info );
            LdapDN dn = new LdapDN( name );
            initialReferralsInfo.addReferralUrl( url, dn );
        }
        catch ( LdapURLEncodingException e )
        {
        }

        while ( referralException.skipReferral() )
        {
            try
            {
                Context ctx = referralException.getReferralContext();
                ctx.list( "" ); //$NON-NLS-1$
            }
            catch ( NamingException ne )
            {
                if ( ne instanceof ReferralException )
                {
                    referralException = ( ReferralException ) ne;
                    try
                    {
                        String info = ( String ) referralException.getReferralInfo();
                        String name = referralException.getRemainingName().toString();
                        LdapURL url = new LdapURL( info );
                        LdapDN dn = new LdapDN( name );
                        initialReferralsInfo.addReferralUrl( url, dn );
                    }
                    catch ( LdapURLEncodingException e )
                    {
View Full Code Here

        assertEquals( 1, references.size() );

        try
        {
            assertEquals( new LdapURL( "ldap://localhost" ).toString(), references.get( 0 ).toString() );
        }
        catch ( LdapURLEncodingException e )
        {
            fail();
        }
View Full Code Here

        assertEquals( 2, references.size() );

        try
        {
            assertEquals( new LdapURL( "ldap://localhost" ).toString(), references.get( 0 ).toString() );
        }
        catch ( LdapURLEncodingException e )
        {
            fail();
        }

        try
        {
            assertEquals( new LdapURL( "ldap://www.apache.org" ).toString(), references.get( 1 ).toString() );
        }
        catch ( LdapURLEncodingException e )
        {
            fail();
        }
View Full Code Here

                {
                    referralsInfo = JNDIConnectionWrapper.handleReferralException( re, referralsInfo );
                    UrlAndDn urlAndDn = referralsInfo.getNext();
                    if ( urlAndDn != null )
                    {
                        LdapURL url = urlAndDn.getUrl();
                        Connection referralConnection = JNDIConnectionWrapper
                            .getReferralConnection( url, monitor, this );
                        if ( referralConnection != null )
                        {
                            String referralSearchBase = url.getDn() != null && !url.getDn().isEmpty() ? url.getDn()
                                .getUpName() : searchBase;
                            String referralFilter = url.getFilter() != null && url.getFilter().length() == 0 ? url
                                .getFilter() : filter;
                            SearchControls referralSearchControls = new SearchControls();
                            referralSearchControls.setSearchScope( url.getScope() > -1 ? url.getScope()
                                : searchControls.getSearchScope() );
                            referralSearchControls.setReturningAttributes( url.getAttributes() != null
                                && url.getAttributes().size() > 0 ? url.getAttributes().toArray(
                                new String[url.getAttributes().size()] ) : searchControls.getReturningAttributes() );
                            referralSearchControls.setCountLimit( searchControls.getCountLimit() );
                            referralSearchControls.setTimeLimit( searchControls.getTimeLimit() );
                            referralSearchControls.setDerefLinkFlag( searchControls.getDerefLinkFlag() );
                            referralSearchControls.setReturningObjFlag( searchControls.getReturningObjFlag() );
View Full Code Here

                        {
                            ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo );
                            UrlAndDn urlAndDn = newReferralsInfo.getNext();
                            if ( urlAndDn != null )
                            {
                                LdapURL url = urlAndDn.getUrl();
                                Connection referralConnection = getReferralConnection( url, monitor, this );
                                if ( referralConnection != null )
                                {
                                    String referralSearchBase = url.getDn() != null && !url.getDn().isEmpty() ? url
                                        .getDn().getUpName() : searchBase;
                                    String referralFilter = url.getFilter() != null && url.getFilter().length() == 0 ? url
                                        .getFilter()
                                        : filter;
                                    SearchControls referralSearchControls = new SearchControls();
                                    referralSearchControls.setSearchScope( url.getScope() > -1 ? url.getScope()
                                        : searchControls.getSearchScope() );
                                    referralSearchControls.setReturningAttributes( url.getAttributes() != null
                                        && url.getAttributes().size() > 0 ? url.getAttributes().toArray(
                                        new String[url.getAttributes().size()] ) : searchControls
                                        .getReturningAttributes() );
                                    referralSearchControls.setCountLimit( searchControls.getCountLimit() );
                                    referralSearchControls.setTimeLimit( searchControls.getTimeLimit() );
                                    referralSearchControls.setDerefLinkFlag( searchControls.getDerefLinkFlag() );
                                    referralSearchControls.setReturningObjFlag( searchControls.getReturningObjFlag() );
View Full Code Here

        try
        {
            String info = ( String ) referralException.getReferralInfo();
            String name = referralException.getRemainingName().toString();
            LdapURL url = new LdapURL( info );
            LdapDN dn = new LdapDN( name );
            initialReferralsInfo.addReferralUrl( url, dn );
        }
        catch ( LdapURLEncodingException e )
        {
        }

        while ( referralException.skipReferral() )
        {
            try
            {
                Context ctx = referralException.getReferralContext();
                ctx.list( "" ); //$NON-NLS-1$
            }
            catch ( NamingException ne )
            {
                if ( ne instanceof ReferralException )
                {
                    referralException = ( ReferralException ) ne;
                    try
                    {
                        String info = ( String ) referralException.getReferralInfo();
                        String name = referralException.getRemainingName().toString();
                        LdapURL url = new LdapURL( info );
                        LdapDN dn = new LdapDN( name );
                        initialReferralsInfo.addReferralUrl( url, dn );
                    }
                    catch ( LdapURLEncodingException e )
                    {
View Full Code Here

        {
            Connection[] connections = ConnectionCorePlugin.getDefault().getConnectionManager().getConnections();
            for ( int i = 0; i < connections.length; i++ )
            {
                Connection connection = connections[i];
                LdapURL connectionUrl = connection.getUrl();
                if ( connectionUrl != null && referralUrl.toString().startsWith( connectionUrl.toString() ) )
                {
                    mainWidget.getViewer().reveal( connection );
                    mainWidget.getViewer().setSelection( new StructuredSelection( connection ), true );
                }
            }
View Full Code Here

     * @return the LDAP URL
     */
    public LdapURL getUrl()
    {
        String s = "ldap://" + getHost() + ":" + getPort();
        LdapURL url = null;
        try
        {
            url = new LdapURL( s );
        }
        catch ( LdapURLEncodingException e )
        {
        }
        return url;
View Full Code Here

            : aliasesDereferencingMethod == AliasDereferencingMethod.FINDING ? "derefFindingBaseObj (2)"
                : aliasesDereferencingMethod == AliasDereferencingMethod.SEARCH ? "derefInSearching (1)"
                    : "neverDerefAliases (0)";

        // build LDAP URL
        LdapURL url = Utils.getLdapURL( connection, searchBase, searchControls.getSearchScope(), filter, searchControls
            .getReturningAttributes() );

        // build command line
        String cmdLine = Utils.getLdapSearchCommandLine( connection, searchBase, searchControls.getSearchScope(),
            aliasesDereferencingMethod, searchControls.getCountLimit(), searchControls.getTimeLimit(), filter,
            searchControls.getReturningAttributes() );

        // build
        Collection<LdifLineBase> lines = new ArrayList<LdifLineBase>();
        lines.add( LdifCommentLine.create( "# LDAP URL     : " + url.toString() ) );
        lines.add( LdifCommentLine.create( "# command line : " + cmdLine.toString() ) );
        lines.add( LdifCommentLine.create( "# baseObject   : " + searchBase ) );
        lines.add( LdifCommentLine.create( "# scope        : " + scopeAsString ) );
        lines.add( LdifCommentLine.create( "# derefAliases : " + aliasAsString ) );
        lines.add( LdifCommentLine.create( "# sizeLimit    : " + searchControls.getTimeLimit() ) );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.codec.util.LdapURL

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.