directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1064981 [2/8] - in /directory: apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/ apacheds/trunk/protocol-ldap/src/main/java/org/apach...
Date Sat, 29 Jan 2011 08:23:06 GMT
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
Sat Jan 29 08:23:02 2011
@@ -21,32 +21,12 @@ package org.apache.directory.shared.ldap
 
 
 import org.apache.directory.shared.asn1.ber.AbstractContainer;
+import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.ldap.codec.controls.ControlDecorator;
-import org.apache.directory.shared.ldap.codec.decorators.AddRequestDecorator;
-import org.apache.directory.shared.ldap.codec.decorators.AddResponseDecorator;
-import org.apache.directory.shared.ldap.codec.decorators.BindRequestDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
-import org.apache.directory.shared.ldap.codec.decorators.ModifyRequestDecorator;
-import org.apache.directory.shared.ldap.codec.decorators.SearchRequestDecorator;
-import org.apache.directory.shared.ldap.codec.decorators.SearchResultEntryDecorator;
 import org.apache.directory.shared.ldap.message.spi.BinaryAttributeDetector;
-import org.apache.directory.shared.ldap.model.message.AbandonRequest;
-import org.apache.directory.shared.ldap.model.message.BindResponse;
-import org.apache.directory.shared.ldap.model.message.CompareRequest;
-import org.apache.directory.shared.ldap.model.message.CompareResponse;
-import org.apache.directory.shared.ldap.model.message.DeleteRequest;
-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.ExtendedResponse;
-import org.apache.directory.shared.ldap.model.message.IntermediateResponse;
-import org.apache.directory.shared.ldap.model.message.ModifyDnRequest;
-import org.apache.directory.shared.ldap.model.message.ModifyDnResponse;
-import org.apache.directory.shared.ldap.model.message.ModifyRequest;
-import org.apache.directory.shared.ldap.model.message.ModifyResponse;
-import org.apache.directory.shared.ldap.model.message.SearchRequest;
-import org.apache.directory.shared.ldap.model.message.SearchResultDone;
-import org.apache.directory.shared.ldap.model.message.SearchResultReference;
-import org.apache.directory.shared.ldap.model.message.UnbindRequest;
+import org.apache.directory.shared.ldap.model.message.Control;
+import org.apache.directory.shared.ldap.model.message.Message;
 
 
 /**
@@ -56,10 +36,10 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class LdapMessageContainer extends AbstractContainer
+public class LdapMessageContainer<E extends MessageDecorator<? extends Message>>
extends AbstractContainer
 {
     /** The Message decorator to store various temporary values */
-    private MessageDecorator messageDecorator;
+    private E messageDecorator;
 
     /** checks if attribute is binary */
     private final BinaryAttributeDetector binaryAttributeDetector;
@@ -68,16 +48,19 @@ public class LdapMessageContainer extend
     private int messageId;
 
     /** The current control */
-    private ControlDecorator currentControl;
+    private ControlDecorator<? extends Control> currentControl;
+    
+    /** The codec service */
+    private final ILdapCodecService codec;
 
 
     /**
      * Creates a new LdapMessageContainer object. We will store ten grammars,
      * it's enough ...
      */
