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();

            // Asking for confirmation
            DeleteServerDialog dsd = new DeleteServerDialog( view.getSite().getShell(), server );
            if ( dsd.open() == DeleteServerDialog.OK )
            {
                // Checking if the server is running
                // If yes, we need to shut it down before removing its data
                if ( server.getState() == ServerStateEnum.STARTED )
                {
                    // Setting the server of the server to 'stopping'
                    server.setState( ServerStateEnum.STOPPING );

                    // Getting the launch job
                    LaunchServerJob launchJob = server.getLaunchJob();
                    if ( launchJob != null )
                    {
                        // Getting the launch
                        ILaunch launch = launchJob.getLaunch();
                        if ( ( launch != null ) && ( !launch.isTerminated() ) )
                        {
                            // Terminating the launch
                            try
                            {
                                launch.terminate();
                            }
                            catch ( DebugException e )
                            {
                                ApacheDsPluginUtils.reportError( Messages.getString( "DeleteAction.ErrorWhileStopping" ) //$NON-NLS-1$
                                    + e.getMessage() );
                            }
                        }
                    }
                }

                // Removing the server
                ServersHandler.getDefault().removeServer( server );

                // Deleting the associated directory on disk
                deleteDirectory( new File( ApacheDsPluginUtils.getApacheDsServersFolder().append( server.getId() )
                    .toOSString() ) );
            }
        }
    }
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" ) ); //$NON-NLS-1$ //$NON-NLS-2$
                try
                {
                    page.openEditor( input, ServerConfigurationEditor.ID );
                }
                catch ( PartInitException e )
View Full Code Here

        if ( view != null )
        {
            StructuredSelection selection = ( StructuredSelection ) view.getViewer().getSelection();
            if ( !selection.isEmpty() )
            {
                Server server = ( Server ) selection.getFirstElement();
                PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn( view.getViewSite().getShell(),
                    server, ServerPropertyPage.ID, null, null );
                dialog.getShell().setText( "Properties for '" + shorten( server.getName(), 30 ) + "'" );
                dialog.open();
            }
        }
    }
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() );
            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
                ServerXmlIOV153 serverXmlIOV153 = new ServerXmlIOV153();
                ServerConfigurationV153 serverConfiguration = null;
                try
                {
                    serverConfiguration = ( ServerConfigurationV153 ) serverXmlIOV153.parse( new FileInputStream(
                        new File( ApacheDsPluginUtils.getApacheDsServersFolder().append( server.getId() ).append(
                            "conf" ).append( "server.xml" ).toOSString() ) ) );
                }
                catch ( FileNotFoundException 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 ( ( serverConfiguration.isEnableLdap() ) || ( serverConfiguration.isEnableLdaps() ) )
                {
                    // 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 ) view.getViewer().getSelection();
            if ( ( !selection.isEmpty() ) && ( selection.size() == 1 ) )
            {
                // Getting the server
                final Server server = ( Server ) selection.getFirstElement();

                // Parsing the 'server.xml' file
                ServerXmlIOV153 serverXmlIOV153 = new ServerXmlIOV153();
                ServerConfigurationV153 serverConfiguration = null;
                try
                {
                    serverConfiguration = ( ServerConfigurationV153 ) serverXmlIOV153.parse( new FileInputStream(
                        new File( ApacheDsPluginUtils.getApacheDsServersFolder().append( server.getId() ).append(
                            "conf" ).append( "server.xml" ).toOSString() ) ) );
                }
                catch ( FileNotFoundException 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();

                // 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

        // 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

        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

     * {@inheritDoc}
     */
    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

        {
            return consolesMap.get( serverId );
        }
        else
        {
            Server server = ServersHandler.getDefault().getServerById( serverId );

            LogMessageConsole logMessageConsole = new LogMessageConsole( "ApacheDS - " + server.getName() ); //$NON-NLS-1$

            consolesMap.put( serverId, logMessageConsole );

            ConsolePlugin.getDefault().getConsoleManager().addConsoles( new IConsole[]
                { logMessageConsole } );
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.