directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1074006 - in /directory/shared/branches/akarasulu: ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/ ldap-codec-standalone/src/main/java/org/apache/directory/shared/ldap/codec/standalone/ ldap-codec/src/main/java/org/apac...
Date Thu, 24 Feb 2011 01:13:08 GMT
Author: akarasulu
Date: Thu Feb 24 01:13:07 2011
New Revision: 1074006

URL: http://svn.apache.org/viewvc?rev=1074006&view=rev
Log:
DIRSHARED-86: adding new decorate methods to LdapCodecService for extended operation handling

Modified:
    directory/shared/branches/akarasulu/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
    directory/shared/branches/akarasulu/ldap-codec-standalone/src/main/java/org/apache/directory/shared/ldap/codec/standalone/StandaloneLdapCodecService.java
    directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/ExtendedRequestFactory.java
    directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java
    directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/MessageDecorator.java
    directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/UnsolicitedResponseFactory.java
    directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/DefaultLdapCodecService.java
    directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/CancelFactory.java
    directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/CertGenerationFactory.java
    directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/GracefulDisconnectFactory.java
    directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/GracefulShutdownFactory.java
    directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedureFactory.java

Modified: directory/shared/branches/akarasulu/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1074006&r1=1074005&r2=1074006&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/shared/branches/akarasulu/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Thu Feb 24 01:13:07 2011
@@ -94,7 +94,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.DeleteRequestImpl;
 import org.apache.directory.shared.ldap.model.message.DeleteResponse;
 import org.apache.directory.shared.ldap.model.message.ExtendedRequest;
-import org.apache.directory.shared.ldap.model.message.ExtendedRequestImpl;
 import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
 import org.apache.directory.shared.ldap.model.message.IntermediateResponse;
 import org.apache.directory.shared.ldap.model.message.IntermediateResponseImpl;

Modified: directory/shared/branches/akarasulu/ldap-codec-standalone/src/main/java/org/apache/directory/shared/ldap/codec/standalone/StandaloneLdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-codec-standalone/src/main/java/org/apache/directory/shared/ldap/codec/standalone/StandaloneLdapCodecService.java?rev=1074006&r1=1074005&r2=1074006&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-codec-standalone/src/main/java/org/apache/directory/shared/ldap/codec/standalone/StandaloneLdapCodecService.java
(original)
+++ directory/shared/branches/akarasulu/ldap-codec-standalone/src/main/java/org/apache/directory/shared/ldap/codec/standalone/StandaloneLdapCodecService.java
Thu Feb 24 01:13:07 2011
@@ -926,4 +926,53 @@ public class StandaloneLdapCodecService 
         
         return req;
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public ExtendedRequestDecorator<?, ?> decorate( ExtendedRequest<?> decoratedMessage
)
+    {
+        ExtendedRequestDecorator<?,?> req = null;
+        
+        ExtendedRequestFactory<?,?> extendedRequestFactory = extReqFactories.get( decoratedMessage.getRequestName()
);
+        if ( extendedRequestFactory != null )
+        {
+            req = extendedRequestFactory.decorate( decoratedMessage );
+        }
+        else
+        {
+            req = new ExtendedRequestDecorator<ExtendedRequest<ExtendedResponse>,
ExtendedResponse>( this, 
+                    ( ExtendedRequest<ExtendedResponse> ) decoratedMessage );
+        }
+        
+        return req;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ExtendedResponseDecorator<?> decorate( ExtendedResponse decoratedMessage
)
+    {
+        ExtendedResponseDecorator<?> resp = null;
+        
+        UnsolicitedResponseFactory<?> unsolicitedResponseFactory = unsolicitedFactories.get(
decoratedMessage.getResponseName() );
+        ExtendedRequestFactory<?,?> extendedRequestFactory = extReqFactories.get( decoratedMessage.getResponseName()
);
+        if ( extendedRequestFactory != null )
+        {
+            resp = extendedRequestFactory.decorate( decoratedMessage );
+        }
+        else if ( unsolicitedResponseFactory != null )
+        {
+            resp = unsolicitedResponseFactory.decorate( decoratedMessage );
+        }
+        else
+        {
+            resp = new ExtendedResponseDecorator<ExtendedResponse>( this, decoratedMessage
);
+        }
+        
+        return resp;
+    }
 }

Modified: directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/ExtendedRequestFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/ExtendedRequestFactory.java?rev=1074006&r1=1074005&r2=1074006&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/ExtendedRequestFactory.java
(original)
+++ directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/ExtendedRequestFactory.java
Thu Feb 24 01:13:07 2011
@@ -74,4 +74,14 @@ public interface ExtendedRequestFactory<
      * @return The new ExtendedResponse.
      */
     P newResponse( byte[] encodedValue ) throws DecoderException;
