You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2010/01/20 05:29:47 UTC

svn commit: r901057 - in /directory/apacheds/trunk/syncrepl: ./ src/main/java/org/apache/directory/server/syncrepl/ src/main/resources/

Author: kayyagari
Date: Wed Jan 20 04:29:43 2010
New Revision: 901057

URL: http://svn.apache.org/viewvc?rev=901057&view=rev
Log:
o updated the getAttribute() mthod to return attributes as a array
o fixed the modify operation
o simplified the logger names and updated the logger config for better readability
o updated the client-api dependency name

Modified:
    directory/apacheds/trunk/syncrepl/pom.xml
    directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncReplConsumer.java
    directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncreplConfiguration.java
    directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncreplRunnerUI.java
    directory/apacheds/trunk/syncrepl/src/main/resources/log4j.properties

Modified: directory/apacheds/trunk/syncrepl/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/syncrepl/pom.xml?rev=901057&r1=901056&r2=901057&view=diff
==============================================================================
--- directory/apacheds/trunk/syncrepl/pom.xml (original)
+++ directory/apacheds/trunk/syncrepl/pom.xml Wed Jan 20 04:29:43 2010
@@ -48,7 +48,7 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.directory.shared</groupId>
-      <artifactId>shared-client-api</artifactId>
+      <artifactId>shared-ldap-client-api</artifactId>
       <version>${org.apache.directory.shared.version}</version>
     </dependency>
 

Modified: directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncReplConsumer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncReplConsumer.java?rev=901057&r1=901056&r2=901057&view=diff
==============================================================================
--- directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncReplConsumer.java (original)
+++ directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncReplConsumer.java Wed Jan 20 04:29:43 2010
@@ -91,7 +91,7 @@
     private byte[] syncCookie;
 
     /** the logger */
-    private static final Logger LOG = LoggerFactory.getLogger( SyncReplConsumer.class );
+    private static final Logger LOG = LoggerFactory.getLogger( SyncReplConsumer.class.getSimpleName() );
 
     /** conection to the syncrepl provider */
     private LdapConnection connection;
@@ -123,6 +123,11 @@
     private SyncDoneValueControlDecoder syncDoneControlDecoder = new SyncDoneValueControlDecoder();
     
     private SyncStateValueControlDecoder syncStateControlDecoder = new SyncStateValueControlDecoder();
+
+    /** attributes on which modification should be ignored */
+    private static final String[] MOD_IGNORE_AT = new String[]{ "entryUUID", "entryCSN"}; //{ "1.3.6.1.1.16.4", "1.3.6.1.4.1.4203.666.1.7" };
+    
+    
     /**
      * @return the config
      */
@@ -231,17 +236,15 @@
         searchRequest.setScope( SearchScope.getSearchScope( config.getSearchScope() ) );
         searchRequest.setTypesOnly( false );
 
-        String attributes = config.getAttributes();
+        String[] attributes = config.getAttributes();
         
-        if ( StringTools.isEmpty( attributes ) )
+        if ( attributes == null )
         {
             searchRequest.addAttributes( SchemaConstants.ALL_USER_ATTRIBUTES );
         }
         else
         {
-            String[] attrs = attributes.trim().split( "," );
-            
-            searchRequest.addAttributes( attrs );
+            searchRequest.addAttributes( attributes );
         }
 
         syncReq = new SyncRequestValueControl();
@@ -365,8 +368,7 @@
 
             LOG.debug( "state name {}", state.name() );
 
