directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r986531 - in /directory: apacheds/branches/apacheds-codec-merge/server-tools/src/main/java/org/apache/directory/server/tools/ clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/ ...
Date Tue, 17 Aug 2010 23:56:49 GMT
Author: elecharny
Date: Tue Aug 17 23:56:48 2010
New Revision: 986531

URL: http://svn.apache.org/viewvc?rev=986531&view=rev
Log:
Removed useless methods and dead code

Modified:
    directory/apacheds/branches/apacheds-codec-merge/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/protocol/LdapProtocolDecoder.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ErrorMessageAction.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/MatchedDNAction.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ReferralAction.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java

Modified: directory/apacheds/branches/apacheds-codec-merge/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java?rev=986531&r1=986530&r2=986531&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
(original)
+++ directory/apacheds/branches/apacheds-codec-merge/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
Tue Aug 17 23:56:48 2010
@@ -172,29 +172,25 @@ public class ImportCommand extends ToolC
 
                 if ( ldapMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
                 {
-                    if ( ( ( LdapMessageContainer ) ldapMessageContainer ).isInternal() )
+                    InternalMessage message = ( ( LdapMessageContainer ) ldapMessageContainer
).getInternalMessage();
+
+                    if ( message instanceof BindResponse )
                     {
-                        InternalMessage message = ( ( LdapMessageContainer ) ldapMessageContainer
)
-                            .getInternalMessage();
+                        BindResponse resp = ( BindResponse ) message;
 
-                        if ( message instanceof BindResponse )
+                        if ( resp.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS
)
                         {
-                            BindResponse resp = ( BindResponse ) message;
-
-                            if ( resp.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS
)
-                            {
-                                System.out.println( "Error : " + resp.getLdapResult().getErrorMessage()
);
-                            }
+                            System.out.println( "Error : " + resp.getLdapResult().getErrorMessage()
);
                         }
-                        else if ( message instanceof ExtendedResponse )
-                        {
-                            ExtendedResponse response = ( ( LdapMessageContainer ) ldapMessageContainer
)
-                                .getExtendedResponse();
+                    }
+                    else if ( message instanceof ExtendedResponse )
+                    {
+                        ExtendedResponse response = ( ( LdapMessageContainer ) ldapMessageContainer
)
+                            .getExtendedResponse();
 
-                            if ( response.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS
)
-                            {
-                                System.out.println( "Error : " + response.getLdapResult().getErrorMessage()
);
-                            }
+                        if ( response.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS
)
+                        {
+                            System.out.println( "Error : " + response.getLdapResult().getErrorMessage()
);
                         }
                     }
 

Modified: directory/clients/ldap/branches/ldap-client-codec-merge/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-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=986531&r1=986530&r2=986531&view=diff
==============================================================================
--- directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Tue Aug 17 23:56:48 2010
@@ -53,7 +53,6 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.asn1.primitives.OID;
-import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.MessageEncoderException;
 import org.apache.directory.shared.ldap.codec.controls.ControlImpl;
@@ -281,37 +280,6 @@ public class LdapNetworkConnection exten
 
 
     /**
-     * Return the response stored into the current session.
-     *
-     * @return The last request response
-     */
-    public LdapMessageCodec getResponse()
-    {
-        return ( LdapMessageCodec ) ldapSession.getAttribute( LDAP_RESPONSE );
-    }
-
-
-    /**
-     * Inject the client Controls into the message
-     */
-    private void setControls( Map<String, Control> controls, LdapMessageCodec message
)
-    {
-        // Add the controls
-        if ( controls != null )
-        {
-            for ( Control control : controls.values() )
-            {
-                ControlImpl ctrl = new ControlImpl( control.getOid() );
-
-                ctrl.setValue( control.getValue() );
-
-                message.addControl( ctrl );
-            }
-        }
-    }
-
-
-    /**
      * Get the smallest timeout from the client timeout and the connection
      * timeout.
      */

Modified: directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/protocol/LdapProtocolDecoder.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/protocol/LdapProtocolDecoder.java?rev=986531&r1=986530&r2=986531&view=diff
==============================================================================
--- directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/protocol/LdapProtocolDecoder.java
(original)
+++ directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/protocol/LdapProtocolDecoder.java
Tue Aug 17 23:56:48 2010
@@ -26,7 +26,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
 import org.apache.directory.shared.asn1.ber.tlv.TLVStateEnum;
 import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -89,48 +88,20 @@ public class LdapProtocolDecoder impleme
 
                 if ( ldapMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
                 {
-                    if ( ( ( LdapMessageContainer ) ldapMessageContainer ).isInternal() )
-                    {
-                        // get back the decoded message
-                        InternalMessage message = ( ( LdapMessageContainer ) ldapMessageContainer
)
-                            .getInternalMessage();
-
-                        if ( IS_DEBUG )
-                        {
-                            LOG.debug( "Decoded LdapMessage : " + message );
-                            buf.mark();
-                        }
-
-                        // Clean the container for the next decoding
-                        ( ( LdapMessageContainer ) ldapMessageContainer ).clean();
+                    // get back the decoded message
+                    InternalMessage message = ( ( LdapMessageContainer ) ldapMessageContainer
).getInternalMessage();
 
-                        // Send back the message
-                        out.write( message );
-                    }
-                    else
+                    if ( IS_DEBUG )
                     {
-                        // get back the decoded message
-                        LdapMessageCodec message = ( ( LdapMessageContainer ) ldapMessageContainer
).getLdapMessage();
+                        LOG.debug( "Decoded LdapMessage : " + message );
+                        buf.mark();
+                    }
 
-                        if ( IS_DEBUG )
-                        {
-                            LOG.debug( "Decoded LdapMessage : "
-                                + ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage()
);
-                            buf.mark();
-                        }
-
-                        // Clean the container for the next decoding
-                        ( ( LdapMessageContainer ) ldapMessageContainer ).clean();
-
-                        if ( IS_DEBUG )
-                        {
-                            //                            LOG.debug( "######################Decoded
message : " + message );
-                            //                            LOG.debug( "####################################################"
);
-                        }
+                    // Clean the container for the next decoding
+                    ( ( LdapMessageContainer ) ldapMessageContainer ).clean();
 
-                        // Send back the message
-                        out.write( message );
-                    }
+                    // Send back the message
+                    out.write( message );
                 }
             }
             catch ( DecoderException de )

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java?rev=986531&r1=986530&r2=986531&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java
(original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java
Tue Aug 17 23:56:48 2010
@@ -140,18 +140,12 @@ public class LdapDecoder implements Prov
                 {
                     if ( IS_DEBUG )
                     {
-                        log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getLdapMessage()
);
+                        log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getInternalMessage()
);
                         buf.mark();
                     }
 
-                    if ( ldapMessageContainer.isInternal() )
-                    {
-                        decoderCallback.decodeOccurred( null, ldapMessageContainer.getInternalMessage()
);
-                    }
-                    else
-                    {
-                        decoderCallback.decodeOccurred( null, ldapMessageContainer.getLdapMessage()
);
-                    }
+                    decoderCallback.decodeOccurred( null, ldapMessageContainer.getInternalMessage()
);
+
                     ldapMessageContainer.clean();
                 }
             }
