directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1085917 - in /directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2: ./ reponse/
Date Sun, 27 Mar 2011 12:12:24 GMT
Author: kayyagari
Date: Sun Mar 27 12:12:23 2011
New Revision: 1085917

URL: http://svn.apache.org/viewvc?rev=1085917&view=rev
Log:
o made changes to allow streaming of response rather than maintaining the whole response body
in memory till the processing of all requests complete

Modified:
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/ParserUtils.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/AddResponseDsml.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/BatchResponseDsml.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/CompareResponseDsml.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/DelResponseDsml.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ErrorResponse.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ExtendedResponseDsml.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ModDNResponseDsml.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ModifyResponseDsml.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResponseDsml.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultDoneDsml.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultEntryDsml.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultReferenceDsml.java

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/ParserUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/ParserUtils.java?rev=1085917&r1=1085916&r2=1085917&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/ParserUtils.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/ParserUtils.java
Sun Mar 27 12:12:23 2011
@@ -71,6 +71,12 @@ public final class ParserUtils
     /** XSD namespace prefix. */
     public static final String XSD = "xsd";
 
+    public static final Namespace DSML_NAMESPACE = new Namespace( null, "urn:oasis:names:tc:DSML:2:0:core"
);
+
+    public static final Namespace XSD_NAMESPACE = new Namespace( XSD, XML_SCHEMA_URI );
+
+    public static final Namespace XSI_NAMESPACE = new Namespace( XSI, XML_SCHEMA_INSTANCE_URI
);
+
 
     /**
      * Private contstructor.
@@ -245,14 +251,12 @@ public final class ParserUtils
                 {
                     if ( ParserUtils.needsBase64Encoding( value ) )
                     {
-                        Namespace xsdNamespace = new Namespace( ParserUtils.XSD, ParserUtils.XML_SCHEMA_URI
);
-                        Namespace xsiNamespace = new Namespace( ParserUtils.XSI, ParserUtils.XML_SCHEMA_INSTANCE_URI
);
-                        element.getDocument().getRootElement().add( xsdNamespace );
-                        element.getDocument().getRootElement().add( xsiNamespace );
+                        element.getDocument().getRootElement().add( XSD_NAMESPACE );
+                        element.getDocument().getRootElement().add( XSI_NAMESPACE );
 
                         Element valueElement = controlElement.addElement( "controlValue"
).addText(
                             ParserUtils.base64Encode( value ) );
-                        valueElement.addAttribute( new QName( "type", xsiNamespace ), ParserUtils.XSD
+ ":"
+                        valueElement.addAttribute( new QName( "type", XSI_NAMESPACE ), ParserUtils.XSD
+ ":"
                             + ParserUtils.BASE64BINARY );
                     }
                     else

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/AddResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/AddResponseDsml.java?rev=1085917&r1=1085916&r2=1085917&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/AddResponseDsml.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/AddResponseDsml.java
Sun Mar 27 12:12:23 2011
@@ -25,6 +25,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.AddResponseImpl;
 import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
 import org.dom4j.Element;
+import org.dom4j.tree.DefaultElement;
 
 
 /**
@@ -35,6 +36,9 @@ import org.dom4j.Element;
 public class AddResponseDsml extends AbstractResultResponseDsml<AddResponse> 
     implements AddResponse
 {
+    private static final String ADD_RESPONSE_TAG = "addResponse";
+
+
     /**
      * Creates a new getDecoratedMessage() of AddResponseDsml.
      */
