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

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


    {
        bot.waitUntil( new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                Server server = getServer( serverName );
                if ( server != null )
                {
                    return ( ServerStateEnum.STARTED == server.getState() );
                }

                return false;
            }
View Full Code Here


    {
        bot.waitUntil( new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                Server server = getServer( serverName );
                if ( server != null )
                {
                    return ( ServerStateEnum.STOPPED == server.getState() );
                }

                return false;
            }
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

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

            // 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 = Messages.getString( "RunAction.PortInUse" ); //$NON-NLS-1$
                        message = NLS
                            .bind(
                                Messages.getString( "RunAction.PortOfProtocolInUse" ), new String[] { alreadyInUseProtocolPortsList[0] } ); //$NON-NLS-1$
                    }
                    else
                    {
                        title = Messages.getString( "RunAction.PortsInUse" ); //$NON-NLS-1$
                        message = Messages.getString( "RunAction.PortsOfProtocolsInUse" ); //$NON-NLS-1$
                        for ( String alreadyInUseProtocolPort : alreadyInUseProtocolPortsList )
                        {
                            message += ApacheDsPluginUtils.LINE_SEPARATOR + "    - " + alreadyInUseProtocolPort; //$NON-NLS-1$
                        }
                    }

                    message += ApacheDsPluginUtils.LINE_SEPARATOR + ApacheDsPluginUtils.LINE_SEPARATOR
                        + Messages.getString( "RunAction.Continue" ); //$NON-NLS-1$

                    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

        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, ApacheDsPluginConstants.PROP_SERVER_PROPERTY_PAGE, null, null );
                dialog.getShell().setText( NLS.bind( Messages.getString( "PropertiesAction.PropertiesFor" ), //$NON-NLS-1$
                    shorten( server.getName(), 30 ) ) );
                dialog.open();
            }
        }
    }
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

            // 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(), Messages
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.