directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1410370 - /directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationMasterDetailsBlock.java
Date Fri, 16 Nov 2012 14:35:12 GMT
Author: pamarcelot
Date: Fri Nov 16 14:35:09 2012
New Revision: 1410370

URL: http://svn.apache.org/viewvc?rev=1410370&view=rev
Log:
Part of a fix for DIRSTUDIO-847 (Add support for replication editing in the ApacheDS 2.0 Configuration
Editor).
Added a LabelProvider to the TableViewer.
Added default values to the new ReplConsumerBean.

Modified:
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationMasterDetailsBlock.java

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationMasterDetailsBlock.java?rev=1410370&r1=1410369&r2=1410370&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationMasterDetailsBlock.java
(original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationMasterDetailsBlock.java
Fri Nov 16 14:35:09 2012
@@ -21,9 +21,13 @@ package org.apache.directory.studio.apac
 
 
 import org.apache.directory.server.config.beans.ReplConsumerBean;
+import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.model.message.SearchScope;
 import org.eclipse.jface.dialogs.MessageDialog;
 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;
@@ -116,7 +120,20 @@ public class ReplicationMasterDetailsBlo
             }
         } );
         viewer.setContentProvider( new ArrayContentProvider() );
-        //      viewer.setLabelProvider( PartitionsPage.PARTITIONS_LABEL_PROVIDER );
+        viewer.setLabelProvider( new LabelProvider()
+        {
+            public String getText( Object element )
+            {
+                if ( element instanceof ReplConsumerBean )
+                {
+                    ReplConsumerBean consumer = ( ReplConsumerBean ) element;
+
+                    return consumer.getReplConsumerId();
+                }
+
+                return super.getText( element );
+            }
+        } );
 
         // Creating the button(s)
         addButton = toolkit.createButton( client, "Add", SWT.PUSH );
@@ -184,7 +201,7 @@ public class ReplicationMasterDetailsBlo
     {
         String newId = getNewId();
 
-        ReplConsumerBean consumerBean = new ReplConsumerBean();
+        ReplConsumerBean consumerBean = getNewReplConsumerBean();
 
         consumerBean.setReplConsumerId( newId );
 
@@ -196,6 +213,32 @@ public class ReplicationMasterDetailsBlo
 
 
     /**
+     * Gets a new ReplConsumerBean.
+     *
+     * @return a new ReplConsumerBean
+     */
+    private ReplConsumerBean getNewReplConsumerBean()
+    {
+        ReplConsumerBean consumerBean = new ReplConsumerBean();
+
+        consumerBean.setEnabled( true );
+        consumerBean.setReplAliasDerefMode( AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue()
);
+        consumerBean.setReplProvHostName( "localhost" );
+        consumerBean.setReplProvPort( 10389 );
+        consumerBean.setReplSearchFilter( "(objectClass=*)" );
+        consumerBean.setReplSearchScope( SearchScope.SUBTREE.getLdapUrlValue() );
+        consumerBean.setReplUserDn( "uid=admin,ou=system" );
+        consumerBean.setReplUserPassword( "secret".getBytes() );
+        consumerBean.setReplRefreshInterval( 60 * 1000 );
+        consumerBean.setReplRefreshNPersist( true );
+        consumerBean.addReplAttributes( SchemaConstants.ALL_USER_ATTRIBUTES );
+        consumerBean.setSearchBaseDn( "dc=example,dc=com" );
+
+        return consumerBean;
+    }
+
+
+    /**
      * Gets a new ID for a new Partition.
      *
      * @return 
@@ -286,7 +329,8 @@ public class ReplicationMasterDetailsBlo
     {
         detailsPage.commit( true );
     }
-    
+
+
     /**
      * Gets the replication page.
      *



Mime
View raw message