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    
024    
025    /**
026     * Control which allows for the management of referrals and other DSA specific
027     * entities without processing them: meaning the referrals are treated as
028     * regular entries using this control. More information is available in <a
029     * href="">RFC 3296</a>. Below we have included section 3 of the RFC describing
030     * this control:
031     * 
032     * <pre>
033     *  3.  The ManageDsaIT Control
034     * 
035     *   The client may provide the ManageDsaIT control with an operation to
036     *   indicate that the operation is intended to manage objects within the
037     *   DSA (server) Information Tree.  The control causes Directory-specific
038     *   entries (DSEs), regardless of type, to be treated as normal entries
039     *   allowing clients to interrogate and update these entries using LDAP
040     *   operations.
041     * 
042     *   A client MAY specify the following control when issuing an add,
043     *   compare, delete, modify, modifyDN, search request or an extended
044     *   operation for which the control is defined.
045     * 
046     *   The control type is 2.16.840.1.113730.3.4.2.  The control criticality
047     *   may be TRUE or, if FALSE, absent.  The control value is absent.
048     * 
049     *   When the control is present in the request, the server SHALL NOT
050     *   generate a referral or continuation reference based upon information
051     *   held in referral objects and instead SHALL treat the referral object
052     *   as a normal entry.  The server, however, is still free to return
053     *   referrals for other reasons.  When not present, referral objects
054     *   SHALL be handled as described above.
055     * 
056     *   The control MAY cause other objects to be treated as normal entries
057     *   as defined by subsequent documents.
058     * </pre>
059     * 
060     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
061     * @version $Rev: 905338 $
062     */
063    public class ManageDsaITControl  extends AbstractControl
064    {
065        /** This control OID */
066        public static final String CONTROL_OID = "2.16.840.1.113730.3.4.2";
067    
068        /**
069         * Default constructor
070         *
071         */
072        public ManageDsaITControl()
073        {
074            super( CONTROL_OID );
075            
076            decoder = new ManageDsaITControlDecoder();
077        }
078    
079        /**
080         * Returns 0 every time.
081         */
082        public int computeLength()
083        {
084            // Call the super class to compute the global control length
085            return super.computeLength( 0 );
086        }
087    
088    
089        /**
090         * Return a String representing this ManageDsaIt Control.
091         */
092        public String toString()
093        {
094            StringBuffer sb = new StringBuffer();
095    
096            sb.append( "    ManageDsaIt Control\n" );
097            sb.append( "        oid : " ).append( getOid() ).append( '\n' );
098            sb.append( "        critical : " ).append( isCritical() ).append( '\n' );
099            
100            return sb.toString();
101        }
102    }