@@ -220,17 +214,10 @@ public class LdapDecoder implements Prov
             {
                 if ( IS_DEBUG )
                 {
-                    log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getLdapMessage()
);
+                    log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getInternalMessage()
);
                 }
 
-                if ( ldapMessageContainer.isInternal() )
-                {
-                    return ldapMessageContainer.getBindResponse();
-                }
-                else
-                {
-                    return ldapMessageContainer.getLdapMessage();
-                }
+                return ldapMessageContainer.getInternalMessage();
             }
             else
             {
@@ -267,10 +254,10 @@ public class LdapDecoder implements Prov
             {
                 if ( IS_DEBUG )
                 {
-                    log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getLdapMessage()
);
+                    log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getInternalMessage()
);
                 }
 
-                return ldapMessageContainer.getLdapMessage();
+                return ldapMessageContainer.getInternalMessage();
             }
             else
             {

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java?rev=986531&r1=986530&r2=986531&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
(original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
Tue Aug 17 23:56:48 2010
@@ -59,9 +59,6 @@ public class LdapMessageContainer extend
     // ~ Instance fields
     // ----------------------------------------------------------------------------
 
-    /** The ldap message */
-    private LdapMessageCodec ldapMessage;
-
     /** The internal ldap message */
     private InternalMessage internalMessage;
 
@@ -115,15 +112,6 @@ public class LdapMessageContainer extend
     /**
      * @return Returns the ldapMessage.
      */
-    public LdapMessageCodec getLdapMessage()
-    {
-        return ldapMessage;
-    }
-
-
-    /**
-     * @return Returns the ldapMessage.
-     */
     public InternalMessage getInternalMessage()
     {
         return internalMessage;
@@ -131,15 +119,6 @@ public class LdapMessageContainer extend
 
 
     /**
-     * @return Returns the LdapResponse.
-     */
-    public LdapResponseCodec getLdapResponse()
-    {
-        return ( LdapResponseCodec ) ldapMessage;
-    }
-
-
-    /**
      * @return Returns the AbandonRequest stored in the container
      */
     public InternalAbandonRequest getAbandonRequest()
@@ -329,18 +308,6 @@ public class LdapMessageContainer extend
 
 
     /**
-     * Set a ldapMessage Object into the container. It will be completed by the
-     * ldapDecoder .
-     * 
-     * @param ldapMessage The message to set.
-     */
-    public void setLdapMessage( LdapMessageCodec ldapMessage )
-    {
-        this.ldapMessage = ldapMessage;
-    }
-
-
-    /**
      * Set a InternalMessage Object into the container. It will be completed by the
      * ldapDecoder.
      * 
@@ -356,7 +323,6 @@ public class LdapMessageContainer extend
     {
         super.clean();
 
-        ldapMessage = null;
         internalMessage = null;
         messageId = 0;
         currentControl = null;
@@ -364,12 +330,6 @@ public class LdapMessageContainer extend
     }
 
 
-    public boolean isInternal()
-    {
-        return internalMessage != null;
-    }
-
-
     /**
      * @return Returns true if the attribute is binary.
      * @param id checks if an attribute id is binary

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java?rev=986531&r1=986530&r2=986531&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
(original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
Tue Aug 17 23:56:48 2010
@@ -1032,22 +1032,12 @@ public class LdapMessageGrammar extends 
                         throw new DecoderException( msg );
                     }
 
-                    if ( ldapMessageContainer.isInternal() )
-                    {
-                        InternalMessage response = ldapMessageContainer.getInternalMessage();
-                        LdapResult ldapResult = ( ( ResultResponse ) response ).getLdapResult();
-
-                        InternalReferral referral = new ReferralImpl();
+                    InternalMessage response = ldapMessageContainer.getInternalMessage();
+                    LdapResult ldapResult = ( ( ResultResponse ) response ).getLdapResult();
 
-                        ldapResult.setReferral( referral );
-                    }
-                    else
-                    {
-                        LdapResponseCodec response = ldapMessageContainer.getLdapResponse();
-                        LdapResultCodec ldapResult = response.getLdapResult();
+                    InternalReferral referral = new ReferralImpl();
 
-                        ldapResult.initReferrals();
-                    }
+                    ldapResult.setReferral( referral );
                 }
             } );
 
@@ -3458,37 +3448,18 @@ public class LdapMessageGrammar extends 
                         throw new DecoderException( I18n.err( I18n.ERR_04099, oidValue )
);
                     }
 
-                    if ( !ldapMessageContainer.isInternal() )
-                    {
-                        LdapMessageCodec message = ldapMessageContainer.getLdapMessage();
-
-                        // get the Control for this OID
-                        Control control = message.getCodecControl( oidValue );
+                    InternalMessage message = ldapMessageContainer.getInternalMessage();
 
-                        if ( control == null )
-                        {
-                            // This control is unknown, we will create a neutral control
-                            control = new ControlImpl( oidValue );
-                        }
+                    Control control = ControlEnum.getControl( oidValue );
 
-                        // The control may be null, if not known
-                        message.addControl( control );
-                    }
-                    else
+                    if ( control == null )
                     {
-                        InternalMessage message = ldapMessageContainer.getInternalMessage();
-
-                        Control control = ControlEnum.getControl( oidValue );
-
-                        if ( control == null )
-                        {
-                            // This control is unknown, we will create a neutral control
-                            control = new ControlImpl( oidValue );
-                        }
-
-                        message.addControl( control );
+                        // This control is unknown, we will create a neutral control
+                        control = new ControlImpl( oidValue );
                     }
 
+                    message.addControl( control );
+
                     // We can have an END transition
                     ldapMessageContainer.grammarEndAllowed( true );
 
@@ -3521,17 +3492,8 @@ public class LdapMessageGrammar extends 
                     // Get the current control
                     Control control = null;
 
-                    if ( !ldapMessageContainer.isInternal() )
-                    {
-                        LdapMessageCodec message = ldapMessageContainer.getLdapMessage();
-
-                        control = message.getCurrentControl();
-                    }
-                    else
-                    {
-                        InternalMessage message = ldapMessageContainer.getInternalMessage();
-                        control = message.getCurrentControl();
-                    }
+                    InternalMessage message = ldapMessageContainer.getInternalMessage();
+                    control = message.getCurrentControl();
 
                     // Store the criticality
                     // We get the value. If it's a 0, it's a FALSE. If it's

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java?rev=986531&r1=986530&r2=986531&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java
(original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java
Tue Aug 17 23:56:48 2010
@@ -25,7 +25,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.controls.CodecControl;
 import org.apache.directory.shared.ldap.codec.controls.ControlDecoder;
@@ -58,16 +57,8 @@ public class ControlValueAction extends 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
         Control control = null;
 
-        if ( !ldapMessageContainer.isInternal() )
-        {
-            LdapMessageCodec message = ldapMessageContainer.getLdapMessage();
-            control = message.getCurrentControl();
-        }
-        else
-        {
-            InternalMessage message = ldapMessageContainer.getInternalMessage();
-            control = message.getCurrentControl();
-        }
+        InternalMessage message = ldapMessageContainer.getInternalMessage();
+        control = message.getCurrentControl();
 
         // Get the current control
         Value value = tlv.getValue();

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java?rev=986531&r1=986530&r2=986531&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java
(original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java
Tue Aug 17 23:56:48 2010
@@ -24,7 +24,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -74,13 +73,5 @@ public class ControlsInitAction extends 
         {
             log.debug( "A new list of controls has been initialized" );
         }
-
-        if ( !ldapMessageContainer.isInternal() )
-        {
-            LdapMessageCodec message = ldapMessageContainer.getLdapMessage();
-
-            // We can initialize the controls array
-            message.initControls();
-        }
     }
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ErrorMessageAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ErrorMessageAction.java?rev=986531&r1=986530&r2=986531&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ErrorMessageAction.java
(original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ErrorMessageAction.java
Tue Aug 17 23:56:48 2010
@@ -25,8 +25,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.LdapResponseCodec;
-import org.apache.directory.shared.ldap.codec.LdapResultCodec;
 import org.apache.directory.shared.ldap.message.internal.LdapResult;
 import org.apache.directory.shared.ldap.message.internal.ResultResponse;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -76,18 +74,9 @@ public class ErrorMessageAction extends 
             errorMessage = StringTools.utf8ToString( tlv.getValue().getData() );
         }
 
-        if ( ldapMessageContainer.isInternal() )
-        {
-            ResultResponse response = ( ResultResponse ) ldapMessageContainer.getInternalMessage();
-            LdapResult ldapResult = response.getLdapResult();
-            ldapResult.setErrorMessage( errorMessage );
-        }
-        else
-        {
-            LdapResponseCodec response = ldapMessageContainer.getLdapResponse();
-            LdapResultCodec ldapResult = response.getLdapResult();
-            ldapResult.setErrorMessage( errorMessage );
-        }
+        ResultResponse response = ( ResultResponse ) ldapMessageContainer.getInternalMessage();
+        LdapResult ldapResult = response.getLdapResult();
+        ldapResult.setErrorMessage( errorMessage );
 
         // We can have an END transition
         ldapMessageContainer.grammarEndAllowed( true );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java?rev=986531&r1=986530&r2=986531&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java
(original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java
Tue Aug 17 23:56:48 2010
@@ -26,11 +26,9 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.LdapResponseCodec;
-import org.apache.directory.shared.ldap.codec.LdapResultCodec;
 import org.apache.directory.shared.ldap.message.ReferralImpl;
-import org.apache.directory.shared.ldap.message.internal.LdapResult;
 import org.apache.directory.shared.ldap.message.internal.InternalReferral;
+import org.apache.directory.shared.ldap.message.internal.LdapResult;
 import org.apache.directory.shared.ldap.message.internal.ResultResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -75,21 +73,11 @@ public class InitReferralsAction extends
             throw new DecoderException( msg );
         }
 
-        if ( ldapMessageContainer.isInternal() )
-        {
-            ResultResponse response = ( ResultResponse ) ldapMessageContainer.getInternalMessage();
-            LdapResult ldapResult = response.getLdapResult();
+        ResultResponse response = ( ResultResponse ) ldapMessageContainer.getInternalMessage();
+        LdapResult ldapResult = response.getLdapResult();
 
-            InternalReferral referral = new ReferralImpl();
-            ldapResult.setReferral( referral );
-        }
-        else
-        {
-            LdapResponseCodec response = ldapMessageContainer.getLdapResponse();
-            LdapResultCodec ldapResult = response.getLdapResult();
-
-            ldapResult.initReferrals();
-        }
+        InternalReferral referral = new ReferralImpl();
+        ldapResult.setReferral( referral );
 
         if ( IS_DEBUG )
         {

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/MatchedDNAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/MatchedDNAction.java?rev=986531&r1=986530&r2=986531&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/MatchedDNAction.java
(original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/MatchedDNAction.java
Tue Aug 17 23:56:48 2010
@@ -26,8 +26,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.LdapResponseCodec;
-import org.apache.directory.shared.ldap.codec.LdapResultCodec;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.internal.LdapResult;
@@ -70,18 +68,9 @@ public class MatchedDNAction extends Gra
         DN matchedDN = null;
         ResultCodeEnum resultCode = null;
 
-        if ( ldapMessageContainer.isInternal() )
-        {
-            ResultResponse response = ( ResultResponse ) ldapMessageContainer.getInternalMessage();
-            LdapResult ldapResult = response.getLdapResult();
-            resultCode = ldapResult.getResultCode();
-        }
-        else
-        {
-            LdapResponseCodec response = ldapMessageContainer.getLdapResponse();
-            LdapResultCodec ldapResult = response.getLdapResult();
-            resultCode = ldapResult.getResultCode();
-        }
+        ResultResponse response = ( ResultResponse ) ldapMessageContainer.getInternalMessage();
+        LdapResult ldapResult = response.getLdapResult();
+        resultCode = ldapResult.getResultCode();
 
         // We have to handle the special case of a 0 length matched
         // DN
@@ -134,17 +123,6 @@ public class MatchedDNAction extends Gra
             log.debug( "The matchedDN is " + matchedDN );
         }
 
-        if ( ldapMessageContainer.isInternal() )
-        {
-            ResultResponse response = ( ResultResponse ) ldapMessageContainer.getInternalMessage();
-            LdapResult ldapResult = response.getLdapResult();
-            ldapResult.setMatchedDn( matchedDN );
-        }
-        else
-        {
-            LdapResponseCodec response = ldapMessageContainer.getLdapResponse();
-            LdapResultCodec ldapResult = response.getLdapResult();
-            ldapResult.setMatchedDN( matchedDN );
-        }
+        ldapResult.setMatchedDn( matchedDN );
     }
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ReferralAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ReferralAction.java?rev=986531&r1=986530&r2=986531&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ReferralAction.java
(original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ReferralAction.java
Tue Aug 17 23:56:48 2010
@@ -26,13 +26,11 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.LdapResponseCodec;
-import org.apache.directory.shared.ldap.codec.LdapResultCodec;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.message.internal.LdapResult;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.message.internal.InternalReferral;
+import org.apache.directory.shared.ldap.message.internal.LdapResult;
 import org.apache.directory.shared.ldap.message.internal.ResultResponse;
 import org.apache.directory.shared.ldap.util.LdapURL;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -69,114 +67,56 @@ public class ReferralAction extends Gram
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
-        if ( ldapMessageContainer.isInternal() )
-        {
-            InternalMessage response = ldapMessageContainer.getInternalMessage();
-            LdapResult ldapResult = ( ( ResultResponse ) response ).getLdapResult();
-            InternalReferral referral = ldapResult.getReferral();
+        InternalMessage response = ldapMessageContainer.getInternalMessage();
+        LdapResult ldapResult = ( ( ResultResponse ) response ).getLdapResult();
+        InternalReferral referral = ldapResult.getReferral();
 
-            if ( tlv.getLength() == 0 )
-            {
-                referral.addLdapUrl( "" );
-            }
-            else
+        if ( tlv.getLength() == 0 )
+        {
+            referral.addLdapUrl( "" );
+        }
+        else
+        {
+            if ( ldapResult.getResultCode() == ResultCodeEnum.REFERRAL )
             {
-                if ( ldapResult.getResultCode() == ResultCodeEnum.REFERRAL )
+                try
                 {
-                    try
-                    {
-                        referral.addLdapUrl( new LdapURL( tlv.getValue().getData() ).toString()
);
-                    }
-                    catch ( LdapURLEncodingException luee )
-                    {
-                        String badUrl = StringTools.utf8ToString( tlv.getValue().getData()
);
-                        log.error( I18n.err( I18n.ERR_04015, badUrl, luee.getMessage() )
);
-                        throw new DecoderException( I18n.err( I18n.ERR_04016, luee.getMessage()
) );
-                    }
+                    referral.addLdapUrl( new LdapURL( tlv.getValue().getData() ).toString()
);
                 }
-                else
+                catch ( LdapURLEncodingException luee )
                 {
-                    log
-                        .warn( "The Referral error message is not allowed when havind an
error code no equals to REFERRAL" );
-                    referral.addLdapUrl( LdapURL.EMPTY_URL.toString() );
+                    String badUrl = StringTools.utf8ToString( tlv.getValue().getData() );
+                    log.error( I18n.err( I18n.ERR_04015, badUrl, luee.getMessage() ) );
+                    throw new DecoderException( I18n.err( I18n.ERR_04016, luee.getMessage()
) );
                 }
             }
-
-            if ( IS_DEBUG )
+            else
             {
-                StringBuffer sb = new StringBuffer();
-                boolean isFirst = true;
-
-                for ( String url : ldapResult.getReferral().getLdapUrls() )
-                {
-                    if ( isFirst )
-                    {
-                        isFirst = false;
-                    }
-                    else
-                    {
-                        sb.append( ", " );
-                    }
-
-                    sb.append( url );
-                }
-
-                log.debug( "The referral error message is set to " + sb.toString() );
+                log.warn( "The Referral error message is not allowed when havind an error
code no equals to REFERRAL" );
+                referral.addLdapUrl( LdapURL.EMPTY_URL.toString() );
             }
         }
-        else
+
+        if ( IS_DEBUG )
         {
-            LdapResponseCodec response = ldapMessageContainer.getLdapResponse();
-            LdapResultCodec ldapResult = response.getLdapResult();
+            StringBuffer sb = new StringBuffer();
+            boolean isFirst = true;
 
-            if ( tlv.getLength() == 0 )
-            {
-                ldapResult.addReferral( LdapURL.EMPTY_URL );
-            }
-            else
+            for ( String url : ldapResult.getReferral().getLdapUrls() )
             {
-                if ( ldapResult.getResultCode() == ResultCodeEnum.REFERRAL )
+                if ( isFirst )
                 {
-                    try
-                    {
-                        ldapResult.addReferral( new LdapURL( tlv.getValue().getData() ) );
-                    }
-                    catch ( LdapURLEncodingException luee )
-                    {
-                        String badUrl = StringTools.utf8ToString( tlv.getValue().getData()
);
-                        log.error( I18n.err( I18n.ERR_04015, badUrl, luee.getMessage() )
);
-                        throw new DecoderException( I18n.err( I18n.ERR_04016, luee.getMessage()
) );
-                    }
+                    isFirst = false;
                 }
                 else
                 {
-                    log
-                        .warn( "The Referral error message is not allowed when havind an
error code no equals to REFERRAL" );
-                    ldapResult.addReferral( LdapURL.EMPTY_URL );
+                    sb.append( ", " );
                 }
 
-                if ( IS_DEBUG )
-                {
-                    StringBuffer sb = new StringBuffer();
-                    boolean isFirst = true;
-
-                    for ( LdapURL url : ldapResult.getReferrals() )
-                    {
-                        if ( isFirst )
-                        {
-                            isFirst = false;
-                        }
-                        else
-                        {
-                            sb.append( ", " );
-                        }
-
-                        sb.append( url );
-                    }
-
-                    log.debug( "The referral error message is set to " + sb.toString() );
-                }
+                sb.append( url );
             }
+
+            log.debug( "The referral error message is set to " + sb.toString() );
         }
 
         // We can have an END transition

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java?rev=986531&r1=986530&r2=986531&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java
(original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java
Tue Aug 17 23:56:48 2010
@@ -29,8 +29,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.util.IntegerDecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.LdapResponseCodec;
-import org.apache.directory.shared.ldap.codec.LdapResultCodec;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.internal.LdapResult;
 import org.apache.directory.shared.ldap.message.internal.ResultResponse;
@@ -142,18 +140,8 @@ public class ResultCodeAction extends Gr
             log.debug( "The result code is set to " + resultCode );
         }
 
-        if ( ldapMessageContainer.isInternal() )
-        {
-            ResultResponse response = ( ResultResponse ) ldapMessageContainer.getInternalMessage();
-            LdapResult ldapResult = response.getLdapResult();
-            ldapResult.setResultCode( resultCode );
-        }
-        else
-        {
-            LdapResponseCodec response = ldapMessageContainer.getLdapResponse();
-            LdapResultCodec ldapResult = new LdapResultCodec();
-            ldapResult.setResultCode( resultCode );
-            response.setLdapResult( ldapResult );
-        }
+        ResultResponse response = ( ResultResponse ) ldapMessageContainer.getInternalMessage();
+        LdapResult ldapResult = response.getLdapResult();
+        ldapResult.setResultCode( resultCode );
     }
 }



Mime
View raw message