-            EntryAttribute entryUUID = remoteEntry.get( "entryUUID" );
-            LOG.debug( "entryUUID = {}", ( entryUUID == null ? null : entryUUID.getString() ) );
+            LOG.debug( "entryUUID = {}", StringTools.uuidToString( syncStateCtrl.getEntryUUID() ) );
 
             switch ( state )
             {
@@ -701,10 +703,12 @@
     
     private void modify( Entry remoteEntry ) throws Exception 
     {
-        LOG.debug( "modifying entry with dn {}", remoteEntry.getDn().getUpName() );
+        LOG.debug( "modifying entry with dn {}", remoteEntry.getDn().getName() );
         
         Entry localEntry = session.lookup( remoteEntry.getDn() );
         
+        remoteEntry.removeAttributes( MOD_IGNORE_AT );
+
         List<Modification> mods = new ArrayList<Modification>();
         Iterator<EntryAttribute> itr = localEntry.iterator();
      
@@ -715,6 +719,7 @@
             Modification mod;
             EntryAttribute remoteAttr = remoteEntry.get( attrId );
             
+            
             if (  remoteAttr != null ) // would be better if we compare the values also? or will it consume more time?
             {
                 mod = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, remoteAttr );

Modified: directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncreplConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncreplConfiguration.java?rev=901057&r1=901056&r2=901057&view=diff
==============================================================================
--- directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncreplConfiguration.java (original)
+++ directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncreplConfiguration.java Wed Jan 20 04:29:43 2010
@@ -19,7 +19,9 @@
  */
 package org.apache.directory.server.syncrepl;
 
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 /**
  * 
@@ -58,8 +60,10 @@
     private String filter;
 
     /** a comma separated string of attribute names */
-    private String attributes;
+    private String attributesString;
 
+    private String[] attrs;
+    
     /** the numer for setting the limit on numer of search results to be fteched
      * default value is 0 (i.e no limit) */
     private int searchSizeLimit = 0;
@@ -205,9 +209,19 @@
     /**
      * @return the attributes
      */
-    public String getAttributes()
+    public String[] getAttributes()
     {
-        return attributes;
+        if( attrs == null )
+        {
+            if ( StringTools.isEmpty( attributesString ) )
+            {
+                attributesString = SchemaConstants.ALL_USER_ATTRIBUTES;
+            }
+
+            attrs = attributesString.trim().split( "," );
+        }
+
+        return attrs;
     }
 
     /**
@@ -215,7 +229,7 @@
      */
     public void setAttributes( String attributes )
     {
-        this.attributes = attributes;
+        this.attributesString = attributes;
     }
 
     /**

Modified: directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncreplRunnerUI.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncreplRunnerUI.java?rev=901057&r1=901056&r2=901057&view=diff
==============================================================================
--- directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncreplRunnerUI.java (original)
+++ directory/apacheds/trunk/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncreplRunnerUI.java Wed Jan 20 04:29:43 2010
@@ -54,8 +54,6 @@
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.SearchScope;
-import org.apache.directory.shared.ldap.ldif.LdifEntry;
-import org.apache.directory.shared.ldap.ldif.LdifReader;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
@@ -90,7 +88,7 @@
 
     private LdapServer ldapServer;
 
-    private static final Logger LOG = LoggerFactory.getLogger( SyncreplRunnerUI.class );
+    private static final Logger LOG = LoggerFactory.getLogger( SyncreplRunnerUI.class.getSimpleName() );
 
     // UI components
     private JButton btnStart;
@@ -112,13 +110,13 @@
     public SyncreplRunnerUI()
     {
         config = new SyncreplConfiguration();
-        config.setProviderHost( "localhost" );
-        config.setPort( 389 );
-        config.setBindDn( "uid=admin,ou=system" );
-        config.setCredentials( "secret" );
+        config.setProviderHost( provServerHost );
+        config.setPort( provServerPort );
+        config.setBindDn( provServerBindDn );
+        config.setCredentials( provServerPwd );
         config.setBaseDn( "dc=my-domain,dc=com" );
         config.setFilter( "(objectclass=*)" );
-        config.setAttributes( "*,+" );
+        config.setAttributes( "*,entryUUID,entryCSN" );
         config.setSearchScope( SearchScope.SUBTREE.getJndiScope() );
         config.setReplicaId( 1 );
         agent.setConfig( config );
@@ -228,13 +226,6 @@
 
             dirService.addPartition( partition );
 
-            String ldif = "dn: " + config.getBaseDn() + "\n" +
-                          "objectClass: top \n" +
-                          "objectClass: domain \n" +
-                          "dc: my-domain\n";
-            LdifReader reader = new LdifReader();
-            List<LdifEntry> testEntries = reader.parseLdif( ldif ); 
-            dirService.setTestEntries( testEntries );
             dirService.startup();
 
             ldapServer.addExtendedOperationHandler( new StartTlsHandler() );

Modified: directory/apacheds/trunk/syncrepl/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/syncrepl/src/main/resources/log4j.properties?rev=901057&r1=901056&r2=901057&view=diff
==============================================================================
--- directory/apacheds/trunk/syncrepl/src/main/resources/log4j.properties (original)
+++ directory/apacheds/trunk/syncrepl/src/main/resources/log4j.properties Wed Jan 20 04:29:43 2010
@@ -14,9 +14,17 @@
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 #############################################################################
-log4j.rootCategory=OFF, stdout
+log4j.rootCategory=DEBUG, stdout
 
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
 
+log4j.logger.org.apache.directory.server.ldap=ERROR
+log4j.logger.org.apache.directory.server.core=ERROR
+log4j.logger.JdbmIndex=ERROR
+log4j.logger.JdbmTable=ERROR
+log4j.logger.org.apache.directory.server.core=ERROR
+log4j.logger.org.apache.directory.shared=ERROR
+log4j.logger.org.apache.directory.shared.ldap.schema.registries=ERROR
+log4j.logger.org.apache.mina=ERROR
\ No newline at end of file