Package org.apache.directory.studio.apacheds.model

Examples of org.apache.directory.studio.apacheds.model.Server


        {
            // What we get from the TableViewer is a StructuredSelection
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();

            // Here's the real object
            Server server = ( Server ) selection.getFirstElement();
            if ( server != null )
            {
                // Opening the editor
                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                PathEditorInput input = new PathEditorInput( ApacheDsPluginUtils.getApacheDsServersFolder().append(
                    server.getId() ).append( "conf" ).append( "server.xml" ) ); //$NON-NLS-1$ //$NON-NLS-2$
                try
                {
                    page.openEditor( input, ServerConfigurationEditor.ID );
                }
                catch ( PartInitException e )
View Full Code Here


        {
            // What we get from the TableViewer is a StructuredSelection
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();

            // Here's the real object
            Server server = ( Server ) selection.getFirstElement();
            if ( server != null )
            {
                // Opening the editor
                IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                PathEditorInput input = new PathEditorInput( ApacheDsPluginUtils.getApacheDsServersFolder().append(
                    server.getId() ).append( "conf" ).append( "server.xml" ) );
                try
                {
                    page.openEditor( input, ServerConfigurationEditor.ID );
                }
                catch ( PartInitException e )
View Full Code Here

                    return;
                }

                // Getting the kind of event and the associated server
                ServerEventEnum kind = event.getKind();
                Server server = event.getServer();
                switch ( kind )
                {
                    // The server state has changed
                    case STATE_CHANGED:
                        // First, we refresh the server
                        refreshServer( server );

                        // Then, we get the state of the server to see if we
                        // need to start or stop the animation thread
                        ServerStateEnum state = server.getState();

                        // If the state is STARTING or STOPPING, we need to
                        // add the server to the list of servers needing
                        // animation and eventually start the animation thread
                        if ( ( state == ServerStateEnum.STARTING ) || ( state == ServerStateEnum.STOPPING ) )
                        {
                            boolean startAnimationThread = false;

                            synchronized ( serversNeedingAnimation )
                            {
                                if ( !serversNeedingAnimation.contains( server ) )
                                {
                                    if ( serversNeedingAnimation.isEmpty() )
                                        startAnimationThread = true;
                                    serversNeedingAnimation.add( server );
                                }
                            }

                            if ( startAnimationThread )
                            {
                                startAnimationThread();
                            }
                        }

                        // If the state is *not* STARTING or STOPPING, we need
                        // to remove the server from the list of servers
                        // needing animation and eventually stop the animation
                        // if this list is empty
                        else
                        {
                            boolean stopAnimationThread = false;

                            synchronized ( serversNeedingAnimation )
                            {
                                if ( serversNeedingAnimation.contains( server ) )
                                {
                                    serversNeedingAnimation.remove( server );
                                    if ( serversNeedingAnimation.isEmpty() )
                                        stopAnimationThread = true;
                                }
                            }

                            if ( stopAnimationThread )
                            {
                                stopAnimationThread();
                            }
                        }
                        break;
                    // The server has been renamed
                    case RENAMED:
                        // We simply refresh the server
                        refreshServer( server );
                        break;
                }

            }
        };

        // Adding the listener to the servers
        for ( Server server : ServersHandler.getDefault().getServersList() )
        {
            server.addListener( serverListener );
        }
    }
