directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1067006 - in /directory: apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/ shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/ shared/branches/m1/ldap-client-a...
Date Thu, 03 Feb 2011 22:19:51 GMT
Author: akarasulu
Date: Thu Feb  3 22:19:50 2011
New Revision: 1067006

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

  o renamed OpaqueControlImpl to OpaqueControl, since it's a final class and
    very specific rather than the default implementations we have dropping Impl
    suffix for this reason
  o renamed hasValue() to hasEncodedValue() to match the get,setEncodedValue() 
    property
  o added some documentation


Added:
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControl.java
      - copied, changed from r1066983, directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControlImpl.java
Removed:
    directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControlImpl.java
Modified:
    directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java
    directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java
    directory/shared/branches/m1/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.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/ILdapCodecService.java
    directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java
    directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/OpaqueControlTest.java

Modified: directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java?rev=1067006&r1=1067005&r2=1067006&view=diff
==============================================================================
--- directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java
(original)
+++ directory/apacheds/branches/m1/server-integ/src/test/java/org/apache/directory/server/operations/bind/MiscBindIT.java
Thu Feb  3 22:19:50 2011
@@ -68,7 +68,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.ldap.model.constants.SupportedSaslMechanisms;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.message.controls.AbstractControl;
-import org.apache.directory.shared.ldap.model.message.controls.OpaqueControlImpl;
+import org.apache.directory.shared.ldap.model.message.controls.OpaqueControl;
 import org.apache.directory.shared.ldap.util.JndiUtils;
 import org.junit.After;
 import org.junit.Before;
@@ -355,7 +355,7 @@ public class MiscBindIT extends Abstract
     @Test
     public void testFailureWithUnsupportedControl() throws Exception
     {
-        Control unsupported = new OpaqueControlImpl( "1.1.1.1" );
+        Control unsupported = new OpaqueControl( "1.1.1.1" );
         unsupported.setCritical( true );
         
         ldapServer.getDirectoryService().setAllowAnonymousAccess( true );

Modified: directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java?rev=1067006&r1=1067005&r2=1067006&view=diff
==============================================================================
--- directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java
(original)
+++ directory/shared/branches/m1/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/reponse/Dsmlv2ResponseGrammar.java
Thu Feb  3 22:19:50 2011
@@ -75,7 +75,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.apache.directory.shared.ldap.model.message.controls.AbstractControl;
-import org.apache.directory.shared.ldap.model.message.controls.OpaqueControlImpl;
+import org.apache.directory.shared.ldap.model.message.controls.OpaqueControl;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.util.Base64;
 import org.apache.directory.shared.util.Strings;
@@ -1214,7 +1214,7 @@ public final class Dsmlv2ResponseGrammar
                 throw new XmlPullParserException( I18n.err( I18n.ERR_03006 ), xpp, null );
             }
 
-            control = container.getLdapCodecService().decorate( new OpaqueControlImpl( attributeValue
) );
+            control = container.getLdapCodecService().decorate( new OpaqueControl( attributeValue
) );
             parent.addControl( control );
         }
         else

Modified: directory/shared/branches/m1/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1067006&r1=1067005&r2=1067006&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/shared/branches/m1/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Thu Feb  3 22:19:50 2011
@@ -127,7 +127,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.UnbindRequest;
 import org.apache.directory.shared.ldap.model.message.UnbindRequestImpl;
 import org.apache.directory.shared.ldap.model.message.controls.AbstractControl;
-import org.apache.directory.shared.ldap.model.message.controls.OpaqueControlImpl;
+import org.apache.directory.shared.ldap.model.message.controls.OpaqueControl;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.name.Rdn;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
@@ -2498,7 +2498,7 @@ public class LdapNetworkConnection exten
         {
             DeleteRequest deleteRequest = new DeleteRequestImpl();
             deleteRequest.setName( dn );
-            deleteRequest.addControl( new OpaqueControlImpl( treeDeleteOid ) );
+            deleteRequest.addControl( new OpaqueControl( treeDeleteOid ) );
             return delete( deleteRequest );
         }
         else