+
+
+    /**
+     * Decorates an ExtendedResponse which may or may not be of the expected 
+     * type. The factory implementor must check and handle appropriately.
+     *
+     * @param decoratedMessage the message to be decorated.
+     * @return The decorated message 
+     */
+    ExtendedResponseDecorator<P> decorate( ExtendedResponse decoratedMessage );
 }

Modified: directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java?rev=1074006&r1=1074005&r2=1074006&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java
(original)
+++ directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java
Thu Feb 24 01:13:07 2011
@@ -259,4 +259,10 @@ public interface LdapCodecService
      * @return The new extended request
      */
     ExtendedRequest<?> newExtendedRequest( String oid, byte[] value );
+
+
+    ExtendedRequestDecorator<?,?> decorate( ExtendedRequest<?> decoratedMessage
);
+
+
+    ExtendedResponseDecorator<?> decorate( ExtendedResponse decoratedMessage );
 }

Modified: directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/MessageDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/MessageDecorator.java?rev=1074006&r1=1074005&r2=1074006&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/MessageDecorator.java
(original)
+++ directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/MessageDecorator.java
Thu Feb 24 01:13:07 2011
@@ -96,7 +96,6 @@ public abstract class MessageDecorator<E
     private final LdapCodecService codec;
 
     
-    @SuppressWarnings("unchecked")
     public static MessageDecorator<? extends Message> getDecorator( LdapCodecService
codec, Message decoratedMessage )
     {
         if ( decoratedMessage instanceof MessageDecorator )
@@ -145,12 +144,11 @@ public abstract class MessageDecorator<E
                 break;
                 
             case EXTENDED_REQUEST:
-                decorator = new ExtendedRequestDecorator<ExtendedRequest<ExtendedResponse>,ExtendedResponse>(

-                    codec, ( ExtendedRequest<ExtendedResponse> ) decoratedMessage );
+                decorator = codec.decorate( ( ExtendedRequest<?> ) decoratedMessage
);
                 break;
                 
             case EXTENDED_RESPONSE:
-                decorator = new ExtendedResponseDecorator<ExtendedResponse>( codec,
( ExtendedResponse ) decoratedMessage );
+                decorator = codec.decorate( ( ExtendedResponse ) decoratedMessage );
                 break;
                 
             case INTERMEDIATE_RESPONSE:

Modified: directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/UnsolicitedResponseFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/UnsolicitedResponseFactory.java?rev=1074006&r1=1074005&r2=1074006&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/UnsolicitedResponseFactory.java
(original)
+++ directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/UnsolicitedResponseFactory.java
Thu Feb 24 01:13:07 2011
@@ -45,4 +45,13 @@ public interface UnsolicitedResponseFact
      *  @return A new instance of the ExtendedResponse.
      */
     R newResponse( byte[] encodedValue ) throws DecoderException;
+
+
+    /**
+     * Decorates an existing extended operation response.
+     * 
+     * @param decoratedMessage the extended response to be decorated
+     * @return the decorated message
+     */
+    ExtendedResponseDecorator<R> decorate( ExtendedResponse decoratedMessage );
 }

Modified: directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/DefaultLdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/DefaultLdapCodecService.java?rev=1074006&r1=1074005&r2=1074006&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/DefaultLdapCodecService.java
(original)
+++ directory/shared/branches/akarasulu/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/DefaultLdapCodecService.java
Thu Feb 24 01:13:07 2011
@@ -529,4 +529,53 @@ public class DefaultLdapCodecService imp
         
         return req;
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public ExtendedRequestDecorator<?, ?> decorate( ExtendedRequest<?> decoratedMessage
)
+    {
+        ExtendedRequestDecorator<?,?> req = null;
+        
+        ExtendedRequestFactory<?,?> extendedRequestFactory = extReqFactories.get( decoratedMessage.getRequestName()
);
+        if ( extendedRequestFactory != null )
+        {
+            req = extendedRequestFactory.decorate( decoratedMessage );
+        }
+        else
+        {
+            req = new ExtendedRequestDecorator<ExtendedRequest<ExtendedResponse>,
ExtendedResponse>( this, 
+                    ( ExtendedRequest<ExtendedResponse> ) decoratedMessage );
+        }
+        
+        return req;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ExtendedResponseDecorator<?> decorate( ExtendedResponse decoratedMessage
)
+    {
+        ExtendedResponseDecorator<?> resp = null;
+        
+        UnsolicitedResponseFactory<?> unsolicitedResponseFactory = unsolicitedFactories.get(
decoratedMessage.getResponseName() );
+        ExtendedRequestFactory<?,?> extendedRequestFactory = extReqFactories.get( decoratedMessage.getResponseName()
);
+        if ( extendedRequestFactory != null )
+        {
+            resp = extendedRequestFactory.decorate( decoratedMessage );
+        }
+        else if ( unsolicitedResponseFactory != null )
+        {
+            resp = unsolicitedResponseFactory.decorate( decoratedMessage );
+        }
+        else
+        {
+            resp = new ExtendedResponseDecorator<ExtendedResponse>( this, decoratedMessage
);
+        }
+        
+        return resp;
+    }
 }

