You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/05/04 10:56:54 UTC
svn commit: r1677554 [2/2] - in
/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config:
./ actions/ editor/ editor/databases/ editor/overlays/ editor/pages/ jobs/
model/ model/io/ wizards/
Copied: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java (from r1676215, directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OverviewPage.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java?p2=directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java&p1=directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OverviewPage.java&r1=1676215&r2=1677554&rev=1677554&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/OverviewPage.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OverviewPage.java Mon May 4 08:56:53 2015
@@ -17,45 +17,245 @@
* under the License.
*
*/
-package org.apache.directory.studio.openldap.config.editor;
+package org.apache.directory.studio.openldap.config.editor.pages;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.openldap.common.ui.LogLevel;
+import org.apache.directory.studio.openldap.common.ui.widgets.LogLevelWidget;
+import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPluginUtils;
+import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.databases.DatabaseWrapper;
+import org.apache.directory.studio.openldap.config.editor.databases.DatabaseWrapperLabelProvider;
+import org.apache.directory.studio.openldap.config.editor.databases.DatabaseWrapperViewerSorter;
+import org.apache.directory.studio.openldap.config.editor.overlays.ModuleWrapper;
+import org.apache.directory.studio.openldap.config.editor.overlays.ModuleWrapperLabelProvider;
+import org.apache.directory.studio.openldap.config.editor.overlays.ModuleWrapperViewerSorter;
+import org.apache.directory.studio.openldap.config.editor.pages.OverlaysPage;
+import org.apache.directory.studio.openldap.config.model.OlcModuleList;
+import org.apache.directory.studio.openldap.config.model.database.OlcDatabaseConfig;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
/**
- * This class represents the General Page of the Server Configuration Editor.
+ * This class represents the General Page of the Server Configuration Editor. It exposes some
+ * of the configured elements, and allow the user to configure some basic parameters :
+ * <ul>
+ * <li>olcServerID</li>
+ * <li>olcConfigDir</li>
+ * <li>olcPidFile</li>
+ * <li>olcLogFile</li>
+ * <li>olcLogLevel</li>
+ * </ul>
*
+ * <pre>
+ * .-----------------------------------------------------------------------------------.
+ * | Overview |
+ * +-----------------------------------------------------------------------------------+
+ * | .-------------------------------------------------------------------------------. |
+ * | |V Global parameters | |
+ * | +-------------------------------------------------------------------------------+ |
+ * | | Server ID : [ ] | |
+ * | | | |
+ * | | Configuration Dir : [ ] Pid File : [ ] | |
+ * | | Log File : [ ] Log Level : [ ] (edit)| |
+ * | +-------------------------------------------------------------------------------+ |
+ * | |
+ * | .---------------------------------------. .------------------------------------. |
+ * | |V Databases | |V Overlays | |
+ * | +---------------------------------------+ +------------------------------------+ |
+ * | | +----------------------------------+ | | +--------------------------------+ | |
+ * | | | abc | | | | module 1 | | |
+ * | | | xyz | | | | module 2 | | |
+ * | | +----------------------------------+ | | +--------------------------------+ | |
+ * | | <Advanced databases configuration> | | <Overlays configuration> | |
+ * | +---------------------------------------+ +------------------------------------+ |
+ * | |
+ * | .-------------------------------------------------------------------------------. |
+ * | |V Configuration detail | |
+ * | +-------------------------------------------------------------------------------+ |
+ * | | <Security configuration> <Tunning configuration> | |
+ * | | <Schemas configuration> <Options configuration> | |
+ * | +-------------------------------------------------------------------------------+ |
+ * +-----------------------------------------------------------------------------------+
+ * </pre>
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class OverviewPage extends ServerConfigurationEditorPage
+public class OverviewPage extends OpenLDAPServerConfigurationEditorPage
{
/** The Page ID*/
public static final String ID = OverviewPage.class.getName(); //$NON-NLS-1$
/** The Page Title */
- private static final String TITLE = "Overview";
+ private static final String TITLE = Messages.getString( "OpenLDAPOverviewPage.Title" ); //$NON-NLS-1$"Overview";
+
+ // UI Controls
+ /** olcServerID */
+ private Text serverIdText;
+
+ /** olcConfigDir */
+ private Text configDirText;
+
+ /** olcPidFile */
+ private Text pidFileText;
+
+ /** olcLogFile */
+ private Text logFileText;
+
+ /** olcLogLevel */
+ private LogLevelWidget logLevelWidget;
+
+ /** The table listing all the existing databases */
+ private TableViewer databaseViewer;
+
+ /** The database wrappers */
+ private List<DatabaseWrapper> databaseWrappers = new ArrayList<DatabaseWrapper>();
+
+ /** This link opens the Databases configuration tab */
+ private Hyperlink databasesPageLink;
+
+ /** The table listing all the existing modules */
+ private TableViewer moduleViewer;
+
+ /** The module wrappers */
+ private List<ModuleWrapper> moduleWrappers = new ArrayList<ModuleWrapper>();
+
+ /** This link opens the Overlays configuration tab */
+ private Hyperlink overlaysPageLink;
+
+ // This link opens the Security configuration tab
+ private Hyperlink securityPageLink;
+ // This link opens the Tuning configuration tab
+ private Hyperlink tuningPageLink;
- // UI Controls
+ // This link opens the Schema configuration tab
+ private Hyperlink schemaPageLink;
+
+ // This link opens the Options configuration tab
+ private Hyperlink optionsPageLink;
/**
* Creates a new instance of GeneralPage.
*
- * @param editor
- * the associated editor
+ * @param editor the associated editor
*/
- public OverviewPage( ServerConfigurationEditor editor )
+ public OverviewPage( OpenLDAPServerConfigurationEditor editor )
{
super( editor, ID, TITLE );
}
+
+ /**
+ * Databases configuration hyper link adapter
+ */
+ private HyperlinkAdapter databasesPageLinkListener = new HyperlinkAdapter()
+ {
+ public void linkActivated( HyperlinkEvent e )
+ {
+ getServerConfigurationEditor().showPage( DatabasesPage.class );
+ }
+ };
+
+
+ /**
+ * Overlays configuration hyper link adapter
+ */
+ private HyperlinkAdapter overlaysPageLinkListener = new HyperlinkAdapter()
+ {
+ public void linkActivated( HyperlinkEvent e )
+ {
+ getServerConfigurationEditor().showPage( OverlaysPage.class );
+ }
+ };
+
+
+ /**
+ * Security configuration hyper link adapter
+ */
+ private HyperlinkAdapter securityPageLinkListener = new HyperlinkAdapter()
+ {
+ public void linkActivated( HyperlinkEvent e )
+ {
+ //getServerConfigurationEditor().showPage( SecurityPage.class );
+ }
+ };
+
/**
+ * Tuning configuration hyper link adapter
+ */
+ private HyperlinkAdapter tuningPageLinkListener = new HyperlinkAdapter()
+ {
+ public void linkActivated( HyperlinkEvent e )
+ {
+ //getServerConfigurationEditor().showPage( TuningPage.class );
+ }
+ };
+
+
+ /**
+ * Schema configuration hyper link adapter
+ */
+ private HyperlinkAdapter schemaPageLinkListener = new HyperlinkAdapter()
+ {
+ public void linkActivated( HyperlinkEvent e )
+ {
+ //getServerConfigurationEditor().showPage( SchemaPage.class );
+ }
+ };
+
+
+ /**
+ * Options configuration hyper link adapter
+ */
+ private HyperlinkAdapter optionsPageLinkListener = new HyperlinkAdapter()
+ {
+ public void linkActivated( HyperlinkEvent e )
+ {
+ getServerConfigurationEditor().showPage( OptionsPage.class );
+ }
+ };
+
+
+ /**
+ * Creates the global Overview OpenLDAP config Tab. It contains 3 rows, with
+ * one or two sections in each :
+ *
+ * <pre>
+ * +---------------------------------------------------------------------+
+ * | |
+ * | Global parameters |
+ * | |
+ * +-----------------------------------+---------------------------------+
+ * | | |
+ * | Databases | Overlays |
+ * | | |
+ * +-----------------------------------+---------------------------------+
+ * | |
+ * | Configuration links |
+ * | |
+ * +---------------------------------------------------------------------+
+ * </pre>
* {@inheritDoc}
*/
protected void createFormContent( Composite parent, FormToolkit toolkit )
@@ -64,26 +264,617 @@ public class OverviewPage extends Server
twl.numColumns = 2;
parent.setLayout( twl );
- Composite leftComposite = toolkit.createComposite( parent );
- leftComposite.setLayout( new GridLayout() );
- TableWrapData leftCompositeTableWrapData = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
+ // The upper part
+ Composite upperComposite = toolkit.createComposite( parent );
+ upperComposite.setLayout( new GridLayout() );
+ TableWrapData leftCompositeTableWrapData = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP, 1, 2 );
leftCompositeTableWrapData.grabHorizontal = true;
- leftComposite.setLayoutData( leftCompositeTableWrapData );
+ upperComposite.setLayoutData( leftCompositeTableWrapData );
- Composite rightComposite = toolkit.createComposite( parent );
- rightComposite.setLayout( new GridLayout() );
- TableWrapData rightCompositeTableWrapData = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP );
- rightCompositeTableWrapData.grabHorizontal = true;
- rightComposite.setLayoutData( rightCompositeTableWrapData );
+ // The middle left part
+ Composite middleLeftComposite = toolkit.createComposite( parent );
+ middleLeftComposite.setLayout( new GridLayout() );
+ TableWrapData middleLeftCompositeTableWrapData = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP, 1, 1 );
+ middleLeftCompositeTableWrapData.grabHorizontal = true;
+ middleLeftComposite.setLayoutData( middleLeftCompositeTableWrapData );
+
+ // The middle right part
+ Composite middleRightComposite = toolkit.createComposite( parent );
+ middleRightComposite.setLayout( new GridLayout() );
+ TableWrapData middleRightCompositeTableWrapData = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP, 1, 1 );
+ middleRightCompositeTableWrapData.grabHorizontal = true;
+ middleRightComposite.setLayoutData( middleRightCompositeTableWrapData );
+
+ // The lower part
+ Composite lowerComposite = toolkit.createComposite( parent );
+ lowerComposite.setLayout( new GridLayout() );
+ TableWrapData lowerCompositeTableWrapData = new TableWrapData( TableWrapData.FILL, TableWrapData.TOP, 1, 2 );
+ lowerCompositeTableWrapData.grabHorizontal = true;
+ lowerComposite.setLayoutData( lowerCompositeTableWrapData );
+
+ // Now, create the sections
+ createGlobalSection( toolkit, upperComposite );
+ createDatabasesSection( toolkit, middleLeftComposite );
+ createOverlaysSection( toolkit, middleRightComposite );
+ createConfigDetailsLinksSection( toolkit, lowerComposite );
refreshUI();
}
/**
+ * Creates the global section. This section is a grid with 4 columns,
+ * where we configure the global options. We support the configuration
+ * of those parameters :
+ * <ul>
+ * <li>olcServerID</li>
+ * <li>olcConfigDir</li>
+ * <li>olcPidFile</li>
+ * <li>olcLogFile</li>
+ * <li>olcLogLevel</li>
+ * </ul>
+ *
+ * <pre>
+ * .-------------------------------------------------------------------------------.
+ * |V Global parameters |
+ * +-------------------------------------------------------------------------------+
+ * | Server ID : [ ] |
+ * | |
+ * | Configuration Dir : [ ] Pid File : [ ] |
+ * | Log File : [ ] Log Level : [ ] (Edit) |
+ * +-------------------------------------------------------------------------------+
+ * </pre>
+ *
+ * @param toolkit the toolkit
+ * @param parent the parent composite
+ */
+ private void createGlobalSection( FormToolkit toolkit, Composite parent )
+ {
+ // Creation of the section
+ Section section = createSection( toolkit, parent, Messages.getString( "OpenLDAPOverviewPage.GlobalSection" ) );
+
+ // The content
+ Composite composite = toolkit.createComposite( section );
+ toolkit.paintBordersFor( composite );
+ GridLayout gridLayout = new GridLayout( 4, false );
+ gridLayout.marginHeight = gridLayout.marginWidth = 0;
+ composite.setLayout( gridLayout );
+ section.setClient( composite );
+
+ // The ServerID parameter
+ toolkit.createLabel( composite, Messages.getString( "OpenLDAPOverviewPage.ServerID" ) ); //$NON-NLS-1$
+ serverIdText = createServerIdText( toolkit, composite );
+ toolkit.createLabel( composite, TABULATION );
+ toolkit.createLabel( composite, TABULATION );
+
+ // One blank line
+ for ( int i = 0; i < gridLayout.numColumns; i++ )
+ {
+ toolkit.createLabel( composite, TABULATION );
+ }
+
+ // The ConfigDir parameter
+ toolkit.createLabel( composite, Messages.getString( "OpenLDAPOverviewPage.ConfigDir" ) ); //$NON-NLS-1$
+ configDirText = createConfigDirText( toolkit, composite );
+
+ // The PidFile parameter
+ toolkit.createLabel( composite, Messages.getString( "OpenLDAPOverviewPage.PidFile" ) ); //$NON-NLS-1$
+ pidFileText = createPidFileText( toolkit, composite );
+ pidFileText.setText( getConfiguration().getGlobal().getOlcPidFile() );
+
+ // The LogFile parameter
+ toolkit.createLabel( composite, Messages.getString( "OpenLDAPOverviewPage.LogFile" ) ); //$NON-NLS-1$
+ logFileText = createLogFileText( toolkit, composite );
+
+ // The LogLevel parameter
+ toolkit.createLabel( composite, Messages.getString( "OpenLDAPOverviewPage.LogLevel" ) );
+ logLevelWidget = new LogLevelWidget();
+ logLevelWidget.create( composite, toolkit );
+ logLevelWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ }
+
+
+ /**
+ * Creates the Databases section. It only expose the existing databases,
+ * they can't be changed.
+ *
+ * <pre>
+ * .------------------------------------.
+ * |V Databases |
+ * +------------------------------------+
+ * | +-------------------------------+ |
+ * | | abc | |
+ * | | xyz | |
+ * | +-------------------------------+ |
+ * | <Advanced databases configuration> |
+ * +------------------------------------+
+ * </pre>
+ *
+ * @param toolkit the toolkit
+ * @param parent the parent composite
+ */
+ private void createDatabasesSection( FormToolkit toolkit, Composite parent )
+ {
+ // Creation of the section
+ Section section = createSection( toolkit, parent, Messages.getString( "OpenLDAPOverviewPage.DatabasesSection" ) );
+
+ // The content
+ Composite composite = toolkit.createComposite( section );
+ toolkit.paintBordersFor( composite );
+ GridLayout gridLayout = new GridLayout( 1, false );
+ gridLayout.marginHeight = gridLayout.marginWidth = 0;
+ composite.setLayout( gridLayout );
+ section.setClient( composite );
+
+ // The inner composite
+ Composite databaseComposite = toolkit.createComposite( section );
+ databaseComposite.setLayout( new GridLayout( 1, false ) );
+ toolkit.paintBordersFor( databaseComposite );
+ section.setClient( databaseComposite );
+ section.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+ // Creating the Table and Table Viewer
+ Table table = toolkit.createTable( databaseComposite, SWT.NONE );
+ GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true, 1, 5 );
+ gd.heightHint = 100;
+ gd.widthHint = 100;
+ table.setLayoutData( gd );
+
+ databaseViewer = new TableViewer( table );
+ databaseViewer.setContentProvider( new ArrayContentProvider() );
+ databaseViewer.setLabelProvider( new DatabaseWrapperLabelProvider() );
+ databaseViewer.setSorter( new DatabaseWrapperViewerSorter() );
+
+ // Databases Page Link
+ databasesPageLink = toolkit.createHyperlink( databaseComposite,
+ Messages.getString( "OpenLDAPOverviewPage.DatabasesPageLink" ), SWT.NONE ); //$NON-NLS-1$
+ databasesPageLink.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 1, 1 ) );
+ databasesPageLink.addHyperlinkListener( databasesPageLinkListener );
+ }
+
+
+ /**
+ * Creates the Overlays section. It only expose the existing overlays,
+ * they can't be changed.
+ *
+ * <pre>
+ * .------------------------------------.
+ * |V Overlays |
+ * +------------------------------------+
+ * | +-------------------------------+ |
+ * | | abc | |
+ * | | xyz | |
+ * | +-------------------------------+ |
+ * | <Advanced Overlays configuration> |
+ * +------------------------------------+
+ * </pre>
+ *
+ * @param toolkit the toolkit
+ * @param parent the parent composite
+ */
+ private void createOverlaysSection( FormToolkit toolkit, Composite parent )
+ {
+ // Creation of the section
+ Section section = createSection( toolkit, parent, Messages.getString( "OpenLDAPOverviewPage.OverlaysSection" ) );
+
+ // The content
+ Composite composite = toolkit.createComposite( section );
+ toolkit.paintBordersFor( composite );
+ GridLayout gridLayout = new GridLayout( 1, false );
+ gridLayout.marginHeight = gridLayout.marginWidth = 0;
+ composite.setLayout( gridLayout );
+ section.setClient( composite );
+
+ // The inner composite
+ Composite overlayComposite = toolkit.createComposite( section );
+ overlayComposite.setLayout( new GridLayout( 1, false ) );
+ toolkit.paintBordersFor( overlayComposite );
+ section.setClient( overlayComposite );
+ section.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+ // Creating the Table and Table Viewer
+ Table table = toolkit.createTable( overlayComposite, SWT.NONE );
+ GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true, 1, 5 );
+ gd.heightHint = 100;
+ gd.widthHint = 100;
+ table.setLayoutData( gd );
+
+ moduleViewer = new TableViewer( table );
+ moduleViewer.setContentProvider( new ArrayContentProvider() );
+ moduleViewer.setLabelProvider( new ModuleWrapperLabelProvider() );
+ moduleViewer.setSorter( new ModuleWrapperViewerSorter() );
+
+ // Overlays Page Link
+ overlaysPageLink = toolkit.createHyperlink( overlayComposite,
+ Messages.getString( "OpenLDAPOverviewPage.OverlaysPageLink" ), SWT.NONE ); //$NON-NLS-1$
+ overlaysPageLink.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 1, 1 ) );
+ overlaysPageLink.addHyperlinkListener( overlaysPageLinkListener );
+ }
+
+
+ /**
+ * Creates the configuration details section. It just links to some other pages
+ *
+ * <pre>
+ * .------------------------------------------------------------------------.
+ * |V Configuration detail |
+ * +------------------------------------------------------------------------+
+ * | <Security configuration> |
+ * | <Tunning configuration> |
+ * | <Options configuration> |
+ * | <Schemas configuration> |
+ * +------------------------------------------------------------------------+ |
+ * </pre>
+ *
+ * @param toolkit the toolkit
+ * @param parent the parent composite
+ */
+ private void createConfigDetailsLinksSection( FormToolkit toolkit, Composite parent )
+ {
+ // Creation of the section
+ Section section = createSection( toolkit, parent, Messages.getString( "OpenLDAPOverviewPage.ConfigDetailsSection" ) );
+
+ // The content
+ Composite composite = toolkit.createComposite( section );
+ toolkit.paintBordersFor( composite );
+ GridLayout gridLayout = new GridLayout( 2, false );
+ gridLayout.marginHeight = gridLayout.marginWidth = 0;
+ composite.setLayout( gridLayout );
+ section.setClient( composite );
+
+ // Security Page Link
+ securityPageLink = toolkit.createHyperlink( composite,
+ Messages.getString( "OpenLDAPOverviewPage.SecurityPageLink" ), SWT.NONE ); //$NON-NLS-1$
+ securityPageLink.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 1, 1 ) );
+ securityPageLink.addHyperlinkListener( securityPageLinkListener );
+
+ // Tuning Page Link
+ tuningPageLink = toolkit.createHyperlink( composite,
+ Messages.getString( "OpenLDAPOverviewPage.TuningPageLink" ), SWT.NONE ); //$NON-NLS-1$
+ tuningPageLink.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 1, 1 ) );
+ tuningPageLink.addHyperlinkListener( tuningPageLinkListener );
+
+ // Schema Page Link
+ schemaPageLink = toolkit.createHyperlink( composite,
+ Messages.getString( "OpenLDAPOverviewPage.SchemaPageLink" ), SWT.NONE ); //$NON-NLS-1$
+ schemaPageLink.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 1, 1 ) );
+ schemaPageLink.addHyperlinkListener( schemaPageLinkListener );
+
+ // Options Page Link
+ optionsPageLink = toolkit.createHyperlink( composite,
+ Messages.getString( "OpenLDAPOverviewPage.OptionsPageLink" ), SWT.NONE ); //$NON-NLS-1$
+ optionsPageLink.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 1, 1 ) );
+ optionsPageLink.addHyperlinkListener( optionsPageLinkListener );
+ }
+
+
+ /**
+ * Creates a Text that can be used to enter a serverID. If the serverID is incorrect,
+ * it will be in red while typing until it gets correct.
+ *
+ * @param toolkit the toolkit
+ * @param parent the parent
+ * @return a Text that can be used to enter a ServerID
+ */
+ private Text createServerIdText( FormToolkit toolkit, Composite parent )
+ {
+ final Text serverIdText = toolkit.createText( parent, "" ); //$NON-NLS-1$
+ GridData gd = new GridData( SWT.NONE, SWT.NONE, false, false );
+ gd.widthHint = 200;
+ serverIdText.setLayoutData( gd );
+
+ serverIdText.addModifyListener( new ModifyListener()
+ {
+ Display display = serverIdText.getDisplay();
+
+ // Check that the ServerID is valid
+ public void modifyText( ModifyEvent e )
+ {
+ Text serverIdText = (Text)e.widget;
+ String serverId = serverIdText.getText();
+
+ try
+ {
+ Integer.parseInt( serverId );
+ }
+ catch ( NumberFormatException nfe )
+ {
+ serverIdText.setForeground( display.getSystemColor( SWT.COLOR_RED ) );
+ }
+ }
+ } );
+
+ // No more than 3 digits
+ serverIdText.setTextLimit( 3 );
+
+ return serverIdText;
+ }
+
+
+ /**
+ * Creates a Text that can be used to enter an ConfigDir.
+ *
+ * @param toolkit the toolkit
+ * @param parent the parent
+ * @return a Text that can be used to enter a config Dir
+ */
+ private Text createConfigDirText( FormToolkit toolkit, Composite parent )
+ {
+ final Text configDirText = toolkit.createText( parent, "" ); //$NON-NLS-1$
+ GridData gd = new GridData( SWT.NONE, SWT.NONE, false, false );
+ gd.widthHint = 300;
+ configDirText.setLayoutData( gd );
+
+ // No more than 512 digits
+ configDirText.setTextLimit( 512 );
+
+ return configDirText;
+ }
+
+
+ /**
+ * Creates a Text that can be used to enter a PID file.
+ *
+ * @param toolkit the toolkit
+ * @param parent the parent
+ * @return a Text that can be used to enter a PID file
+ */
+ private Text createPidFileText( FormToolkit toolkit, Composite parent )
+ {
+ final Text pidFileText = toolkit.createText( parent, "" ); //$NON-NLS-1$
+ GridData gd = new GridData( SWT.NONE, SWT.NONE, false, false );
+ gd.widthHint = 300;
+ pidFileText.setLayoutData( gd );
+
+ // No more than 512 digits
+ pidFileText.setTextLimit( 512 );
+
+ return pidFileText;
+ }
+
+
+ /**
+ * Creates a Text that can be used to enter a Log file.
+ *
+ * @param toolkit the toolkit
+ * @param parent the parent
+ * @return a Text that can be used to enter a Log file
+ */
+ private Text createLogFileText( FormToolkit toolkit, Composite parent )
+ {
+ final Text logFileText = toolkit.createText( parent, "" ); //$NON-NLS-1$
+ GridData gd = new GridData( SWT.NONE, SWT.NONE, false, false );
+ gd.widthHint = 300;
+ logFileText.setLayoutData( gd );
+
+ // No more than 512 digits
+ logFileText.setTextLimit( 512 );
+
+ return logFileText;
+ }
+
+
+ /**
+ * Creates a Text that can be used to enter the Log level.
+ *
+ * @param toolkit the toolkit
+ * @param parent the parent
+ * @return a Text that can be used to enter the Log level
+ */
+ private Text createLogLevelText( FormToolkit toolkit, Composite parent )
+ {
+ final Text logLevelText = toolkit.createText( parent, "" ); //$NON-NLS-1$
+ GridData gd = new GridData( SWT.NONE, SWT.NONE, false, false );
+ gd.widthHint = 200;
+ logLevelText.setLayoutData( gd );
+
+ // No more than 512 digits
+ logLevelText.setTextLimit( 512 );
+
+ logLevelText.addModifyListener( new ModifyListener()
+ {
+ Display display = logLevelText.getDisplay();
+
+ // Check that the LogLevel is valid
+ public void modifyText( ModifyEvent e )
+ {
+ Text logLevelText = (Text)e.widget;
+ String logLevel = logLevelText.getText();
+
+ try
+ {
+ Integer.parseInt( logLevel );
+ logLevelText.setForeground( display.getSystemColor( SWT.COLOR_BLACK ) );
+ }
+ catch ( NumberFormatException nfe )
+ {
+ logLevelText.setForeground( display.getSystemColor( SWT.COLOR_RED ) );
+ }
+ }
+ } );
+
+ // No more than 6 digits
+ logLevelText.setTextLimit( 6 );
+
+ return logLevelText;
+ }
+
+
+ /**
+ * Get the ServerID
+ */
+ private String getServerId()
+ {
+ List<String> serverIdList = getConfiguration().getGlobal().getOlcServerID();
+
+ if ( serverIdList == null )
+ {
+ return "";
+ }
+
+ boolean isFirst = true;
+ StringBuilder sb = new StringBuilder();
+
+ for ( String serverId : serverIdList )
+ {
+ if ( isFirst )
+ {
+ isFirst = false;
+ }
+ else
+ {
+ sb.append( ", " );
+ }
+
+ sb.append( serverId );
+ }
+
+ return sb.toString();
+ }
+
+
+ /**
+ * Get the various LogLevel values, and concatenate them in a String
+ */
+ private String getLogLevel()
+ {
+ List<String> logLevelList = getConfiguration().getGlobal().getOlcLogLevel();
+
+ if ( logLevelList == null )
+ {
+ return "none";
+ }
+
+ boolean isFirst = true;
+ StringBuilder sb = new StringBuilder();
+
+ for ( String logLevel : logLevelList )
+ {
+ if ( isFirst )
+ {
+ isFirst = false;
+ }
+ else
+ {
+ sb.append( " " );
+ }
+
+ sb.append( logLevel );
+ }
+
+ return sb.toString();
+ }
+
+
+ /**
* {@inheritDoc}
*/
- protected void refreshUI()
+ public void refreshUI()
+ {
+ if ( isInitialized() )
+ {
+ removeListeners();
+
+ // Update the ServerIDText
+ serverIdText.setText( getServerId() );
+
+ // Update the ConfigDirText
+ configDirText.setText( getConfiguration().getGlobal().getOlcConfigDir() );
+
+ // Update the LogFIleText
+ String logFile = getConfiguration().getGlobal().getOlcLogFile();
+
+ if ( logFile != null )
+ {
+ logFileText.setText( logFile );
+ }
+ else
+ {
+ logFileText.setText( "<stderr>" );
+ }
+
+ // Update the DatabaseTableViewer
+ databaseWrappers.clear();
+
+ for ( OlcDatabaseConfig database : getConfiguration().getDatabases() )
+ {
+ databaseWrappers.add( new DatabaseWrapper( database ) );
+ }
+
+ databaseViewer.setInput( databaseWrappers );
+
+ // Update the OverlaysTableViewer
+ moduleWrappers.clear();
+
+ for ( OlcModuleList moduleList : getConfiguration().getModules() )
+ {
+ List<String> modules = moduleList.getOlcModuleLoad();
+ int index = OpenLdapConfigurationPluginUtils.getOrderingPostfix( moduleList.getCn().get( 0 ) );
+
+ if ( modules != null )
+ {
+ for ( String module : modules )
+ {
+ int order = OpenLdapConfigurationPluginUtils.getOrderingPrefix( module );
+ String strippedModule = OpenLdapConfigurationPluginUtils.stripOrderingPrefix( module );
+ String strippedModuleListName = OpenLdapConfigurationPluginUtils.stripOrderingPostfix( moduleList.getCn().get( 0 ) );
+ moduleWrappers.add( new ModuleWrapper( strippedModuleListName, index, strippedModule, moduleList.
+ getOlcModulePath(), order ) );
+ }
+ }
+ }
+
+ moduleViewer.setInput( moduleWrappers );
+
+ // Update the LogLevelWidget
+ String logLevels = getLogLevel();
+ logLevelWidget.setValue( LogLevel.parseLogLevel( logLevels ) );
+
+ addListeners();
+ }
+ }
+
+
+ /**
+ * Removes the listeners
+ */
+ private void removeListeners()
{
+ // The serverID Text
+ removeDirtyListener( serverIdText );
+
+ // The configDir Text
+ removeDirtyListener( configDirText );
+
+ // The pidFile Text
+ removeDirtyListener( pidFileText );
+
+ // The logFile Text
+ removeDirtyListener( logFileText );
+
+ // The LogLevel Widget
+ logLevelWidget.removeWidgetModifyListener( dirtyWidgetModifyListener );
+ }
+
+
+ /**
+ * Adds listeners to UI Controls.
+ */
+ private void addListeners()
+ {
+ // The serverID Text
+ addDirtyListener( serverIdText );
+
+ // The configDir Text
+ addDirtyListener( configDirText );
+
+ // The pidFile Text
+ addDirtyListener( pidFileText );
+
+ // The logFile Text
+ addDirtyListener( logFileText );
+
+ // The LogLevel Widget
+ logLevelWidget.addWidgetModifyListener( dirtyWidgetModifyListener );
}
}
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties?rev=1677554&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages.properties Mon May 4 08:56:53 2015
@@ -0,0 +1,52 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+ConnectionServerConfigurationInput.ConnectionConfiguration={0} - Configuration
+
+ErrorPage.CouldNotOpenEditor=Could not open the editor.
+ErrorPage.Details=Details
+ErrorPage.ErrorOpeningEditor=Error opening the editor
+
+LoadingPage.LoadingConfiguration=Loading Configuration
+LoadingPage.LoadingConfigurationEllipsis=Loading Configuration...
+LoadingPage.LoadingTheConfigurationPleaseWait=Loading the configuration, please wait...
+
+NewServerConfigurationInput.NewOpenLDAPConfigurationFile=New OpenLDAP configuration file
+
+ServerConfigurationEditor.SavingServerConfiguration=Saving Server Configuration
+
+ServerConfigurationEditorUtils.ChangesCouldNotBeSavedToConnection=Changes could not be saved to the connection.
+ServerConfigurationEditorUtils.Question=Question
+ServerConfigurationEditorUtils.TheFileAlreadyExistsWantToReplace=The file "{0}" already exists. Do you want to replace the existing file?
+
+OpenLDAPOverviewPage.Title=Overview
+OpenLDAPOverviewPage.GlobalSection=Global parameters
+OpenLDAPOverviewPage.ServerID=Server ID :
+OpenLDAPOverviewPage.ConfigDir=Config. Directory :
+OpenLDAPOverviewPage.PidFile=PID File :
+OpenLDAPOverviewPage.LogFile=Log File :
+OpenLDAPOverviewPage.LogLevel=Log Level :
+OpenLDAPOverviewPage.DatabasesSection=Databases
+OpenLDAPOverviewPage.DatabasesPageLink=Advanced Databases Configuration...
+OpenLDAPOverviewPage.OverlaysSection=Loaded Overlays
+OpenLDAPOverviewPage.OverlaysPageLink=Advanced Overlays Configuration...
+OpenLDAPOverviewPage.ConfigDetailsSection=Configuration Details
+OpenLDAPOverviewPage.SecurityPageLink=Security Configuration...
+OpenLDAPOverviewPage.TuningPageLink=Tuning Configuration...
+OpenLDAPOverviewPage.SchemaPageLink=Schema Configuration...
+OpenLDAPOverviewPage.OptionsPageLink=Options Configuration...
+
+OptionsPage.LogTitle=Logs
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties?rev=1677554&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_de.properties Mon May 4 08:56:53 2015
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+ConnectionServerConfigurationInput.ConnectionConfiguration={0} - Konfiguration
+
+ErrorPage.CouldNotOpenEditor=Der Editor konnte nicht ge\u00F6ffnet werden.
+ErrorPage.Details=Details
+ErrorPage.ErrorOpeningEditor=Fehler beim \u00D6ffnen des Editors
+
+LoadingPage.LoadingConfiguration=Konfiguration wird geladen
+LoadingPage.LoadingConfigurationEllipsis=Konfiguration wird geladen...
+LoadingPage.LoadingTheConfigurationPleaseWait=Konfiguration wird geladen, bitte warten...
+
+NewServerConfigurationInput.NewApacheDS20ConfigurationFile=Neue OpenLDAP Konfigurationsdatei
+
+ServerConfigurationEditor.SavingServerConfiguration=Server Konfiguration speichern
+
+ServerConfigurationEditorPage.DefaultWithValue=(Default: {0})
+
+ServerConfigurationEditorUtils.ChangesCouldNotBeSavedToConnection=\u00C4nderungen konnten nicht \u00FCber die Verbindung gespeichert werden.
+ServerConfigurationEditorUtils.Question=Frage
+ServerConfigurationEditorUtils.TheFileAlreadyExistsWantToReplace=Die Datei "{0}" existiert bereits. Soll die existierende Datei \u00FCberschrieben werden?
Added: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties?rev=1677554&view=auto
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties (added)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/messages_fr.properties Mon May 4 08:56:53 2015
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+ConnectionServerConfigurationInput.ConnectionConfiguration={0} - Configuration
+
+ErrorPage.CouldNotOpenEditor=Impossible d''ouvrir l''\u00E9diteur.
+ErrorPage.Details=D\u00E9tails
+ErrorPage.ErrorOpeningEditor=Erreur \u00E0 l''ouverture de l''\u00E9diteur
+
+
+LoadingPage.LoadingConfiguration=Chargement de la configuration
+LoadingPage.LoadingConfigurationEllipsis=Chargement de la configuration...
+LoadingPage.LoadingTheConfigurationPleaseWait=Chargement de la configuration en cours, veuillez patienter...
+
+NewServerConfigurationInput.NewApacheDS20ConfigurationFile=Nouveau fichier de configuration OpenLDAP
+
+ServerConfigurationEditor.SavingServerConfiguration=Sauvegarde de la configuration du serveur
+
+ServerConfigurationEditorPage.DefaultWithValue=(Par d\u00E9faut: {0})
+
+ServerConfigurationEditorUtils.ChangesCouldNotBeSavedToConnection=Les modifications n''ont pu \u00EAtre sauvegard\u00E9es sur la connection.
+ServerConfigurationEditorUtils.Question=Question
+ServerConfigurationEditorUtils.TheFileAlreadyExistsWantToReplace=Le fichier "{0}" existe d\u00E9j\u00E0. Souhaitez-vous remplacer le fichier existant ?
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/LoadConfigurationRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/LoadConfigurationRunnable.java?rev=1677554&r1=1677553&r2=1677554&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/LoadConfigurationRunnable.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/jobs/LoadConfigurationRunnable.java Mon May 4 08:56:53 2015
@@ -29,7 +29,7 @@ import org.eclipse.ui.IEditorInput;
import org.apache.directory.studio.openldap.config.editor.ConnectionServerConfigurationInput;
import org.apache.directory.studio.openldap.config.editor.DirectoryServerConfigurationInput;
-import org.apache.directory.studio.openldap.config.editor.ServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
import org.apache.directory.studio.openldap.config.model.OpenLdapConfiguration;
import org.apache.directory.studio.openldap.config.model.io.ConfigurationReader;
@@ -42,7 +42,7 @@ import org.apache.directory.studio.openl
public class LoadConfigurationRunnable implements StudioRunnableWithProgress
{
/** The associated editor */
- private ServerConfigurationEditor editor;
+ private OpenLDAPServerConfigurationEditor editor;
/**
@@ -50,7 +50,7 @@ public class LoadConfigurationRunnable i
*
* @param editor the editor
*/
- public LoadConfigurationRunnable( ServerConfigurationEditor editor )
+ public LoadConfigurationRunnable( OpenLDAPServerConfigurationEditor editor )
{
this.editor = editor;
}
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapConfiguration.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapConfiguration.java?rev=1677554&r1=1677553&r2=1677554&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapConfiguration.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/OpenLdapConfiguration.java Mon May 4 08:56:53 2015
@@ -47,80 +47,176 @@ public class OpenLdapConfiguration
/** The other configuration elements list*/
private List<OlcConfig> configurationElements = new ArrayList<OlcConfig>();
+
+ /** The loaded modules */
+ private List<OlcModuleList> modules = new ArrayList<OlcModuleList>();
- public boolean add( OlcConfig o )
+ /**
+ * @return the list of modules
+ */
+ public List<OlcModuleList> getModules()
{
- return configurationElements.add( o );
+ return modules;
}
- public boolean addDatabase( OlcDatabaseConfig o )
+ /**
+ * Add a module in the list of modules
+ *
+ * @param modules the modules to add
+ */
+ public void add( OlcModuleList module )
{
- return databases.add( o );
+ modules.add( module );
}
- public void clearDatabases()
+ /**
+ * Remove a module from the list of modules
+ *
+ * @param modules the modules to remove
+ */
+ public boolean remove( OlcModuleList module )
{
- databases.clear();
+ return modules.remove( module );
}
- public boolean contains( OlcConfig o )
+ /**
+ * Reset the module list
+ */
+ public void clearModuleList()
{
- return configurationElements.contains( o );
+ modules.clear();
}
+ /**
+ * @return the list of configuration elements
+ */
public List<OlcConfig> getConfigurationElements()
{
return configurationElements;
}
+
+ /**
+ * Add a configuration element in the list of elements
+ *
+ * @param element the element to add
+ */
+ public boolean add( OlcConfig element )
+ {
+ return configurationElements.add( element );
+ }
+
- public Connection getConnection()
+ /**
+ * Tells if the list of elements contains a given element
+ *
+ * @param element The element we are looking for
+ * @return true if the element exists
+ */
+ public boolean contains( OlcConfig element )
{
- return connection;
+ return configurationElements.contains( element );
+ }
+
+
+ /**
+ * Remove a element from the list of configuration elements
+ *
+ * @param element the element to remove
+ */
+ public boolean remove( OlcConfig element )
+ {
+ return configurationElements.remove( element );
}
+ /**
+ * @return the list of databases
+ */
public List<OlcDatabaseConfig> getDatabases()
{
return databases;
}
- public OlcGlobal getGlobal()
+ /**
+ * Add a database in the list of databases
+ *
+ * @param database the database to add
+ */
+ public boolean add( OlcDatabaseConfig database )
{
- return global;
+ return databases.add( database );
}
- public boolean remove( OlcConfig o )
+ /**
+ * Reset the database list
+ */
+ public void clearDatabases()
{
- return configurationElements.remove( o );
+ databases.clear();
}
- public boolean removeDatabase( OlcDatabaseConfig o )
+ /**
+ * Remove a database from the list of databases
+ *
+ * @param database the database to remove
+ */
+ public boolean remove( OlcDatabaseConfig database )
{
- return databases.remove( o );
+ return databases.remove( database );
}
- public void setConnection( Connection connection )
+ /**
+ * @return the connection
+ */
+ public Connection getConnection()
{
- this.connection = connection;
+ return connection;
}
+ /**
+ * @return the global configuration
+ */
+ public OlcGlobal getGlobal()
+ {
+ return global;
+ }
+
+
+ /**
+ * Store the global configuration (which belongs to cn=config)
+ * @param global The configuration
+ */
public void setGlobal( OlcGlobal global )
{
this.global = global;
}
+ /**
+ * Stores the connection in the configuration
+ *
+ * @param connection The connection to store
+ */
+ public void setConnection( Connection connection )
+ {
+ this.connection = connection;
+ }
+
+
+ /**
+ * @return The number of configuration elements stored
+ */
public int size()
{
return configurationElements.size();
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationReader.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationReader.java?rev=1677554&r1=1677553&r2=1677554&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationReader.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationReader.java Mon May 4 08:56:53 2015
@@ -62,12 +62,13 @@ import org.apache.directory.studio.openl
import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPlugin;
import org.apache.directory.studio.openldap.config.editor.ConnectionServerConfigurationInput;
import org.apache.directory.studio.openldap.config.editor.DirectoryServerConfigurationInput;
-import org.apache.directory.studio.openldap.config.editor.ServerConfigurationEditorUtils;
+import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditorUtils;
import org.apache.directory.studio.openldap.config.jobs.EntryBasedConfigurationPartition;
import org.apache.directory.studio.openldap.config.model.AuxiliaryObjectClass;
import org.apache.directory.studio.openldap.config.model.ConfigurationElement;
import org.apache.directory.studio.openldap.config.model.OlcConfig;
import org.apache.directory.studio.openldap.config.model.OlcGlobal;
+import org.apache.directory.studio.openldap.config.model.OlcModuleList;
import org.apache.directory.studio.openldap.config.model.OlcOverlayConfig;
import org.apache.directory.studio.openldap.config.model.OpenLdapConfiguration;
import org.apache.directory.studio.openldap.config.model.database.OlcDatabaseConfig;
@@ -132,12 +133,7 @@ public class ConfigurationReader
// Storing the object in the configuration objects map
dnToConfigObjectMap.put( entry.getDn(), configurationObject );
- if ( configurationObject instanceof OlcDatabaseConfig )
- {
- OlcDatabaseConfig databaseConfig = ( OlcDatabaseConfig ) configurationObject;
- configuration.addDatabase( databaseConfig );
- }
- else if ( configurationObject instanceof OlcOverlayConfig )
+ if ( configurationObject instanceof OlcOverlayConfig )
{
OlcOverlayConfig overlayConfig = ( OlcOverlayConfig ) configurationObject;
@@ -157,6 +153,14 @@ public class ConfigurationReader
{
configuration.setGlobal( ( OlcGlobal ) configurationObject );
}
+ else if ( configurationObject instanceof OlcModuleList )
+ {
+ configuration.add( (OlcModuleList)configurationObject );
+ }
+ else if ( configurationObject instanceof OlcDatabaseConfig )
+ {
+ configuration.add( ( OlcDatabaseConfig ) configurationObject );
+ }
else
{
configuration.add( configurationObject );
@@ -253,14 +257,8 @@ public class ConfigurationReader
// Storing the object in the configuration objects map
dnToConfigObjectMap.put( entry.getDn(), configurationObject );
- // Checking if it's a database
- if ( configurationObject instanceof OlcDatabaseConfig )
- {
- OlcDatabaseConfig databaseConfig = ( OlcDatabaseConfig ) configurationObject;
- configuration.addDatabase( databaseConfig );
- }
// Checking if it's an overlay
- else if ( configurationObject instanceof OlcOverlayConfig )
+ if ( configurationObject instanceof OlcOverlayConfig )
{
OlcOverlayConfig overlayConfig = ( OlcOverlayConfig ) configurationObject;
@@ -282,6 +280,11 @@ public class ConfigurationReader
{
configuration.setGlobal( ( OlcGlobal ) configurationObject );
}
+ // Checking if it's a database
+ else if ( configurationObject instanceof OlcDatabaseConfig )
+ {
+ configuration.add( (OlcDatabaseConfig)configurationObject );
+ }
// Any other object type
else
{
@@ -349,7 +352,7 @@ public class ConfigurationReader
// Create the set of candidates
for ( Value<?> objectClassValue : objectClassAttribute )
{
- ObjectClass oc = ServerConfigurationEditorUtils.getObjectClass( schemaManager,
+ ObjectClass oc = OpenLDAPServerConfigurationEditorUtils.getObjectClass( schemaManager,
objectClassValue.getString() );
if ( ( oc != null ) && ( oc.isStructural() ) )
@@ -361,14 +364,14 @@ public class ConfigurationReader
// Now find the parent OC
for ( Value<?> objectClassValue : objectClassAttribute )
{
- ObjectClass oc = ServerConfigurationEditorUtils.getObjectClass( schemaManager,
+ ObjectClass oc = OpenLDAPServerConfigurationEditorUtils.getObjectClass( schemaManager,
objectClassValue.getString() );
if ( oc != null )
{
for ( String superiorName : oc.getSuperiorOids() )
{
- ObjectClass superior = ServerConfigurationEditorUtils.getObjectClass( schemaManager,
+ ObjectClass superior = OpenLDAPServerConfigurationEditorUtils.getObjectClass( schemaManager,
superiorName );
if ( ( superior != null ) && ( superior.isStructural() )
@@ -411,7 +414,7 @@ public class ConfigurationReader
{
for ( Value<?> objectClassValue : objectClassAttribute )
{
- ObjectClass oc = ServerConfigurationEditorUtils.getObjectClass( schemaManager,
+ ObjectClass oc = OpenLDAPServerConfigurationEditorUtils.getObjectClass( schemaManager,
objectClassValue.getString() );
if ( ( oc != null ) && ( oc.isAuxiliary() ) )
@@ -454,7 +457,7 @@ public class ConfigurationReader
// The DN corresponding to the configuration base
// Creating the configuration partition
- EntryBasedConfigurationPartition configurationPartition = ServerConfigurationEditorUtils
+ EntryBasedConfigurationPartition configurationPartition = OpenLDAPServerConfigurationEditorUtils
.createConfigurationPartition( schemaManager, configurationDn );
// Opening the connection (if needed)
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationWriter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationWriter.java?rev=1677554&r1=1677553&r2=1677554&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationWriter.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/ConfigurationWriter.java Mon May 4 08:56:53 2015
@@ -42,7 +42,7 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
import org.apache.directory.studio.openldap.config.OpenLdapConfigurationPlugin;
-import org.apache.directory.studio.openldap.config.editor.ServerConfigurationEditorUtils;
+import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditorUtils;
import org.apache.directory.studio.openldap.config.model.AuxiliaryObjectClass;
import org.apache.directory.studio.openldap.config.model.ConfigurationElement;
import org.apache.directory.studio.openldap.config.model.OlcConfig;
@@ -487,7 +487,7 @@ public class ConfigurationWriter
{
try
{
- ObjectClass objectClassObject = ServerConfigurationEditorUtils.getObjectClass( OpenLdapConfigurationPlugin
+ ObjectClass objectClassObject = OpenLDAPServerConfigurationEditorUtils.getObjectClass( OpenLdapConfigurationPlugin
.getDefault().getSchemaManager(), objectClass );
if ( objectClassObject != null )
@@ -529,7 +529,7 @@ public class ConfigurationWriter
{
SchemaManager schemaManager = OpenLdapConfigurationPlugin.getDefault().getSchemaManager();
- ObjectClass topObjectClass = ServerConfigurationEditorUtils.getObjectClass( schemaManager,
+ ObjectClass topObjectClass = OpenLDAPServerConfigurationEditorUtils.getObjectClass( schemaManager,
SchemaConstants.TOP_OC );
if ( topObjectClass != null )
@@ -550,7 +550,7 @@ public class ConfigurationWriter
{
for ( String superior : superiors )
{
- ObjectClass superiorObjectClass = ServerConfigurationEditorUtils.getObjectClass( schemaManager,
+ ObjectClass superiorObjectClass = OpenLDAPServerConfigurationEditorUtils.getObjectClass( schemaManager,
superior );
computeObjectClassAttributeValues( objectClassAttributeValues, superiorObjectClass );
}
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/SaveConfigurationRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/SaveConfigurationRunnable.java?rev=1677554&r1=1677553&r2=1677554&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/SaveConfigurationRunnable.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/model/io/SaveConfigurationRunnable.java Mon May 4 08:56:53 2015
@@ -28,8 +28,8 @@ import org.eclipse.ui.IEditorInput;
import org.apache.directory.studio.openldap.config.editor.ConnectionServerConfigurationInput;
import org.apache.directory.studio.openldap.config.editor.DirectoryServerConfigurationInput;
-import org.apache.directory.studio.openldap.config.editor.ServerConfigurationEditor;
-import org.apache.directory.studio.openldap.config.editor.ServerConfigurationEditorUtils;
+import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditorUtils;
/**
@@ -40,7 +40,7 @@ import org.apache.directory.studio.openl
public class SaveConfigurationRunnable implements StudioRunnableWithProgress
{
/** The associated editor */
- private ServerConfigurationEditor editor;
+ private OpenLDAPServerConfigurationEditor editor;
/**
@@ -49,7 +49,7 @@ public class SaveConfigurationRunnable i
* @param editor
* the editor
*/
- public SaveConfigurationRunnable( ServerConfigurationEditor editor )
+ public SaveConfigurationRunnable( OpenLDAPServerConfigurationEditor editor )
{
super();
this.editor = editor;
@@ -100,14 +100,14 @@ public class SaveConfigurationRunnable i
if ( input instanceof ConnectionServerConfigurationInput )
{
// Saving the ServerConfiguration to the connection
- ServerConfigurationEditorUtils.saveConfiguration( ( ConnectionServerConfigurationInput ) input,
+ OpenLDAPServerConfigurationEditorUtils.saveConfiguration( ( ConnectionServerConfigurationInput ) input,
editor, monitor );
success = true;
}
else if ( input instanceof DirectoryServerConfigurationInput )
{
// Saving the ServerConfiguration to the 'slapd.d' directory
- ServerConfigurationEditorUtils.saveConfiguration( editor.getConfiguration(),
+ OpenLDAPServerConfigurationEditorUtils.saveConfiguration( editor.getConfiguration(),
( ( DirectoryServerConfigurationInput ) input ).getDirectory() );
success = true;
}
Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/NewOpenLDAPConfigurationFileWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/NewOpenLDAPConfigurationFileWizard.java?rev=1677554&r1=1677553&r2=1677554&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/NewOpenLDAPConfigurationFileWizard.java (original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/wizards/NewOpenLDAPConfigurationFileWizard.java Mon May 4 08:56:53 2015
@@ -21,7 +21,7 @@ package org.apache.directory.studio.open
import org.apache.directory.studio.openldap.config.editor.NewServerConfigurationInput;
-import org.apache.directory.studio.openldap.config.editor.ServerConfigurationEditor;
+import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
@@ -55,7 +55,7 @@ public class NewOpenLDAPConfigurationFil
try
{
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- page.openEditor( new NewServerConfigurationInput(), ServerConfigurationEditor.ID );
+ page.openEditor( new NewServerConfigurationInput(), OpenLDAPServerConfigurationEditor.ID );
}
catch ( PartInitException e )
{