@@ -2529,7 +2529,7 @@ public class LdapNetworkConnection exten
             {
                 DeleteRequest deleteRequest = new DeleteRequestImpl();
                 deleteRequest.setName( newDn );
-                deleteRequest.addControl( new OpaqueControlImpl( treeDeleteOid ) );
+                deleteRequest.addControl( new OpaqueControl( treeDeleteOid ) );
                 return delete( deleteRequest );
             }
             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=1067006&r1=1067005&r2=1067006&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 22:19:50 2011
@@ -51,7 +51,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.controls.Cascade;
 import org.apache.directory.shared.ldap.model.message.controls.EntryChange;
 import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
-import org.apache.directory.shared.ldap.model.message.controls.OpaqueControlImpl;
+import org.apache.directory.shared.ldap.model.message.controls.OpaqueControl;
 import org.apache.directory.shared.ldap.model.message.controls.PagedResults;
 import org.apache.directory.shared.ldap.model.message.controls.PersistentSearch;
 import org.apache.directory.shared.ldap.model.message.controls.Subentries;
@@ -137,7 +137,7 @@ public class DefaultLdapCodecService imp
     /**
      * {@inheritDoc}
      */
-    public Iterator<String> controlOids()
+    public Iterator<String> registeredControls()
     {
         return controlFactories.keySet().iterator();
     }
@@ -146,7 +146,7 @@ public class DefaultLdapCodecService imp
     /**
      * {@inheritDoc}
      */
-    public Iterator<String> extendedRequestOids()
+    public Iterator<String> registeredExtendedRequests()
     {
         return extReqFactories.keySet().iterator();
     }
@@ -249,7 +249,7 @@ public class DefaultLdapCodecService imp
             
             if ( factory == null )
             {
-                return ( E ) new OpaqueControlImpl( oid );
+                return ( E ) new OpaqueControl( oid );
             }
             
             return ( E ) factory.newControl();
