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    
021    package org.apache.directory.shared.ldap.codec.extended.operations;
022    
023    
024    import org.apache.directory.shared.asn1.AbstractAsn1Object;
025    
026    
027    /**
028     * A common class for graceful Disconnect and Shutdown extended operations.
029     * 
030     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
031     * @version $Rev: 664290 $, $Date: 2008-06-07 08:28:06 +0200 (Sat, 07 Jun 2008) $, 
032     */
033    public abstract class GracefulAction extends AbstractAsn1Object
034    {
035        /** Undetermined value used for timeOffline */
036        public static final int UNDETERMINED = 0;
037    
038        /** The shutdown is immediate */
039        public static final int NOW = 0;
040    
041        /** offline Time after disconnection */
042        protected int timeOffline = UNDETERMINED;
043    
044        /** Delay before disconnection */
045        protected int delay = NOW;
046    
047    
048        /**
049         * Default constructor. The time offline will be set to UNDETERMINED and
050         * there is no delay.
051         */
052        public GracefulAction()
053        {
054            super();
055        }
056    
057    
058        /**
059         * Create a GracefulAction object, with a timeOffline and a delay
060         * 
061         * @param timeOffline The time the server will be offline
062         * @param delay The delay before the disconnection
063         */
064        public GracefulAction( int timeOffline, int delay )
065        {
066            super();
067            this.timeOffline = timeOffline;
068            this.delay = delay;
069        }
070    
071    
072        public int getDelay()
073        {
074            return delay;
075        }
076    
077    
078        public void setDelay( int delay )
079        {
080            this.delay = delay;
081        }
082    
083    
084        public int getTimeOffline()
085        {
086            return timeOffline;
087        }
088    
089    
090        public void setTimeOffline( int timeOffline )
091        {
092            this.timeOffline = timeOffline;
093        }
094    }