directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r191342 - in /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo: AttributeValueAssertion.java BindRequest.java LdapMessage.java LdapResult.java SearchRequest.java
Date Sun, 19 Jun 2005 14:40:37 GMT
Author: elecharny
Date: Sun Jun 19 07:40:36 2005
New Revision: 191342

URL: http://svn.apache.org/viewcvs?rev=191342&view=rev
Log:
Eliminated references to MutableString

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

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AttributeValueAssertion.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AttributeValueAssertion.java?rev=191342&r1=191341&r2=191342&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AttributeValueAssertion.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/AttributeValueAssertion.java
Sun Jun 19 07:40:36 2005
@@ -16,15 +16,15 @@
  */
 package org.apache.asn1.ldap.pojo;
 
+import org.apache.asn1.ldap.codec.primitives.LdapString;
 import org.apache.asn1.primitives.OctetString;
-import org.apache.asn1.util.MutableString;
 
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class AttributeValueAssertion {
     /** The attribute description */
-    private MutableString attributeDesc;
+    private LdapString attributeDesc;
     
     /** The assertion value */
     private OctetString assertionValue;
@@ -46,14 +46,14 @@
     /**
      * @return Returns the attributeDesc.
      */
-    public MutableString getAttributeDesc() {
-        return attributeDesc;
+    public String getAttributeDesc() {
+        return (attributeDesc == null ? null : attributeDesc.toString());
     }
     
     /**
      * @param attributeDesc The attributeDesc to set.
      */
-    public void setAttributeDesc(MutableString attributeDesc) {
+    public void setAttributeDesc(LdapString attributeDesc) {
         this.attributeDesc = attributeDesc;
     }
 }

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=191342&r1=191341&r2=191342&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
Sun Jun 19 07:40:36 2005
@@ -17,7 +17,7 @@
 package org.apache.asn1.ldap.pojo;
 
 import org.apache.asn1.Asn1Object;
-import org.apache.asn1.util.MutableString;
+import org.apache.asn1.ldap.codec.primitives.LdapDN;
 
 /**
  * A BindRequest ldapObject. It's a sub-class of Asn1Object, and it extends
@@ -34,7 +34,7 @@
     private int                version;
 
     /** The name of the user requesting a bind */
-    private MutableString      name;
+    private LdapDN     name;
 
     /** The authentication used to bind the user */
     private Asn1Object authentication;
@@ -78,10 +78,10 @@
      *
      * @return The sasl user authentication
      */
-    public SaslAuthentication getSaslAuthentication()
+    public SaslCredentials getSaslAuthentication()
     {
 
-        return (SaslAuthentication)authentication;
+        return (SaslCredentials)authentication;
     }
 
     /**
@@ -109,7 +109,7 @@
      *
      * @param name The user name
      */
-    public void setName( MutableString name )
+    public void setName( LdapDN name )
     {
         this.name = name;
     }

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/LdapMessage.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/LdapMessage.java?rev=191342&r1=191341&r2=191342&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/LdapMessage.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/LdapMessage.java
Sun Jun 19 07:40:36 2005
@@ -16,7 +16,11 @@
  */
 package org.apache.asn1.ldap.pojo;
 
+import java.nio.ByteBuffer;
+
 import org.apache.asn1.Asn1Object;
+import org.apache.asn1.ber.tlv.Length;
+import org.apache.asn1.codec.EncoderException;
 
 /**
  * The main ldapObject : every Ldap Message are encapsulated in it. It has a
@@ -144,6 +148,36 @@
     public void setProtocolOP( Asn1Object protocolOp )
     {
         this.protocolOp = protocolOp;
+    }
+
+    /**
+     * Generate the PDU which contains the encoded object.
+     * 
+     * The generation is done in two phases :
+     * - first, we compute the length of each part and the
+     *   global PDU length
+     * - second, we produce the PDU.
+     *   
+     * @param object The encoded PDU
+     * @return A ByteBuffer that contaons the PDU
+     * @throws EncoderException If anything goes wrong.
+     */
+    public Object encode(Object object) throws EncoderException
+    {
+        // Compute the LdapMessage length. It will be the sum of each
+        // element, plus the length of the Length part plus 1 byte for 
+        // the tag.
+        int ldapMessageLength = 0;
+        
+        // The length of the MessageId.
+        ldapMessageLength += Length.getNbBytes(messageId) ;
+        
+        int protocolOpLength = 0;
+        
+        // Allocate the bytes buffer.  
+        ByteBuffer bb = ByteBuffer.allocate(ldapMessageLength + Length.getNbBytes(protocolOpLength)
+ 1 );
+
+        return bb;
     }
 
 }

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/LdapResult.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/LdapResult.java?rev=191342&r1=191341&r2=191342&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/LdapResult.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/LdapResult.java
Sun Jun 19 07:40:36 2005
@@ -17,7 +17,8 @@
 package org.apache.asn1.ldap.pojo;
 
 import org.apache.asn1.Asn1Object;
-import org.apache.asn1.util.MutableString;
+import org.apache.asn1.ldap.codec.primitives.LdapDN;
+import org.apache.asn1.ldap.codec.primitives.LdapString;
 
 
 /**
@@ -81,13 +82,13 @@
     private int resultCode;
 
     /** The DN that is mathed by the Bind */
-    private MutableString matchedDN;
+    private LdapDN matchedDN;
 
     /** The Bind error message, if any */
-    private MutableString errorMessage;
+    private LdapString errorMessage;
 
     /** The referrals, if any. This is an optional element */
-    private MutableString[] referrals;
+    private LdapString[] referrals;
     
     /** The number of referral */
     private int nbReferral;
@@ -103,7 +104,7 @@
         super( );
         
         nbReferral = 0;
-        referrals = new MutableString[10];
+        referrals = new LdapString[10];
     }
 
     //~ Methods ------------------------------------------------------------------------------------
