You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2008/05/16 14:24:19 UTC
svn commit: r657030 - in
/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration:
editor/ editor/v152/ editor/v152/dialogs/ model/v152/
Author: pamarcelot
Date: Fri May 16 05:24:18 2008
New Revision: 657030
URL: http://svn.apache.org/viewvc?rev=657030&view=rev
Log:
o Added parsing of interceptors for the 1.5.2 server.xml file.
o Added support for interceptors in the 1.5.2 sever.xml editor.
Added:
directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/dialogs/InterceptorDialog.java
directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/InterceptorConfiguration.java
directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/InterceptorEnum.java
directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ReplicationInterceptorConfiguration.java
Modified:
directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/InterceptorDetailsPage.java
directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/InterceptorsMasterDetailsBlock.java
directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerConfigurationV152.java
directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java
Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java?rev=657030&r1=657029&r2=657030&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java (original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditor.java Fri May 16 05:24:18 2008
@@ -115,7 +115,7 @@
messageBox.setMessage( "An error occurred when reading the file." + "\n" + e.getMessage() );
messageBox.open();
- // Creating a defualt (empty) server configuration and assigning the serverXmlIO
+ // Creating a default (empty) server configuration and assigning the serverXmlIO
serverConfiguration = new ServerConfigurationV152();
serverXmlIO = new ServerXmlIOV152();
return;
Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/InterceptorDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/InterceptorDetailsPage.java?rev=657030&r1=657029&r2=657030&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/InterceptorDetailsPage.java (original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/InterceptorDetailsPage.java Fri May 16 05:24:18 2008
@@ -20,7 +20,7 @@
package org.apache.directory.studio.apacheds.configuration.editor.v152;
-import org.apache.directory.studio.apacheds.configuration.model.v152.Interceptor;
+import org.apache.directory.studio.apacheds.configuration.model.v152.InterceptorEnum;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
@@ -54,14 +54,14 @@
private IManagedForm mform;
/** The input Interceptor */
- private Interceptor input;
+ private InterceptorEnum input;
/** The dirty flag */
private boolean dirty = false;
// UI fields
private Text nameText;
- private Text classText;
+ private Text descriptionText;
// Listeners
/** The Modify Listener for Text Widgets */
@@ -130,12 +130,16 @@
// Name
toolkit.createLabel( client, "Name:" );
nameText = toolkit.createText( client, "" );
+ nameText.setEditable( false );
nameText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
- // Class
- toolkit.createLabel( client, "Class:" );
- classText = toolkit.createText( client, "" );
- classText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
+ // Description
+ toolkit.createLabel( client, "Description:" );
+ descriptionText = toolkit.createText( client, "" );
+ descriptionText.setEditable( false );
+ GridData gridData = new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 );
+ gridData.heightHint = 75;
+ descriptionText.setLayoutData( gridData );
}
@@ -145,7 +149,7 @@
private void addListeners()
{
nameText.addModifyListener( textModifyListener );
- classText.addModifyListener( textModifyListener );
+ descriptionText.addModifyListener( textModifyListener );
}
@@ -155,7 +159,7 @@
private void removeListeners()
{
nameText.removeModifyListener( textModifyListener );
- classText.removeModifyListener( textModifyListener );
+ descriptionText.removeModifyListener( textModifyListener );
}
@@ -167,7 +171,7 @@
IStructuredSelection ssel = ( IStructuredSelection ) selection;
if ( ssel.size() == 1 )
{
- input = ( Interceptor ) ssel.getFirstElement();
+ input = ( InterceptorEnum ) ssel.getFirstElement();
}
else
{
@@ -184,8 +188,7 @@
{
if ( input != null )
{
- input.setName( nameText.getText() );
- input.setClassType( classText.getText() );
+ //TODO
}
}
@@ -236,9 +239,9 @@
String name = input.getName();
nameText.setText( ( name == null ) ? "" : name );
- // Class
- String classType = input.getClassType();
- classText.setText( ( classType == null ) ? "" : classType );
+ // Description
+ String description = input.getDescription();
+ descriptionText.setText( ( description == null ) ? "" : description );
addListeners();
}
Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/InterceptorsMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/InterceptorsMasterDetailsBlock.java?rev=657030&r1=657029&r2=657030&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/InterceptorsMasterDetailsBlock.java (original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/InterceptorsMasterDetailsBlock.java Fri May 16 05:24:18 2008
@@ -25,15 +25,17 @@
import org.apache.directory.studio.apacheds.configuration.ApacheDSConfigurationPlugin;
import org.apache.directory.studio.apacheds.configuration.ApacheDSConfigurationPluginConstants;
import org.apache.directory.studio.apacheds.configuration.editor.ServerConfigurationEditor;
-import org.apache.directory.studio.apacheds.configuration.model.v152.Interceptor;
+import org.apache.directory.studio.apacheds.configuration.editor.v152.dialogs.InterceptorDialog;
+import org.apache.directory.studio.apacheds.configuration.model.v152.InterceptorEnum;
import org.apache.directory.studio.apacheds.configuration.model.v152.ServerConfigurationV152;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -68,7 +70,7 @@
private ServerConfigurationV152 serverConfiguration;
/** The Interceptors List */
- private List<Interceptor> interceptors;
+ private List<InterceptorEnum> interceptors;
/** The Details Page */
private InterceptorDetailsPage detailsPage;
@@ -76,7 +78,7 @@
private static final String NEW_NAME = "New Interceptor ";
// UI Fields
- private CheckboxTableViewer viewer;
+ private TableViewer viewer;
private Button addButton;
private Button deleteButton;
private Button upButton;
@@ -91,7 +93,8 @@
public InterceptorsMasterDetailsBlock( FormPage page )
{
this.page = page;
- serverConfiguration = ( ServerConfigurationV152 ) ( ( ServerConfigurationEditor ) page.getEditor() ).getServerConfiguration();
+ serverConfiguration = ( ServerConfigurationV152 ) ( ( ServerConfigurationEditor ) page.getEditor() )
+ .getServerConfiguration();
interceptors = serverConfiguration.getInterceptors();
}
@@ -121,14 +124,14 @@
section.setClient( client );
// Creatig the Table and Table Viewer
- Table table = toolkit.createTable( client, SWT.CHECK );
+ Table table = toolkit.createTable( client, SWT.NULL );
GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true, 1, 4 );
gd.heightHint = 20;
gd.widthHint = 100;
table.setLayoutData( gd );
final SectionPart spart = new SectionPart( section );
managedForm.addPart( spart );
- viewer = new CheckboxTableViewer( table );
+ viewer = new TableViewer( table );
viewer.addSelectionChangedListener( new ISelectionChangedListener()
{
public void selectionChanged( SelectionChangedEvent event )
@@ -141,7 +144,20 @@
{
public Image getImage( Object element )
{
- return ApacheDSConfigurationPlugin.getDefault().getImage( ApacheDSConfigurationPluginConstants.IMG_INTERCEPTOR );
+ return ApacheDSConfigurationPlugin.getDefault().getImage(
+ ApacheDSConfigurationPluginConstants.IMG_INTERCEPTOR );
+ }
+
+
+ public String getText( Object element )
+ {
+ if ( element instanceof InterceptorEnum )
+ {
+ return ( ( InterceptorEnum ) element ).getName();
+
+ }
+
+ return super.getText( element );
}
} );
@@ -185,9 +201,7 @@
public void selectionChanged( SelectionChangedEvent event )
{
viewer.refresh();
-
deleteButton.setEnabled( !event.getSelection().isEmpty() );
-
enableDisableUpDownButtons();
}
} );
@@ -196,11 +210,15 @@
{
public void widgetSelected( SelectionEvent e )
{
- Interceptor newInterceptor = new Interceptor( getNewName() );
- interceptors.add( newInterceptor );
- viewer.refresh();
- viewer.setSelection( new StructuredSelection( newInterceptor ) );
- setEditorDirty();
+ InterceptorDialog dialog = new InterceptorDialog( interceptors );
+ if ( Dialog.OK == dialog.open() )
+ {
+ InterceptorEnum newInterceptor = dialog.getInterceptor();
+ interceptors.add( newInterceptor );
+ viewer.refresh();
+ viewer.setSelection( new StructuredSelection( newInterceptor ) );
+ setEditorDirty();
+ }
}
} );
@@ -211,8 +229,7 @@
StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
if ( !selection.isEmpty() )
{
- Interceptor interceptor = ( Interceptor ) selection.getFirstElement();
-
+ InterceptorEnum interceptor = ( InterceptorEnum ) selection.getFirstElement();
interceptors.remove( interceptor );
viewer.refresh();
setEditorDirty();
@@ -227,17 +244,16 @@
StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
if ( !selection.isEmpty() )
{
- Interceptor interceptor = ( Interceptor ) selection.getFirstElement();
+ InterceptorEnum interceptor = ( InterceptorEnum ) selection.getFirstElement();
int index = interceptors.indexOf( interceptor );
if ( index > 0 )
{
- Interceptor interceptorBefore = interceptors.get( index - 1 );
+ InterceptorEnum interceptorBefore = interceptors.get( index - 1 );
if ( interceptorBefore != null )
{
interceptors.set( index - 1, interceptor );
interceptors.set( index, interceptorBefore );
-
viewer.refresh();
setEditorDirty();
enableDisableUpDownButtons();
@@ -254,12 +270,12 @@
StructuredSelection selection = ( StructuredSelection ) viewer.getSelection();
if ( !selection.isEmpty() )
{
- Interceptor interceptor = ( Interceptor ) selection.getFirstElement();
+ InterceptorEnum interceptor = ( InterceptorEnum ) selection.getFirstElement();
int index = interceptors.indexOf( interceptor );
if ( index < ( interceptors.size() - 1 ) )
{
- Interceptor interceptorAfter = interceptors.get( index + 1 );
+ InterceptorEnum interceptorAfter = interceptors.get( index + 1 );
if ( interceptorAfter != null )
{
interceptors.set( index + 1, interceptor );
@@ -293,7 +309,7 @@
ok = true;
name = NEW_NAME + counter;
- for ( Interceptor interceptor : interceptors )
+ for ( InterceptorEnum interceptor : interceptors )
{
if ( interceptor.getName().equalsIgnoreCase( name ) )
{
@@ -319,7 +335,7 @@
downButton.setEnabled( !selection.isEmpty() );
if ( !selection.isEmpty() )
{
- Interceptor interceptor = ( Interceptor ) selection.getFirstElement();
+ InterceptorEnum interceptor = ( InterceptorEnum ) selection.getFirstElement();
upButton.setEnabled( interceptors.indexOf( interceptor ) != 0 );
downButton.setEnabled( interceptors.indexOf( interceptor ) != ( interceptors.size() - 1 ) );
}
@@ -370,7 +386,7 @@
protected void registerPages( DetailsPart detailsPart )
{
detailsPage = new InterceptorDetailsPage( this );
- detailsPart.registerPage( Interceptor.class, detailsPage );
+ detailsPart.registerPage( InterceptorEnum.class, detailsPage );
}
Added: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/dialogs/InterceptorDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/dialogs/InterceptorDialog.java?rev=657030&view=auto
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/dialogs/InterceptorDialog.java (added)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/v152/dialogs/InterceptorDialog.java Fri May 16 05:24:18 2008
@@ -0,0 +1,277 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.directory.studio.apacheds.configuration.editor.v152.dialogs;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.directory.studio.apacheds.configuration.ApacheDSConfigurationPlugin;
+import org.apache.directory.studio.apacheds.configuration.ApacheDSConfigurationPluginConstants;
+import org.apache.directory.studio.apacheds.configuration.model.v152.InterceptorEnum;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the Dialog for Interceptor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class InterceptorDialog extends Dialog
+{
+ /** The initial interceptors list */
+ private List<InterceptorEnum> initialInterceptors;
+
+ /** The available interceptors list */
+ private List<InterceptorEnum> availableInterceptors;
+
+ /** The selected interceptor */
+ private InterceptorEnum selectedInterceptor;
+
+ // UI Fields
+ private Table interceptorsTable;
+ private TableViewer interceptorsTableViewer;
+ private Button addButton;
+
+
+ /**
+ * Creates a new instance of InterceptorDialog.
+ */
+ public InterceptorDialog( List<InterceptorEnum> interceptors )
+ {
+ super( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() );
+ this.initialInterceptors = interceptors;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+ */
+ protected void configureShell( Shell newShell )
+ {
+ super.configureShell( newShell );
+ newShell.setText( "Add An Interceptor" );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea( Composite parent )
+ {
+ Composite composite = new Composite( parent, SWT.NONE );
+ composite.setLayout( new GridLayout() );
+ composite.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) );
+
+ // Choose Label
+ Label chooseLabel = new Label( composite, SWT.NONE );
+ chooseLabel.setText( "Choose an interceptor:" );
+ chooseLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+
+ // Interceptors Table Viewer
+ interceptorsTable = new Table( composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
+ | SWT.FULL_SELECTION | SWT.HIDE_SELECTION );
+ GridData gridData = new GridData( SWT.FILL, SWT.FILL, true, true );
+ gridData.heightHint = 148;
+ gridData.minimumHeight = 148;
+ gridData.widthHint = 350;
+ gridData.minimumWidth = 350;
+ interceptorsTable.setLayoutData( gridData );
+ interceptorsTable.addMouseListener( new MouseAdapter()
+ {
+ public void mouseDoubleClick( MouseEvent e )
+ {
+ if ( interceptorsTable.getSelectionIndex() != -1 )
+ {
+ okPressed();
+ }
+ }
+ } );
+
+ interceptorsTableViewer = new TableViewer( interceptorsTable );
+ interceptorsTableViewer.setContentProvider( new ArrayContentProvider() );
+ interceptorsTableViewer.setLabelProvider( new LabelProvider()
+ {
+ public Image getImage( Object element )
+ {
+ return ApacheDSConfigurationPlugin.getDefault().getImage(
+ ApacheDSConfigurationPluginConstants.IMG_INTERCEPTOR );
+ }
+
+
+ public String getText( Object element )
+ {
+ if ( element instanceof InterceptorEnum )
+ {
+ return ( ( InterceptorEnum ) element ).getName();
+
+ }
+
+ return super.getText( element );
+ }
+ } );
+ interceptorsTableViewer.addSelectionChangedListener( new ISelectionChangedListener()
+ {
+ public void selectionChanged( SelectionChangedEvent event )
+ {
+ StructuredSelection selection = ( StructuredSelection ) interceptorsTableViewer.getSelection();
+ if ( selection.isEmpty() )
+ {
+ if ( ( addButton != null ) && ( !addButton.isDisposed() ) )
+ {
+ addButton.setEnabled( false );
+ }
+ }
+ else
+ {
+ if ( ( addButton != null ) && ( !addButton.isDisposed() ) )
+ {
+ addButton.setEnabled( true );
+ }
+ }
+ }
+ } );
+
+ initFromInput();
+
+ return composite;
+ }
+
+
+ /**
+ * Initializes the UI from the input.
+ */
+ private void initFromInput()
+ {
+ // Creating the available interceptors list
+ availableInterceptors = new ArrayList<InterceptorEnum>();
+ if ( !initialInterceptors.contains( InterceptorEnum.NORMALIZATION ) )
+ {
+ availableInterceptors.add( InterceptorEnum.NORMALIZATION );
+ }
+ if ( !initialInterceptors.contains( InterceptorEnum.AUTHENTICATION ) )
+ {
+ availableInterceptors.add( InterceptorEnum.AUTHENTICATION );
+ }
+ if ( !initialInterceptors.contains( InterceptorEnum.REFERRAL ) )
+ {
+ availableInterceptors.add( InterceptorEnum.REFERRAL );
+ }
+ if ( !initialInterceptors.contains( InterceptorEnum.ACI_AUTHORIZATION ) )
+ {
+ availableInterceptors.add( InterceptorEnum.ACI_AUTHORIZATION );
+ }
+ if ( !initialInterceptors.contains( InterceptorEnum.DEFAULT_AUTHORIZATION ) )
+ {
+ availableInterceptors.add( InterceptorEnum.DEFAULT_AUTHORIZATION );
+ }
+ if ( !initialInterceptors.contains( InterceptorEnum.EXCEPTION ) )
+ {
+ availableInterceptors.add( InterceptorEnum.EXCEPTION );
+ }
+ if ( !initialInterceptors.contains( InterceptorEnum.OPERATIONAL_ATTRIBUTE ) )
+ {
+ availableInterceptors.add( InterceptorEnum.OPERATIONAL_ATTRIBUTE );
+ }
+ if ( !initialInterceptors.contains( InterceptorEnum.SCHEMA ) )
+ {
+ availableInterceptors.add( InterceptorEnum.SCHEMA );
+ }
+ if ( !initialInterceptors.contains( InterceptorEnum.COLLECTIVE_ATTRIBUTE ) )
+ {
+ availableInterceptors.add( InterceptorEnum.COLLECTIVE_ATTRIBUTE );
+ }
+ if ( !initialInterceptors.contains( InterceptorEnum.EVENT ) )
+ {
+ availableInterceptors.add( InterceptorEnum.EVENT );
+ }
+ if ( !initialInterceptors.contains( InterceptorEnum.TRIGGER ) )
+ {
+ availableInterceptors.add( InterceptorEnum.TRIGGER );
+ }
+ if ( !initialInterceptors.contains( InterceptorEnum.REPLICATION ) )
+ {
+ availableInterceptors.add( InterceptorEnum.REPLICATION );
+ }
+
+ // Setting the input
+ interceptorsTableViewer.setInput( availableInterceptors );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createButtonsForButtonBar( Composite parent )
+ {
+ addButton = createButton( parent, IDialogConstants.OK_ID, "Add", true ); //$NON-NLS-1$
+ createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
+
+ addButton.setEnabled( false );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ protected void okPressed()
+ {
+ StructuredSelection selection = ( StructuredSelection ) interceptorsTableViewer.getSelection();
+ if ( !selection.isEmpty() )
+ {
+ selectedInterceptor = ( InterceptorEnum ) selection.getFirstElement();
+ }
+
+ super.okPressed();
+ }
+
+
+ /**
+ * Gets the interceptor.
+ *
+ * @return
+ * the interceptor
+ */
+ public InterceptorEnum getInterceptor()
+ {
+ return selectedInterceptor;
+ }
+}
Added: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/InterceptorConfiguration.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/InterceptorConfiguration.java?rev=657030&view=auto
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/InterceptorConfiguration.java (added)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/InterceptorConfiguration.java Fri May 16 05:24:18 2008
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.directory.studio.apacheds.configuration.model.v152;
+
+
+/**
+ * This interface defines an interceptor configuration.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface InterceptorConfiguration
+{
+}
Added: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/InterceptorEnum.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/InterceptorEnum.java?rev=657030&view=auto
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/InterceptorEnum.java (added)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/InterceptorEnum.java Fri May 16 05:24:18 2008
@@ -0,0 +1,181 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.directory.studio.apacheds.configuration.model.v152;
+
+
+/**
+ * This enum contains all the interceptors.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public enum InterceptorEnum
+{
+ /** The Normalization Interceptor */
+ NORMALIZATION("Normalization", "Description"),
+
+ /** The Authentication Interceptor */
+ AUTHENTICATION("Authentication", "Description"),
+
+ /** The Referral Interceptor */
+ REFERRAL("Referral", "Description"),
+
+ /** The ACI Authorization Interceptor */
+ ACI_AUTHORIZATION("ACI Authorization", "Description"),
+
+ /** The Default Authorization Interceptor */
+ DEFAULT_AUTHORIZATION("Default Authorization", "Description"),
+
+ /** The Exception Interceptor */
+ EXCEPTION("Exception", "Description"),
+
+ /** The Operational Attribute Interceptor */
+ OPERATIONAL_ATTRIBUTE("Operational Attribute", "Description"),
+
+ /** The Schema Interceptor */
+ SCHEMA("Schema", "Description"),
+
+ /** The Sub-Entry Interceptor */
+ SUBENTRY("Sub-Entry", "Description"),
+
+ /** The Collective Attribute Interceptor */
+ COLLECTIVE_ATTRIBUTE("Collective Attribute", "Description"),
+
+ /** The Event Interceptor */
+ EVENT("Event", "Description"),
+
+ /** The Trigger Interceptor */
+ TRIGGER("Trigger", "Description"),
+
+ /** The Replication Interceptor */
+ REPLICATION("Replication", "Description", new ReplicationInterceptorConfiguration());
+
+ /** The name */
+ private String name;
+
+ /** The description */
+ private String description;
+
+ /** The interceptor configuration */
+ private InterceptorConfiguration configuration;
+
+
+ /**
+ * Creates a new instance of InterceptorEnum.
+ *
+ * @param name
+ * the name
+ * @param description
+ * the description
+ */
+ private InterceptorEnum( String name, String description )
+ {
+ this.name = name;
+ this.description = description;
+ }
+
+
+ /**
+ * Creates a new instance of InterceptorEnum.
+ *
+ * @param name
+ * the name
+ * @param description
+ * the description
+ */
+ private InterceptorEnum( String name, String description, InterceptorConfiguration configuration )
+ {
+ this.name = name;
+ this.description = description;
+ this.configuration = configuration;
+ }
+
+
+ /**
+ * Gets the name.
+ *
+ * @return
+ * the name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+
+ /**
+ * Sets the name.
+ *
+ * @param name
+ * the name
+ */
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+
+ /**
+ * Gets the description.
+ *
+ * @return
+ * the description
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+
+ /**
+ * Sets the description.
+ *
+ * @param description
+ * the description
+ */
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+
+ /**
+ * Gets the configuration.
+ *
+ * @return
+ * the configuration
+ */
+ public InterceptorConfiguration getConfiguration()
+ {
+ return configuration;
+ }
+
+
+ /**
+ * Sets the configuration
+ *
+ * @param configuration
+ * the configuration
+ */
+ public void setConfiguration( InterceptorConfiguration configuration )
+ {
+ this.configuration = configuration;
+ }
+}
Added: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ReplicationInterceptorConfiguration.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ReplicationInterceptorConfiguration.java?rev=657030&view=auto
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ReplicationInterceptorConfiguration.java (added)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ReplicationInterceptorConfiguration.java Fri May 16 05:24:18 2008
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.directory.studio.apacheds.configuration.model.v152;
+
+/**
+ * This class implements a interceptor configuration for the replication interceptor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ReplicationInterceptorConfiguration implements InterceptorConfiguration
+{
+}
Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerConfigurationV152.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerConfigurationV152.java?rev=657030&r1=657029&r2=657030&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerConfigurationV152.java (original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerConfigurationV152.java Fri May 16 05:24:18 2008
@@ -133,7 +133,7 @@
private List<Partition> partitions;
/** The Interceptors */
- private List<Interceptor> interceptors;
+ private List<InterceptorEnum> interceptors;
/** The Extended Operations */
private List<ExtendedOperation> extendedOperations;
@@ -150,7 +150,7 @@
saslQops = new ArrayList<String>();
saslRealms = new ArrayList<String>();
partitions = new ArrayList<Partition>();
- interceptors = new ArrayList<Interceptor>();
+ interceptors = new ArrayList<InterceptorEnum>();
extendedOperations = new ArrayList<ExtendedOperation>();
binaryAttributes = new ArrayList<String>();
}
@@ -192,7 +192,7 @@
* @return
* true (as per the general contract of the Collection.add method).
*/
- public boolean addInterceptor( Interceptor interceptor )
+ public boolean addInterceptor( InterceptorEnum interceptor )
{
return interceptors.add( interceptor );
}
@@ -344,7 +344,7 @@
* @return
* the Interceptors List
*/
- public List<Interceptor> getInterceptors()
+ public List<InterceptorEnum> getInterceptors()
{
return interceptors;
}
@@ -898,7 +898,7 @@
* @param interceptors
* the new value
*/
- public void setInterceptors( List<Interceptor> interceptors )
+ public void setInterceptors( List<InterceptorEnum> interceptors )
{
this.interceptors = interceptors;
}
Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java?rev=657030&r1=657029&r2=657030&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java (original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/v152/ServerXmlIOV152.java Fri May 16 05:24:18 2008
@@ -208,17 +208,6 @@
}
else
{
- // Allow Anonymous Access
- // Attribute allowAnonymousAccess = defaultDirectoryServiceElement.attribute( "allowAnonymousAccess" );
- // if ( allowAnonymousAccess == null )
- // {
- // // TODO throw an error
- // }
- // else
- // {
- // serverConfiguration.setAllowAnonymousAccess( parseBoolean( allowAnonymousAccess.getValue() ) );
- // }
-
// Access Control Enabled
org.dom4j.Attribute accessControlEnabledAttribute = defaultDirectoryServiceElement
.attribute( "accessControlEnabled" );
@@ -591,10 +580,82 @@
}
+ /**
+ * Reads the interceptors.
+ *
+ * @param element
+ * the element
+ * @param serverConfiguration
+ * the server configuration
+ */
private void readInterceptors( Element element, ServerConfigurationV152 serverConfiguration )
{
- // TODO Auto-generated method stub
+ // Getting the 'interceptors
+ Element interceptorsElement = element.element( "interceptors" );
+ if ( interceptorsElement != null )
+ {
+ // Looping on all interceptor elements
+ for ( Iterator<?> i = interceptorsElement.elementIterator(); i.hasNext(); )
+ {
+ // Getting the 'jbdmPartition' element
+ Element interceptorElement = ( Element ) i.next();
+ // Checking which interceptor it is
+ String interceptorElementName = interceptorElement.getName();
+ if ( "normalizationInterceptor".equalsIgnoreCase( interceptorElementName ) )
+ {
+ serverConfiguration.addInterceptor( InterceptorEnum.NORMALIZATION );
+ }
+ else if ( "authenticationInterceptor".equalsIgnoreCase( interceptorElementName ) )
+ {
+ serverConfiguration.addInterceptor( InterceptorEnum.AUTHENTICATION );
+ }
+ else if ( "referralInterceptor".equalsIgnoreCase( interceptorElementName ) )
+ {
+ serverConfiguration.addInterceptor( InterceptorEnum.REFERRAL );
+ }
+ else if ( "aciAuthorizationInterceptor".equalsIgnoreCase( interceptorElementName ) )
+ {
+ serverConfiguration.addInterceptor( InterceptorEnum.ACI_AUTHORIZATION );
+ }
+ else if ( "defaultAuthorizationInterceptor".equalsIgnoreCase( interceptorElementName ) )
+ {
+ serverConfiguration.addInterceptor( InterceptorEnum.DEFAULT_AUTHORIZATION );
+ }
+ else if ( "exceptionInterceptor".equalsIgnoreCase( interceptorElementName ) )
+ {
+ serverConfiguration.addInterceptor( InterceptorEnum.EXCEPTION );
+ }
+ else if ( "operationalAttributeInterceptor".equalsIgnoreCase( interceptorElementName ) )
+ {
+ serverConfiguration.addInterceptor( InterceptorEnum.OPERATIONAL_ATTRIBUTE );
+ }
+ else if ( "schemaInterceptor".equalsIgnoreCase( interceptorElementName ) )
+ {
+ serverConfiguration.addInterceptor( InterceptorEnum.SCHEMA );
+ }
+ else if ( "subentryInterceptor".equalsIgnoreCase( interceptorElementName ) )
+ {
+ serverConfiguration.addInterceptor( InterceptorEnum.SUBENTRY );
+ }
+ else if ( "collectiveAttributeInterceptor".equalsIgnoreCase( interceptorElementName ) )
+ {
+ serverConfiguration.addInterceptor( InterceptorEnum.COLLECTIVE_ATTRIBUTE );
+ }
+ else if ( "eventInterceptor".equalsIgnoreCase( interceptorElementName ) )
+ {
+ serverConfiguration.addInterceptor( InterceptorEnum.EVENT );
+ }
+ else if ( "triggerInterceptor".equalsIgnoreCase( interceptorElementName ) )
+ {
+ serverConfiguration.addInterceptor( InterceptorEnum.TRIGGER );
+ }
+ else if ( "replicationInterceptor".equalsIgnoreCase( interceptorElementName ) )
+ {
+ serverConfiguration.addInterceptor( InterceptorEnum.REPLICATION );
+ }
+ }
+ }
}