Examples of LdapURL


Examples of org.apache.directory.shared.ldap.model.url.LdapUrl

        assertEquals( 1, referrals.size() );

        try
        {
            assertTrue( referrals.contains( new LdapUrl( "ldap://www.apache.org/" ).toString() ) );
        }
        catch ( LdapURLEncodingException e )
        {
            fail();
        }
View Full Code Here

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

            {
                for ( Iterator<Value<?>> iterator = refAttribute.iterator(); iterator.hasNext(); )
                {
                    Value<?> value = ( Value<?> ) iterator.next();

                    srr.addSearchResultReference( new LdapURL( ( String ) value.get() ) );
                }
            }

            return srr;
        }
View Full Code Here

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

        ConnectionParameterPage[] connectionParameterPages = ConnectionParameterPageManager
            .getConnectionParameterPages();
        for ( Connection connection : connections )
        {
            ConnectionParameter parameter = connection.getConnectionParameter();
            LdapURL ldapUrl = new LdapURL();
            ldapUrl.setDn( LdapDN.EMPTY_LDAPDN );
            for ( ConnectionParameterPage connectionParameterPage : connectionParameterPages )
            {
                connectionParameterPage.mergeParametersToLdapURL( parameter, ldapUrl );
            }
            sb.append( ldapUrl.toString() );
            sb.append( ConnectionCoreConstants.LINE_SEPARATOR );
        }
        return sb.toString();
    }