@@ -119,7 +120,7 @@
     /**
      * @param errorMessage The errorMessage to set.
      */
-    public void setErrorMessage( MutableString errorMessage )
+    public void setErrorMessage( LdapString errorMessage )
     {
         this.errorMessage = errorMessage;
     }
@@ -136,7 +137,7 @@
      * Set the Matched DN
      * @param matchedDN The matchedDN to set.
      */
-    public void setMatchedDN( MutableString matchedDN )
+    public void setMatchedDN( LdapDN matchedDN )
     {
         this.matchedDN = matchedDN;
     }
@@ -144,7 +145,7 @@
     /**
      * @return Returns the referral.
      */
-    public MutableString[] getReferrals()
+    public LdapString[] getReferrals()
     {
         return referrals;
     }
@@ -154,7 +155,7 @@
      *
      * @param referral The referral to set.
      */
-    public void setReferral( MutableString[] referrals )
+    public void setReferral( LdapString[] referrals )
     {
         this.referrals = referrals;
     }
@@ -164,7 +165,7 @@
      *
      * @param referral The referral to add.
      */
-    public void addReferral( MutableString referral )
+    public void addReferral( LdapString referral )
     {
         this.referrals[nbReferral++] = referral;
     }

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchRequest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchRequest.java?rev=191342&r1=191341&r2=191342&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchRequest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/SearchRequest.java
Sun Jun 19 07:40:36 2005
@@ -17,8 +17,9 @@
 package org.apache.asn1.ldap.pojo;
 
 import org.apache.asn1.Asn1Object;
+import org.apache.asn1.ldap.codec.primitives.LdapDN;
+import org.apache.asn1.ldap.codec.primitives.LdapString;
 import org.apache.asn1.ldap.pojo.filters.Filter;
-import org.apache.asn1.util.MutableString;
 
 import java.util.ArrayList;
 
@@ -35,7 +36,7 @@
     //~ Instance fields ----------------------------------------------------------------------------
 
     /** The base DN */
-    private MutableString baseObject;
+    private LdapDN baseObject;
 
     /** The scope. It could be baseObject, singleLevel or wholeSubtree. */
     private int scope;
@@ -94,7 +95,7 @@
      * 
      * @param attribute The attribute to add to the list
      */
-    public void addAttribute (MutableString attribute) {
+    public void addAttribute (LdapString attribute) {
         attributes.add(attribute);
     }
     
@@ -113,9 +114,9 @@
      *
      * @return Returns the baseObject.
      */
-    public MutableString getBaseObject()
+    public String getBaseObject()
     {
-        return baseObject;
+        return ( baseObject == null ? null : baseObject.toString() );
     }
 
     /**
@@ -123,7 +124,7 @@
      *
      * @param baseObject The baseObject to set.
      */
-    public void setBaseObject( MutableString baseObject )
+    public void setBaseObject( LdapDN baseObject )
     {
         this.baseObject = baseObject;
     }



Mime
View raw message