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.message.control;
021    
022    import org.apache.directory.shared.ldap.message.InternalControl;
023    
024    
025    /**
026     * Control implementation.
027     * 
028     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
029     * @version $Rev: 764131 $
030     */
031    public abstract class InternalAbstractControl implements InternalControl
032    {
033        /** Unique object identifier for this control */
034        private String oid;
035    
036        /** Flag for control criticality */
037        private boolean isCritical;
038    
039    
040        // ------------------------------------------------------------------------
041        // Control Interface Method Implementations
042        // ------------------------------------------------------------------------
043    
044        /**
045         * Determines whether or not this control is critical for the correct
046         * operation of a request or response message. The default for this value
047         * should be false.
048         * 
049         * @return true if the control is critical false otherwise.
050         */
051        public boolean isCritical()
052        {
053            return this.isCritical;
054        }
055    
056    
057        /**
058         * Sets the critical flag which determines whether or not this control is
059         * critical for the correct operation of a request or response message. The
060         * default for this value should be false.
061         * 
062         * @param isCritical
063         *            true if the control is critical false otherwise.
064         */
065        public void setCritical( boolean isCritical )
066        {
067            this.isCritical = isCritical;
068        }
069    
070    
071        /**
072         * Sets the OID of the Control to identify the control type.
073         * 
074         * @param oid
075         *            the OID of this Control.
076         */
077        public void setID( String oid )
078        {
079            this.oid = oid;
080        }
081    
082    
083        /**
084         * Retrieves the object identifier assigned for the LDAP control.
085         * 
086         * @return The non-null object identifier string.
087         */
088        public String getID()
089        {
090            return this.oid;
091        }
092    }