You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2011/02/10 04:17:57 UTC
svn commit: r1069210 - in /directory:
apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/partition/
apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/
apacheds/branches/m1/protocol-ldap/src/main/jav...
Author: akarasulu
Date: Thu Feb 10 03:17:50 2011
New Revision: 1069210
URL: http://svn.apache.org/viewvc?rev=1069210&view=rev
Log:
Fix for DIRSHARED-84:
o These notice of disconnect based extended responses issued for the various
LDAP operations, bind, compare, modify etc have no specific dependencies
outside of the model.
o Hence it makes sense to push them back into the model, under the message
package's extended sub-package. Previously they were located under the
codec's messages package.
o They aught to be public, and hence visible since they're part of the std.
message model without anything specific to ApacheDS or Studio.
Added:
directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/
directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/AddNoDResponse.java
directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/BindNoDResponse.java
directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/CompareNoDResponse.java
directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/DeleteNoDResponse.java
directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ExtendedNoDResponse.java
directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ModifyDnNoDResponse.java
directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ModifyNoDResponse.java
directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/NoticeOfDisconnect.java
directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/SearchNoDResponse.java
Removed:
directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/AddNoDResponse.java
directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/BindNoDResponse.java
directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/CompareNoDResponse.java
directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/DeleteNoDResponse.java
directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ExtendedNoDResponse.java
directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ModifyDnNoDResponse.java
directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/ModifyNoDResponse.java
directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/NoticeOfDisconnect.java
directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/SearchNoDResponse.java
Modified:
directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java
directory/shared/branches/m1/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/GracefulDisconnect.java
Modified: directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=1069210&r1=1069209&r2=1069210&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Thu Feb 10 03:17:50 2011
@@ -57,7 +57,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.shared.ldap.extras.extended.NoticeOfDisconnect;
+import org.apache.directory.shared.ldap.model.message.extended.NoticeOfDisconnect;
import org.apache.directory.shared.ldap.model.message.controls.Cascade;
import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
import org.apache.directory.shared.ldap.extras.controls.SyncDoneValue;
Modified: directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java?rev=1069210&r1=1069209&r2=1069210&view=diff
==============================================================================
--- directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java (original)
+++ directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java Thu Feb 10 03:17:50 2011
@@ -23,7 +23,7 @@ package org.apache.directory.server.ldap
import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
import org.apache.directory.shared.ldap.codec.api.BinaryAttributeDetector;
import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
-import org.apache.directory.shared.ldap.extras.extended.NoticeOfDisconnect;
+import org.apache.directory.shared.ldap.model.message.extended.NoticeOfDisconnect;
import org.apache.directory.shared.ldap.model.exception.ResponseCarryingMessageException;
import org.apache.directory.shared.ldap.model.message.Control;
import org.apache.directory.shared.ldap.model.message.ExtendedRequest;
Modified: directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=1069210&r1=1069209&r2=1069210&view=diff
==============================================================================
--- directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java (original)
+++ directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java Thu Feb 10 03:17:50 2011
@@ -64,7 +64,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.extras.controls.SyncInfoValue;
import org.apache.directory.shared.ldap.extras.controls.SyncRequestValue;
import org.apache.directory.shared.ldap.extras.controls.SyncStateValue;
-import org.apache.directory.shared.ldap.extras.extended.NoticeOfDisconnect;
+import org.apache.directory.shared.ldap.model.message.extended.NoticeOfDisconnect;
import org.apache.directory.shared.ldap.model.constants.SaslQoP;
import org.apache.directory.shared.ldap.model.exception.LdapConfigurationException;
import org.apache.directory.shared.ldap.model.message.AbandonRequest;
Modified: directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java?rev=1069210&r1=1069209&r2=1069210&view=diff
==============================================================================
--- directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java (original)
+++ directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java Thu Feb 10 03:17:50 2011
@@ -36,7 +36,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.extras.extended.GracefulDisconnect;
import org.apache.directory.shared.ldap.extras.extended.GracefulShutdownRequest;
import org.apache.directory.shared.ldap.extras.extended.GracefulShutdownResponse;
-import org.apache.directory.shared.ldap.extras.extended.NoticeOfDisconnect;
+import org.apache.directory.shared.ldap.model.message.extended.NoticeOfDisconnect;
import org.apache.mina.core.future.WriteFuture;
import org.apache.mina.core.service.IoAcceptor;
import org.apache.mina.core.session.IoSession;
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=1069210&r1=1069209&r2=1069210&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 10 03:17:50 2011
@@ -60,13 +60,9 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
import org.apache.directory.shared.ldap.codec.api.MessageEncoderException;
-import org.apache.directory.shared.ldap.extras.extended.*;
-import org.apache.directory.shared.ldap.extras.extended.AddNoDResponse;
-import org.apache.directory.shared.ldap.extras.extended.CompareNoDResponse;
-import org.apache.directory.shared.ldap.extras.extended.DeleteNoDResponse;
-import org.apache.directory.shared.ldap.extras.extended.ExtendedNoDResponse;
-import org.apache.directory.shared.ldap.extras.extended.ModifyDnNoDResponse;
-import org.apache.directory.shared.ldap.extras.extended.SearchNoDResponse;
+import org.apache.directory.shared.ldap.model.message.extended.AddNoDResponse;
+import org.apache.directory.shared.ldap.model.message.extended.*;
+import org.apache.directory.shared.ldap.model.message.extended.ModifyDnNoDResponse;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.constants.SupportedSaslMechanisms;
import org.apache.directory.shared.ldap.model.cursor.Cursor;
@@ -121,6 +117,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.OpaqueControl;
+import org.apache.directory.shared.ldap.model.message.extended.SearchNoDResponse;
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;
@@ -2063,7 +2060,7 @@ public class LdapNetworkConnection exten
}
else
{
- if ( modifyResponse instanceof ModifyNoDResponse )
+ if ( modifyResponse instanceof ModifyNoDResponse)
{
// A NoticeOfDisconnect : deserves a special treatment
throw new LdapException( modifyResponse.getLdapResult().getErrorMessage() );
Modified: directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/GracefulDisconnect.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/GracefulDisconnect.java?rev=1069210&r1=1069209&r2=1069210&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/GracefulDisconnect.java (original)
+++ directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/GracefulDisconnect.java Thu Feb 10 03:17:50 2011
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
/**
* An unsolicited notification, extended response, intended for notifying
* clients of upcoming disconnection due to intended service windows. Unlike the
- * {@link NoticeOfDisconnect} this response contains additional information about
+ * {@link org.apache.directory.shared.ldap.model.message.extended.NoticeOfDisconnect} this response contains additional information about
* the amount of time the server will be offline and exactly when it intends to
* shutdown.
*
Added: directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/AddNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/AddNoDResponse.java?rev=1069210&view=auto
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/AddNoDResponse.java (added)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/AddNoDResponse.java Thu Feb 10 03:17:50 2011
@@ -0,0 +1,105 @@
+/*
+ * 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.model.message.extended;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.message.AddResponseImpl;
+import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+
+
+/**
+ * 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/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/BindNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/BindNoDResponse.java?rev=1069210&view=auto
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/BindNoDResponse.java (added)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/BindNoDResponse.java Thu Feb 10 03:17:50 2011
@@ -0,0 +1,105 @@
+/*
+ * 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.model.message.extended;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.message.BindResponseImpl;
+import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+
+
+/**
+ * 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/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/CompareNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/CompareNoDResponse.java?rev=1069210&view=auto
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/CompareNoDResponse.java (added)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/CompareNoDResponse.java Thu Feb 10 03:17:50 2011
@@ -0,0 +1,105 @@
+/*
+ * 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.model.message.extended;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.message.CompareResponseImpl;
+import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+
+
+/**
+ * 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/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/DeleteNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/DeleteNoDResponse.java?rev=1069210&view=auto
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/DeleteNoDResponse.java (added)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/DeleteNoDResponse.java Thu Feb 10 03:17:50 2011
@@ -0,0 +1,105 @@
+/*
+ * 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.model.message.extended;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.message.DeleteResponseImpl;
+import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+
+
+/**
+ * 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/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ExtendedNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ExtendedNoDResponse.java?rev=1069210&view=auto
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ExtendedNoDResponse.java (added)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ExtendedNoDResponse.java Thu Feb 10 03:17:50 2011
@@ -0,0 +1,108 @@
+/*
+ * 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.model.message.extended;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.message.ExtendedResponseImpl;
+import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+
+
+/**
+ * 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/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ModifyDnNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ModifyDnNoDResponse.java?rev=1069210&view=auto
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ModifyDnNoDResponse.java (added)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ModifyDnNoDResponse.java Thu Feb 10 03:17:50 2011
@@ -0,0 +1,105 @@
+/*
+ * 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.model.message.extended;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.message.ModifyDnResponseImpl;
+import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+
+
+/**
+ * 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;
+ }
+}
Added: directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ModifyNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ModifyNoDResponse.java?rev=1069210&view=auto
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ModifyNoDResponse.java (added)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/ModifyNoDResponse.java Thu Feb 10 03:17:50 2011
@@ -0,0 +1,105 @@
+/*
+ * 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.model.message.extended;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.message.ModifyResponseImpl;
+import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+
+
+/**
+ * An extended operation intended for notifying clients of upcoming
+ * 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 = 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 ModifyNoDResponse UNAVAILABLE = new ModifyNoDResponse( ResultCodeEnum.UNAVAILABLE );
+
+ /** The single instance with protocolError result code. */
+ public static final ModifyNoDResponse PROTOCOLERROR = new ModifyNoDResponse( ResultCodeEnum.PROTOCOL_ERROR );
+
+ /** The single instance with strongAuthRequired result code. */
+ public static final ModifyNoDResponse STRONGAUTHREQUIRED = new ModifyNoDResponse(
+ ResultCodeEnum.STRONG_AUTH_REQUIRED );
+
+
+ /**
+ * Creates a new instance of NoticeOfDisconnect.
+ */
+ private ModifyNoDResponse( 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/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/NoticeOfDisconnect.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/NoticeOfDisconnect.java?rev=1069210&view=auto
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/NoticeOfDisconnect.java (added)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/NoticeOfDisconnect.java Thu Feb 10 03:17:50 2011
@@ -0,0 +1,233 @@
+/*
+ * 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.model.message.extended;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.message.ExtendedResponseImpl;
+import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+
+
+/**
+ * An extended operation intended for notifying clients of upcoming
+ * disconnection. Here's what <a
+ * href="http://www.faqs.org/rfcs/rfc2251.html">RFC 2251</a> has to say about
+ * it:
+ *
+ * <pre>
+ * Section 4.1.1 (Small snippet on sending NoD)
+ *
+ * If the server receives a PDU from the client in which the LDAPMessage
+ * SEQUENCE tag cannot be recognized, the messageID cannot be parsed,
+ * the tag of the protocolOp is not recognized as a request, or the
+ * encoding structures or lengths of data fields are found to be
+ * incorrect, then the server MUST return the notice of disconnection
+ * described in section 4.4.1, with resultCode protocolError, and
+ * immediately close the connection. In other cases that the server
+ * cannot parse the request received by the client, the server MUST
+ * return an appropriate response to the request, with the resultCode
+ * set to protocolError.
+ *
+ * ...
+ *
+ * 4.4. Unsolicited Notification
+ *
+ * An unsolicited notification is an LDAPMessage sent from the server to
+ * the client which is not in response to any LDAPMessage received by
+ * the server. It is used to signal an extraordinary condition in the
+ * server or in the connection between the client and the server. The
+ * notification is of an advisory nature, and the server will not expect
+ * any response to be returned from the client.
+ *
+ * The unsolicited notification is structured as an LDAPMessage in which
+ * the messageID is 0 and protocolOp is of the extendedResp form. The
+ * responseName field of the ExtendedResponse is present. The LDAPOID
+ * value MUST be unique for this notification, and not be used in any
+ * other situation.
+ *
+ * One unsolicited notification is defined in this document.
+ *
+ * 4.4.1. Notice of Disconnection
+ *
+ * This notification may be used by the server to advise the client that
+ * the server is about to close the connection due to an error
+ * condition. Note that this notification is NOT a response to an
+ * unbind requested by the client: the server MUST follow the procedures
+ * of section 4.3. This notification is intended to assist clients in
+ * distinguishing between an error condition and a transient network
+ * failure. As with a connection close due to network failure, the
+ * client MUST NOT assume that any outstanding requests which modified
+ * the directory have succeeded or failed.
+ *
+ * The responseName is 1.3.6.1.4.1.1466.20036, the response field is
+ * absent, and the resultCode is used to indicate the reason for the
+ * disconnection.
+ *
+ * The following resultCode values are to be used in this notification:
+ *
+ * - protocolError: The server has received data from the client in
+ * which the LDAPMessage structure could not be parsed.
+ *
+ * - strongAuthRequired: The server has detected that an established
+ * underlying security association protecting communication between
+ * the client and server has unexpectedly failed or been compromised.
+ *
+ * - unavailable: This server will stop accepting new connections and
+ * operations on all existing connections, and be unavailable for an
+ * extended period of time. The client may make use of an alternative
+ * server.
+ *
+ * After sending this notice, the server MUST close the connection.
+ * After receiving this notice, the client MUST NOT transmit any further
+ * on the connection, and may abruptly close the connection.
+ * </pre>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public final class NoticeOfDisconnect extends ExtendedResponseImpl
+{
+ /** The serialVersionUID. */
+ private static final long serialVersionUID = -4682291068700593492L;
+
+ /** The OID of the NotiveOfDisconnect extended operation. */
+ public static final String EXTENSION_OID = "1.3.6.1.4.1.1466.20036";
+
+ /** The empty response */
+ private static final byte[] EMPTY_RESPONSE = new byte[0];
+
+ /** The single instance with unavailable result code. */
+ public static final NoticeOfDisconnect UNAVAILABLE = new NoticeOfDisconnect( ResultCodeEnum.UNAVAILABLE );
+
+ /** The single instance with protocolError result code. */
+ public static final NoticeOfDisconnect PROTOCOLERROR = new NoticeOfDisconnect( ResultCodeEnum.PROTOCOL_ERROR );
+
+ /** The single instance with strongAuthRequired result code. */
+ public static final NoticeOfDisconnect STRONGAUTHREQUIRED = new NoticeOfDisconnect(
+ ResultCodeEnum.STRONG_AUTH_REQUIRED );
+
+
+ /**
+ * Creates a new instance of NoticeOfDisconnect.
+ */
+ private NoticeOfDisconnect( ResultCodeEnum rcode )
+ {
+ super( 0, 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;
+ }
+
+
+ /**
+ * Sets the response OID specific encoded response values.
+ *
+ * @param value the response specific encoded response values.
+ */
+ public void setResponse( byte[] value )
+ {
+ throw new UnsupportedOperationException( I18n.err( I18n.ERR_04173 ) );
+ }
+
+
+ /**
+ * 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;
+ }
+
+
+ /**
+ * Sets the OID uniquely identifying this extended response (a.k.a. its
+ * name).
+ *
+ * @param oid
+ * the OID of the extended response type.
+ */
+ public void setResponseName( String oid )
+ {
+ throw new UnsupportedOperationException( I18n.err( I18n.ERR_04168, 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;
+ }
+
+ return ( obj instanceof NoticeOfDisconnect );
+ }
+}
Added: directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/SearchNoDResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/SearchNoDResponse.java?rev=1069210&view=auto
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/SearchNoDResponse.java (added)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/message/extended/SearchNoDResponse.java Thu Feb 10 03:17:50 2011
@@ -0,0 +1,105 @@
+/*
+ * 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.model.message.extended;
+
+
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.model.message.SearchResultDoneImpl;
+
+
+/**
+ * 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;
+ }
+}