001    /*
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *  
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *  
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License. 
018     *  
019     */
020    package org.apache.directory.shared.ldap.codec.controls;
021    
022    
023    import java.nio.ByteBuffer;
024    
025    import org.apache.directory.shared.asn1.AbstractAsn1Object;
026    import org.apache.directory.shared.asn1.codec.EncoderException;
027    
028    
029    /**
030     * Control which allows for the management of referrals and other DSA specific
031     * entities without processing them: meaning the referrals are treated as
032     * regular entries using this control. More information is available in <a
033     * href="">RFC 3296</a>. Below we have included section 3 of the RFC describing
034     * this control:
035     * 
036     * <pre>
037     *  3.  The ManageDsaIT Control
038     * 
039     *   The client may provide the ManageDsaIT control with an operation to
040     *   indicate that the operation is intended to manage objects within the
041     *   DSA (server) Information Tree.  The control causes Directory-specific
042     *   entries (DSEs), regardless of type, to be treated as normal entries
043     *   allowing clients to interrogate and update these entries using LDAP
044     *   operations.
045     * 
046     *   A client MAY specify the following control when issuing an add,
047     *   compare, delete, modify, modifyDN, search request or an extended
048     *   operation for which the control is defined.
049     * 
050     *   The control type is 2.16.840.1.113730.3.4.2.  The control criticality
051     *   may be TRUE or, if FALSE, absent.  The control value is absent.
052     * 
053     *   When the control is present in the request, the server SHALL NOT
054     *   generate a referral or continuation reference based upon information
055     *   held in referral objects and instead SHALL treat the referral object
056     *   as a normal entry.  The server, however, is still free to return
057     *   referrals for other reasons.  When not present, referral objects
058     *   SHALL be handled as described above.
059     * 
060     *   The control MAY cause other objects to be treated as normal entries
061     *   as defined by subsequent documents.
062     * </pre>
063     * 
064     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
065     * @version $Rev: 602753 $
066     */
067    public class ManageDsaITControlCodec extends AbstractAsn1Object
068    {
069        private static final ByteBuffer EMPTY_BUFFER = ByteBuffer.allocate( 0 );
070    
071        /**
072         * Default constructor
073         *
074         */
075        public ManageDsaITControlCodec()
076        {
077            super();
078        }
079    
080        /**
081         * Returns 0 everytime.
082         */
083        public int computeLength()
084        {
085            return 0;
086        }
087    
088    
089        /**
090         * Encodes the control: does nothing but returns an empty buffer.
091         */
092        public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
093        {
094            return EMPTY_BUFFER;
095        }
096    }