You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2006/09/09 03:00:00 UTC

svn commit: r441715 - /directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ControlDecorator.java

Author: elecharny
Date: Fri Sep  8 17:59:59 2006
New Revision: 441715

URL: http://svn.apache.org/viewvc?view=rev&rev=441715
Log:
Added all the accessor to the decorated control

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

Modified: directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ControlDecorator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ControlDecorator.java?view=diff&rev=441715&r1=441714&r2=441715
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ControlDecorator.java (original)
+++ directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/ControlDecorator.java Fri Sep  8 17:59:59 2006
@@ -23,6 +23,7 @@
 
 import org.apache.directory.shared.ldap.codec.Decoder;
 import org.apache.directory.shared.ldap.codec.Encoder;
+import org.apache.directory.shared.ldap.utils.StringTools;
 
 /**
  * The control decorator is used to implement codec operations, or DSLM operations, 
@@ -44,5 +45,105 @@
     public ControlDecorator( Control control )
     {
         this.control = control;
+    }
+    
+    /**
+     * Get the control type
+     * 
+     * @return A string which represent the control type
+     */
+    public String getID()
+    {
+        return ( ((ConcreteControl)control).getID() == null ? 
+            "" : ((ConcreteControl)control).getID().toString() );
+    }
+
+
+    /**
+     * Set the control type
+     * 
+     * @param controlType An OID to store
+     */
+    public void setControlType( String controlType )
+    {
+        ((ConcreteControl)control).setControlType( controlType );
+    }
+
+
+    /**
+     * Get the control value
+     * 
+     * @return The control value
+     */
+    public byte[] getControlValue()
+    {
+        if ( ((ConcreteControl)control).getControlValue() == null )
+        {
+            return null;
+        }
+        else
+        {
+            return (byte[])((ConcreteControl)control).getControlValue();
+        }
+    }
+
+
+    /**
+     * Set the encoded control value
+     * 
+     * @param encodedValue The encoded control value to store
+     */
+    public void setEncodedValue( byte[] encodedValue )
+    {
+        ((ConcreteControl)control).setControlValue( encodedValue );
+    }
+
+
+    /**
+     * Get the raw control encoded bytes
+     * 
+     * @return the encoded bytes for the control
+     */
+    public byte[] getEncodedValue()
+    {
+        if ( ((ConcreteControl)control).getEncodedValue() == null )
+        {
+            return StringTools.EMPTY_BYTES;
+        }
+
+        return ((ConcreteControl)control).getEncodedValue();
+    }
+
+
+    /**
+     * Set the control value
+     * 
+     * @param controlValue The control value to store
+     */
+    public void setControlValue( byte[] controlValue )
+    {
+        ((ConcreteControl)control).setControlValue( controlValue );
+    }
+
+
+    /**
+     * Get the criticality
+     * 
+     * @return <code>true</code> if the criticality flag is true.
+     */
+    public boolean isCritical()
+    {
+        return ((ConcreteControl)control).isCritical();
+    }
+
+
+    /**
+     * Set the criticality
+     * 
+     * @param criticality The criticality value
+     */
+    public void setCriticality( boolean criticality )
+    {
+        ((ConcreteControl)control).setCriticality( criticality );
     }
 }