directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1151905 - in /directory: apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ apacheds/trunk/protocol-ldap/src/main/java/org/apac...
Date Thu, 28 Jul 2011 16:05:43 GMT
Author: elecharny
Date: Thu Jul 28 16:05:42 2011
New Revision: 1151905

URL: http://svn.apache.org/viewvc?rev=1151905&view=rev
Log:
o More Javadoc
o More comments
o Added a error handling when the SynReplHandler is not installed in the producer
o Removed a useless method

Modified:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLog.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplRequestHandler.java
    directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/shared/ldap/extras/controls/SyncModifyDnType.java

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java?rev=1151905&r1=1151904&r2=1151905&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
Thu Jul 28 16:05:42 2011
@@ -217,6 +217,7 @@ class LdapProtocolHandler extends Demuxi
                     resp.getLdapResult().setDiagnosticMessage( "Unsupport critical control:
" + control.getOid() );
                     resp.getLdapResult().setResultCode( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION
);
                     session.write( resp );
+                    
                     return;
                 }
             }

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=1151905&r1=1151904&r2=1151905&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
Thu Jul 28 16:05:42 2011
@@ -484,12 +484,14 @@ public class LdapServer extends Director
 
         nexus.registerSupportedSaslMechanisms( saslMechanismHandlers.keySet() );
 
+        // Install the replication handler if we have one
         if ( replicationReqHandler != null )
         {
             replicationReqHandler.init( this );
             ( ( SearchHandler ) getSearchHandler() ).setReplicationReqHandler( replicationReqHandler
);
         }
 
+        // And start the replication consumers on this server
         startConsumers();
 
         started = true;

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=1151905&r1=1151904&r2=1151905&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
Thu Jul 28 16:05:42 2011
@@ -83,6 +83,7 @@ import org.slf4j.LoggerFactory;
  */
 public class SearchHandler extends LdapRequestHandler<SearchRequest>
 {
+    /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( SearchHandler.class );
 
     /** Speedup for logs */
@@ -91,6 +92,7 @@ public class SearchHandler extends LdapR
     /** cached to save redundant lookups into registries */
     private AttributeType OBJECT_CLASS_AT;
 
+    /** The replication handler */
     protected ReplicationRequestHandler replicationReqHandler;
 
 
@@ -178,7 +180,22 @@ public class SearchHandler extends LdapR
         // check first for the syncrepl search request decorator
         if ( req.getControls().containsKey( SyncRequestValue.OID ) )
         {
-            handleSyncreplSearch( session, req );
+            if ( replicationReqHandler != null )
+            {
+                replicationReqHandler.handleSyncRequest( session, req );
+            }
+            else
+            {
+                LOG.warn( "This server does not allow replication" );
+                // Replication is not allowed on this server. generate a error message
+                LdapResult result = req.getResultResponse().getLdapResult();
+                
+                result.setDiagnosticMessage( "Replicztion is not allowed on this server"
);
+                result.setResultCode( ResultCodeEnum.OTHER );
+                session.getIoSession().write( req.getResultResponse() );
+                
+                return;
+            }
         }
         // if we have the ManageDSAIt decorator, go directly
         // to the handling without pre-processing the request
@@ -207,7 +224,6 @@ public class SearchHandler extends LdapR
                 default:
                     throw new IllegalStateException( I18n.err( I18n.ERR_685, req ) );
             }
-
         }
     }
 
@@ -1615,23 +1631,12 @@ public class SearchHandler extends LdapR
     }
 
 
-    public void setReplicationReqHandler( ReplicationRequestHandler prov )
-    {
-        this.replicationReqHandler = prov;
-    }
-
-
     /**
-     *
-     * handles the syncrepl search
-     *
-     * @param session the LDAP session under which processing occurs
-     * @param req the request to be handled
-     * @throws org.apache.directory.shared.ldap.model.exception.LdapException
+     * Install the replication handler when it's allowed by this server
+     * @param replicationReqHandler The replication handler provider
      */
-    public void handleSyncreplSearch( LdapSession session, SearchRequest req ) throws LdapException
+    public void setReplicationReqHandler( ReplicationRequestHandler replicationReqHandler
)
     {
-        replicationReqHandler.handleSyncRequest( session, req );
+        this.replicationReqHandler = replicationReqHandler;
     }
