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

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


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

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


     */
    private Connection getTestConnection()
    {
        ConnectionParameter cp = new ConnectionParameter( null, getHostName(), getPort(), getEncyrptionMethod(),
            ConnectionParameter.AuthenticationMethod.NONE, null, null, null, true, null );
        Connection conn = new Connection( cp );
        return conn;
    }
View Full Code Here

        checkConnectionButton.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent event )
            {
                Connection connection = getTestConnection();
                CheckNetworkParameterRunnable runnable = new CheckNetworkParameterRunnable( connection );
                IStatus status = RunnableContextRunner.execute( runnable, runnableContext, true );
                if ( status.isOK() )
                {
                    MessageDialog.openInformation( Display.getDefault().getActiveShell(), Messages
View Full Code Here

            }

            List<String> connectionIds = folder.getConnectionIds();
            for ( String connectionId : connectionIds )
            {
                Connection connection = ConnectionCorePlugin.getDefault().getConnectionManager().getConnectionById(
                    connectionId );
                if ( connection != null && !connectionsToDelete.contains( connection ) )
                {
                    connectionsToDelete.add( connection );
                }
View Full Code Here

            String normalizedUrl = Utils.getSimpleNormalizedUrl( url );

            if ( referralUrlToReferralConnectionCache.containsKey( normalizedUrl ) )
            {
                // check if referral connection exists in connection manager
                Connection referralConnection = referralUrlToReferralConnectionCache.get( normalizedUrl );
                Connection[] connections = ConnectionCorePlugin.getDefault().getConnectionManager().getConnections();
                for ( int i = 0; i < connections.length; i++ )
                {
                    Connection connection = connections[i];
                    if ( referralConnection == connection )
                    {
                        return referralConnection;
                    }
                }

                // referral connection doesn't exist in connection manager, remove it from cache
                referralUrlToReferralConnectionCache.remove( normalizedUrl );
            }
        }

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

        if ( referralUrls != null )
        {
            Connection[] connections = ConnectionCorePlugin.getDefault().getConnectionManager().getConnections();
            for ( int i = 0; i < connections.length; i++ )
            {
                Connection connection = connections[i];
                LdapURL connectionUrl = connection.getUrl();
                String normalizedConnectionUrl = Utils.getSimpleNormalizedUrl( connectionUrl );
                for ( LdapURL url : referralUrls )
                {
                    if ( url != null && Utils.getSimpleNormalizedUrl( url ).equals( normalizedConnectionUrl ) )
                    {
View Full Code Here

        {
            selectedConnectionFolder = ( ConnectionFolder ) firstElement;
        }
        else if ( firstElement instanceof Connection )
        {
            Connection connection = ( Connection ) firstElement;
            selectedConnectionFolder = ConnectionCorePlugin.getDefault().getConnectionFolderManager()
                .getParentConnectionFolder( connection );
        }

        if ( selectedConnectionFolder == null )
View Full Code Here

            pages[i].saveParameters( connectionParameter );
            pages[i].saveDialogSettings();
        }

        // create persistent connection
        final Connection conn = new Connection( connectionParameter );
        ConnectionCorePlugin.getDefault().getConnectionManager().addConnection( conn );

        // add connection to folder
        selectedConnectionFolder.addConnectionId( conn.getId() );

        // open connection
        new StudioConnectionJob( new OpenConnectionsRunnable( conn ) ).execute();

        return true;
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

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.