Package org.apache.directory.studio.connection.core

Examples of org.apache.directory.studio.connection.core.Connection


        // connections
        List<Connection> connections = getConnectionsToPaste();
        for ( Connection connection : connections )
        {
            Connection newConnection = ( Connection ) connection.clone();
            connectionManager.addConnection( newConnection );
            targetFolder.addConnectionId( newConnection.getId() );
        }

        // connection folders
        List<ConnectionFolder> connectionFolders = getConnectionFoldersToPaste();
        for ( ConnectionFolder connectionFolder : connectionFolders )
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() );

                                    namingEnumeration = referralConnection.getJNDIConnectionWrapper().search(
                                        referralSearchBase, referralFilter, referralSearchControls,
                                        aliasesDereferencingMethod, referralsHandlingMethod, controls, monitor,
                                        newReferralsInfo );
                                }
                            }
View Full Code Here

                    {
                        ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo );
                        UrlAndDn urlAndDn = newReferralsInfo.getNext();
                        if ( urlAndDn != null )
                        {
                            Connection referralConnection = getReferralConnection( urlAndDn.getUrl(), monitor, this );
                            if ( referralConnection != null )
                            {
                                String referralDn = urlAndDn.getDn() != null && !urlAndDn.getDn().isEmpty() ? urlAndDn
                                    .getDn().getUpName() : dn;

                                referralConnection.getJNDIConnectionWrapper().modifyEntry( referralDn,
                                    modificationItems, referralsHandlingMethod, controls, monitor, newReferralsInfo );
                            }
                        }
                    }
                    catch ( NamingException ne )
View Full Code Here

                    {
                        ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo );
                        UrlAndDn urlAndDn = newReferralsInfo.getNext();
                        if ( urlAndDn != null )
                        {
                            Connection referralConnection = getReferralConnection( urlAndDn.getUrl(), monitor, this );
                            if ( referralConnection != null )
                            {
                                //                                String referralDn = url.getDn() != null && !url.getDn().isEmpty() ? url.getDn()
                                //                                    .getUpName() : dn;
                                // TODO: referral DN???
                                referralConnection.getJNDIConnectionWrapper().renameEntry( oldDn, newDn, deleteOldRdn,
                                    referralsHandlingMethod, controls, monitor, newReferralsInfo );
                            }
                        }
                    }
                    catch ( NamingException ne )
View Full Code Here

                    {
                        ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo );
                        UrlAndDn urlAndDn = newReferralsInfo.getNext();
                        if ( urlAndDn != null )
                        {
                            Connection referralConnection = getReferralConnection( urlAndDn.getUrl(), monitor, this );
                            if ( referralConnection != null )
                            {
                                String referralDn = urlAndDn.getDn() != null && !urlAndDn.getDn().isEmpty() ? urlAndDn
                                    .getDn().getUpName() : dn;

                                referralConnection.getJNDIConnectionWrapper().createEntry( referralDn, attributes,
                                    referralsHandlingMethod, controls, monitor, newReferralsInfo );
                            }
                        }
                    }
                    catch ( NamingException ne )
View Full Code Here

                    {
                        ReferralsInfo newReferralsInfo = handleReferralException( re, referralsInfo );
                        UrlAndDn urlAndDn = newReferralsInfo.getNext();
                        if ( urlAndDn != null )
                        {
                            Connection referralConnection = getReferralConnection( urlAndDn.getUrl(), monitor, this );
                            if ( referralConnection != null )
                            {
                                String referralDn = urlAndDn.getDn() != null && !urlAndDn.getDn().isEmpty() ? urlAndDn
                                    .getDn().getUpName() : dn;

                                referralConnection.getJNDIConnectionWrapper().deleteEntry( referralDn,
                                    referralsHandlingMethod, controls, monitor, newReferralsInfo );
                            }
                        }
                    }
                    catch ( NamingException ne )
