directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1067570 - in /directory/shared/branches/m1: dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/
Date Sun, 06 Feb 2011 01:34:14 GMT
Author: akarasulu
Date: Sun Feb  6 01:34:13 2011
New Revision: 1067570

URL: http://svn.apache.org/viewvc?rev=1067570&view=rev
Log:
DIRSHARED-80:

 o aim is to remove dependence on codec decorators
 o we're achieving this by preparing the DSML decorators to replace them
 o implementing all the required interfaces to act as request decorators


Added:
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbstractResultResponseRequestDsml.java
Modified:
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbandonRequestDsml.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbstractRequestDsml.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AuthRequestDsml.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/CompareRequestDsml.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/DelRequestDsml.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ExtendedRequestDsml.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ModifyDNRequestDsml.java
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/RequestDecorator.java

Modified: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbandonRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbandonRequestDsml.java?rev=1067570&r1=1067569&r2=1067570&view=diff
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbandonRequestDsml.java
(original)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbandonRequestDsml.java
Sun Feb  6 01:34:13 2011
@@ -32,7 +32,8 @@ import org.dom4j.Element;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AbandonRequestDsml extends AbstractRequestDsml<AbandonRequest>
+public class AbandonRequestDsml extends AbstractRequestDsml<AbandonRequest> 
+    implements AbandonRequest
 {
     /**
      * Creates a new instance of AbandonRequestDsml.
@@ -70,12 +71,10 @@ public class AbandonRequestDsml extends 
     {
         Element element = super.toDsml( root );
 
-        AbandonRequest request = (AbandonRequest) getDecorated();
-
         // AbandonID
-        if ( request.getAbandoned() != 0 )
+        if ( getDecorated().getAbandoned() != 0 )
         {
-            element.addAttribute( "abandonID", "" + request.getAbandoned() );
+            element.addAttribute( "abandonID", "" + getDecorated().getAbandoned() );
         }
 
         return element;
@@ -89,7 +88,7 @@ public class AbandonRequestDsml extends 
      */
     public int getAbandonedMessageId()
     {
-        return ( ( AbandonRequest ) getDecorated() ).getAbandoned();
+        return getDecorated().getAbandoned();
     }
 
 
@@ -100,6 +99,24 @@ public class AbandonRequestDsml extends 
      */
     public void setAbandonedMessageId( int abandonedMessageId )
     {
-        ( ( AbandonRequest ) getDecorated() ).setAbandoned( abandonedMessageId );
+        getDecorated().setAbandoned( abandonedMessageId );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getAbandoned()
+    {
+        return getDecorated().getAbandoned();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setAbandoned( int requestId )
+    {
+        getDecorated().setAbandoned( requestId );
     }
 }

Modified: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbstractRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbstractRequestDsml.java?rev=1067570&r1=1067569&r2=1067570&view=diff
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbstractRequestDsml.java
(original)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbstractRequestDsml.java
Sun Feb  6 01:34:13 2011
@@ -36,7 +36,7 @@ import org.dom4j.Element;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class AbstractRequestDsml<E extends Request> extends RequestDecorator<E>
implements DsmlDecorator
+public abstract class AbstractRequestDsml<E extends Request> extends RequestDecorator<E>
implements DsmlDecorator<E>, Request
 {
     /**
      * Creates a new instance of AbstractRequestDsml.

Added: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbstractResultResponseRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbstractResultResponseRequestDsml.java?rev=1067570&view=auto
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbstractResultResponseRequestDsml.java
(added)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AbstractResultResponseRequestDsml.java
Sun Feb  6 01:34:13 2011
@@ -0,0 +1,173 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.dsmlv2.request;
+
+
+import java.nio.ByteBuffer;
+
+import org.apache.directory.shared.asn1.EncoderException;
+import org.apache.directory.shared.dsmlv2.DsmlDecorator;
+import org.apache.directory.shared.dsmlv2.ParserUtils;
+import org.apache.directory.shared.ldap.codec.LdapCodecService;
+import org.apache.directory.shared.ldap.codec.decorators.RequestDecorator;
+import org.apache.directory.shared.ldap.model.message.AbandonListener;
+import org.apache.directory.shared.ldap.model.message.AbandonableRequest;
+import org.apache.directory.shared.ldap.model.message.ResultResponse;
+import org.apache.directory.shared.ldap.model.message.ResultResponseRequest;
+import org.dom4j.Element;
+
+
+/**
+ * Abstract class for DSML requests.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class AbstractResultResponseRequestDsml<E extends ResultResponseRequest>

+    extends RequestDecorator<E> 
+    implements DsmlDecorator<E>, ResultResponseRequest, AbandonableRequest
+{
+    /**
+     * Creates a new instance of AbstractRequestDsml.
+     *
+     * @param ldapMessage
+     *      the message to decorate
+     */
+    public AbstractResultResponseRequestDsml( LdapCodecService codec, E ldapMessage )
+    {
+        super( codec, ldapMessage );
+    }
+
+
+    /**
+     * Creates the Request Element and adds RequestID and Controls.
+     *
+     * @param root
+     *      the root element
+     * @return
+     *      the Request Element of the given name containing
+     */
+    public Element toDsml( Element root )
+    {
+        Element element = root.addElement( getRequestName() );
+
+        // Request ID
+        int requestID = getDecorated().getMessageId();
+        if ( requestID > 0 )
+        {
+            element.addAttribute( "requestID", "" + requestID );
+        }
+
+        // Controls
+        ParserUtils.addControls( getCodecService(), element, getDecorated().getControls().values()
);
+
+        return element;
+    }
+
+
+    /**
+     * Gets the name of the request according to the type of the decorated element.
+     *
+     * @return
+     *      the name of the request according to the type of the decorated element.
+     */
+    private String getRequestName()
+    {
+        switch ( getDecorated().getType() )
+        {
+            case ABANDON_REQUEST:
+                return "abandonRequest";
+
+            case ADD_REQUEST:
+                return "addRequest";
+
+            case BIND_REQUEST:
+                return "authRequest";
+
+            case COMPARE_REQUEST:
+                return "compareRequest";
+
+            case DEL_REQUEST:
+                return "delRequest";
+
+            case EXTENDED_REQUEST:
+                return "extendedRequest";
+
+            case MODIFYDN_REQUEST:
+                return "modDNRequest";
+
+            case MODIFY_REQUEST:
+                return "modifyRequest";
+
+            case SEARCH_REQUEST:
+                return "searchRequest";
+
+            default:
+                return "error";
+        }
+    }
+
+
+    public int computeLength()
+    {
+        return 0;
+    }
+
+
+    public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ResultResponse getResultResponse()
+    {
+        return getDecorated().getResultResponse();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void abandon()
+    {
+        ( ( AbandonableRequest ) getDecorated() ).abandon();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isAbandoned()
+    {
+        return ( ( AbandonableRequest ) getDecorated() ).isAbandoned();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addAbandonListener( AbandonListener listener )
+    {
+        ( ( AbandonableRequest ) getDecorated() ).addAbandonListener( listener );
+    }
+}

Modified: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java?rev=1067570&r1=1067569&r2=1067570&view=diff
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java
(original)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java
Sun Feb  6 01:34:13 2011
@@ -41,7 +41,8 @@ import org.dom4j.QName;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AddRequestDsml extends AbstractRequestDsml<AddRequest>
+public class AddRequestDsml extends AbstractResultResponseRequestDsml<AddRequest> 
+    implements AddRequest
 {
     /**
      * Creates a new getDecoratedMessage() of AddRequestDsml.
@@ -80,16 +81,14 @@ public class AddRequestDsml extends Abst
     {
         Element element = super.toDsml( root );
 
-        AddRequest request = ( AddRequest ) getDecorated();
-
         // Dn
-        if ( request.getEntry() != null )
+        if ( getDecorated().getEntry() != null )
         {
-            element.addAttribute( "dn", request.getEntry().getDn().getName() );
+            element.addAttribute( "dn", getDecorated().getEntry().getDn().getName() );
         }
 
         // Attributes
-        Entry entry = request.getEntry();
+        Entry entry = getDecorated().getEntry();
         if ( entry != null )
         {
             for ( EntryAttribute attribute : entry )
@@ -139,7 +138,7 @@ public class AddRequestDsml extends Abst
      */
     public Entry getEntry()
     {
-        return ( ( AddRequest ) getDecorated() ).getEntry();
+        return getDecorated().getEntry();
     }
 
 
@@ -184,7 +183,7 @@ public class AddRequestDsml extends Abst
      */
     public Dn getEntryDn()
     {
-        return ( ( AddRequest ) getDecorated() ).getEntryDn();
+        return getDecorated().getEntryDn();
     }
 
 
@@ -195,7 +194,7 @@ public class AddRequestDsml extends Abst
      */
     public void setEntryDn( Dn entryDn )
     {
-        ( ( AddRequest ) getDecorated() ).setEntryDn( entryDn );
+        getDecorated().setEntryDn( entryDn );
     }
 
 
@@ -207,7 +206,7 @@ public class AddRequestDsml extends Abst
      */
     public void setEntry( Entry entry )
     {
-        ( ( AddRequest ) getDecorated() ).setEntry( entry );
+        getDecorated().setEntry( entry );
     }
 
 
@@ -218,4 +217,13 @@ public class AddRequestDsml extends Abst
     {
         return ( ( AddRequestDecorator ) getDecorated() ).getCurrentAttributeType();
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public MessageTypeEnum getResponseType()
+    {
+        return getDecorated().getResponseType();
+    }
 }

Modified: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AuthRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AuthRequestDsml.java?rev=1067570&r1=1067569&r2=1067570&view=diff
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AuthRequestDsml.java
(original)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AuthRequestDsml.java
Sun Feb  6 01:34:13 2011
@@ -24,6 +24,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.BindRequest;
 import org.apache.directory.shared.ldap.model.message.BindRequestImpl;
 import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
+import org.apache.directory.shared.ldap.model.name.Dn;
 import org.dom4j.Element;
 
 
@@ -32,7 +33,9 @@ import org.dom4j.Element;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AuthRequestDsml extends AbstractRequestDsml<BindRequest>
+public class AuthRequestDsml 
+    extends AbstractResultResponseRequestDsml<BindRequest>
+    implements BindRequest
 {
     /**
      * Creates a new getDecoratedMessage() of AuthRequestDsml.
@@ -82,4 +85,130 @@ public class AuthRequestDsml extends Abs
 
         return element;
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public MessageTypeEnum getResponseType()
+    {
+        return getDecorated().getResponseType();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isSimple()
+    {
+        return getDecorated().isSimple();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean getSimple()
+    {
+        return getDecorated().getSimple();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setSimple( boolean isSimple )
+    {
+        getDecorated().setSimple( isSimple );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getCredentials()
+    {
+        return getDecorated().getCredentials();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setCredentials( String credentials )
+    {
+        getDecorated().setCredentials( credentials );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setCredentials( byte[] credentials )
+    {
+        getDecorated().setCredentials( credentials );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Dn getName()
+    {
+        return getDecorated().getName();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setName( Dn name )
+    {
+        getDecorated().setName( name );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isVersion3()
+    {
+        return getDecorated().isVersion3();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean getVersion3()
+    {
+        return getDecorated().getVersion3();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setVersion3( boolean isVersion3 )
+    {
+        getDecorated().setVersion3( isVersion3 );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getSaslMechanism()
+    {
+        return getDecorated().getSaslMechanism();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setSaslMechanism( String saslMechanism )
+    {
+        getDecorated().setSaslMechanism( saslMechanism );
+    }
 }

Modified: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/CompareRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/CompareRequestDsml.java?rev=1067570&r1=1067569&r2=1067570&view=diff
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/CompareRequestDsml.java
(original)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/CompareRequestDsml.java
Sun Feb  6 01:34:13 2011
@@ -21,6 +21,7 @@ package org.apache.directory.shared.dsml
 
 
 import org.apache.directory.shared.ldap.codec.LdapCodecService;
+import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.directory.shared.ldap.model.message.CompareRequest;
 import org.apache.directory.shared.ldap.model.message.CompareRequestImpl;
 import org.apache.directory.shared.ldap.model.message.MessageTypeEnum;
@@ -33,7 +34,9 @@ import org.dom4j.Element;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class CompareRequestDsml extends AbstractRequestDsml<CompareRequest>
+public class CompareRequestDsml 
+    extends AbstractResultResponseRequestDsml<CompareRequest>
+    implements CompareRequest
 {
     /**
      * Creates a new getDecoratedMessage() of CompareRequestDsml.
@@ -102,7 +105,7 @@ public class CompareRequestDsml extends 
      */
     public Dn getName()
     {
-        return ( (CompareRequest) getDecorated() ).getName();
+        return getDecorated().getName();
     }
 
 
@@ -113,18 +116,7 @@ public class CompareRequestDsml extends 
      */
     public void setName( Dn entry )
     {
-        ( ( CompareRequest ) getDecorated() ).setName( entry );
-    }
-
-
-    /**
-     * Get the assertion value
-     * 
-     * @return Returns the assertionValue.
-     */
-    public Object getAssertionValue()
-    {
-        return ( ( CompareRequest ) getDecorated() ).getAssertionValue();
+        getDecorated().setName( entry );
     }
 
 
@@ -137,11 +129,11 @@ public class CompareRequestDsml extends 
     {
         if ( assertionValue instanceof String )
         {
-            ( ( CompareRequest ) getDecorated() ).setAssertionValue( ( String ) assertionValue
);
+            getDecorated().setAssertionValue( ( String ) assertionValue );
         }
         else
         {
-            ( ( CompareRequest ) getDecorated() ).setAssertionValue( ( byte[] ) assertionValue
);
+            getDecorated().setAssertionValue( ( byte[] ) assertionValue );
         }
     }
 
@@ -153,7 +145,7 @@ public class CompareRequestDsml extends 
      */
     public String getAttributeDesc()
     {
-        return ( ( CompareRequest ) getDecorated() ).getAttributeId();
+        return getDecorated().getAttributeId();
     }
 
 
@@ -164,6 +156,60 @@ public class CompareRequestDsml extends 
      */
     public void setAttributeDesc( String attributeDesc )
     {
-        ( ( CompareRequest ) getDecorated() ).setAttributeId( attributeDesc );
+        getDecorated().setAttributeId( attributeDesc );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public MessageTypeEnum getResponseType()
+    {
+        return getDecorated().getResponseType();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setAssertionValue( String value )
+    {
+        getDecorated().setAssertionValue( value );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setAssertionValue( byte[] value )
+    {
+        getDecorated().setAssertionValue( value );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getAttributeId()
+    {
+        return getDecorated().getAttributeId();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setAttributeId( String attrId )
+    {
+        getDecorated().setAttributeId( attrId );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Value<?> getAssertionValue()
+    {
+        return getDecorated().getAssertionValue();
     }
 }

Modified: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/DelRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/DelRequestDsml.java?rev=1067570&r1=1067569&r2=1067570&view=diff
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/DelRequestDsml.java
(original)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/DelRequestDsml.java
Sun Feb  6 01:34:13 2011
@@ -33,7 +33,9 @@ import org.dom4j.Element;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class DelRequestDsml extends AbstractRequestDsml<DeleteRequest>
+public class DelRequestDsml 
+    extends AbstractResultResponseRequestDsml<DeleteRequest>
+    implements DeleteRequest
 {
     /**
      * Creates a new getDecoratedMessage() of DelRequestDsml.
@@ -72,12 +74,10 @@ public class DelRequestDsml extends Abst
     {
         Element element = super.toDsml( root );
 
-        DeleteRequest request = ( DeleteRequest ) getDecorated();
-
         // Dn
-        if ( request.getName() != null )
+        if ( getDecorated().getName() != null )
         {
-            element.addAttribute( "dn", request.getName().getName() );
+            element.addAttribute( "dn", getDecorated().getName().getName() );
         }
 
         return element;
@@ -91,7 +91,7 @@ public class DelRequestDsml extends Abst
      */
     public Dn getEntry()
     {
-        return ( ( DeleteRequest ) getDecorated() ).getName();
+        return getDecorated().getName();
     }
 
 
@@ -102,6 +102,33 @@ public class DelRequestDsml extends Abst
      */
     public void setEntry( Dn entry )
     {
-        ( (DeleteRequest) getDecorated() ).setName( entry );
+        getDecorated().setName( entry );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public MessageTypeEnum getResponseType()
+    {
+        return getDecorated().getResponseType();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Dn getName()
+    {
+        return getDecorated().getName();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setName( Dn name )
+    {
+        getDecorated().setName( name );
     }
 }

Modified: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ExtendedRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ExtendedRequestDsml.java?rev=1067570&r1=1067569&r2=1067570&view=diff
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ExtendedRequestDsml.java
(original)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ExtendedRequestDsml.java
Sun Feb  6 01:34:13 2011
@@ -36,7 +36,9 @@ import org.dom4j.QName;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ExtendedRequestDsml extends AbstractRequestDsml<ExtendedRequest>
+public class ExtendedRequestDsml 
+    extends AbstractResultResponseRequestDsml<ExtendedRequest>
+    implements ExtendedRequest
 {
     /**
      * Creates a new getDecoratedMessage() of ExtendedRequestDsml.
@@ -75,12 +77,11 @@ public class ExtendedRequestDsml extends
     {
         Element element = super.toDsml( root );
 
-        ExtendedRequest request = ( ExtendedRequest ) getDecorated();
-
         // Request Name
-        if ( request.getRequestName() != null )
+        if ( getDecorated().getRequestName() != null )
         {
-            element.addElement( "requestName" ).setText( request.getRequestName() );
+            element.addElement( "requestName" ).setText( 
+                getDecorated().getRequestName() );
         }
 
         // Request Value        
@@ -90,8 +91,9 @@ public class ExtendedRequestDsml extends
         element.getDocument().getRootElement().add( xsiNamespace );
 
         Element valueElement = element.addElement( "requestValue" ).addText(
-            ParserUtils.base64Encode( request.getRequestValue() ) );
-        valueElement.addAttribute( new QName( "type", xsiNamespace ), "xsd:" + ParserUtils.BASE64BINARY
);
+            ParserUtils.base64Encode( getDecorated().getRequestValue() ) );
+        valueElement.addAttribute( new QName( "type", xsiNamespace ), 
+            "xsd:" + ParserUtils.BASE64BINARY );
 
         return element;
     }
@@ -104,7 +106,7 @@ public class ExtendedRequestDsml extends
      */
     public String getRequestName()
     {
-        return ( (ExtendedRequest) getDecorated() ).getRequestName();
+        return getDecorated().getRequestName();
     }
 
 
@@ -115,7 +117,7 @@ public class ExtendedRequestDsml extends
      */
     public void setRequestName( OID requestName )
     {
-        ( ( ExtendedRequest ) getDecorated() ).setRequestName( requestName.toString() );
+        getDecorated().setRequestName( requestName.toString() );
     }
 
 
@@ -126,7 +128,7 @@ public class ExtendedRequestDsml extends
      */
     public byte[] getRequestValue()
     {
-        return ( ( ExtendedRequest ) getDecorated() ).getRequestValue();
+        return getDecorated().getRequestValue();
     }
 
 
@@ -137,6 +139,24 @@ public class ExtendedRequestDsml extends
      */
     public void setRequestValue( byte[] requestValue )
     {
-        ( ( ExtendedRequest ) getDecorated() ).getRequestValue();
+        getDecorated().getRequestValue();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public MessageTypeEnum getResponseType()
+    {
+        return getDecorated().getResponseType();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setRequestName( String oid )
+    {
+        getDecorated().setRequestName( oid );
     }
 }

Modified: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ModifyDNRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ModifyDNRequestDsml.java?rev=1067570&r1=1067569&r2=1067570&view=diff
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ModifyDNRequestDsml.java
(original)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ModifyDNRequestDsml.java
Sun Feb  6 01:34:13 2011
@@ -34,7 +34,9 @@ import org.dom4j.Element;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ModifyDNRequestDsml extends AbstractRequestDsml<ModifyDnRequest>
+public class ModifyDNRequestDsml 
+    extends AbstractResultResponseRequestDsml<ModifyDnRequest>
+    implements ModifyDnRequest
 {
     /**
      * Creates a new getDecoratedMessage() of ModifyDNRequestDsml.
@@ -107,7 +109,7 @@ public class ModifyDNRequestDsml extends
      */
     public Dn getName()
     {
-        return ( ( ModifyDnRequest ) getDecorated() ).getName();
+        return getDecorated().getName();
     }
 
 
@@ -118,7 +120,7 @@ public class ModifyDNRequestDsml extends
      */
     public void setEntry( Dn name )
     {
-        ( ( ModifyDnRequest ) getDecorated() ).setName( name );
+        getDecorated().setName( name );
     }
 
 
@@ -129,7 +131,7 @@ public class ModifyDNRequestDsml extends
      */
     public boolean isDeleteOldRDN()
     {
-        return ( ( ModifyDnRequest ) getDecorated() ).getDeleteOldRdn();
+        return getDecorated().getDeleteOldRdn();
     }
 
 
@@ -140,7 +142,7 @@ public class ModifyDNRequestDsml extends
      */
     public void setDeleteOldRDN( boolean deleteOldRDN )
     {
-        ( ( ModifyDnRequest ) getDecorated() ).setDeleteOldRdn( deleteOldRDN );
+        getDecorated().setDeleteOldRdn( deleteOldRDN );
     }
 
 
@@ -151,7 +153,7 @@ public class ModifyDNRequestDsml extends
      */
     public Rdn getNewRDN()
     {
-        return ( ( ModifyDnRequest ) getDecorated() ).getNewRdn();
+        return getDecorated().getNewRdn();
     }
 
 
@@ -162,7 +164,7 @@ public class ModifyDNRequestDsml extends
      */
     public void setNewRDN( Rdn newRdn)
     {
-        ( ( ModifyDnRequest ) getDecorated() ).setNewRdn(newRdn);
+        getDecorated().setNewRdn( newRdn );
     }
 
 
@@ -173,7 +175,7 @@ public class ModifyDNRequestDsml extends
      */
     public Dn getNewSuperior()
     {
-        return ( (ModifyDnRequest) getDecorated() ).getNewSuperior();
+        return getDecorated().getNewSuperior();
     }
 
 
@@ -184,6 +186,69 @@ public class ModifyDNRequestDsml extends
      */
     public void setNewSuperior( Dn newSuperior )
     {
-        ( ( ModifyDnRequest ) getDecorated() ).setNewSuperior( newSuperior );
+        getDecorated().setNewSuperior( newSuperior );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public MessageTypeEnum getResponseType()
+    {
+        return getDecorated().getResponseType();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setName( Dn name )
+    {
+        getDecorated().setName( name );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Rdn getNewRdn()
+    {
+        return getDecorated().getNewRdn();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setNewRdn( Rdn newRdn )
+    {
+        getDecorated().setNewRdn( newRdn );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean getDeleteOldRdn()
+    {
+        return getDecorated().getDeleteOldRdn();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setDeleteOldRdn( boolean deleteOldRdn )
+    {
+        getDecorated().setDeleteOldRdn( deleteOldRdn );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isMove()
+    {
+        return getDecorated().isMove();
     }
 }

Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/RequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/RequestDecorator.java?rev=1067570&r1=1067569&r2=1067570&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/RequestDecorator.java
(original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/RequestDecorator.java
Sun Feb  6 01:34:13 2011
@@ -27,6 +27,8 @@ import org.apache.directory.shared.ldap.
 /**
  * A decorator for the LdapResultResponse message
  *
+ * @TODO make this extend AbstractDsmlMessageDecorator instead of codec's 
+ * MessageDecorator.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public abstract class RequestDecorator<M extends Request> extends MessageDecorator<M>
implements Request



Mime
View raw message