Package org.apache.directory.studio.ldapbrowser.core.model

Examples of org.apache.directory.studio.ldapbrowser.core.model.DN


            rootDSE = new RootDSE( this );
            cacheEntry( rootDSE );
        }

        // get well-known root DSE attributes, includes + and *
        ISearch search = new Search( null, this, new DN(), ISearch.FILTER_TRUE, ROOT_DSE_ATTRIBUTES, ISearch.SCOPE_OBJECT, 0,
            0, IBrowserConnection.DEREFERENCE_ALIASES_NEVER, IBrowserConnection.HANDLE_REFERRALS_IGNORE, false, false, null );
        search( search, monitor );

        // get base DNs
        if( !isFetchBaseDNs() && getBaseDN() != null && !"".equals( getBaseDN().toString() ))
        {
            // only add the specified base DN
            DN dn = getBaseDN();
            IEntry entry = new BaseDNEntry( new DN( dn ), this );
            cacheEntry( entry );
            rootDSE.addChild( entry );
           
            // check if entry exists
            search = new Search( null, this, dn, ISearch.FILTER_TRUE, ISearch.NO_ATTRIBUTES, ISearch.SCOPE_OBJECT, 1, 0,
                IBrowserConnection.DEREFERENCE_ALIASES_NEVER, IBrowserConnection.HANDLE_REFERRALS_IGNORE, true, true, null );
            search( search, monitor );
        }
        else
        {
            // get naming contexts
            Set<String> namingContextSet = new HashSet<String>();
            IAttribute attribute = rootDSE.getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_NAMINGCONTEXTS );
            if ( attribute != null )
            {
                String[] values = attribute.getStringValues();
                for ( int i = 0; i < values.length; i++ )
                {
                    namingContextSet.add( values[i] );
                }
            }
            for ( String namingContext : namingContextSet )
            {
                if ( !"".equals( namingContext ) ) { //$NON-NLS-1$
                    try
                    {
                        IEntry entry = new BaseDNEntry( new DN( namingContext ), this );
                        rootDSE.addChild( entry );
                        cacheEntry( entry );
                    }
                    catch ( Exception e )
                    {
                        monitor.reportError( BrowserCoreMessages.model__error_setting_base_dn, e );
                    }
                }
                else
                {
                    // special handling of empty namingContext: perform a one-level search and add all result DNs to the set
                    search = new Search( null, this, new DN(), ISearch.FILTER_TRUE, ISearch.NO_ATTRIBUTES, ISearch.SCOPE_ONELEVEL, 0,
                        0, IBrowserConnection.DEREFERENCE_ALIASES_NEVER, IBrowserConnection.HANDLE_REFERRALS_IGNORE, false, false, null );
                    search( search, monitor );
                    ISearchResult[] results = search.getSearchResults();
                    for ( int k = 0; results != null && k < results.length; k++ )
                    {
View Full Code Here


            String[] values = attribute.getStringValues();
            for ( int i = 0; i < values.length; i++ )
            {
                try
                {
                    metadataEntryList.add( new DN( values[i] ) );
                }
                catch ( NameException e )
                {
                }
            }
View Full Code Here

        try
        {
            if ( getRootDSE().getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_SUBSCHEMASUBENTRY ) != null )
            {
                SearchParameter sp = new SearchParameter();
                sp.setSearchBase( new DN( getRootDSE().getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_SUBSCHEMASUBENTRY )
                    .getStringValue() ) );
                sp.setFilter( Schema.SCHEMA_FILTER );
                sp.setScope( ISearch.SCOPE_OBJECT );
                sp.setReturningAttributes( new String[]
                    { Schema.SCHEMA_ATTRIBUTE_OBJECTCLASSES, Schema.SCHEMA_ATTRIBUTE_ATTRIBUTETYPES,
View Full Code Here

     */
    public DN getBaseDN()
    {
        try
        {
            return new DN( connection.getConnectionParameter().getExtendedProperty( CONNECTION_PARAMETER_BASE_DN ) );
        }
        catch ( NameException e )
        {
            return null;
        }
View Full Code Here

                        LdifContainer container = enumeration.next( monitor );
                        if ( container instanceof LdifContentRecord )
                        {

                            LdifContentRecord record = ( LdifContentRecord ) container;
                            DN dn = new DN( record.getDnLine().getValueAsString() );

                            // get entry from cache or create it
                            IEntry entry = connection.getEntryFromCache( dn );
                            if ( entry == null )
                            {
View Full Code Here

    {
        IEntry entry = null;

        // build tree to parent
        LinkedList parentDnList = new LinkedList();
        DN parentDN = dn;
        while ( parentDN != null && connection.getEntryFromCache( parentDN ) == null )
        {
            parentDnList.addFirst( parentDN );
            parentDN = parentDN.getParentDn();
        }
        for ( Iterator it = parentDnList.iterator(); it.hasNext(); )
        {
            DN aDN = ( DN ) it.next();
            if ( aDN.getParentDn() == null )
            {
                entry = new BaseDNEntry( aDN, connection );
                connection.cacheEntry( entry );
            }
            else if ( connection.getEntryFromCache( aDN.getParentDn() ) != null )
            {
                IEntry parentEntry = connection.getEntryFromCache( aDN.getParentDn() );
                entry = new Entry( parentEntry, aDN.getRdn() );
                entry.setDirectoryEntry( true );

                parentEntry.addChild( entry );
                // parentEntry.setAttributesInitialized(false, this);
View Full Code Here

    public static DN getDn( javax.naming.directory.SearchResult sr, String base ) throws NamingException,
        NameException, NoSuchFieldException
    {
        String dn = sr.getNameInNamespace();
        dn = unescapeJndiName( dn );
        return new DN( dn );
    }
View Full Code Here

    private IEntry dummyEntry;


    public AttributeComparator( IBrowserConnection connection )
    {
        this.dummyEntry = new DummyEntry( new DN(), connection );
    }
View Full Code Here

        errorMessage = null;
        if ( !isAutoFetchBaseDns() )
        {
            try
            {
                new DN( getBaseDN() );
            }
            catch ( NameException e )
            {
                message = "Please enter a valid base DN.";
            }
View Full Code Here

        {
            public void modifyText( ModifyEvent e )
            {
                try
                {
                    dn = new DN( dnCombo.getText() );
                }
                catch ( NameException e1 )
                {
                    dn = null;
                }

                internalSetEnabled();
                notifyListeners();
            }
        } );

        // Up button
        upButton = new Button( textAndUpComposite, SWT.PUSH );
        upButton.setToolTipText( "Parent" );
        upButton.setImage( BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_PARENT ) );
        upButton.setEnabled( false );
        upButton.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent e )
            {
                if ( dn != null && dn.getParentDn() != null )
                {
                    dn = dn.getParentDn();
                    dnChanged();
                    internalSetEnabled();
                    notifyListeners();
                }
            }
        } );

        // Browse button
        entryBrowseButton = BaseWidgetUtils.createButton( parent, "Br&owse...", 1 );
        entryBrowseButton.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent e )
            {
                if ( connection != null )
                {
                    // get root entry
                    IEntry rootEntry = connection.getRootDSE();
                    if( suffix != null && suffix.getRdns().length > 0 )
                    {
                        rootEntry = connection.getEntryFromCache( suffix );
                        if ( rootEntry == null )
                        {
                            ReadEntryJob job = new ReadEntryJob( connection, suffix );
                            RunnableContextJobAdapter.execute( job );
                            rootEntry = job.getReadEntry();
                        }
                    }

                    // calculate initial DN
                    DN initialDN = dn;
                    if( suffix != null && suffix.getRdns().length > 0 )
                    {
                        if( initialDN != null && initialDN.getRdns().length > 0 )
                        {
                            initialDN = new DN( initialDN, suffix );
                        }
                    }

                    // get initial entry
                    IEntry entry = rootEntry;
                    if ( initialDN != null && initialDN.getRdns().length > 0 )
                    {
                        entry = connection.getEntryFromCache( initialDN );
                        if ( entry == null )
                        {
                            ReadEntryJob job = new ReadEntryJob( connection, initialDN );
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.ldapbrowser.core.model.DN

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.