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

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


     */
    public Connection getBrowserConnection()
    {
        ConnectionFolderManager connectionFolderManager = ConnectionCorePlugin.getDefault()
            .getConnectionFolderManager();
        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
        if ( connectionFolderManager != null )
        {
            ConnectionFolder rootConnectionFolder = connectionFolderManager.getRootConnectionFolder();
            if ( rootConnectionFolder != null )
            {
                return connectionManager.getConnectionById( rootConnectionFolder.getConnectionIds().get( 0 ) );
            }
        }

        return null;
    }
View Full Code Here


            // Loading the Connections
            ZipEntry connectionsEntry = importFile.getEntry( "connections.xml" ); //$NON-NLS-1$
            if ( connectionsEntry != null )
            {
                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" ); //$NON-NLS-1$
View Full Code Here

     * This implementation drops the dragged connection to
     * the selected position.
     */
    public void drop( DropTargetEvent event )
    {
        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
        ConnectionFolderManager connectionFolderManager = ConnectionCorePlugin.getDefault()
            .getConnectionFolderManager();

        try
        {
            if ( ConnectionTransfer.getInstance().isSupportedType( event.currentDataType ) )
            {
                // get connection and folders to handle
                Object[] objects = ( Object[] ) event.data;
                Object target = event.item != null ? event.item.getData() : connectionFolderManager
                    .getRootConnectionFolder();

                ConnectionFolder targetFolder = null;
                if ( target instanceof ConnectionFolder )
                {
                    targetFolder = ( ConnectionFolder ) target;
                }
                else if ( target instanceof Connection )
                {
                    Connection connection = ( Connection ) target;
                    targetFolder = connectionFolderManager.getParentConnectionFolder( connection );
                }

                for ( Object object : objects )
                {
                    if ( object instanceof Connection )
                    {
                        Connection connection = ( Connection ) object;
                        if ( event.detail == DND.DROP_MOVE )
                        {
                            ConnectionFolder parentConnectionFolder = connectionFolderManager
                                .getParentConnectionFolder( connection );
                            parentConnectionFolder.removeConnectionId( connection.getId() );
                            targetFolder.addConnectionId( connection.getId() );
                        }
                        else if ( event.detail == DND.DROP_COPY )
                        {
                            Connection newConnection = ( Connection ) connection.clone();
                            connectionManager.addConnection( newConnection );
                            targetFolder.addConnectionId( newConnection.getId() );
                        }
                    }
                    else if ( object instanceof ConnectionFolder )
                    {
View Full Code Here

     */
    public void run()
    {
        ConnectionFolderManager connectionFolderManager = ConnectionCorePlugin.getDefault()
            .getConnectionFolderManager();
        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();

        ConnectionFolder[] selectedFolders = getSelectedConnectionFolders();
        Connection[] selectedConnections = getSelectedConnections();
        ConnectionFolder targetFolder = null;
        if ( selectedFolders.length > 0 )
        {
            targetFolder = selectedFolders[0];
        }
        else if ( selectedConnections.length > 0 )
        {
            targetFolder = connectionFolderManager.getParentConnectionFolder( selectedConnections[0] );
        }
        if ( targetFolder == null )
        {
            targetFolder = connectionFolderManager.getRootConnectionFolder();
        }

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

     */
    public Connection createTestConnection( String name, int port ) throws Exception
    {
        name = name + "_" + System.currentTimeMillis();

        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
        ConnectionParameter connectionParameter = new ConnectionParameter();
        connectionParameter.setNetworkProvider( NetworkProvider.JNDI );
        connectionParameter.setName( name );
        connectionParameter.setHost( "localhost" );
        connectionParameter.setPort( port );
        connectionParameter.setEncryptionMethod( EncryptionMethod.NONE );
        connectionParameter.setAuthMethod( AuthenticationMethod.SIMPLE );
        connectionParameter.setBindPrincipal( "uid=admin,ou=system" );
        connectionParameter.setBindPassword( "secret" );
        Connection connection = new Connection( connectionParameter );
        connectionManager.addConnection( connection );

        ConnectionFolderManager connectionFolderManager = ConnectionCorePlugin.getDefault()
            .getConnectionFolderManager();
        ConnectionFolder rootConnectionFolder = connectionFolderManager.getRootConnectionFolder();
        rootConnectionFolder.addConnectionId( connection.getId() );
View Full Code Here

    /**
     * Deletes the test connection.
     */
    public void deleteTestConnections()
    {
        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
        for ( Connection connection : connectionManager.getConnections() )
        {
            connectionManager.removeConnection( connection );
        }
    }
View Full Code Here

        // finish dialog
        wizardBot.clickFinishButton();
        connectionsViewBot.waitForConnection( "NewConnectionWizardTest" );

        // ensure connection was created
        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
        assertNotNull( connectionManager.getConnections() );
        assertEquals( 1, connectionManager.getConnections().length );
        Connection connection = connectionManager.getConnections()[0];
        assertEquals( "NewConnectionWizardTest", connection.getName() );
        assertEquals( "localhost", connection.getHost() );
        assertEquals( ldapServer.getPort(), connection.getPort() );
        assertEquals( AuthenticationMethod.SIMPLE, connection.getAuthMethod() );
        assertEquals( "uid=admin,ou=system", connection.getBindPrincipal() );
View Full Code Here

            // Loading the Connections
            ZipEntry connectionsEntry = importFile.getEntry( "connections.xml" );
            if ( connectionsEntry != null )
            {
                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" );
View Full Code Here

     * This implementation drops the dragged connection to
     * the selected position.
     */
    public void drop( DropTargetEvent event )
    {
        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();
        ConnectionFolderManager connectionFolderManager = ConnectionCorePlugin.getDefault()
            .getConnectionFolderManager();

        try
        {
            if ( ConnectionTransfer.getInstance().isSupportedType( event.currentDataType ) )
            {
                // get connection and folders to handle
                Object[] objects = ( Object[] ) event.data;
                Object target = event.item != null ? event.item.getData() : connectionFolderManager
                    .getRootConnectionFolder();

                ConnectionFolder targetFolder = null;
                if ( target instanceof ConnectionFolder )
                {
                    targetFolder = ( ConnectionFolder ) target;
                }
                else if ( target instanceof Connection )
                {
                    Connection connection = ( Connection ) target;
                    targetFolder = connectionFolderManager.getParentConnectionFolder( connection );
                }

                for ( Object object : objects )
                {
                    if ( object instanceof Connection )
                    {
                        Connection connection = ( Connection ) object;
                        if ( event.detail == DND.DROP_MOVE )
                        {
                            ConnectionFolder parentConnectionFolder = connectionFolderManager
                                .getParentConnectionFolder( connection );
                            parentConnectionFolder.removeConnectionId( connection.getId() );
                            targetFolder.addConnectionId( connection.getId() );
                        }
                        else if ( event.detail == DND.DROP_COPY )
                        {
                            Connection newConnection = ( Connection ) connection.clone();
                            connectionManager.addConnection( newConnection );
                            targetFolder.addConnectionId( newConnection.getId() );
                        }
                    }
                    else if ( object instanceof ConnectionFolder )
                    {
View Full Code Here

     */
    public void run()
    {
        ConnectionFolderManager connectionFolderManager = ConnectionCorePlugin.getDefault()
            .getConnectionFolderManager();
        ConnectionManager connectionManager = ConnectionCorePlugin.getDefault().getConnectionManager();

        ConnectionFolder[] selectedFolders = getSelectedConnectionFolders();
        Connection[] selectedConnections = getSelectedConnections();
        ConnectionFolder targetFolder = null;
        if ( selectedFolders.length > 0 )
        {
            targetFolder = selectedFolders[0];
        }
        else if ( selectedConnections.length > 0 )
        {
            targetFolder = connectionFolderManager.getParentConnectionFolder( selectedConnections[0] );
        }
        if ( targetFolder == null )
        {
            targetFolder = connectionFolderManager.getRootConnectionFolder();
        }

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

TOP

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

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.