-    public LdapMessageContainer()
+    public LdapMessageContainer( ILdapCodecService codec )
     {
-        this( new BinaryAttributeDetector()
+        this( codec, new BinaryAttributeDetector()
         {
             public boolean isBinary( String attributeId )
             {
@@ -93,9 +76,10 @@ public class LdapMessageContainer extend
      *
      * @param binaryAttributeDetector checks if an attribute is binary
      */
-    public LdapMessageContainer( BinaryAttributeDetector binaryAttributeDetector )
+    public LdapMessageContainer( ILdapCodecService codec, BinaryAttributeDetector binaryAttributeDetector
)
     {
         super();
+        this.codec = codec;
         this.stateStack = new int[10];
         this.grammar = LdapMessageGrammar.getInstance();
         this.binaryAttributeDetector = binaryAttributeDetector;
@@ -104,218 +88,22 @@ public class LdapMessageContainer extend
 
 
     /**
-     * @return Returns the ldapMessage.
-     */
-    public MessageDecorator getMessage()
-    {
-        return messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the AbandonRequest stored in the container
-     */
-    public AbandonRequest getAbandonRequest()
-    {
-        return ( AbandonRequest ) messageDecorator.getDecoratedMessage();
-    }
-
-
-    /**
-     * @return Returns the AddRequest stored in the container
-     */
-    public AddRequestDecorator getAddRequest()
-    {
-        return ( AddRequestDecorator ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the AddResponse stored in the container
-     */
-    public AddResponseDecorator getAddResponse()
-    {
-        return ( AddResponseDecorator ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the BindRequest stored in the container
-     */
-    public BindRequestDecorator getBindRequest()
-    {
-        return ( BindRequestDecorator ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the BindResponse stored in the container
-     */
-    public BindResponse getBindResponse()
-    {
-        return ( BindResponse ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the CompareRequest stored in the container
-     */
-    public CompareRequest getCompareRequest()
-    {
-        return ( CompareRequest ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the CompareResponse stored in the container
-     */
-    public CompareResponse getCompareResponse()
-    {
-        return ( CompareResponse ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the DelRequest stored in the container
-     */
-    public DeleteRequest getDeleteRequest()
-    {
-        return ( DeleteRequest ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the DelResponse stored in the container
-     */
-    public DeleteResponse getDeleteResponse()
-    {
-        return ( DeleteResponse ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the ExtendedRequest stored in the container
-     */
-    public ExtendedRequest getExtendedRequest()
-    {
-        return (ExtendedRequest) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the ExtendedResponse stored in the container
-     */
-    public ExtendedResponse getExtendedResponse()
-    {
-        return ( ExtendedResponse ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the IntermediateResponse stored in the container
-     */
-    public IntermediateResponse getIntermediateResponse()
-    {
-        return ( IntermediateResponse ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the ModifyRequestDecorator stored in the container
-     */
-    public ModifyRequestDecorator getModifyRequestDecorator()
-    {
-        return ( ModifyRequestDecorator ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the ModifyRequest stored in the container
-     */
-    public ModifyRequest getModifyRequest()
-    {
-        return ( ModifyRequest ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the ModifyResponse stored in the container
-     */
-    public ModifyResponse getModifyResponse()
-    {
-        return ( ModifyResponse ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the ModifyDnRequest stored in the container
-     */
-    public ModifyDnRequest getModifyDnRequest()
-    {
-        return ( ModifyDnRequest ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the ModifyDnResponse stored in the container
-     */
-    public ModifyDnResponse getModifyDnResponse()
-    {
-        return ( ModifyDnResponse ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the SearchRequest stored in the container
-     */
-    public SearchRequest getSearchRequest()
-    {
-        return ( SearchRequest ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the SearchRequest stored in the container
-     */
-    public SearchRequestDecorator getSearchRequestDecorator()
-    {
-        return ( SearchRequestDecorator ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the SearchResultEntry stored in the container
-     */
-    public SearchResultEntryDecorator getSearchResultEntry()
-    {
-        return ( SearchResultEntryDecorator ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the SearchResultReference stored in the container
-     */
-    public SearchResultReference getSearchResultReference()
-    {
-        return ( SearchResultReference ) messageDecorator;
-    }
-
-
-    /**
-     * @return Returns the SearchResultDone stored in the container
+     * Gets the {@link ILdapCodecService} associated with this {@link Asn1Container}.
+     *
+     * @return
      */
-    public SearchResultDone getSearchResultDone()
+    public ILdapCodecService getLdapCodecService()
     {
-        return ( SearchResultDone ) messageDecorator;
+        return codec;
     }
-
-
+    
+    
     /**
-     * @return Returns the UnbindRequest stored in the container
+     * @return Returns the ldapMessage.
      */
-    public UnbindRequest getUnbindRequest()
+    public E getMessage()
     {
-        return ( UnbindRequest ) messageDecorator.getDecoratedMessage();
+        return messageDecorator;
     }
 
 
@@ -325,9 +113,9 @@ public class LdapMessageContainer extend
      * 
      * @param message The message to set.
      */
-    public void setMessage( MessageDecorator message )
+    public void setMessage( E messageDecorator )
     {
-        messageDecorator = message;
+        this.messageDecorator = messageDecorator;
     }
 
 
@@ -377,7 +165,7 @@ public class LdapMessageContainer extend
     /**
      * @return the current control being created
      */
-    public ControlDecorator getCurrentControl()
+    public ControlDecorator<? extends Control> getCurrentControl()
     {
         return currentControl;
     }
@@ -387,7 +175,7 @@ public class LdapMessageContainer extend
      * Store a newly created control
      * @param currentControl The control to store
      */
-    public void setCurrentControl( ControlDecorator currentControl )
+    public void setCurrentControl( ControlDecorator<? extends Control> currentControl
)
     {
         this.currentControl = currentControl;
     }



Mime
View raw message