Modified: directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/CancelFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/CancelFactory.java?rev=1074006&r1=1074005&r2=1074006&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/CancelFactory.java
(original)
+++ directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/CancelFactory.java
Thu Feb 24 01:13:07 2011
@@ -23,12 +23,14 @@ package org.apache.directory.shared.ldap
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.ldap.codec.api.ExtendedRequestDecorator;
 import org.apache.directory.shared.ldap.codec.api.ExtendedRequestFactory;
+import org.apache.directory.shared.ldap.codec.api.ExtendedResponseDecorator;
 import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.extras.extended.CancelRequestImpl;
 import org.apache.directory.shared.ldap.extras.extended.CancelResponseImpl;
 import org.apache.directory.shared.ldap.extras.extended.CancelRequest;
 import org.apache.directory.shared.ldap.extras.extended.CancelResponse;
 import org.apache.directory.shared.ldap.model.message.ExtendedRequest;
+import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
 
 
 /**
@@ -104,4 +106,22 @@ public class CancelFactory implements Ex
         
         return ( CancelRequestDecorator ) newRequest();
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ExtendedResponseDecorator<CancelResponse> decorate( ExtendedResponse decoratedMessage
)
+    {
+        if ( decoratedMessage instanceof CancelResponseDecorator )
+        {
+            return ( CancelResponseDecorator ) decoratedMessage;
+        }
+        else if ( decoratedMessage instanceof CancelResponse )
+        {
+            return new CancelResponseDecorator( codec, ( CancelResponse ) decoratedMessage
);
+        }
+        
+        return new CancelResponseDecorator( codec, new CancelResponseImpl() );        
+    }
 }

Modified: directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/CertGenerationFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/CertGenerationFactory.java?rev=1074006&r1=1074005&r2=1074006&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/CertGenerationFactory.java
(original)
+++ directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/CertGenerationFactory.java
Thu Feb 24 01:13:07 2011
@@ -23,6 +23,7 @@ package org.apache.directory.shared.ldap
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.ldap.codec.api.ExtendedRequestDecorator;
 import org.apache.directory.shared.ldap.codec.api.ExtendedRequestFactory;
+import org.apache.directory.shared.ldap.codec.api.ExtendedResponseDecorator;
 import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.extras.extended.CancelRequest;
 import org.apache.directory.shared.ldap.extras.extended.CertGenerationRequestImpl;
@@ -30,6 +31,7 @@ import org.apache.directory.shared.ldap.
 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.message.ExtendedRequest;
+import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
 
 
 /**
@@ -106,4 +108,22 @@ public class CertGenerationFactory 
         
         return ( CertGenerationRequestDecorator ) newRequest();
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ExtendedResponseDecorator<CertGenerationResponse> decorate( ExtendedResponse
decoratedMessage )
+    {
+        if ( decoratedMessage instanceof CertGenerationResponseDecorator )
+        {
+            return ( CertGenerationResponseDecorator ) decoratedMessage;
+        }
+        else if ( decoratedMessage instanceof CertGenerationResponse )
+        {
+            return new CertGenerationResponseDecorator( codec, ( CertGenerationResponse )
decoratedMessage );
+        }
+        
+        return new CertGenerationResponseDecorator( codec, new CertGenerationResponseImpl()
);
+    }
 }

Modified: directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/GracefulDisconnectFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/GracefulDisconnectFactory.java?rev=1074006&r1=1074005&r2=1074006&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/GracefulDisconnectFactory.java
(original)
+++ directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/GracefulDisconnectFactory.java
Thu Feb 24 01:13:07 2011
@@ -22,10 +22,12 @@ package org.apache.directory.shared.ldap
 
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.ldap.codec.api.ExtendedRequestFactory;
+import org.apache.directory.shared.ldap.codec.api.ExtendedResponseDecorator;
 import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.api.UnsolicitedResponseFactory;
 import org.apache.directory.shared.ldap.extras.extended.GracefulDisconnectResponseImpl;
 import org.apache.directory.shared.ldap.extras.extended.GracefulDisconnectResponse;
+import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
 
 
 /**
@@ -61,4 +63,19 @@ public class GracefulDisconnectFactory i
     {
         return new GracefulDisconnectResponseDecorator( codec, encodedValue );
     }
+
+
+    public ExtendedResponseDecorator<GracefulDisconnectResponse> decorate( ExtendedResponse
decoratedMessage )
+    {
+        if ( decoratedMessage instanceof GracefulDisconnectResponseDecorator )
+        {
+            return ( GracefulDisconnectResponseDecorator ) decoratedMessage;
+        }
+        else if ( decoratedMessage instanceof GracefulDisconnectResponse )
+        {
+            return new GracefulDisconnectResponseDecorator( codec, ( GracefulDisconnectResponse
) decoratedMessage );
+        }
+        
+        return new GracefulDisconnectResponseDecorator( codec, new GracefulDisconnectResponseImpl()
);
+    }
 }

Modified: directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/GracefulShutdownFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/GracefulShutdownFactory.java?rev=1074006&r1=1074005&r2=1074006&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/GracefulShutdownFactory.java
(original)
+++ directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/GracefulShutdownFactory.java
Thu Feb 24 01:13:07 2011
@@ -23,12 +23,14 @@ package org.apache.directory.shared.ldap
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.ldap.codec.api.ExtendedRequestDecorator;
 import org.apache.directory.shared.ldap.codec.api.ExtendedRequestFactory;
+import org.apache.directory.shared.ldap.codec.api.ExtendedResponseDecorator;
 import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.extras.extended.GracefulShutdownRequestImpl;
 import org.apache.directory.shared.ldap.extras.extended.GracefulShutdownResponseImpl;
 import org.apache.directory.shared.ldap.extras.extended.GracefulShutdownRequest;
 import org.apache.directory.shared.ldap.extras.extended.GracefulShutdownResponse;
 import org.apache.directory.shared.ldap.model.message.ExtendedRequest;
+import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
 
 
 /**
@@ -107,4 +109,22 @@ public class GracefulShutdownFactory 
         
         return ( GracefulShutdownRequestDecorator ) newRequest();
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ExtendedResponseDecorator<GracefulShutdownResponse> decorate( ExtendedResponse
decoratedMessage )
+    {
+        if ( decoratedMessage instanceof GracefulShutdownResponseDecorator )
+        {
+            return ( GracefulShutdownResponseDecorator ) decoratedMessage;
+        }
+        else if ( decoratedMessage instanceof GracefulShutdownResponse )
+        {
+            return new GracefulShutdownResponseDecorator( codec, ( GracefulShutdownResponse
) decoratedMessage );
+        }
+        
+        return new GracefulShutdownResponseDecorator( codec, new GracefulShutdownResponseImpl()
);
+    }
 }

Modified: directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedureFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedureFactory.java?rev=1074006&r1=1074005&r2=1074006&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedureFactory.java
(original)
+++ directory/shared/branches/akarasulu/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ads_impl/StoredProcedureFactory.java
Thu Feb 24 01:13:07 2011
@@ -23,12 +23,14 @@ package org.apache.directory.shared.ldap
 import org.apache.directory.shared.asn1.DecoderException; 
 import org.apache.directory.shared.ldap.codec.api.ExtendedRequestDecorator;
 import org.apache.directory.shared.ldap.codec.api.ExtendedRequestFactory;
+import org.apache.directory.shared.ldap.codec.api.ExtendedResponseDecorator;
 import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.extras.extended.StoredProcedureRequest;
 import org.apache.directory.shared.ldap.extras.extended.StoredProcedureResponse;
 import org.apache.directory.shared.ldap.extras.extended.StoredProcedureRequestImpl;
 import org.apache.directory.shared.ldap.extras.extended.StoredProcedureResponseImpl;
 import org.apache.directory.shared.ldap.model.message.ExtendedRequest;
+import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
 
 
 /**
@@ -108,6 +110,22 @@ public class StoredProcedureFactory impl
             return new StoredProcedureRequestDecorator( codec, ( StoredProcedureRequest )
modelRequest );
         }
         
+        // @TODO this is really bad because we loose the parameters 
         return ( StoredProcedureRequestDecorator ) newRequest();
     }
+
+
+    public ExtendedResponseDecorator<StoredProcedureResponse> decorate( ExtendedResponse
decoratedMessage )
+    {
+        if ( decoratedMessage instanceof StoredProcedureResponseDecorator )
+        {
+            return ( StoredProcedureResponseDecorator ) decoratedMessage;
+        }
+        else if ( decoratedMessage instanceof StoredProcedureResponse )
+        {
+            return new StoredProcedureResponseDecorator( codec, ( StoredProcedureResponse
) decoratedMessage );
+        }
+        
+        return new StoredProcedureResponseDecorator( codec, new StoredProcedureResponseImpl()
);
+    }
 }



Mime
View raw message