directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1005405 - in /directory/shared/trunk: ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/ ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/ ldap/src/main/java/org/apache/directory/shared/ldap/messag...
Date Thu, 07 Oct 2010 10:49:46 GMT
Author: elecharny
Date: Thu Oct  7 10:49:45 2010
New Revision: 1005405

URL: http://svn.apache.org/viewvc?rev=1005405&view=rev
Log:
Added handling of the missing NoD for each response type

Added:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/AddNoDResponse.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/BindNoDResponse.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/CompareNoDResponse.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/DeleteNoDResponse.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ExtendedNoDResponse.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ModifyDnNoDResponse.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ModifyNoDResponse.java
      - copied, changed from r1005346, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/ModifyNoDResponse.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/SearchNoDResponse.java
Removed:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/ModifyNoDResponse.java
Modified:
    directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
    directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java

Modified: directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1005405&r1=1005404&r2=1005405&view=diff
==============================================================================
--- directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Thu Oct  7 10:49:45 2010
@@ -114,8 +114,15 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.UnbindRequest;
 import org.apache.directory.shared.ldap.message.UnbindRequestImpl;
 import org.apache.directory.shared.ldap.message.control.Control;
-import org.apache.directory.shared.ldap.message.extended.ModifyNoDResponse;
 import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
