directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1067033 - 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/ ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/
Date Thu, 03 Feb 2011 23:37:31 GMT
Author: akarasulu
Date: Thu Feb  3 23:37:31 2011
New Revision: 1067033

URL: http://svn.apache.org/viewvc?rev=1067033&view=rev
Log:
DIRSHARED-81: document cleanup and reducing codec, and factory interface methods

Modified:
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IControlFactory.java
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ILdapCodecService.java
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java

Modified: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java?rev=1067033&r1=1067032&r2=1067033&view=diff
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
(original)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/Dsmlv2Grammar.java
Thu Feb  3 23:37:31 2011
@@ -2747,7 +2747,7 @@ public final class Dsmlv2Grammar extends
                     throw new XmlPullParserException( I18n.err( I18n.ERR_03034 ), xpp, null
);
                 }
 
-                control = codec.decorate( (Control)codec.newControl( attributeValue ) );
+                control = codec.decorate( codec.newControl( attributeValue ) );
                 container.getBatchRequest().getCurrentRequest().addControl( control );
             }
             else

Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java?rev=1067033&r1=1067032&r2=1067033&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
(original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
Thu Feb  3 23:37:31 2011
@@ -206,37 +206,6 @@ public class DefaultLdapCodecService imp
     /**
      * {@inheritDoc}
      */
-    @SuppressWarnings("unchecked")
-    public <E> E newControl( Class<? extends Control> clazz )
-    {
-        try
-        {
-            Field f = clazz.getField( "OID" );
-            String oid = ( String ) f.get( null );
-            IControlFactory<?,?> factory = controlFactories.get( oid );
-            
-            return ( E ) factory.newControl();
-        }
-        catch ( IllegalAccessException e )
-        {
-            e.printStackTrace();
-        }
-        catch ( SecurityException e )
-        {
-            e.printStackTrace();
-        }
-        catch ( NoSuchFieldException e )
-        {
-            e.printStackTrace();
-        }
-        
-        return null;
-    }
-
-    
-    /**
-     * {@inheritDoc}
-     */
     public ProtocolCodecFactory newProtocolCodecFactory( boolean client )
     {
         return null;
@@ -244,7 +213,7 @@ public class DefaultLdapCodecService imp
 
     
     @SuppressWarnings("unchecked")
-    public <E> E newControl( String oid )
+    public ICodecControl<? extends Control> newControl( String oid )
     {
         try
         {
@@ -252,10 +221,10 @@ public class DefaultLdapCodecService imp
             
             if ( factory == null )
             {
-                return ( E ) new OpaqueControl( oid );
+                return new BasicControlDecorator( this, new OpaqueControl( oid ) );
             }
             
-            return ( E ) factory.newControl();
+            return factory.newCodecControl();
         }
         catch ( SecurityException e )
         {

Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IControlFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IControlFactory.java?rev=1067033&r1=1067032&r2=1067033&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IControlFactory.java
(original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IControlFactory.java
Thu Feb  3 23:37:31 2011
@@ -64,12 +64,12 @@ public interface IControlFactory<C exten
 
     /**
      * Same as the {@link #newCodecControl()} but returns the decorated object using
-     * the Control interface subtype. Or do we really want that?
+     * the Control interface sub-type. Or do we really want that?
      *
      * @TODO isn't this totally superfluous? If the codec needs to get a handle on
      * the original control object it can get that when it likes. If it needs to
-     * decorate it can do so. Must investigte why this is here and if we can remove
-     * it. This might be for efficiency - not to have to unnecesarily create a new
+     * decorate it can do so. Must investigate why this is here and if we can remove
+     * it. This might be for efficiency - not to have to unnecessarily create a new
      * decorator when all the codec wants is the control object.
      *
      * @return

Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ILdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ILdapCodecService.java?rev=1067033&r1=1067032&r2=1067033&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ILdapCodecService.java
(original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ILdapCodecService.java
Thu Feb  3 23:37:31 2011
@@ -79,17 +79,7 @@ public interface ILdapCodecService
     void registerExtendedOp( IExtendedOpFactory<?,?> factory );
     
     
-    /**
-     * Creates a new Control instance
-     * 
-     * @param <E>
-     * @param clazz
-     * @return
-     */
-    <E> E newControl( Class<? extends Control> clazz );
-    
-    
-    <E> E newControl( String oid );
+    ICodecControl<? extends Control> newControl( String oid );
     
 
     ICodecControl<? extends Control> decorate( Control control );

Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java?rev=1067033&r1=1067032&r2=1067033&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java
(original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java
Thu Feb  3 23:37:31 2011
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.shared.ldap.codec.controls;
 
+
 import org.apache.directory.shared.asn1.AbstractAsn1Object;
 import org.apache.directory.shared.ldap.codec.ICodecControl;
 import org.apache.directory.shared.ldap.codec.ILdapCodecService;
@@ -90,6 +91,8 @@ public abstract class ControlDecorator<E
     // ------------------------------------------------------------------------
     // Control Methods
     // ------------------------------------------------------------------------
+    
+    
     /**
      * Get the OID
      * 
@@ -166,6 +169,8 @@ public abstract class ControlDecorator<E
     // ------------------------------------------------------------------------
     // CodecControl Methods
     // ------------------------------------------------------------------------
+    
+    
     /**
      * {@inheritDoc}
      */
@@ -178,6 +183,8 @@ public abstract class ControlDecorator<E
     // ------------------------------------------------------------------------
     // Object Method Overrides
     // ------------------------------------------------------------------------
+    
+    
     /**
      * @see Object#hashCode()
      */



Mime
View raw message