directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r441562 - /directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/MessageDecorator.java
Date Fri, 08 Sep 2006 16:46:23 GMT
Author: elecharny
Date: Fri Sep  8 09:46:22 2006
New Revision: 441562

URL: http://svn.apache.org/viewvc?view=rev&rev=441562
Log:
Implements Encoder and Decoder.
Added a method to initialize the controls list

Modified:
    directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/MessageDecorator.java

Modified: directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/MessageDecorator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/MessageDecorator.java?view=diff&rev=441562&r1=441561&r2=441562
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/MessageDecorator.java
(original)
+++ directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/MessageDecorator.java
Fri Sep  8 09:46:22 2006
@@ -19,19 +19,29 @@
  */
 package org.apache.directory.shared.ldap.messages;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 import javax.naming.ldap.Control;
 
+import org.apache.directory.shared.ldap.codec.Decoder;
+import org.apache.directory.shared.ldap.codec.Encoder;
+import org.apache.directory.shared.ldap.codec.asn1ber.messages.ControlAsn1Ber;
+
 /**
  * Root Decorator for all LDAP message type decorators.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class MessageDecorator implements Message {
+public abstract class MessageDecorator implements Message, Encoder, Decoder 
+{
     /** A reference to the decorated object */
     protected Message message;
     
+    /** The controls decorator Map */
+    protected transient List<ControlDecorator> controlDecorators;
+
     /**
      * Creates a new instance of MessageDecorator, and set the decorated
      * message into the inner member
@@ -44,10 +54,29 @@
     }
     
     /**
+     * Create the array list which will contains the controls
+     * decorators
+     */
+    public void setControlDecorator()
+    {
+        Map<String, Control> controls = message.getControls();  
+        
+        if ( ( controls != null ) && ( controls.isEmpty() == false ) ) 
+        {
+            controlDecorators = new ArrayList<ControlDecorator>();
+            
+            for ( Control control:controls.values() )
+            {
+                controlDecorators.add( new ControlAsn1Ber( control ) );
+            }
+        }
+    }
+    
+    /**
      * Gets the controls associated with this message mapped by OID.
      * 
-     * @return Map of OID strings to Control object instances.
-     * @see Control
+     * @return Map of OID strings to ConcreteControl object instances.
+     * @see ConcreteControl
      */
     public Map<String, Control> getControls()
     {



Mime
View raw message