directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r209020 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/Control.java
Date Mon, 04 Jul 2005 06:39:02 GMT
Author: elecharny
Date: Sun Jul  3 23:39:01 2005
New Revision: 209020

URL: http://svn.apache.org/viewcvs?rev=209020&view=rev
Log:
Renamed the Controls class to Control

Added:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/Control.java
      - copied, changed from r189643, directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/Controls.java

Copied: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/Control.java
(from r189643, directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/Controls.java)
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/Control.java?p2=directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/Control.java&p1=directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/Controls.java&r1=189643&r2=209020&rev=209020&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/Controls.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/Control.java
Sun Jul  3 23:39:01 2005
@@ -17,24 +17,27 @@
 package org.apache.asn1.ldap.pojo;
 
 import org.apache.asn1.Asn1Object;
+import org.apache.asn1.primitives.OID;
+import org.apache.asn1.primitives.OctetString;
+
 
 /**
- * A ldapObject to store Controls.
+ * A ldapObject to store Control.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class Controls extends Asn1Object
+public class Control extends Asn1Object
 {
     //~ Instance fields ----------------------------------------------------------------------------
 
     /** The control type */
-    private String controlType;
+    private OID controlType;
 
     /** The criticality (default value is false) */
     private boolean criticality = false;
 
     /** Optionnal control value */
-    private String controlValue;
+    private OctetString controlValue;
 
     //~ Methods ------------------------------------------------------------------------------------
 
@@ -45,16 +48,15 @@
      */
     public String getControlType()
     {
-
-        return controlType;
+        return (controlType == null ? "" : controlType.toString() );
     }
 
     /**
      * Set the control type
      *
-     * @param controlType A string to store
+     * @param controlType An OID to store
      */
-    public void setControlType( String controlType )
+    public void setControlType( OID controlType )
     {
         this.controlType = controlType;
     }
@@ -66,8 +68,7 @@
      */
     public String getControlValue()
     {
-
-        return controlValue;
+        return (controlValue == null ? "" : controlValue.toString() );
     }
 
     /**
@@ -75,7 +76,7 @@
      *
      * @param controlValue The control value to store
      */
-    public void setControlValue( String controlValue )
+    public void setControlValue( OctetString controlValue )
     {
         this.controlValue = controlValue;
     }
@@ -87,7 +88,6 @@
      */
     public boolean getCriticality()
     {
-
         return criticality;
     }
 
@@ -99,5 +99,25 @@
     public void setCriticality( boolean criticality )
     {
         this.criticality = criticality;
+    }
+    
+    /**
+     * Return a String representing a Control
+     */
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+        
+        sb.append("    Control :\n");
+        sb.append("        ").append(controlType.toString()).append('\n');
+        sb.append("        ").append(criticality).append('\n');
+        
+        if ( controlValue != null ) 
+        {
+            sb.append("        ").append(controlValue.toString()).append('\n');
+        }
+        
+        sb.append( "\n" );
+        return sb.toString();
     }
 }



Mime
View raw message