From commits-return-22153-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Sun Jun 14 12:33:42 2009 Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 65507 invoked from network); 14 Jun 2009 12:33:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Jun 2009 12:33:42 -0000 Received: (qmail 71923 invoked by uid 500); 14 Jun 2009 12:33:53 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 71861 invoked by uid 500); 14 Jun 2009 12:33:53 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 71852 invoked by uid 99); 14 Jun 2009 12:33:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Jun 2009 12:33:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Jun 2009 12:33:51 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5AB1E23888D6; Sun, 14 Jun 2009 12:33:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r784548 - /directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java Date: Sun, 14 Jun 2009 12:33:31 -0000 To: commits@directory.apache.org From: kayyagari@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090614123331.5AB1E23888D6@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kayyagari Date: Sun Jun 14 12:33:30 2009 New Revision: 784548 URL: http://svn.apache.org/viewvc?rev=784548&view=rev Log: o added a new delete method with listener parameter o fixed the message id setting, returning reponse value and unlocking session for async feature Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java Modified: directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java?rev=784548&r1=784547&r2=784548&view=diff ============================================================================== --- directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java (original) +++ directory/shared/trunk/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java Sun Jun 14 12:33:30 2009 @@ -724,9 +724,10 @@ // Send the request to the server ldapSession.write( message ); + + AddResponse response = null; if( listener == null ) { - AddResponse response = null; try { long timeout = getTimeout( addRequest.getTimeout() ); @@ -745,16 +746,15 @@ unlockSession(); throw new LdapException( e ); } - - unlockSession(); - - return response; } else { - listenerMap.put( newId, listener ); - return null; + listenerMap.put( newId, listener ); } + + unlockSession(); + + return response; } @@ -1396,6 +1396,7 @@ // Store the response into the responseQueue AddResponseCodec addRespCodec = response.getAddResponse(); addRespCodec.addControl( response.getCurrentControl() ); + addRespCodec.setMessageId( response.getMessageId() ); AddListener addListener = ( AddListener ) listenerMap.get( addRespCodec.getMessageId() ); AddResponse addResp = convert( addRespCodec ); @@ -1437,6 +1438,7 @@ case LdapConstants.DEL_RESPONSE : // Store the response into the responseQueue DelResponseCodec delRespCodec = response.getDelResponse(); + delRespCodec.setMessageId( response.getMessageId() ); delRespCodec.addControl( response.getCurrentControl() ); DeleteResponse delResp = convert( delRespCodec ); DeleteListener delListener = ( DeleteListener ) listenerMap.get( delResp.getMessageId() ); @@ -1460,6 +1462,7 @@ // Store the response into the responseQueue IntermediateResponseCodec intermediateResponseCodec = response.getIntermediateResponse(); + intermediateResponseCodec.setMessageId( response.getMessageId() ); intermediateResponseCodec.addControl( response.getCurrentControl() ); IntermediateResponse intrmResp = convert( intermediateResponseCodec ); @@ -1478,6 +1481,7 @@ case LdapConstants.MODIFY_RESPONSE : ModifyResponseCodec modRespCodec = response.getModifyResponse(); + modRespCodec.setMessageId( response.getMessageId() ); modRespCodec.addControl( response.getCurrentControl() ); ModifyResponse modResp = convert( modRespCodec ); @@ -1497,6 +1501,7 @@ ModifyDNResponseCodec modDnCodec = response.getModifyDNResponse(); modDnCodec.addControl( response.getCurrentControl() ); + modDnCodec.setMessageId( response.getMessageId() ); ModifyDnResponse modDnResp = convert( modDnCodec ); ModifyDnListener modDnListener = ( ModifyDnListener ) listenerMap.get( modDnCodec.getMessageId() ); if( modDnListener != null ) @@ -1514,6 +1519,7 @@ // Store the response into the responseQueue SearchResultDoneCodec searchResultDoneCodec = response.getSearchResultDone(); + searchResultDoneCodec.setMessageId( response.getMessageId() ); searchResultDoneCodec.addControl( response.getCurrentControl() ); SearchResultDone srchDone = convert( searchResultDoneCodec ); // search listener has to be removed from listener map only here @@ -1533,6 +1539,7 @@ // Store the response into the responseQueue SearchResultEntryCodec searchResultEntryCodec = response.getSearchResultEntry(); + searchResultEntryCodec.setMessageId( response.getMessageId() ); searchResultEntryCodec.addControl( response.getCurrentControl() ); SearchResultEntry srchEntry = convert( searchResultEntryCodec ); @@ -1552,6 +1559,7 @@ // Store the response into the responseQueue SearchResultReferenceCodec searchResultReferenceCodec = response.getSearchResultReference(); + searchResultReferenceCodec.setMessageId( response.getMessageId() ); searchResultReferenceCodec.addControl( response.getCurrentControl() ); SearchResultReference srchRef = convert( searchResultReferenceCodec ); @@ -1631,9 +1639,9 @@ ldapSession.write( modifyMessage ); + ModifyResponse response = null; if( listener == null ) { - ModifyResponse response = null; try { long timeout = getTimeout( modRequest.getTimeout() ); @@ -1652,16 +1660,15 @@ unlockSession(); throw new LdapException( e ); } - - unlockSession(); - - return response; } else { listenerMap.put( newId, listener ); - return null; } + + unlockSession(); + + return response; } @@ -1886,6 +1893,20 @@ return delete( dn, false ); } + + /** + * deletes the entry with the given DN + * + * @param dn the target entry's DN + * @param listener the delete operation response listener + * @return operation's response, null if a non-null listener value is provided + * @throws LdapException + */ + public DeleteResponse delete( LdapDN dn, DeleteListener listener ) throws LdapException + { + return delete( new DeleteRequest( dn ), listener ); + } + /** * deletes the entry with the given DN and all its children @@ -2027,9 +2048,9 @@ ldapSession.write( deleteMessage ); + DeleteResponse response = null; if( listener == null ) { - DeleteResponse response = null; try { long timeout = getTimeout( delRequest.getTimeout() ); @@ -2051,15 +2072,15 @@ throw ldapException; } - unlockSession(); - - return response; } else { listenerMap.put( newId, listener ); - return null; } + + unlockSession(); + + return response; }