directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r965547 - in /directory/clients/ldap/branches/ldap-client-subtree/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api: LdapConnection.java LdapNetworkConnection.java
Date Mon, 19 Jul 2010 16:22:20 GMT
Author: elecharny
Date: Mon Jul 19 16:22:20 2010
New Revision: 965547

URL: http://svn.apache.org/viewvc?rev=965547&view=rev
Log:
Added a modify(  DN, Modification... ) method in the LdapConnection for convenience

Modified:
    directory/clients/ldap/branches/ldap-client-subtree/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
    directory/clients/ldap/branches/ldap-client-subtree/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java

Modified: directory/clients/ldap/branches/ldap-client-subtree/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/branches/ldap-client-subtree/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java?rev=965547&r1=965546&r2=965547&view=diff
==============================================================================
--- directory/clients/ldap/branches/ldap-client-subtree/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
(original)
+++ directory/clients/ldap/branches/ldap-client-subtree/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
Mon Jul 19 16:22:20 2010
@@ -24,6 +24,7 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.shared.asn1.primitives.OID;
 import org.apache.directory.shared.ldap.cursor.Cursor;
 import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapException;
@@ -207,9 +208,21 @@ public interface LdapConnection
 
     /**
      * 
+     * Applies all the modifications to the entry specified by its DN
+     *
+     * @param DN The entry's DN
+     * @param modifications The list of modifications to be applied
+     * @return the modify operation's response
+     * @throws LdapException in case of modify operation failure or timeout happens
+     */
+    public abstract ModifyResponse modify( DN dn, Modification... modifications ) throws
LdapException;
+
+    
+    /**
+     * 
      * modifies all the attributes present in the entry by applying the same operation.
      *
-     * @param entry the entry whise attributes to be modified
+     * @param entry the entry with the attributes to be modified
      * @param modOp the operation to be applied on all the attributes of the above entry
      * @return the modify operation's response
      * @throws LdapException in case of modify operation failure or timeout happens

Modified: directory/clients/ldap/branches/ldap-client-subtree/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/branches/ldap-client-subtree/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=965547&r1=965546&r2=965547&view=diff
==============================================================================
--- directory/clients/ldap/branches/ldap-client-subtree/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/clients/ldap/branches/ldap-client-subtree/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Mon Jul 19 16:22:20 2010
@@ -117,6 +117,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapException;
@@ -166,7 +167,6 @@ import org.slf4j.LoggerFactory;
  */
 public class LdapNetworkConnection extends IoHandlerAdapter implements LdapAsyncConnection
 {
-
     /** logger for reporting errors that might not be handled properly upstream */
     private static final Logger LOG = LoggerFactory.getLogger( LdapNetworkConnection.class
);
 
@@ -1901,6 +1901,24 @@ public class LdapNetworkConnection exten
     /**
      * {@inheritDoc}
      */
+    public ModifyResponse modify( DN dn, Modification... modifications ) throws LdapException
+    {
+        if ( dn == null )
+        {
+            LOG.debug( "received a null dn for modification" );
+            throw new IllegalArgumentException( "The DN to be modified cannot be null" );
+        }
+
+        ModifyRequest modReq = new ModifyRequest( dn );
+        modReq.addModification( modifications );
+
+        return modify( modReq );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     public ModifyResponse modify( ModifyRequest modRequest ) throws LdapException
     {
         ModifyFuture modifyFuture = modifyAsync( modRequest );



Mime
View raw message