View Full Code Here

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

                line = line.trim();
                if ( StringUtils.isNotEmpty( line ) )
                {
                    try
                    {
                        LdapURL ldapUrl = new LdapURL( line );
                        ConnectionParameter parameter = new ConnectionParameter();
                        for ( ConnectionParameterPage connectionParameterPage : connectionParameterPages )
                        {
                            connectionParameterPage.mergeLdapUrlToParameters( ldapUrl, parameter );
                        }
View Full Code Here

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

    /**
     * {@inheritDoc}
     */
    public void run()
    {
        LdapURL url = null;
        if ( getSelectedSearches().length > 0 )
        {
            url = getSelectedSearches()[0].getUrl();
        }
        else if ( getSelectedEntries().length > 0 )
        {
            url = getSelectedEntries()[0].getUrl();
        }
        else if ( getSelectedAttributes().length > 0 )
        {
            url = getSelectedAttributes()[0].getEntry().getUrl();
        }
        else if ( getSelectedAttributeHierarchies().length > 0 )
        {
            url = getSelectedAttributeHierarchies()[0].getAttribute().getEntry().getUrl();
        }
        else if ( getSelectedValues().length > 0 )
        {
            url = getSelectedValues()[0].getAttribute().getEntry().getUrl();
        }
        else if ( getSelectedSearchResults().length > 0 )
        {
            url = getSelectedSearchResults()[0].getEntry().getUrl();
        }
        else if ( getSelectedBookmarks().length > 0 )
        {
            url = getSelectedBookmarks()[0].getEntry().getUrl();
        }

        if ( url != null )
        {
            CopyAction.copyToClipboard( new Object[]
                { url.toString() }, new Transfer[]
                { TextTransfer.getInstance() } );
        }
    }
View Full Code Here

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

       
        // manage each Referral, building the correct URL for each of them
        for ( Value<?> url:refs )
        {
            // we have to replace the parent by the referral
            LdapURL ldapUrl = new LdapURL( url.getString() );
           
            // We have a problem with the DN : we can't use the UpName,
            // as we may have some spaces around the ',' and '+'.
            // So we have to take the RDN one by one, and create a
            // new DN with the type and value UP form
           
            DN urlDn = (DN)ldapUrl.getDn().addAll( childDn );
           
            ldapUrl.setDn( urlDn );
            urls.add( ldapUrl.toString() );
        }
       
        // Return with an exception
        LdapReferralException lre = new LdapReferralException( urls );
        lre.setRemainingName( childDn );
View Full Code Here

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

        for ( Value<?> url:refs )
        {
            // we have to replace the parent by the referral
            try
            {
                LdapURL ldapUrl = new LdapURL( url.getString() );
               
                StringBuilder urlString = new StringBuilder();
   
                if ( ( ldapUrl.getDn() == null ) || ( ldapUrl.getDn() == DN.EMPTY_DN) )
                {
                    ldapUrl.setDn( parentEntry.getDn() );
                }
                else
                {
                    // We have a problem with the DN : we can't use the UpName,
                    // as we may have some spaces around the ',' and '+'.
                    // So we have to take the RDN one by one, and create a
                    // new DN with the type and value UP form
                   
                    DN urlDn = (DN)ldapUrl.getDn().addAll( childDn );
                   
                    ldapUrl.setDn( urlDn );
                }
               
                urlString.append( ldapUrl.toString() ).append( "??" );
               
                switch ( scope )
                {
                    case OBJECT :
                        urlString.append( "base" );
View Full Code Here

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

    /**
     * @param producer the producer to set
     */
    public void setProducer( String producer ) throws LdapURLEncodingException
    {
        this.producer = new LdapURL( producer );
       
        // Update the other fields
        baseDN = this.producer.getDn();
        useSSL = "ldaps".equalsIgnoreCase( this.producer.getScheme() );
        host = this.producer.getHost();
View Full Code Here

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

                referral.addLdapUrl( ref );
                continue;
            }
           
            // parse the ref value and normalize the DN 
            LdapURL ldapUrl = new LdapURL();
            try
            {
                ldapUrl.parse( ref.toCharArray() );
            }
            catch ( LdapURLEncodingException e )
            {
                LOG.error( I18n.err( I18n.ERR_165, ref, referralAncestor ) );
            }
           
            DN urlDn = new DN( ldapUrl.getDn().getName() );
            urlDn.normalize( session.getCoreSession().getDirectoryService().getSchemaManager()
                .getNormalizerMapping() );
           
            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.
             */
            int diff = reqTargetDn.size() - referralAncestor.getDn().size();
            DN extra = new DN();

            // TODO - fix this by access unormalized RDN values
            // seems we have to do this because get returns normalized rdns
            DN reqUnnormalizedDn = new DN( reqTargetDn.getName() );
            for ( int jj = 0; jj < diff; jj++ )
            {
                extra.add( reqUnnormalizedDn.get( referralAncestor.getDn().size() + jj ) );
            }

            urlDn.addAll( extra );

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

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

                referral.addLdapUrl( ref );
                continue;
            }
           
            // Parse the ref value  
            LdapURL ldapUrl = new LdapURL();
            try
            {
                ldapUrl.parse( ref.toCharArray() );
            }
            catch ( LdapURLEncodingException e )
            {
                LOG.error( I18n.err( I18n.ERR_165, ref, referralAncestor ) );
            }
           
            // Normalize the DN to check for same dn
            DN urlDn = new DN( ldapUrl.getDn().getName() );
            urlDn.normalize( session.getCoreSession().getDirectoryService().getSchemaManager()
                .getNormalizerMapping() );
           
            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.
             */
            int diff = req.getBase().size() - referralAncestor.getDn().size();
            DN extra = new DN();

            // TODO - fix this by access unormalized RDN values
            // seems we have to do this because get returns normalized rdns
            DN reqUnnormalizedDn = new DN( req.getBase().getName() );
            for ( int jj = 0; jj < diff; jj++ )
            {
                extra.add( reqUnnormalizedDn.get( referralAncestor.getDn().size() + jj ) );
            }

            ldapUrl.getDn().addAll( extra );
            ldapUrl.setForceScopeRendering( true );
            ldapUrl.setAttributes( req.getAttributes() );
            ldapUrl.setScope( req.getScope().getScope() );
            referral.addLdapUrl( ldapUrl.toString() );
        }
       
        return referral;
    }
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.