directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r209232 - /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/BindRequest.java
Date Tue, 05 Jul 2005 06:38:31 GMT
Author: elecharny
Date: Mon Jul  4 23:38:31 2005
New Revision: 209232

URL: http://svn.apache.org/viewcvs?rev=209232&view=rev
Log:
- Added a isLdapV3() method
- Added a toString() method

Modified:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/BindRequest.java

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/BindRequest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/BindRequest.java?rev=209232&r1=209231&r2=209232&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/BindRequest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/BindRequest.java
Mon Jul  4 23:38:31 2005
@@ -31,7 +31,7 @@
     //~ Instance fields ----------------------------------------------------------------------------
 
     /** The protocol Version to use. Should be 3 */
-    private int                version;
+    private int        version;
 
     /** The name of the user requesting a bind */
     private LdapDN     name;
@@ -124,6 +124,16 @@
 
         return version;
     }
+    
+    /**
+     * Check if the Ldap version in use is 3
+     * 
+     * @return true if the ldap version is 3
+     */
+    public boolean isLdapV3()
+    {
+        return version == 3;
+    }
 
     /**
      * Set the protocol version
@@ -134,4 +144,37 @@
     {
         this.version = version;
     }
+    
+    /**
+     * Get a String representation of a BindRequest
+     *
+     * @return A BindRequest String 
+     */
+    public String toString()
+    {
+
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "    BindRequest\n" );
+        sb.append( "        Version : '" ).append( version ).append("'\n");
+        sb.append( "        Name : '" ).append( name.toString() ).append("'\n");
+        
+        if ( authentication instanceof SimpleAuthentication )
+        {
+            sb.append( "        Simple authentication : '" ).append( ((SimpleAuthentication)authentication).getSimple().toString()
).append("'\n");
+        }
+        else
+        {
+            sb.append( "        Sasl credentials\n" );
+            sb.append( "            Mechanism :'" ).append( ((SaslCredentials)authentication).getMechanism().toString()
).append("'\n");
+            
+            if ( ( (SaslCredentials)authentication ).getCredentials() != null )
+            {
+                sb.append( "            Credentials :'" ).append( ((SaslCredentials)authentication).getCredentials().toString()
).append("'\n");
+            }
+        }
+
+        return sb.toString();
+    }
+    
 }



Mime
View raw message