directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1072243 - in /directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap: ExtendedOperationHandler.java handlers/extended/CertGenerationRequestHandler.java
Date Sat, 19 Feb 2011 04:02:35 GMT
Author: akarasulu
Date: Sat Feb 19 04:02:35 2011
New Revision: 1072243

URL: http://svn.apache.org/viewvc?rev=1072243&view=rev
Log:
DIRSHARED-86: cleaning up cert generation handler which now because of the codec does not
need to handle decoding

Modified:
    directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java
    directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java

Modified: directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java?rev=1072243&r1=1072242&r2=1072243&view=diff
==============================================================================
--- directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java
(original)
+++ directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java
Sat Feb 19 04:02:35 2011
@@ -32,7 +32,7 @@ import org.apache.directory.shared.ldap.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  *
  */
-public interface ExtendedOperationHandler
+public interface ExtendedOperationHandler<R extends ExtendedRequest>
 {
     /**
      * Returns the EXTENSION_OID of the extended request this handler can handle.
@@ -58,7 +58,7 @@ public interface ExtendedOperationHandle
      * 
      * @throws Exception if failed to handle the operation
      */
-    void handleExtendedOperation( LdapSession session, ExtendedRequest req ) throws Exception;
+    void handleExtendedOperation( LdapSession session, R req ) throws Exception;
 
 
     /**

Modified: directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java?rev=1072243&r1=1072242&r2=1072243&view=diff
==============================================================================
--- directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
(original)
+++ directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
Sat Feb 19 04:02:35 2011
@@ -20,7 +20,6 @@
 package org.apache.directory.server.ldap.handlers.extended;
 
 
-import java.nio.ByteBuffer;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
@@ -30,15 +29,9 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.ldap.ExtendedOperationHandler;
 import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.ldap.LdapSession;
-import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.ldap.extras.extended.ads_impl.CertGenerationContainer;
-import org.apache.directory.shared.ldap.extras.extended.ads_impl.CertGenerationDecoder;
-import org.apache.directory.shared.ldap.extras.extended.ads_impl.CertGenerationObject;
 import org.apache.directory.shared.ldap.extras.extended.CertGenerationRequest;
 import org.apache.directory.shared.ldap.extras.extended.CertGenerationResponse;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.message.ExtendedRequest;
 import org.apache.directory.shared.ldap.model.name.Dn;
 
 
@@ -47,9 +40,8 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class CertGenerationRequestHandler implements ExtendedOperationHandler
+public class CertGenerationRequestHandler implements ExtendedOperationHandler<CertGenerationRequest>
 {
-
     private static final Set<String> EXTENSION_OIDS;
 
     static
@@ -61,47 +53,46 @@ public class CertGenerationRequestHandle
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public String getOid()
     {
         return CertGenerationRequest.EXTENSION_OID;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Set<String> getExtensionOids()
     {
         return EXTENSION_OIDS;
     }
 
 
-    public void handleExtendedOperation( LdapSession session, ExtendedRequest req ) throws
Exception
+    /**
+     * {@inheritDoc}
+     */
+    public void handleExtendedOperation( LdapSession session, CertGenerationRequest req )
throws Exception
     {
-        ByteBuffer bb = ByteBuffer.wrap( req.getRequestValue() );
-        Asn1Decoder decoder = new CertGenerationDecoder();
-        CertGenerationContainer container = new CertGenerationContainer();
-
-        try
-        {
-            decoder.decode( bb, container );
-        }
-        catch ( DecoderException e )
-        {
-            throw e;
-        }
-
-        CertGenerationObject certGenObj = container.getCertGenerationObject();
-
-        Entry entry = session.getCoreSession().lookup( new Dn( certGenObj.getTargetDN() )
);
+        Entry entry = session.getCoreSession().lookup( new Dn( req.getTargetDN() ) );
 
         if ( entry != null )
         {
-            TlsKeyGenerator.addKeyPair( ( ( ClonedServerEntry ) entry ).getOriginalEntry(),
certGenObj.getIssuerDN(),
-                certGenObj.getSubjectDN(), certGenObj.getKeyAlgorithm() );
+            TlsKeyGenerator.addKeyPair( 
+                ( ( ClonedServerEntry ) entry ).getOriginalEntry(), 
+                req.getIssuerDN(),
+                req.getSubjectDN(), 
+                req.getKeyAlgorithm() );
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void setLdapServer( LdapServer ldapServer )
     {
     }
-
 }



Mime
View raw message