directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r373299 - /directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/message/extended/GracefulShutdownResponse.java
Date Sun, 29 Jan 2006 09:20:37 GMT
Author: akarasulu
Date: Sun Jan 29 01:20:34 2006
New Revision: 373299

URL: http://svn.apache.org/viewcvs?rev=373299&view=rev
Log:
adding the JNDI compatible representations of codec objects for graceful shutdowns

Added:
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/message/extended/GracefulShutdownResponse.java
  (with props)

Added: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/message/extended/GracefulShutdownResponse.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/message/extended/GracefulShutdownResponse.java?rev=373299&view=auto
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/message/extended/GracefulShutdownResponse.java
(added)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/message/extended/GracefulShutdownResponse.java
Sun Jan 29 01:20:34 2006
@@ -0,0 +1,135 @@
+/*
+ *   Copyright 2006 The Apache Software Foundation
+ *
+ *   Licensed 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.ldap.common.message.extended;
+
+
+import org.apache.ldap.common.message.ExtendedResponseImpl;
+import org.apache.ldap.common.message.ResultCodeEnum;
+
+
+/**
+ * The response sent back from the server when a {@see GracefulShutdownRequest}
+ * extended operation is sent.  Delivery of this response may block until all
+ * connected clients are sent a GracefulDisconnect unsolicited notification.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class GracefulShutdownResponse extends ExtendedResponseImpl
+{
+    private static final long serialVersionUID = -3824715470944544189L;
+    public static final String EXTENSION_OID = "1.2.6.1.4.1.18060.1.1.1.100.4";
+    private static final byte[] EMPTY_RESPONSE = new byte[0];
+    
+    
+    public GracefulShutdownResponse( int messageId, ResultCodeEnum rcode )
+    {
+        super( messageId );
+        
+        switch ( rcode.getValue() )
+        {
+            case( ResultCodeEnum.SUCCESS_VAL ):
+                break;
+            case( ResultCodeEnum.OPERATIONSERROR_VAL ):
+                break;
+            case( ResultCodeEnum.INSUFFICIENTACCESSRIGHTS_VAL ):
+                break;
+            default:
+                throw new IllegalArgumentException( "The result code can only be one of:
" + 
+                    ResultCodeEnum.SUCCESS + ", " + 
+                    ResultCodeEnum.OPERATIONSERROR + ", " + 
+                    ResultCodeEnum.INSUFFICIENTACCESSRIGHTS );
+        }
+        super.getLdapResult().setMatchedDn( "" );
+        super.getLdapResult().setResultCode( rcode );
+    }
+    
+    
+    public GracefulShutdownResponse( int messageId )
+    {
+        super( messageId );
+        super.getLdapResult().setMatchedDn( "" );
+        super.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
+    }
+    
+    
+    // ------------------------------------------------------------------------
+    // 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 reponse OID specific encoded response values.
+     *
+     * @param value the response specific encoded response values.
+     */
+    public void setResponse( byte [] value )
+    {
+        throw new UnsupportedOperationException( "the response is hardcoded as zero length
array" );
+    }
+
+
+    /**
+     * 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( "the OID is fixed: " + EXTENSION_OID );
+    }
+
+
+    public boolean equals( Object obj )
+    {
+        if ( obj == this )
+        {
+            return true;
+        }
+
+        if ( obj instanceof GracefulShutdownResponse )
+        {
+            return true;
+        }
+
+        return false;
+    }
+}

Propchange: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/message/extended/GracefulShutdownResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message