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

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


        if ( referralUrl != null )
        {
            Connection[] connections = ConnectionCorePlugin.getDefault().getConnectionManager().getConnections();
            for ( int i = 0; i < connections.length; i++ )
            {
                Connection connection = connections[i];
                LdapURL connectionUrl = connection.getUrl();
                if ( connectionUrl != null && referralUrl.toString().startsWith( connectionUrl.toString() ) )
                {
                    mainWidget.getViewer().reveal( connection );
                    mainWidget.getViewer().setSelection( new StructuredSelection( connection ), true );
                }
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();
                CheckNetworkParameterJob job = new CheckNetworkParameterJob( connection );
                RunnableContextJobAdapter.execute( job, runnableContext );
                if ( job.getExternalResult().isOK() )
                {
                    MessageDialog.openInformation( Display.getDefault().getActiveShell(), "Check Network Parameter",
View Full Code Here

     */
    private void bindCurrentPassword()
    {
        if ( !"".equals( testPasswordText.getText() ) && entry != null )
        {
            Connection connection = ( Connection ) entry.getBrowserConnection().getConnection().clone();
            connection.setName( null );
            connection.setBindPrincipal( entry.getDn().getUpName() );
            connection.setBindPassword( testPasswordText.getText() );
            connection.setAuthMethod( AuthenticationMethod.SIMPLE );

            CheckBindJob job = new CheckBindJob( connection );
            RunnableContextJobAdapter.execute( job );
            if ( job.getExternalResult().isOK() )
            {
View Full Code Here

     * @return a test connection
     */
    private Connection getTestConnection()
    {
        ConnectionParameter cp = connectionParameterPageModifyListener.getTestConnectionParameters();
        Connection conn = new Connection( cp );
        return conn;
    }
View Full Code Here

        fetchBaseDnsButton.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent e )
            {
                Connection connection = getTestConnection();
                IBrowserConnection browserConnection = new BrowserConnection( connection );

                FetchBaseDNsJob job = new FetchBaseDNsJob( browserConnection );
                RunnableContextJobAdapter.execute( job, runnableContext );
                if ( job.getExternalResult().isOK() )
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 OpenConnectionsJob( conn ).execute();

        return true;
View Full Code Here

    private void loadBrowserConnections()
    {
        Connection[] connections = ConnectionCorePlugin.getDefault().getConnectionManager().getConnections();
        for ( int i = 0; i < connections.length; i++ )
        {
            Connection connection = connections[i];
            BrowserConnection browserConnection = new BrowserConnection( connection );
            connectionMap.put( connection.getId(), browserConnection );
           
            try
            {
                String schemaFilename = getSchemaCacheFileName( browserConnection );
                FileReader reader = new FileReader( schemaFilename );
View Full Code Here

                InputStream connectionsInputStream = importFile.getInputStream( connectionsEntry );
                ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
                Set<ConnectionParameter> connectionParametersSet = ConnectionIO.load( connectionsInputStream );
                for ( ConnectionParameter connectionParameter : connectionParametersSet )
                {
                    connectionManager.addConnection( new Connection( connectionParameter ) );
                }
            }

            // Loading the ConnectionFolders
            ZipEntry connectionFoldersEntry = importFile.getEntry( "connectionFolders.xml" );
            ConnectionFolder rootConnectionFolder = null;
            if ( connectionFoldersEntry != null )
            {
                InputStream connectionFoldersInputStream = importFile.getInputStream( connectionFoldersEntry );
                ConnectionFolderManager connectionFolderManager = ConnectionCorePlugin.getDefault()
                    .getConnectionFolderManager();
                Set<ConnectionFolder> connectionFoldersSet = ConnectionIO
                    .loadConnectionFolders( connectionFoldersInputStream );
                for ( ConnectionFolder connectionFolder : connectionFoldersSet )
                {
                    if ( !"0".equals( connectionFolder.getId() ) )
                    {
                        connectionFolderManager.addConnectionFolder( connectionFolder );
                    }
                    else
                    {
                        rootConnectionFolder = connectionFolder;
                    }
                }

                // Root ConnectionFolder must be the last one to be loaded
                if ( rootConnectionFolder != null )
                {
                    ConnectionFolder realRootConnectionFolder = connectionFolderManager.getRootConnectionFolder();
                    // Adding subfolders
                    List<String> realSubFolderIds = realRootConnectionFolder.getSubFolderIds();
                    for ( String subFolderId : rootConnectionFolder.getSubFolderIds() )
                    {
                        if ( !realSubFolderIds.contains( subFolderId ) )
                        {
                            realRootConnectionFolder.addSubFolderId( subFolderId );
                        }
                    }

                    // Adding connections
                    List<String> realConnectionIds = realRootConnectionFolder.getConnectionIds();
                    for ( String connectionId : rootConnectionFolder.getConnectionIds() )
                    {
                        if ( !realConnectionIds.contains( connectionId ) )
                        {
                            realRootConnectionFolder.addConnectionId( connectionId );
                        }
                    }
                }
            }

            // Loading the BrowserConnections
            ZipEntry browserConnectionsEntry = importFile.getEntry( "browserconnections.xml" );
            if ( browserConnectionsEntry != null )
            {
                InputStream browserConnectionsInputStream = importFile.getInputStream( browserConnectionsEntry );

                Connection[] connections = ConnectionCorePlugin.getDefault().getConnectionManager().getConnections();
                Map<String, IBrowserConnection> connectionsMap = new HashMap<String, IBrowserConnection>();
                for ( int i = 0; i < connections.length; i++ )
                {
                    Connection connection = connections[i];
                    BrowserConnection browserConnection = new BrowserConnection( connection );
                    connectionsMap.put( connection.getId(), browserConnection );
                }

                BrowserConnectionIO.load( browserConnectionsInputStream, connectionsMap );
            }
        }
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.