Anonymous avatar Anonymous committed 49e5d1c

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.

git-svn-id: https://svn.apache.org/repos/asf/directory/studio/trunk@1410370 13f79535-47bb-0310-9956-ffa450edef68

Comments (0)

Files changed (1)

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

 
 
 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;
             }
         } );
         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 );
     {
         String newId = getNewId();
 
-        ReplConsumerBean consumerBean = new ReplConsumerBean();
+        ReplConsumerBean consumerBean = getNewReplConsumerBean();
 
         consumerBean.setReplConsumerId( newId );
 
 
 
     /**
+     * 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 
     {
         detailsPage.commit( true );
     }
-    
+
+
     /**
      * Gets the replication page.
      *
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.