@@ -70,7 +74,16 @@ public class AddResponseDsml extends Abs
      */
     public Element toDsml( Element root )
     {
-        Element element = root.addElement( "addResponse" );
+        Element element = null;
+        
+        if ( root != null )
+        {
+            element = root.addElement( ADD_RESPONSE_TAG );
+        }
+        else
+        {
+            element = new DefaultElement( ADD_RESPONSE_TAG );           
+        }
 
         LdapResultDsml ldapResultDsml = new LdapResultDsml( getCodecService(), 
             getDecorated().getLdapResult(), getDecorated() );

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/BatchResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/BatchResponseDsml.java?rev=1085917&r1=1085916&r2=1085917&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/BatchResponseDsml.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/BatchResponseDsml.java
Sun Mar 27 12:12:23 2011
@@ -139,6 +139,10 @@ public class BatchResponseDsml
         Document document = DocumentHelper.createDocument();
         Element element = document.addElement( "batchResponse" );
 
+        element.add( ParserUtils.DSML_NAMESPACE );
+        element.add( ParserUtils.XSD_NAMESPACE );
+        element.add( ParserUtils.XSI_NAMESPACE );
+        
         // RequestID
         if ( requestID != 0 )
         {

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/CompareResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/CompareResponseDsml.java?rev=1085917&r1=1085916&r2=1085917&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/CompareResponseDsml.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/CompareResponseDsml.java
Sun Mar 27 12:12:23 2011
@@ -26,6 +26,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.CompareResponseImpl;
 import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
 import org.dom4j.Element;
+import org.dom4j.tree.DefaultElement;
 
 
 /**
@@ -35,6 +36,9 @@ import org.dom4j.Element;
  */
 public class CompareResponseDsml extends AbstractResultResponseDsml<CompareResponse>
implements CompareResponse
 {
+    private static final String COMPARE_RESPONSE_TAG = "compareResponse";
+
+
     /**
      * Creates a new getDecoratedMessage() of CompareResponseDsml.
      */
@@ -70,7 +74,16 @@ public class CompareResponseDsml extends
      */
     public Element toDsml( Element root )
     {
-        Element element = root.addElement( "compareResponse" );
+        Element element = null;
+
+        if ( root != null )
+        {
+            element = root.addElement( COMPARE_RESPONSE_TAG );
+        }
+        else
+        {
+            element = new DefaultElement( COMPARE_RESPONSE_TAG );
+        }
 
         LdapResultDsml ldapResultDsml = new LdapResultDsml( getCodecService(), 
             getDecorated().getLdapResult(), getDecorated() );

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/DelResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/DelResponseDsml.java?rev=1085917&r1=1085916&r2=1085917&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/DelResponseDsml.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/DelResponseDsml.java
Sun Mar 27 12:12:23 2011
@@ -26,6 +26,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.DeleteResponseImpl;
 import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
 import org.dom4j.Element;
+import org.dom4j.tree.DefaultElement;
 
 
 /**
@@ -36,6 +37,9 @@ import org.dom4j.Element;
 public class DelResponseDsml extends AbstractResultResponseDsml<DeleteResponse>
     implements DeleteResponse
 {
+    private static final String DEL_RESPONSE_TAG = "delResponse";
+
+
     /**
      * Creates a new getDecoratedMessage() of DelResponseDsml.
      */
@@ -71,7 +75,17 @@ public class DelResponseDsml extends Abs
      */
     public Element toDsml( Element root )
     {
-        Element element = root.addElement( "delResponse" );
+        Element element = null;
+
+        if ( root != null )
+        {
+            element = root.addElement( DEL_RESPONSE_TAG );
+        }
+        else
+        {
+            element = new DefaultElement( DEL_RESPONSE_TAG );
+        }
+        
 
         LdapResultDsml ldapResultDsml = new LdapResultDsml( getCodecService(), 
             getDecorated().getLdapResult(), getDecorated() );

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ErrorResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ErrorResponse.java?rev=1085917&r1=1085916&r2=1085917&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ErrorResponse.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ErrorResponse.java
Sun Mar 27 12:12:23 2011
@@ -26,6 +26,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.model.message.Response;
 import org.dom4j.Element;
+import org.dom4j.tree.DefaultElement;
 
 
 /**
@@ -50,6 +51,9 @@ import org.dom4j.Element;
  */
 public class ErrorResponse extends AbstractResponse implements Response, DsmlDecorator<Response>
 {
+    private static final String ERROR_RESPONSE_TAG = "errorResponse";
+
+
     /**
      * This enum represents the different types of error response
      *
@@ -121,8 +125,17 @@ public class ErrorResponse extends Abstr
      */
     public Element toDsml( Element root )
     {
-        Element element = root.addElement( "errorResponse" );
+        Element element = null;
 
+        if ( root != null )
+        {
+            element = root.addElement( ERROR_RESPONSE_TAG );
+        }
+        else
+        {
+            element = new DefaultElement( ERROR_RESPONSE_TAG );
+        }
+        
         // RequestID
         if ( requestID != 0 )
         {

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ExtendedResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ExtendedResponseDsml.java?rev=1085917&r1=1085916&r2=1085917&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ExtendedResponseDsml.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ExtendedResponseDsml.java
Sun Mar 27 12:12:23 2011
@@ -30,6 +30,7 @@ import org.apache.directory.shared.util.
 import org.dom4j.Element;
 import org.dom4j.Namespace;
 import org.dom4j.QName;
+import org.dom4j.tree.DefaultElement;
 
 
 /**
@@ -40,6 +41,7 @@ import org.dom4j.QName;
 public class ExtendedResponseDsml extends AbstractResultResponseDsml<ExtendedResponse>
     implements ExtendedResponse
 {
+    private static final String EXTENDED_RESPONSE_TAG = "extendedResponse";
     private static final long serialVersionUID = -3989420095112650346L;
     private byte[] response;
 
@@ -79,7 +81,17 @@ public class ExtendedResponseDsml extend
      */
     public Element toDsml( Element root )
     {
-        Element element = root.addElement( "extendedResponse" );
+        Element element = null;
+
+        if ( root != null )
+        {
+            element = root.addElement( EXTENDED_RESPONSE_TAG );
+        }
+        else
+        {
+            element = new DefaultElement( EXTENDED_RESPONSE_TAG );
+        }
+        
         ExtendedResponse extendedResponse = ( ExtendedResponse ) getDecorated();
 
         // LDAP Result

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ModDNResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ModDNResponseDsml.java?rev=1085917&r1=1085916&r2=1085917&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ModDNResponseDsml.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ModDNResponseDsml.java
Sun Mar 27 12:12:23 2011
@@ -25,6 +25,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.ModifyDnResponse;
 import org.apache.directory.shared.ldap.model.message.ModifyDnResponseImpl;
 import org.dom4j.Element;
+import org.dom4j.tree.DefaultElement;
 
 
 /**
@@ -35,6 +36,9 @@ import org.dom4j.Element;
 public class ModDNResponseDsml extends AbstractResultResponseDsml<ModifyDnResponse>
     implements ModifyDnResponse
 {
+    private static final String MOD_DN_RESPONSE_TAG = "modDNResponse";
+
+
     /**
      * Creates a new getDecoratedMessage() of ModDNResponseDsml.
      */
@@ -70,7 +74,16 @@ public class ModDNResponseDsml extends A
      */
     public Element toDsml( Element root )
     {
-        Element element = root.addElement( "modDNResponse" );
+        Element element = null;
+
+        if ( root != null )
+        {
+            element = root.addElement( MOD_DN_RESPONSE_TAG );
+        }
+        else
+        {
+            element = new DefaultElement( MOD_DN_RESPONSE_TAG );
+        }
 
         LdapResultDsml ldapResultDsml = new LdapResultDsml( getCodecService(), 
             getDecorated().getLdapResult(), getDecorated() );

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ModifyResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ModifyResponseDsml.java?rev=1085917&r1=1085916&r2=1085917&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ModifyResponseDsml.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ModifyResponseDsml.java
Sun Mar 27 12:12:23 2011
@@ -25,6 +25,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.ModifyResponse;
 import org.apache.directory.shared.ldap.model.message.ModifyResponseImpl;
 import org.dom4j.Element;
+import org.dom4j.tree.DefaultElement;
 
 
 /**
@@ -35,6 +36,9 @@ import org.dom4j.Element;
 public class ModifyResponseDsml extends AbstractResultResponseDsml<ModifyResponse>
     implements ModifyResponse
 {
+    private static final String MODIFY_RESPONSE_TAG = "modifyResponse";
+
+
     /**
      * Creates a new getDecoratedMessage() of ModifyResponseDsml.
      */
@@ -70,7 +74,16 @@ public class ModifyResponseDsml extends 
      */
     public Element toDsml( Element root )
     {
-        Element element = root.addElement( "modifyResponse" );
+        Element element = null;
+
+        if ( root != null )
+        {
+            element = root.addElement( MODIFY_RESPONSE_TAG );
+        }
+        else
+        {
+            element = new DefaultElement( MODIFY_RESPONSE_TAG );
+        }
 
         LdapResultDsml ldapResultDsml = new LdapResultDsml( getCodecService(), 
             getDecorated().getLdapResult(), getDecorated() );

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResponseDsml.java?rev=1085917&r1=1085916&r2=1085917&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResponseDsml.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResponseDsml.java
Sun Mar 27 12:12:23 2011
@@ -31,6 +31,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.SearchResultEntry;
 import org.apache.directory.shared.ldap.model.message.SearchResultReference;
 import org.dom4j.Element;
+import org.dom4j.tree.DefaultElement;
 
 
 /**
@@ -42,6 +43,8 @@ import org.dom4j.Element;
  */
 public class SearchResponseDsml extends AbstractResponseDsml<Response>
 {
+    private static final String SEARCH_RESPONSE_TAG = "searchResponse";
+
     /** The responses */
     private List<DsmlDecorator<? extends Response>> responses = 
         new ArrayList<DsmlDecorator<? extends Response>>();
@@ -120,7 +123,17 @@ public class SearchResponseDsml extends 
      */
     public Element toDsml( Element root )
     {
-        Element element = root.addElement( "searchResponse" );
+        Element element = null;
+
+        if ( root != null )
+        {
+            element = root.addElement( SEARCH_RESPONSE_TAG );
+        }
+        else
+        {
+            element = new DefaultElement( SEARCH_RESPONSE_TAG );
+        }
+
 
         // RequestID
         if ( getDecorated() != null )

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultDoneDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultDoneDsml.java?rev=1085917&r1=1085916&r2=1085917&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultDoneDsml.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultDoneDsml.java
Sun Mar 27 12:12:23 2011
@@ -25,6 +25,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.SearchResultDone;
 import org.apache.directory.shared.ldap.model.message.SearchResultDoneImpl;
 import org.dom4j.Element;
+import org.dom4j.tree.DefaultElement;
 
 
 /**
@@ -35,6 +36,9 @@ import org.dom4j.Element;
 public class SearchResultDoneDsml extends AbstractResultResponseDsml<SearchResultDone>
     implements SearchResultDone
 {
+    private static final String SEARCH_RESULT_DONE_TAG = "searchResultDone";
+
+
     /**
      * Creates a new getDecoratedMessage() of SearchResultDoneDsml.
      */
@@ -70,7 +74,16 @@ public class SearchResultDoneDsml extend
      */
     public Element toDsml( Element root )
     {
-        Element element = root.addElement( "searchResultDone" );
+        Element element = null;
+
+        if ( root != null )
+        {
+            element = root.addElement( SEARCH_RESULT_DONE_TAG );
+        }
+        else
+        {
+            element = new DefaultElement( SEARCH_RESULT_DONE_TAG );
+        }
 
         LdapResultDsml ldapResultDsml = 
             new LdapResultDsml( getCodecService(), getDecorated().getLdapResult(), getDecorated()
);

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultEntryDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultEntryDsml.java?rev=1085917&r1=1085916&r2=1085917&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultEntryDsml.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultEntryDsml.java
Sun Mar 27 12:12:23 2011
@@ -34,6 +34,7 @@ import org.apache.directory.shared.ldap.
 import org.dom4j.Element;
 import org.dom4j.Namespace;
 import org.dom4j.QName;
+import org.dom4j.tree.DefaultElement;
 
 
 /**
@@ -45,7 +46,9 @@ public class SearchResultEntryDsml 
     extends AbstractResponseDsml<SearchResultEntry>
     implements SearchResultEntry
 {
-    
+
+    private static final String SEARCH_RESULT_ENTRY_TAG = "searchResultEntry";
+
     /** The current attribute being processed */
     private EntryAttribute currentAttribute;
     
@@ -124,7 +127,17 @@ public class SearchResultEntryDsml 
      */
     public Element toDsml( Element root )
     {
-        Element element = root.addElement( "searchResultEntry" );
+        Element element = null;
+
+        if ( root != null )
+        {
+            element = root.addElement( SEARCH_RESULT_ENTRY_TAG );
+        }
+        else
+        {
+            element = new DefaultElement( SEARCH_RESULT_ENTRY_TAG );
+        }
+
         SearchResultEntry searchResultEntry = ( SearchResultEntry ) getDecorated();
         element.addAttribute( "dn", searchResultEntry.getObjectName().getName() );
 

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultReferenceDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultReferenceDsml.java?rev=1085917&r1=1085916&r2=1085917&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultReferenceDsml.java
(original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/SearchResultReferenceDsml.java
Sun Mar 27 12:12:23 2011
@@ -29,6 +29,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.SearchResultReference;
 import org.apache.directory.shared.ldap.model.message.SearchResultReferenceImpl;
 import org.dom4j.Element;
+import org.dom4j.tree.DefaultElement;
 
 
 /**
@@ -40,6 +41,9 @@ public class SearchResultReferenceDsml 
     extends AbstractResponseDsml<SearchResultReference>
     implements SearchResultReference
 {
+    private static final String SEARCH_RESULT_REFERENCE_TAG = "searchResultReference";
+
+
     /**
      * Creates a new getDecoratedMessage() of SearchResultReferenceDsml.
      */
@@ -75,7 +79,17 @@ public class SearchResultReferenceDsml 
      */
     public Element toDsml( Element root )
     {
-        Element element = root.addElement( "searchResultReference" );
+        Element element = null;
+
+        if ( root != null )
+        {
+            element = root.addElement( SEARCH_RESULT_REFERENCE_TAG );
+        }
+        else
+        {
+            element = new DefaultElement( SEARCH_RESULT_REFERENCE_TAG );
+        }
+
 
         // Adding References
         for ( String url : getDecorated().getReferral().getLdapUrls() )



Mime
View raw message