Examples of Referral


Examples of org.apache.directory.shared.ldap.model.message.Referral

        // Get the Value and store it in the BindRequest
        TLV tlv = container.getCurrentTLV();

        // Get the referral, or create it if not existing
        Referral referral = searchResultReference.getReferral();

        if ( referral == null )
        {
            referral = new ReferralImpl();
            searchResultReference.setReferral( referral );
        }

        // We have to handle the special case of a 0 length list of referrals
        LdapURL url = LdapURL.EMPTY_URL;

        if ( tlv.getLength() == 0 )
        {
            referral.addLdapUrl( "" );
        }
        else
        {
            String urlStr = Strings.utf8ToString(tlv.getValue().getData());

            try
            {
                url = new LdapURL( urlStr );
                referral.addLdapUrl( urlStr );
            }
            catch ( LdapURLEncodingException luee )
            {
                LOG.error( I18n.err( I18n.ERR_04021, urlStr, luee.getMessage() ) );
                throw new DecoderException( I18n.err( I18n.ERR_04016, luee.getMessage() ) );
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.message.Referral

                }

                // if we get here then we have a valid referral ancestor
                try
                {
                    Referral referral = getReferralOnAncestorForSearch( session, req, referralAncestor );

                    result.setResultCode( ResultCodeEnum.REFERRAL );
                    result.setReferral( referral );
                    session.getIoSession().write( req.getResultResponse() );
                }
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.message.Referral

        Entry referralAncestor ) throws Exception
    {
        LOG.debug( "Inside getReferralOnAncestor()" );

        Attribute refAttr = ((ClonedServerEntry)referralAncestor).getOriginalEntry().get( SchemaConstants.REF_AT );
        Referral referral = new ReferralImpl();

        for ( Value<?> value : refAttr )
        {
            String ref = value.getString();

            LOG.debug( "Calculating LdapURL for referrence value {}", ref );

            // need to add non-ldap URLs as-is
            if ( !ref.startsWith( "ldap" ) )
            {
                referral.addLdapUrl( ref );
                continue;
            }

            // Parse the ref value
            LdapUrl ldapUrl = null;
           
            try
            {
                ldapUrl = new LdapUrl( ref );
            }
            catch ( LdapURLEncodingException e )
            {
                LOG.error( I18n.err( I18n.ERR_165, ref, referralAncestor ) );
            }

            // Normalize the Dn to check for same dn
            Dn urlDn = new Dn( session.getCoreSession().getDirectoryService()
                .getSchemaManager(), ldapUrl.getDn().getName() );

            if ( urlDn.getNormName().equals( req.getBase().getNormName() ) )
            {
                ldapUrl.setForceScopeRendering( true );
                ldapUrl.setAttributes( req.getAttributes() );
                ldapUrl.setScope( req.getScope().getScope() );
                referral.addLdapUrl( ldapUrl.toString() );
                continue;
            }

            /*
             * If we get here then the Dn of the referral was not the same as the
             * Dn of the ref LDAP URL.  We must calculate the remaining (difference)
             * name past the farthest referral Dn which the target name extends.
             */
            Dn suffix = req.getBase().getDescendantOf( referralAncestor.getDn() );
            Dn refDn = urlDn.add( suffix );
           
            ldapUrl.setDn( refDn );
            ldapUrl.setForceScopeRendering( true );
            ldapUrl.setAttributes( req.getAttributes() );
            ldapUrl.setScope( req.getScope().getScope() );
            referral.addLdapUrl( ldapUrl.toString() );
        }

        return referral;
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.model.message.Referral

        Entry referralAncestor ) throws Exception
    {
        LOG.debug( "Inside getReferralOnAncestor()" );

        Attribute refAttr = ((ClonedServerEntry)referralAncestor).getOriginalEntry().get( SchemaConstants.REF_AT );
        Referral referral = new ReferralImpl();

        for ( Value<?> value : refAttr )
        {
            String ref = value.getString();

            LOG.debug( "Calculating LdapURL for referrence value {}", ref );

            // need to add non-ldap URLs as-is
            if ( !ref.startsWith( "ldap" ) )
            {
                referral.addLdapUrl( ref );
                continue;
            }

            // parse the ref value and normalize the Dn
            LdapUrl ldapUrl = null;
           
            try
            {
                ldapUrl = new LdapUrl( ref );
            }
            catch ( LdapURLEncodingException e )
            {
                LOG.error( I18n.err( I18n.ERR_165, ref, referralAncestor ) );
            }

            Dn urlDn = new Dn( session.getCoreSession().getDirectoryService()
                .getSchemaManager(), ldapUrl.getDn().getName() );

            if ( urlDn.getNormName().equals( referralAncestor.getDn().getNormName() ) )
            {
                // according to the protocol there is no need for the dn since it is the same as this request
                StringBuilder buf = new StringBuilder();
                buf.append( ldapUrl.getScheme() );
                buf.append( ldapUrl.getHost() );

                if ( ldapUrl.getPort() > 0 )
                {
                    buf.append( ":" );
                    buf.append( ldapUrl.getPort() );
                }

                referral.addLdapUrl( buf.toString() );
                continue;
            }

            /*
             * If we get here then the Dn of the referral was not the same as the
             * Dn of the ref LDAP URL.  We must calculate the remaining (difference)
             * name past the farthest referral Dn which the target name extends.
             */
            Dn suffix = req.getBase().getDescendantOf( referralAncestor.getDn() );
            urlDn = urlDn.add( suffix );

            StringBuilder buf = new StringBuilder();
            buf.append( ldapUrl.getScheme() );
            buf.append( ldapUrl.getHost() );

            if ( ldapUrl.getPort() > 0 )
            {
                buf.append( ":" );
                buf.append( ldapUrl.getPort() );
            }

            buf.append( "/" );
            buf.append( LdapUrl.urlEncode( urlDn.getName(), false ) );
            referral.addLdapUrl( buf.toString() );
        }

        return referral;
    }