-
 }

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLog.java?rev=1151905&r1=1151904&r2=1151905&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLog.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLog.java
Thu Jul 28 16:05:42 2011
@@ -43,6 +43,9 @@ import org.slf4j.LoggerFactory;
  */
 public class ReplicaEventLog
 {
+    /** The logger */
+    private static final Logger LOG = LoggerFactory.getLogger( ReplicaEventLog.class );
+    
     /** IP address of the syncrepl consumer */
     private String hostName;
 
@@ -65,7 +68,6 @@ public class ReplicaEventLog
     private boolean refreshNPersist;
 
     // fields that won't be serialized
-
     /** the ActiveMQ session */
     private ActiveMQSession amqSession;
 
@@ -83,7 +85,6 @@ public class ReplicaEventLog
 
     private volatile boolean dirty;
 
-    private static final Logger LOG = LoggerFactory.getLogger( ReplicaEventLog.class );
 
 
     public ReplicaEventLog( int replicaId )
@@ -115,7 +116,7 @@ public class ReplicaEventLog
 
 
     /**
-     * stores the given EventType and Entry in the queue 
+     * Stores the given EventType and Entry in the queue 
      *
      * @param event the EventType
      * @param entry the modified Entry

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java?rev=1151905&r1=1151904&r2=1151905&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java
Thu Jul 28 16:05:42 2011
@@ -45,31 +45,36 @@ import org.slf4j.LoggerFactory;
 
 
 /**
- * TODO ReplicaEventMessage.
+ * A place holder storing an Entry and the operation applied on it
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class ReplicaEventMessage implements Externalizable
 {
-    private EventType eventType;
-    private Entry entry;
-
-    private SyncModifyDnDecorator modDnControl;
-    
+    /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( ReplicaEventMessage.class
);
 
-    private static SchemaManager schemaManager;
+    /** The message event type */
+    private EventType eventType;
     
-    private LdapApiService codec;
+    /** The entry */
+    private Entry entry;
 
+    /** The SchemaManager instance */
+    private static SchemaManager schemaManager;
 
-    public ReplicaEventMessage()
-    {
-        // used by deserializer
-        codec = LdapApiServiceFactory.getSingleton();
-    }
+    /** The LDAP codec used to serialize the entries */
+    private LdapApiService codec = LdapApiServiceFactory.getSingleton();
 
+    /** The modifyDN control */
+    private SyncModifyDnDecorator modDnControl;
+    
 
+    /**
+     * Create a new ReplicaEvent instance for a Add/Delete+Modify operation
+     * @param eventType The event type
+     * @param entry The entry
+     */
     public ReplicaEventMessage( EventType eventType, Entry entry )
     {
         this.eventType = eventType;
@@ -77,37 +82,54 @@ public class ReplicaEventMessage impleme
     }
 
 
+    /**
+     * Create a new ReplicaEvent instance for a ModDN operation
+     * @param modDnControl The modDN control
+     * @param entry The entry
+     */
     public ReplicaEventMessage( SyncModifyDnDecorator modDnControl, Entry entry )
     {
-        codec = LdapApiServiceFactory.getSingleton();
         this.modDnControl = modDnControl;
         this.entry = entry;
     }
 
     
+    /**
+     * @return The eventType
+     */
     public EventType getEventType()
     {
         return eventType;
     }
 
 
+    /**
+     * @return The stored Entry
+     */
     public Entry getEntry()
     {
         return entry;
     }
 
 
+    /**
+     * @return The ModDN conrol
+     */
     public SyncModifyDnDecorator getModDnControl()
     {
         return modDnControl;
     }
 
     
+    /**
+     * {@inheritDoc}
+     */
     public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
     {
 
         byte b = in.readByte();
-        if( b == 0 ) // handle the SyncModDnControl
+        
+        if ( b == 0 ) // handle the SyncModDnControl
         {
             SyncModifyDnType modDnType = SyncModifyDnType.getModifyDnType( in.readShort()
);
             
@@ -116,7 +138,7 @@ public class ReplicaEventMessage impleme
             
             modDnControl.setEntryDn( in.readUTF() );
             
-            switch( modDnType )
+            switch ( modDnType )
             {
                 case MOVE:
                     modDnControl.setNewSuperiorDn( in.readUTF() );
@@ -189,9 +211,12 @@ public class ReplicaEventMessage impleme
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void writeExternal( ObjectOutput out ) throws IOException
     {
-        if( eventType == null )
+        if ( eventType == null )
         {
             out.writeByte( 0 );
             
@@ -199,7 +224,7 @@ public class ReplicaEventMessage impleme
             out.writeShort( modDnType.getValue() );
             out.writeUTF( modDnControl.getEntryDn() );
             
-            switch( modDnType )
+            switch ( modDnType )
             {
                 case MOVE:
                     out.writeUTF( modDnControl.getNewSuperiorDn() );
@@ -247,9 +272,12 @@ public class ReplicaEventMessage impleme
     }
 
 
+    /**
+     * Set the SchemaManager 
+     * @param schemaManager The SchemaManager instance
+     */
     public static void setSchemaManager( SchemaManager schemaManager )
     {
         ReplicaEventMessage.schemaManager = schemaManager;
     }
-
 }

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplRequestHandler.java?rev=1151905&r1=1151904&r2=1151905&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplRequestHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplRequestHandler.java
Thu Jul 28 16:05:42 2011
@@ -232,28 +232,38 @@ public class SyncReplRequestHandler impl
     }
 
 
-    public void handleSyncRequest( LdapSession session, SearchRequest req ) throws LdapException
+    /**
+     * Process the incoming search request sent by a remote server when trying to replicate.
+     * 
+     * @param session The used LdapSession. Should be the dedicated user
+     * @param request The search request
+     */
+    public void handleSyncRequest( LdapSession session, SearchRequest request ) throws LdapException
     {
         try
         {
-            SyncRequestValue syncControl = ( SyncRequestValue ) req.getControls().get(
+            // First extract the Sync control from the request
+            SyncRequestValue syncControl = ( SyncRequestValue ) request.getControls().get(
                 SyncRequestValue.OID );
 
             // cookie is in the format <replicaId>;<Csn value>
             byte[] cookieBytes = syncControl.getCookie();
-            String cookieString = Strings.utf8ToString(cookieBytes);
 
             if ( cookieBytes == null )
             {
-                doInitialRefresh( session, req );
+                // No cookie ? We have to get all the entries from the server
+                doInitialRefresh( session, request );
             }
             else
             {
-                LOG.warn( "search request received with the cookie {}", Strings.utf8ToString(cookieBytes)
);
+                String cookieString = Strings.utf8ToString(cookieBytes);
+                
+                LOG.warn( "search request received with the cookie {}", cookieString );
+                
                 if ( !isValidCookie( cookieString ) )
                 {
                     LOG.error( "received a invalid cookie {} from the consumer with session
{}", cookieString, session );
-                    sendESyncRefreshRequired( session, req );
+                    sendESyncRefreshRequired( session, request );
                 }
                 else
                 {
@@ -262,11 +272,11 @@ public class SyncReplRequestHandler impl
                     {
                         LOG.warn( "received a valid cookie {} but there is no event log associated
with this replica",
                             cookieString );
-                        sendESyncRefreshRequired( session, req );
+                        sendESyncRefreshRequired( session, request );
                     }
                     else
                     {
-                        doContentUpdate( session, req, clientMsgLog );
+                        doContentUpdate( session, request, clientMsgLog );
                     }
                 }
             }
@@ -290,6 +300,7 @@ public class SyncReplRequestHandler impl
         String lastSentCsn = clientMsgLog.getLastSentCsn();
 
         ReplicaEventLogCursor cursor = clientMsgLog.getCursor();
+        
         while ( cursor.next() )
         {
             ReplicaEventMessage message = cursor.get();
@@ -308,18 +319,23 @@ public class SyncReplRequestHandler impl
             else
             {
                 SyncStateTypeEnum syncStateType = null;
-                if ( event == EventType.ADD || event == EventType.MODIFY )
-                {
-                    syncStateType = SyncStateTypeEnum.ADD;
-                }
-                else if ( event == EventType.DELETE )
+                
+                switch ( event )
                 {
-                    syncStateType = SyncStateTypeEnum.DELETE;
+                    case ADD :
+                    case MODIFY :
+                        syncStateType = SyncStateTypeEnum.ADD;
+                        break;
+                        
+                    case DELETE :
+                        syncStateType = SyncStateTypeEnum.DELETE;
+                        break;
                 }
 
                 sendSearchResultEntry( session, req, entry, syncStateType );
             }
         }
+        
         cursor.close();
 
         return lastSentCsn;
@@ -376,29 +392,36 @@ public class SyncReplRequestHandler impl
     }
 
 
-    private void doInitialRefresh( LdapSession session, SearchRequest req ) throws Exception
+    /**
+     * Process the initial refresh : we will send all the entries 
+     * 
+     * @param session The LDAP session to use
+     * @param request The serarch request to process
+     * @throws Exception
+     */
+    private void doInitialRefresh( LdapSession session, SearchRequest request ) throws Exception
     {
-        String originalFilter = req.getFilter().toString();
+        String originalFilter = request.getFilter().toString();
         InetSocketAddress address = ( InetSocketAddress ) session.getIoSession().getRemoteAddress();
         String hostName = address.getAddress().getHostName();
 
-        ExprNode modifiedFilter = modifyFilter( session, req );
+        ExprNode modifiedFilter = modifyFilter( session, request );
 
         String contextCsn = dirService.getContextCsn();
 
-        boolean refreshNPersist = isRefreshNPersist( req );
+        boolean refreshNPersist = isRefreshNPersist( request );
 
         // first register a persistent search handler before starting the initial content
refresh
         // this is to log all the operations happen on DIT during initial content refresh
-
         ReplicaEventLog replicaLog = createRelicaEventLog( hostName, originalFilter );
 
         replicaLog.setRefreshNPersist( refreshNPersist );
+        StringValue contexCsnValue = new StringValue( contextCsn );
 
         // modify the filter to include the context Csn
-        GreaterEqNode csnGeNode = new GreaterEqNode( SchemaConstants.ENTRY_CSN_AT, new StringValue(
contextCsn ) );
+        GreaterEqNode csnGeNode = new GreaterEqNode( SchemaConstants.ENTRY_CSN_AT, contexCsnValue
);
         ExprNode postInitContentFilter = new AndNode( modifiedFilter, csnGeNode );
-        req.setFilter( postInitContentFilter );
+        request.setFilter( postInitContentFilter );
 
         // now we process entries forever as they change
         LOG.info( "starting persistent search for the client {}", replicaLog );
@@ -406,17 +429,17 @@ public class SyncReplRequestHandler impl
         // irrespective of the sync mode set the 'isRealtimePush' to false initially so that
we can
         // store the modifications in the queue and later if it is a persist mode
         // we push this queue's content and switch to realtime mode
-        SyncReplSearchListener handler = new SyncReplSearchListener( session, req, replicaLog,
false );
+        SyncReplSearchListener handler = new SyncReplSearchListener( session, request, replicaLog,
false );
         replicaLog.setPersistentListener( handler );
 
         // compose notification criteria and add the listener to the event 
         // service using that notification criteria to determine which events 
         // are to be delivered to the persistent search issuing client
         NotificationCriteria criteria = new NotificationCriteria();
-        criteria.setAliasDerefMode( req.getDerefAliases() );
-        criteria.setBase( req.getBase() );
-        criteria.setFilter( req.getFilter() );
-        criteria.setScope( req.getScope() );
+        criteria.setAliasDerefMode( request.getDerefAliases() );
+        criteria.setBase( request.getBase() );
+        criteria.setFilter( request.getFilter() );
+        criteria.setScope( request.getScope() );
         criteria.setEventMask( EventType.ALL_EVENT_TYPES_MASK );
 
         replicaLog.setSearchCriteria( criteria );
@@ -424,25 +447,25 @@ public class SyncReplRequestHandler impl
         dirService.getEventService().addListener( handler, criteria );
 
         // then start pushing initial content
-        LessEqNode csnNode = new LessEqNode( SchemaConstants.ENTRY_CSN_AT, new StringValue(
contextCsn ) );
+        LessEqNode csnNode = new LessEqNode( SchemaConstants.ENTRY_CSN_AT, contexCsnValue
);
 
         // modify the filter to include the context Csn
         ExprNode initialContentFilter = new AndNode( modifiedFilter, csnNode );
-        req.setFilter( initialContentFilter );
+        request.setFilter( initialContentFilter );
 
-        SearchResultDone searchDoneResp = doSimpleSearch( session, req );
+        SearchResultDone searchDoneResp = doSimpleSearch( session, request );
 
         if ( searchDoneResp.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
         {
             replicaLog.setLastSentCsn( contextCsn );
-            byte[] cookie = Strings.getBytesUtf8(replicaLog.getId() + REPLICA_ID_DELIM +
contextCsn);
+            byte[] cookie = Strings.getBytesUtf8( replicaLog.getId() + REPLICA_ID_DELIM +
contextCsn );
 
             if ( refreshNPersist ) // refreshAndPersist mode
             {
-                contextCsn = sendContentFromLog( session, req, replicaLog );
+                contextCsn = sendContentFromLog( session, request, replicaLog );
                 cookie = Strings.getBytesUtf8(replicaLog.getId() + REPLICA_ID_DELIM + contextCsn);
 
-                IntermediateResponse intermResp = new IntermediateResponseImpl( req.getMessageId()
);
+                IntermediateResponse intermResp = new IntermediateResponseImpl( request.getMessageId()
);
                 intermResp.setResponseName( SyncInfoValue.OID );
 
                 SyncInfoValueDecorator syncInfo = new SyncInfoValueDecorator( 
@@ -538,11 +561,15 @@ public class SyncReplRequestHandler impl
     }
 
 
+    /**
+     * Process the results get from a search request. We will send them to the client.
+     */
     private void readResults( LdapSession session, SearchRequest req, LdapResult ldapResult,
         EntryFilteringCursor cursor, long sizeLimit ) throws Exception
     {
         long count = 0;
 
+        
         while ( ( count < sizeLimit ) && cursor.next() )
         {
             // Handle closed session
@@ -582,15 +609,20 @@ public class SyncReplRequestHandler impl
     }
 
 
+    /**
+     * Prepare and send a search result entry response, with the associated
+     * SyncState control.
+     */
     private void sendSearchResultEntry( LdapSession session, SearchRequest req, Entry entry,
         SyncStateTypeEnum syncStateType ) throws Exception
     {
-
         Attribute uuid = entry.get( SchemaConstants.ENTRY_UUID_AT );
+        
+        // Create the SyncState control
         SyncStateValueDecorator syncStateControl = new SyncStateValueDecorator(
             ldapServer.getDirectoryService().getLdapCodecService() );
         syncStateControl.setSyncStateType( syncStateType );
-        syncStateControl.setEntryUUID( Strings.uuidToBytes(uuid.getString()) );
+        syncStateControl.setEntryUUID( Strings.uuidToBytes( uuid.getString() ) );
 
         if ( syncStateType == SyncStateTypeEnum.DELETE )
         {
@@ -792,12 +824,14 @@ public class SyncReplRequestHandler impl
          *  (| (objectClass=referral)(objectClass=*)) == (objectClass=*)
          */
         boolean isOcPresenceFilter = false;
+        
         if ( req.getFilter() instanceof PresenceNode )
         {
             PresenceNode presenceNode = ( PresenceNode ) req.getFilter();
 
             AttributeType at = session.getCoreSession().getDirectoryService().getSchemaManager()
                 .lookupAttributeTypeRegistry( presenceNode.getAttribute() );
+            
             if ( at.getOid().equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
             {
                 isOcPresenceFilter = true;
@@ -805,6 +839,7 @@ public class SyncReplRequestHandler impl
         }
 
         ExprNode filter = req.getFilter();
+        
         if ( !req.hasControl( ManageDsaIT.OID ) && !isOcPresenceFilter )
         {
             filter = new OrNode( req.getFilter(), newIsReferralEqualityNode( session ) );
@@ -1016,10 +1051,13 @@ public class SyncReplRequestHandler impl
     }
 
 
+    /**
+     * Tells if the control contains the REFRESHNPERSIST mode
+     */
     private boolean isRefreshNPersist( SearchRequest req )
     {
-        SyncRequestValue control = ( SyncRequestValue ) req.getControls().get(
-            SyncRequestValue.OID );
-        return ( control.getMode() == SynchronizationModeEnum.REFRESH_AND_PERSIST ? true
: false );
+        SyncRequestValue control = ( SyncRequestValue ) req.getControls().get( SyncRequestValue.OID
);
+        
+        return control.getMode() == SynchronizationModeEnum.REFRESH_AND_PERSIST;
     }
 }

Modified: directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/shared/ldap/extras/controls/SyncModifyDnType.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/shared/ldap/extras/controls/SyncModifyDnType.java?rev=1151905&r1=1151904&r2=1151905&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/shared/ldap/extras/controls/SyncModifyDnType.java
(original)
+++ directory/shared/trunk/ldap/extras/codec-api/src/main/java/org/apache/directory/shared/ldap/extras/controls/SyncModifyDnType.java
Thu Jul 28 16:05:42 2011
@@ -51,7 +51,7 @@ public enum SyncModifyDnType
     
     public static SyncModifyDnType getModifyDnType( int value )
     {
-        switch( value )
+        switch ( value )
         {
             case 0 : return MOVE;
             



Mime
View raw message