@@ -303,7 +303,7 @@ public class DefaultLdapCodecService imp
         
         if ( factory == null )
         {
-            AbstractControl ourControl = new OpaqueControlImpl( control.getID() );
+            AbstractControl ourControl = new OpaqueControl( control.getID() );
             ourControl.setCritical( control.isCritical() );
             BasicControlDecorator decorator = new BasicControlDecorator( this, ourControl
);
             decorator.setValue( control.getEncodedValue() );

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=1067006&r1=1067005&r2=1067006&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 22:19:50 2011
@@ -29,28 +29,63 @@ import org.apache.mina.filter.codec.Prot
 
 
 /**
- * The LdapCodec interface.
+ * The service interface for the LDAP codec.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public interface ILdapCodecService
 {
-    Iterator<String> controlOids();
+    /**
+     * Returns an Iterator over the OID Strings of registered controls.
+     * 
+     * @return The registered control OID Strings
+     */
+    Iterator<String> registeredControls();
     
     
-    Iterator<String> extendedRequestOids();
+    /**
+     * Returns an Iterator over the OID Strings of registered extended 
+     * requests.
+     *
+     * @return The registered extended request OID Strings
+     */
+    Iterator<String> registeredExtendedRequests();
     
     
+    /**
+     * Returns an Iterator over the OID Strings of registered extended 
+     * responses.
+     *
+     * @return The registered extended response OID Strings
+     */
     Iterator<String> extendedResponseOids();
     
     
+    /**
+     * Registers an {@link IControlFactory} with this service.
+     * 
+     * @param factory The control factory
+     */
     void registerControl( IControlFactory<?,?> factory );
     
     
+    /**
+     * Registers an {@link IExtendedOpFactory} for generating extended request 
+     * response pairs.
+     * 
+     * @param factory The extended operation factory
+     */
     void registerExtendedOp( IExtendedOpFactory<?,?> factory );
     
     
+    /**
+     * Creates a new Control instance
+     * 
+     * @param <E>
+     * @param clazz
+     * @return
+     */
     <E> E newControl( Class<? extends Control> clazz );
     
     

Copied: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControl.java
(from r1066983, directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControlImpl.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControl.java?p2=directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControl.java&p1=directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControlImpl.java&r1=1066983&r2=1067006&rev=1067006&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControlImpl.java
(original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControl.java
Thu Feb  3 22:19:50 2011
@@ -20,19 +20,21 @@
 package org.apache.directory.shared.ldap.model.message.controls;
 
 
+import org.apache.directory.shared.ldap.codec.IControlFactory;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.util.Strings;
 
 
 /**
- * A simple implementation of the {@link Control} interface with storage for 
- * the OID and the criticality properties. When the codec factory service
- * does not have specific control factories available, hence the control is
- * unrecognized, it creates instances of this control for them.
+ * A final {@link Control} implementation intended specifically for handling
+ * controls who's values cannot be encoded or decoded by the codec service. 
+ * This situation results when no {@link IControlFactory} is found to be 
+ * registered for this control's OID. Hence additional opaque value handling
+ * methods are included to manage the opaque control value.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class OpaqueControlImpl extends AbstractControl implements Control
+public final class OpaqueControl extends AbstractControl implements Control
 {
 	/** The opaque encoded value */
 	private byte[] value;
@@ -42,7 +44,7 @@ public final class OpaqueControlImpl ext
      *
      * @param oid The OID of this Control.
      */
-    public OpaqueControlImpl( String oid )
+    public OpaqueControl( String oid )
     {
         super( oid );
     }
@@ -54,7 +56,7 @@ public final class OpaqueControlImpl ext
      * @param oid The OID of this Control.
      * @param criticality true if this Control is critical, false otherwise. 
      */
-    public OpaqueControlImpl( String oid, boolean criticality )
+    public OpaqueControl( String oid, boolean criticality )
     {
         super( oid, criticality);
     }
@@ -70,7 +72,8 @@ public final class OpaqueControlImpl ext
     
     
     /**
-     * Stores an opaque value into the vontrol
+     * Stores an opaque value into the control.
+     * 
      * @param value The opaque value to store
      */
     public void setEncodedValue( byte[] value )
@@ -82,9 +85,10 @@ public final class OpaqueControlImpl ext
     /**
      * Tells if the control has a stored value. Note that if the 
      * control has an empty value, this method will return true.
+     * 
      * @return true if the control has a value
      */
-    public boolean hasValue()
+    public boolean hasEncodedValue()
     {
     	return value != null;
     }

Modified: directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java?rev=1067006&r1=1067005&r2=1067006&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java
(original)
+++ directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java
Thu Feb  3 22:19:50 2011
@@ -42,7 +42,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.BindRequestImpl;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.message.controls.AbstractControl;
-import org.apache.directory.shared.ldap.model.message.controls.OpaqueControlImpl;
+import org.apache.directory.shared.ldap.model.message.controls.OpaqueControl;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Ignore;
@@ -189,7 +189,7 @@ public class BindRequestPerfTest
             bindRequest.setSimple( true );
             bindRequest.setName( name );
             bindRequest.setCredentials( Strings.getBytesUtf8("password") );
-            Control control = new OpaqueControlImpl( "2.16.840.1.113730.3.4.2" );
+            Control control = new OpaqueControl( "2.16.840.1.113730.3.4.2" );
 
             bindRequest.addControl( control );
 

Modified: directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/OpaqueControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/OpaqueControlTest.java?rev=1067006&r1=1067005&r2=1067006&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/OpaqueControlTest.java
(original)
+++ directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/OpaqueControlTest.java
Thu Feb  3 22:19:50 2011
@@ -23,7 +23,7 @@ package org.apache.directory.shared.ldap
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import org.apache.directory.shared.ldap.model.message.controls.OpaqueControlImpl;
+import org.apache.directory.shared.ldap.model.message.controls.OpaqueControl;
 import org.apache.directory.shared.util.StringConstants;
 import org.junit.Test;
 
@@ -37,12 +37,12 @@ public class OpaqueControlTest
     @Test
     public void testEmptyValue()
     {
-        OpaqueControlImpl control = new OpaqueControlImpl( "1.1" );
+        OpaqueControl control = new OpaqueControl( "1.1" );
 
-        assertFalse( control.hasValue() );
+        assertFalse( control.hasEncodedValue() );
 
         control.setEncodedValue( StringConstants.EMPTY_BYTES );
 
-        assertTrue( control.hasValue() );
+        assertTrue( control.hasEncodedValue() );
     }
 }



Mime
View raw message