+import org.apache.directory.shared.ldap.message.extended.nod.AddNoDResponse;
+import org.apache.directory.shared.ldap.message.extended.nod.BindNoDResponse;
+import org.apache.directory.shared.ldap.message.extended.nod.CompareNoDResponse;
+import org.apache.directory.shared.ldap.message.extended.nod.DeleteNoDResponse;
+import org.apache.directory.shared.ldap.message.extended.nod.ExtendedNoDResponse;
+import org.apache.directory.shared.ldap.message.extended.nod.ModifyDnNoDResponse;
+import org.apache.directory.shared.ldap.message.extended.nod.ModifyNoDResponse;
+import org.apache.directory.shared.ldap.message.extended.nod.SearchNoDResponse;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -523,25 +530,54 @@ public class LdapNetworkConnection exten
         {
             public void operationComplete( IoFuture future )
             {
-                // Nothing to do here
-                //System.out.println( "received a NoD, closing everything" );
+                // Process all the waiting operations and cancel them
+                LOG.debug( "received a NoD, closing everything" );
 
                 for ( int messageId : futureMap.keySet() )
                 {
                     ResponseFuture<?> responseFuture = futureMap.get( messageId );
-                    //System.out.println( "closing " + responseFuture );
+                    LOG.debug( "closing {}", responseFuture );
+
+                    responseFuture.cancel();
 
                     try
                     {
-                        if ( responseFuture instanceof ModifyFuture )
+                        if ( responseFuture instanceof AddFuture )
+                        {
+                            ( ( AddFuture ) responseFuture ).set( AddNoDResponse.PROTOCOLERROR
);
+                        }
+                        else if ( responseFuture instanceof BindFuture )
+                        {
+                            ( ( BindFuture ) responseFuture ).set( BindNoDResponse.PROTOCOLERROR
);
+                        }
+                        else if ( responseFuture instanceof CompareFuture )
+                        {
+                            ( ( CompareFuture ) responseFuture ).set( CompareNoDResponse.PROTOCOLERROR
);
+                        }
+                        else if ( responseFuture instanceof DeleteFuture )
+                        {
+                            ( ( DeleteFuture ) responseFuture ).set( DeleteNoDResponse.PROTOCOLERROR
);
+                        }
+                        else if ( responseFuture instanceof ExtendedFuture )
+                        {
+                            ( ( ExtendedFuture ) responseFuture ).set( ExtendedNoDResponse.PROTOCOLERROR
);
+                        }
+                        else if ( responseFuture instanceof ModifyFuture )
                         {
-                            responseFuture.cancel();
                             ( ( ModifyFuture ) responseFuture ).set( ModifyNoDResponse.PROTOCOLERROR
);
                         }
+                        else if ( responseFuture instanceof ModifyDnFuture )
+                        {
+                            ( ( ModifyDnFuture ) responseFuture ).set( ModifyDnNoDResponse.PROTOCOLERROR
);
+                        }
+                        else if ( responseFuture instanceof SearchFuture )
+                        {
+                            ( ( SearchFuture ) responseFuture ).set( SearchNoDResponse.PROTOCOLERROR
);
+                        }
                     }
                     catch ( Exception e )
                     {
-
+                        LOG.error( "Error while processing the NoD for {}", responseFuture
);
                     }
 
                     futureMap.remove( messageId );

Modified: directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java?rev=1005405&r1=1005404&r2=1005405&view=diff
==============================================================================
--- directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java
(original)
+++ directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java
Thu Oct  7 10:49:45 2010
@@ -163,6 +163,7 @@ public class ResponseFuture<R extends Re
 
 
     /**
+     * Associate a cause to the ResponseFuture
      * @param cause the cause to set
      */
     public void setCause( Throwable cause )
@@ -171,6 +172,10 @@ public class ResponseFuture<R extends Re
     }
 
 
+    /**
+     * Cancel the Future
+     *
+     */
     public void cancel()
     {
         // set the cancel flag first
@@ -178,7 +183,9 @@ public class ResponseFuture<R extends Re
     }
 
 
-    @Override
+    /**
+     * {@inheritDoc}
+     */
     public String toString()
     {
         StringBuilder sb = new StringBuilder();

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/AddNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/AddNoDResponse.java?rev=1005405&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/AddNoDResponse.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/AddNoDResponse.java
Thu Oct  7 10:49:45 2010
@@ -0,0 +1,106 @@
+/*
+ *  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.ldap.message.extended.nod;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.message.AddResponseImpl;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
+
+
+/**
+ * An extended operation intended for notifying clients of upcoming
+ * disconnection for the Add response. 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AddNoDResponse extends AddResponseImpl
+{
+    /** The OID of the NotiveOfDisconnect extended operation. */
+    public static final String EXTENSION_OID = NoticeOfDisconnect.EXTENSION_OID;
+
+    /** The empty response */
+    private static final byte[] EMPTY_RESPONSE = new byte[0];
+
+    /** The single instance with unavailable result code. */
+    public static final AddNoDResponse UNAVAILABLE = new AddNoDResponse( ResultCodeEnum.UNAVAILABLE
);
+
+    /** The single instance with protocolError result code. */
+    public static final AddNoDResponse PROTOCOLERROR = new AddNoDResponse( ResultCodeEnum.PROTOCOL_ERROR
);
+
+    /** The single instance with strongAuthRequired result code. */
+    public static final AddNoDResponse STRONGAUTHREQUIRED = new AddNoDResponse(
+        ResultCodeEnum.STRONG_AUTH_REQUIRED );
+
+
+    /**
+     * Creates a new instance of NoticeOfDisconnect.
+     */
+    private AddNoDResponse( ResultCodeEnum rcode )
+    {
+        super();
+
+        switch ( rcode )
+        {
+            case UNAVAILABLE:
+                break;
+
+            case PROTOCOL_ERROR:
+                break;
+
+            case STRONG_AUTH_REQUIRED:
+                break;
+
+            default:
+                throw new IllegalArgumentException( I18n.err( I18n.ERR_04166, ResultCodeEnum.UNAVAILABLE,
+                    ResultCodeEnum.PROTOCOL_ERROR, ResultCodeEnum.STRONG_AUTH_REQUIRED )
);
+        }
+
+        super.getLdapResult().setErrorMessage( rcode.toString() + ": The server will disconnect!"
);
+        super.getLdapResult().setMatchedDn( null );
+        super.getLdapResult().setResultCode( rcode );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // ExtendedResponse Interface Method Implementations
+    // ------------------------------------------------------------------------
+    /**
+     * Gets the reponse OID specific encoded response values.
+     * 
+     * @return the response specific encoded response values.
+     */
+    public byte[] getResponse()
+    {
+        return EMPTY_RESPONSE;
+    }
+
+
+    /**
+     * Gets the OID uniquely identifying this extended response (a.k.a. its
+     * name).
+     * 
+     * @return the OID of the extended response type.
+     */
+    public String getResponseName()
+    {
+        return EXTENSION_OID;
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/BindNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/BindNoDResponse.java?rev=1005405&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/BindNoDResponse.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/BindNoDResponse.java
Thu Oct  7 10:49:45 2010
@@ -0,0 +1,106 @@
+/*
+ *  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.ldap.message.extended.nod;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.message.BindResponseImpl;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
+
+
+/**
+ * An extended operation intended for notifying clients of upcoming
+ * disconnection for the Bind response. 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class BindNoDResponse extends BindResponseImpl
+{
+    /** The OID of the NotiveOfDisconnect extended operation. */
+    public static final String EXTENSION_OID = NoticeOfDisconnect.EXTENSION_OID;
+
+    /** The empty response */
+    private static final byte[] EMPTY_RESPONSE = new byte[0];
+
+    /** The single instance with unavailable result code. */
+    public static final BindNoDResponse UNAVAILABLE = new BindNoDResponse( ResultCodeEnum.UNAVAILABLE
);
+
+    /** The single instance with protocolError result code. */
+    public static final BindNoDResponse PROTOCOLERROR = new BindNoDResponse( ResultCodeEnum.PROTOCOL_ERROR
);
+
+    /** The single instance with strongAuthRequired result code. */
+    public static final BindNoDResponse STRONGAUTHREQUIRED = new BindNoDResponse(
+        ResultCodeEnum.STRONG_AUTH_REQUIRED );
+
+
+    /**
+     * Creates a new instance of NoticeOfDisconnect.
+     */
+    private BindNoDResponse( ResultCodeEnum rcode )
+    {
+        super();
+
+        switch ( rcode )
+        {
+            case UNAVAILABLE:
+                break;
+
+            case PROTOCOL_ERROR:
+                break;
+
+            case STRONG_AUTH_REQUIRED:
+                break;
+
+            default:
+                throw new IllegalArgumentException( I18n.err( I18n.ERR_04166, ResultCodeEnum.UNAVAILABLE,
+                    ResultCodeEnum.PROTOCOL_ERROR, ResultCodeEnum.STRONG_AUTH_REQUIRED )
);
+        }
+
+        super.getLdapResult().setErrorMessage( rcode.toString() + ": The server will disconnect!"
);
+        super.getLdapResult().setMatchedDn( null );
+        super.getLdapResult().setResultCode( rcode );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // ExtendedResponse Interface Method Implementations
+    // ------------------------------------------------------------------------
+    /**
+     * Gets the reponse OID specific encoded response values.
+     * 
+     * @return the response specific encoded response values.
+     */
+    public byte[] getResponse()
+    {
+        return EMPTY_RESPONSE;
+    }
+
+
+    /**
+     * Gets the OID uniquely identifying this extended response (a.k.a. its
+     * name).
+     * 
+     * @return the OID of the extended response type.
+     */
+    public String getResponseName()
+    {
+        return EXTENSION_OID;
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/CompareNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/CompareNoDResponse.java?rev=1005405&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/CompareNoDResponse.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/CompareNoDResponse.java
Thu Oct  7 10:49:45 2010
@@ -0,0 +1,106 @@
+/*
+ *  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.ldap.message.extended.nod;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.message.CompareResponseImpl;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
+
+
+/**
+ * An extended operation intended for notifying clients of upcoming
+ * disconnection for the Compare response. 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class CompareNoDResponse extends CompareResponseImpl
+{
+    /** The OID of the NotiveOfDisconnect extended operation. */
+    public static final String EXTENSION_OID = NoticeOfDisconnect.EXTENSION_OID;
+
+    /** The empty response */
+    private static final byte[] EMPTY_RESPONSE = new byte[0];
+
+    /** The single instance with unavailable result code. */
+    public static final CompareNoDResponse UNAVAILABLE = new CompareNoDResponse( ResultCodeEnum.UNAVAILABLE
);
+
+    /** The single instance with protocolError result code. */
+    public static final CompareNoDResponse PROTOCOLERROR = new CompareNoDResponse( ResultCodeEnum.PROTOCOL_ERROR
);
+
+    /** The single instance with strongAuthRequired result code. */
+    public static final CompareNoDResponse STRONGAUTHREQUIRED = new CompareNoDResponse(
+        ResultCodeEnum.STRONG_AUTH_REQUIRED );
+
+
+    /**
+     * Creates a new instance of NoticeOfDisconnect.
+     */
+    private CompareNoDResponse( ResultCodeEnum rcode )
+    {
+        super();
+
+        switch ( rcode )
+        {
+            case UNAVAILABLE:
+                break;
+
+            case PROTOCOL_ERROR:
+                break;
+
+            case STRONG_AUTH_REQUIRED:
+                break;
+
+            default:
+                throw new IllegalArgumentException( I18n.err( I18n.ERR_04166, ResultCodeEnum.UNAVAILABLE,
+                    ResultCodeEnum.PROTOCOL_ERROR, ResultCodeEnum.STRONG_AUTH_REQUIRED )
);
+        }
+
+        super.getLdapResult().setErrorMessage( rcode.toString() + ": The server will disconnect!"
);
+        super.getLdapResult().setMatchedDn( null );
+        super.getLdapResult().setResultCode( rcode );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // ExtendedResponse Interface Method Implementations
+    // ------------------------------------------------------------------------
+    /**
+     * Gets the reponse OID specific encoded response values.
+     * 
+     * @return the response specific encoded response values.
+     */
+    public byte[] getResponse()
+    {
+        return EMPTY_RESPONSE;
+    }
+
+
+    /**
+     * Gets the OID uniquely identifying this extended response (a.k.a. its
+     * name).
+     * 
+     * @return the OID of the extended response type.
+     */
+    public String getResponseName()
+    {
+        return EXTENSION_OID;
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/DeleteNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/DeleteNoDResponse.java?rev=1005405&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/DeleteNoDResponse.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/DeleteNoDResponse.java
Thu Oct  7 10:49:45 2010
@@ -0,0 +1,106 @@
+/*
+ *  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.ldap.message.extended.nod;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.message.DeleteResponseImpl;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
+
+
+/**
+ * An extended operation intended for notifying clients of upcoming
+ * disconnection for the Delete response. 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class DeleteNoDResponse extends DeleteResponseImpl
+{
+    /** The OID of the NotiveOfDisconnect extended operation. */
+    public static final String EXTENSION_OID = NoticeOfDisconnect.EXTENSION_OID;
+
+    /** The empty response */
+    private static final byte[] EMPTY_RESPONSE = new byte[0];
+
+    /** The single instance with unavailable result code. */
+    public static final DeleteNoDResponse UNAVAILABLE = new DeleteNoDResponse( ResultCodeEnum.UNAVAILABLE
);
+
+    /** The single instance with protocolError result code. */
+    public static final DeleteNoDResponse PROTOCOLERROR = new DeleteNoDResponse( ResultCodeEnum.PROTOCOL_ERROR
);
+
+    /** The single instance with strongAuthRequired result code. */
+    public static final DeleteNoDResponse STRONGAUTHREQUIRED = new DeleteNoDResponse(
+        ResultCodeEnum.STRONG_AUTH_REQUIRED );
+
+
+    /**
+     * Creates a new instance of NoticeOfDisconnect.
+     */
+    private DeleteNoDResponse( ResultCodeEnum rcode )
+    {
+        super();
+
+        switch ( rcode )
+        {
+            case UNAVAILABLE:
+                break;
+
+            case PROTOCOL_ERROR:
+                break;
+
+            case STRONG_AUTH_REQUIRED:
+                break;
+
+            default:
+                throw new IllegalArgumentException( I18n.err( I18n.ERR_04166, ResultCodeEnum.UNAVAILABLE,
+                    ResultCodeEnum.PROTOCOL_ERROR, ResultCodeEnum.STRONG_AUTH_REQUIRED )
);
+        }
+
+        super.getLdapResult().setErrorMessage( rcode.toString() + ": The server will disconnect!"
);
+        super.getLdapResult().setMatchedDn( null );
+        super.getLdapResult().setResultCode( rcode );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // ExtendedResponse Interface Method Implementations
+    // ------------------------------------------------------------------------
+    /**
+     * Gets the reponse OID specific encoded response values.
+     * 
+     * @return the response specific encoded response values.
+     */
+    public byte[] getResponse()
+    {
+        return EMPTY_RESPONSE;
+    }
+
+
+    /**
+     * Gets the OID uniquely identifying this extended response (a.k.a. its
+     * name).
+     * 
+     * @return the OID of the extended response type.
+     */
+    public String getResponseName()
+    {
+        return EXTENSION_OID;
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ExtendedNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ExtendedNoDResponse.java?rev=1005405&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ExtendedNoDResponse.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ExtendedNoDResponse.java
Thu Oct  7 10:49:45 2010
@@ -0,0 +1,109 @@
+/*
+ *  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.ldap.message.extended.nod;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.message.ExtendedResponseImpl;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
+
+
+/**
+ * An extended operation intended for notifying clients of upcoming
+ * disconnection for the Extended response. 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ExtendedNoDResponse extends ExtendedResponseImpl
+{
+    /** The serial version UID */
+    static final long serialVersionUID = 2L;
+
+    /** The OID of the NotiveOfDisconnect extended operation. */
+    public static final String EXTENSION_OID = NoticeOfDisconnect.EXTENSION_OID;
+
+    /** The empty response */
+    private static final byte[] EMPTY_RESPONSE = new byte[0];
+
+    /** The single instance with unavailable result code. */
+    public static final ExtendedNoDResponse UNAVAILABLE = new ExtendedNoDResponse( ResultCodeEnum.UNAVAILABLE
);
+
+    /** The single instance with protocolError result code. */
+    public static final ExtendedNoDResponse PROTOCOLERROR = new ExtendedNoDResponse( ResultCodeEnum.PROTOCOL_ERROR
);
+
+    /** The single instance with strongAuthRequired result code. */
+    public static final ExtendedNoDResponse STRONGAUTHREQUIRED = new ExtendedNoDResponse(
+        ResultCodeEnum.STRONG_AUTH_REQUIRED );
+
+
+    /**
+     * Creates a new instance of NoticeOfDisconnect.
+     */
+    private ExtendedNoDResponse( ResultCodeEnum rcode )
+    {
+        super( EXTENSION_OID );
+
+        switch ( rcode )
+        {
+            case UNAVAILABLE:
+                break;
+
+            case PROTOCOL_ERROR:
+                break;
+
+            case STRONG_AUTH_REQUIRED:
+                break;
+
+            default:
+                throw new IllegalArgumentException( I18n.err( I18n.ERR_04166, ResultCodeEnum.UNAVAILABLE,
+                    ResultCodeEnum.PROTOCOL_ERROR, ResultCodeEnum.STRONG_AUTH_REQUIRED )
);
+        }
+
+        super.getLdapResult().setErrorMessage( rcode.toString() + ": The server will disconnect!"
);
+        super.getLdapResult().setMatchedDn( null );
+        super.getLdapResult().setResultCode( rcode );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // ExtendedResponse Interface Method Implementations
+    // ------------------------------------------------------------------------
+    /**
+     * Gets the reponse OID specific encoded response values.
+     * 
+     * @return the response specific encoded response values.
+     */
+    public byte[] getResponse()
+    {
+        return EMPTY_RESPONSE;
+    }
+
+
+    /**
+     * Gets the OID uniquely identifying this extended response (a.k.a. its
+     * name).
+     * 
+     * @return the OID of the extended response type.
+     */
+    public String getResponseName()
+    {
+        return EXTENSION_OID;
+    }
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ModifyDnNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ModifyDnNoDResponse.java?rev=1005405&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ModifyDnNoDResponse.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ModifyDnNoDResponse.java
Thu Oct  7 10:49:45 2010
@@ -0,0 +1,106 @@
+/*
+ *  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.ldap.message.extended.nod;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.message.ModifyDnResponseImpl;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
+
+
+/**
+ * An extended operation intended for notifying clients of upcoming
+ * disconnection for the ModifyDn response. 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ModifyDnNoDResponse extends ModifyDnResponseImpl
+{
+    /** The OID of the NotiveOfDisconnect extended operation. */
+    public static final String EXTENSION_OID = NoticeOfDisconnect.EXTENSION_OID;
+
+    /** The empty response */
+    private static final byte[] EMPTY_RESPONSE = new byte[0];
+
+    /** The single instance with unavailable result code. */
+    public static final ModifyDnNoDResponse UNAVAILABLE = new ModifyDnNoDResponse( ResultCodeEnum.UNAVAILABLE
);
+
+    /** The single instance with protocolError result code. */
+    public static final ModifyDnNoDResponse PROTOCOLERROR = new ModifyDnNoDResponse( ResultCodeEnum.PROTOCOL_ERROR
);
+
+    /** The single instance with strongAuthRequired result code. */
+    public static final ModifyDnNoDResponse STRONGAUTHREQUIRED = new ModifyDnNoDResponse(
+        ResultCodeEnum.STRONG_AUTH_REQUIRED );
+
+
+    /**
+     * Creates a new instance of NoticeOfDisconnect.
+     */
+    private ModifyDnNoDResponse( ResultCodeEnum rcode )
+    {
+        super();
+
+        switch ( rcode )
+        {
+            case UNAVAILABLE:
+                break;
+
+            case PROTOCOL_ERROR:
+                break;
+
+            case STRONG_AUTH_REQUIRED:
+                break;
+
+            default:
+                throw new IllegalArgumentException( I18n.err( I18n.ERR_04166, ResultCodeEnum.UNAVAILABLE,
+                    ResultCodeEnum.PROTOCOL_ERROR, ResultCodeEnum.STRONG_AUTH_REQUIRED )
);
+        }
+
+        super.getLdapResult().setErrorMessage( rcode.toString() + ": The server will disconnect!"
);
+        super.getLdapResult().setMatchedDn( null );
+        super.getLdapResult().setResultCode( rcode );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // ExtendedResponse Interface Method Implementations
+    // ------------------------------------------------------------------------
+    /**
+     * Gets the reponse OID specific encoded response values.
+     * 
+     * @return the response specific encoded response values.
+     */
+    public byte[] getResponse()
+    {
+        return EMPTY_RESPONSE;
+    }
+
+
+    /**
+     * Gets the OID uniquely identifying this extended response (a.k.a. its
+     * name).
+     * 
+     * @return the OID of the extended response type.
+     */
+    public String getResponseName()
+    {
+        return EXTENSION_OID;
+    }
+}

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ModifyNoDResponse.java
(from r1005346, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/ModifyNoDResponse.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ModifyNoDResponse.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ModifyNoDResponse.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/ModifyNoDResponse.java&r1=1005346&r2=1005405&rev=1005405&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/ModifyNoDResponse.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/ModifyNoDResponse.java
Thu Oct  7 10:49:45 2010
@@ -17,22 +17,24 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.message.extended;
+package org.apache.directory.shared.ldap.message.extended.nod;
 
 
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.message.ModifyResponseImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
 
 
 /**
  * An extended operation intended for notifying clients of upcoming
- * disconnection. * @author <a href="mailto:dev@directory.apache.org">Apache Directory
Project</a>
+ * disconnection for the Modify response. 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class ModifyNoDResponse extends ModifyResponseImpl
 {
     /** The OID of the NotiveOfDisconnect extended operation. */
-    public static final String EXTENSION_OID = "1.3.6.1.4.1.1466.20036";
+    public static final String EXTENSION_OID = NoticeOfDisconnect.EXTENSION_OID;
 
     /** The empty response */
     private static final byte[] EMPTY_RESPONSE = new byte[0];
@@ -101,38 +103,4 @@ public class ModifyNoDResponse extends M
     {
         return EXTENSION_OID;
     }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int hashCode()
-    {
-        int hash = 37;
-        // Seems simple but look at the equals() method ...
-        hash = hash * 17 + getClass().getName().hashCode();
-
-        return hash;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean equals( Object obj )
-    {
-        if ( obj == this )
-        {
-            return true;
-        }
-
-        if ( obj instanceof ModifyNoDResponse )
-        {
-            return true;
-        }
-
-        return false;
-    }
 }

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/SearchNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/SearchNoDResponse.java?rev=1005405&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/SearchNoDResponse.java
(added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/nod/SearchNoDResponse.java
Thu Oct  7 10:49:45 2010
@@ -0,0 +1,106 @@
+/*
+ *  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.ldap.message.extended.nod;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.SearchResultDoneImpl;
+import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
+
+
+/**
+ * An extended operation intended for notifying clients of upcoming
+ * disconnection for the Search response. 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class SearchNoDResponse extends SearchResultDoneImpl
+{
+    /** The OID of the NotiveOfDisconnect extended operation. */
+    public static final String EXTENSION_OID = NoticeOfDisconnect.EXTENSION_OID;
+
+    /** The empty response */
+    private static final byte[] EMPTY_RESPONSE = new byte[0];
+
+    /** The single instance with unavailable result code. */
+    public static final SearchNoDResponse UNAVAILABLE = new SearchNoDResponse( ResultCodeEnum.UNAVAILABLE
);
+
+    /** The single instance with protocolError result code. */
+    public static final SearchNoDResponse PROTOCOLERROR = new SearchNoDResponse( ResultCodeEnum.PROTOCOL_ERROR
);
+
+    /** The single instance with strongAuthRequired result code. */
+    public static final SearchNoDResponse STRONGAUTHREQUIRED = new SearchNoDResponse(
+        ResultCodeEnum.STRONG_AUTH_REQUIRED );
+
+
+    /**
+     * Creates a new instance of NoticeOfDisconnect.
+     */
+    private SearchNoDResponse( ResultCodeEnum rcode )
+    {
+        super();
+
+        switch ( rcode )
+        {
+            case UNAVAILABLE:
+                break;
+
+            case PROTOCOL_ERROR:
+                break;
+
+            case STRONG_AUTH_REQUIRED:
+                break;
+
+            default:
+                throw new IllegalArgumentException( I18n.err( I18n.ERR_04166, ResultCodeEnum.UNAVAILABLE,
+                    ResultCodeEnum.PROTOCOL_ERROR, ResultCodeEnum.STRONG_AUTH_REQUIRED )
);
+        }
+
+        super.getLdapResult().setErrorMessage( rcode.toString() + ": The server will disconnect!"
);
+        super.getLdapResult().setMatchedDn( null );
+        super.getLdapResult().setResultCode( rcode );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // ExtendedResponse Interface Method Implementations
+    // ------------------------------------------------------------------------
+    /**
+     * Gets the reponse OID specific encoded response values.
+     * 
+     * @return the response specific encoded response values.
+     */
+    public byte[] getResponse()
+    {
+        return EMPTY_RESPONSE;
+    }
+
+
+    /**
+     * Gets the OID uniquely identifying this extended response (a.k.a. its
+     * name).
+     * 
+     * @return the OID of the extended response type.
+     */
+    public String getResponseName()
+    {
+        return EXTENSION_OID;
+    }
+}



Mime
View raw message