View Full Code Here

     *
     * @return the referral connection
     */
    static Connection getReferralConnection( LdapURL url, StudioProgressMonitor monitor, Object source )
    {
        Connection referralConnection = null;
        IReferralHandler referralHandler = ConnectionCorePlugin.getDefault().getReferralHandler();
        if ( referralHandler != null )
        {
            referralConnection = referralHandler.getReferralConnection( url );

            if ( referralConnection != null && !referralConnection.getJNDIConnectionWrapper().isConnected() )
            {
                referralConnection.getJNDIConnectionWrapper().connect( monitor );
                referralConnection.getJNDIConnectionWrapper().bind( monitor );
                for ( IConnectionListener listener : ConnectionCorePlugin.getDefault().getConnectionListners() )
                {
                    listener.connectionOpened( referralConnection, monitor );
                }
                ConnectionEventRegistry.fireConnectionOpened( referralConnection, source );
View Full Code Here

                        {
                            StudioSearchResult ssr = ( StudioSearchResult ) sr;

                            isReferral = ssr.isReferral();

                            Connection connection = ssr.getConnection();
                            IBrowserConnection bc = BrowserCorePlugin.getDefault().getConnectionManager()
                                .getBrowserConnection( connection );
                            if ( bc != null )
                            {
                                resultBrowserConnection = bc;
View Full Code Here

                if ( !event.getSelection().isEmpty() )
                {
                    Object o = ( ( IStructuredSelection ) event.getSelection() ).getFirstElement();
                    if ( o instanceof Connection )
                    {
                        Connection connection = ( Connection ) o;
                        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
                            .getBrowserConnection( connection );
                        initialBrowserConnection = browserConnection;

                    }
                }
            }
        } );

        connectionMainWidget.getViewer().addDoubleClickListener( new IDoubleClickListener()
        {
            public void doubleClick( DoubleClickEvent event )
            {
                if ( !event.getSelection().isEmpty() )
                {
                    Object o = ( ( IStructuredSelection ) event.getSelection() ).getFirstElement();
                    if ( o instanceof Connection )
                    {
                        Connection connection = ( Connection ) o;
                        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
                            .getBrowserConnection( connection );
                        initialBrowserConnection = browserConnection;
                        okPressed();
                    }
                }
            }
        } );

        if ( initialBrowserConnection != null )
        {
            Connection connection = initialBrowserConnection.getConnection();
            connectionMainWidget.getViewer().reveal( connection );
            connectionMainWidget.getViewer().setSelection( new StructuredSelection( connection ), true );
        }

        applyDialogFont( composite );
View Full Code Here

    public Connection getReferralConnection( final LdapURL referralUrl )
    {
        // check cache
        if ( referralUrlToReferralConnectionCache.containsKey( referralUrl ) )
        {
            Connection referralConnection = referralUrlToReferralConnectionCache.get( referralUrl );
            if ( referralConnection != null )
            {
                Connection[] connections = ConnectionCorePlugin.getDefault().getConnectionManager().getConnections();
                for ( int i = 0; i < connections.length; i++ )
                {
                    Connection connection = connections[i];
                    if ( referralConnection == connection )
                    {
                        return referralConnection;
                    }
                }
            }
        }

        referralUrlToReferralConnectionCache.remove( referralUrl );

        // open dialog
        final Connection[] referralConnection = new Connection[1];
        PlatformUI.getWorkbench().getDisplay().syncExec( new Runnable()
        {
            public void run()
            {
                SelectReferralConnectionDialog dialog = new SelectReferralConnectionDialog( PlatformUI.getWorkbench()
                    .getDisplay().getActiveShell(), referralUrl );
                if ( dialog.open() == SelectReferralConnectionDialog.OK )
                {
                    Connection connection = dialog.getReferralConnection();
                    referralUrlToReferralConnectionCache.put( referralUrl, connection );
                    referralConnection[0] = connection;
                }
            }
        } );
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.connection.core.Connection

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.