View Full Code Here

Examples of org.apache.directory.studio.connection.core.io.jndi.ReferralsInfo.Referral

                {
                    logModifycation = false;
                    try
                    {
                        ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo );
                        Referral referral = newReferralsInfo.getNextReferral();
                        if ( referral != null )
                        {
                            Connection referralConnection = getReferralConnection( referral, monitor, this );
                            if ( referralConnection != null )
                            {
                                String referralDn = referral.getLdapURLs().get( 0 ).getDn().getUpName();
                                referralConnection.getJNDIConnectionWrapper().modifyEntry( referralDn,
                                    modificationItems, controls, monitor, newReferralsInfo );
                            }
                            else
                            {
View Full Code Here

Examples of org.apache.directory.studio.connection.core.io.jndi.ReferralsInfo.Referral

                {
                    logModifycation = false;
                    try
                    {
                        ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo );
                        Referral referral = newReferralsInfo.getNextReferral();
                        if ( referral != null )
                        {
                            Connection referralConnection = getReferralConnection( referral, monitor, this );
                            if ( referralConnection != null )
                            {
View Full Code Here

Examples of org.apache.directory.studio.connection.core.io.jndi.ReferralsInfo.Referral

                {
                    logModifycation = false;
                    try
                    {
                        ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo );
                        Referral referral = newReferralsInfo.getNextReferral();
                        if ( referral != null )
                        {
                            Connection referralConnection = getReferralConnection( referral, monitor, this );
                            if ( referralConnection != null )
                            {
                                String referralDn = referral.getLdapURLs().get( 0 ).getDn().getUpName();
                                referralConnection.getJNDIConnectionWrapper().createEntry( referralDn, attributes,
                                    controls, monitor, newReferralsInfo );
                            }
                            else
                            {
View Full Code Here

Examples of org.apache.directory.studio.connection.core.io.jndi.ReferralsInfo.Referral

                {
                    logModifycation = false;
                    try
                    {
                        ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo );
                        Referral referral = newReferralsInfo.getNextReferral();
                        if ( referral != null )
                        {
                            Connection referralConnection = getReferralConnection( referral, monitor, this );
                            if ( referralConnection != null )
                            {
                                String referralDn = referral.getLdapURLs().get( 0 ).getDn().getUpName();
                                referralConnection.getJNDIConnectionWrapper().deleteEntry( referralDn, controls,
                                    monitor, newReferralsInfo );
                            }
                            else
                            {
View Full Code Here

Examples of org.apache.directory.studio.connection.core.io.jndi.ReferralsInfo.Referral

        if ( initialReferralsInfo == null )
        {
            initialReferralsInfo = new ReferralsInfo();
        }

        Referral referral = handleReferralException( referralException, initialReferralsInfo, null );

        while ( referralException.skipReferral() )
        {
            try
            {
View Full Code Here

Examples of org.apache.directory.studio.connection.core.io.jndi.ReferralsInfo.Referral

            LdapURL url = new LdapURL( info );
            LdapDN dn = new LdapDN( name );

            if ( referral == null )
            {
                referral = initialReferralsInfo.new Referral( dn );
                initialReferralsInfo.addReferral( referral );
            }
            referral.addUrl( url );
        }
        catch ( LdapURLEncodingException e )
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.