View Full Code Here

     */
    public String getColumnText( Object element, int columnIndex )
    {
        if ( element instanceof Server )
        {
            Server server = ( Server ) element;
            if ( columnIndex == 0 )
            {
                return server.getName();
            }
            else if ( columnIndex == 1 )
            {
                ServerStateEnum state = ( ( Server ) element ).getState();
                switch ( state )
View Full Code Here

            // Getting the selection
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
            {
                // Getting the server
                final Server server = ( Server ) selection.getFirstElement();

                // Parsing the 'server.xml' file
                ServerConfiguration serverConfiguration = null;
                try
                {
                    serverConfiguration = ApacheDsPluginUtils.getServerConfiguration( server );
                }
                catch ( IOException e )
                {
                    reportErrorReadingServerConfiguration( e.getMessage() );
                    return;
                }
                catch ( ServerXmlIOException e )
                {
                    reportErrorReadingServerConfiguration( e.getMessage() );
                    return;
                }

                // Checking if we could read the 'server.xml' file
                if ( serverConfiguration == null )
                {
                    reportErrorReadingServerConfiguration( null );
                    return;
                }

                // Verifying if the protocol ports are currently available
                String[] alreadyInUseProtocolPortsList = getAlreadyInUseProtocolPorts( serverConfiguration );
                if ( ( alreadyInUseProtocolPortsList != null ) && ( alreadyInUseProtocolPortsList.length > 0 ) )
                {
                    String title = null;
                    String message = null;

                    if ( alreadyInUseProtocolPortsList.length == 1 )
                    {
                        title = "Port already in use";
                        message = "The port of the protocol " + alreadyInUseProtocolPortsList[0]
                            + " is already in use.";
                    }
                    else
                    {
                        title = "Ports already in use";
                        message = "The ports of the following protocols are already in use:";
                        for ( String alreadyInUseProtocolPort : alreadyInUseProtocolPortsList )
                        {
                            message += ApacheDsPluginUtils.LINE_SEPARATOR + "    - " + alreadyInUseProtocolPort;
                        }
                    }

                    message += ApacheDsPluginUtils.LINE_SEPARATOR + ApacheDsPluginUtils.LINE_SEPARATOR
                        + "Do you wish to continue?";

                    MessageDialog dialog = new MessageDialog( view.getSite().getShell(), title, null, message,
                        MessageDialog.WARNING, new String[]
                            { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, MessageDialog.OK );
                    if ( dialog.open() == MessageDialog.CANCEL )
                    {
                        return;
                    }
                }

                // Verifying the libraries in the plugin's folder
                ApacheDsPluginUtils.verifyLibrariesFolder( server );

                // Creating, setting and launching the launch job
                LaunchServerJob job = new LaunchServerJob( server, serverConfiguration );
                job.setLogsLevel( ApacheDsPluginUtils.getServerLogsLevel() );
                job.setLogsPattern( ApacheDsPluginUtils.getServerLogsPattern() );
                server.setLaunchJob( job );
                job.schedule();
            }
        }
    }
View Full Code Here

        {
            // What we get from the TableViewer is a StructuredSelection
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();

            // Here's the real object
            Server server = ( Server ) selection.getFirstElement();
            if ( server != null )
            {
                queryNewServerNameInline( server );
            }
        }
View Full Code Here

     * @see org.eclipse.jface.wizard.Wizard#performFinish()
     */
    public boolean performFinish()
    {
        // Creating the new server
        Server server = new Server( page.getServerName() );

        // Adding the new server to the servers handler
        ServersHandler.getDefault().addServer( server );

        // Creating the complete folder structure for the new server
        ApacheDsPluginUtils.createNewServerFolder( server.getId() );

        return true;
    }
View Full Code Here

        GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false );
        gd.widthHint = 300;
        locationText.setLayoutData( gd );

        // Getting the server
        Server server = ( Server ) getElement();
        if ( server != null )
        {
            nameText.setText( server.getName() );
            versionText.setText( server.getVersion().toString() );
            locationText.setText( ApacheDsPluginUtils.getApacheDsServersFolder().append( server.getId() ).toOSString() );
        }

        return parent;
    }
View Full Code Here

            // Getting the selection
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
            {
                // Getting the server
                Server server = ( Server ) selection.getFirstElement();

                // Parsing the 'server.xml' file
                ServerConfiguration serverConfiguration = null;
                try
                {
                    serverConfiguration = ApacheDsPluginUtils.getServerConfiguration( server );
                }
                catch ( IOException e )
                {
                    reportErrorReadingServerConfiguration( e.getMessage() );
                    return;
                }
                catch ( ServerXmlIOException e )
                {
                    reportErrorReadingServerConfiguration( e.getMessage() );
                    return;
                }

                // Checking if we could read the 'server.xml' file
                if ( serverConfiguration == null )
                {
                    reportErrorReadingServerConfiguration( null );
                    return;
                }

                if ( isEnableLdapOrLdaps( serverConfiguration ))
                {
                    // Creating the connection using the helper class
                    CreateConnectionActionHelper.createLdapBrowserConnection( server.getName(), serverConfiguration );
                }
                else
                {
                    // LDAP and LDAPS protocols are disabled, we report this error to the user
                    MessageDialog dialog = new MessageDialog( view.getSite().getShell(),
View Full Code Here

        // Getting the selection
        StructuredSelection selection = ( StructuredSelection ) tableViewer.getSelection();

        if ( !selection.isEmpty() )
        {
            Server server = ( Server ) selection.getFirstElement();

            switch ( server.getState() )
            {
                case STARTED:
                    run.setEnabled( false );
                    stop.setEnabled( true );
                    break;
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.apacheds.model.Server

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.