Save This Page
Home » j2ssh-0.2.9-src » com.sshtools.j2ssh.transport » [javadoc | source]
    1   /*
    2    *  SSHTools - Java SSH2 API
    3    *
    4    *  Copyright (C) 2002-2003 Lee David Painter and Contributors.
    5    *
    6    *  Contributions made by:
    7    *
    8    *  Brett Smith
    9    *  Richard Pernavas
   10    *  Erwin Bolwidt
   11    *
   12    *  This program is free software; you can redistribute it and/or
   13    *  modify it under the terms of the GNU General Public License
   14    *  as published by the Free Software Foundation; either version 2
   15    *  of the License, or (at your option) any later version.
   16    *
   17    *  This program is distributed in the hope that it will be useful,
   18    *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   19    *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   20    *  GNU General Public License for more details.
   21    *
   22    *  You should have received a copy of the GNU General Public License
   23    *  along with this program; if not, write to the Free Software
   24    *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
   25    */
   26   package com.sshtools.j2ssh.transport;
   27   
   28   import com.sshtools.j2ssh.util.State;
   29   
   30   
   31   /**
   32    * <p>
   33    * This class represents the state of a transport protocol service.
   34    * </p>
   35    *
   36    * @author Lee David Painter
   37    * @version $Revision: 1.24 $
   38    *
   39    * @since 0.2.0
   40    */
   41   public class ServiceState extends State {
   42       /** The service is unitialized */
   43       public final static int SERVICE_UNINITIALIZED = 1;
   44   
   45       /** The service has started and can send/recieve messages */
   46       public final static int SERVICE_STARTED = 2;
   47   
   48       /** The service has stopped and no messages can be sent or received */
   49       public final static int SERVICE_STOPPED = 3;
   50   
   51       /**
   52        * <p>
   53        * Constructs the state instance
   54        * </p>
   55        */
   56       public ServiceState() {
   57           super(SERVICE_UNINITIALIZED);
   58       }
   59   
   60       /**
   61        * <p>
   62        * Evaluates whether the state is valid.
   63        * </p>
   64        *
   65        * @param state
   66        *
   67        * @return
   68        *
   69        * @since 0.2.0
   70        */
   71       public boolean isValidState(int state) {
   72           return ((state == SERVICE_UNINITIALIZED) || (state == SERVICE_STARTED) ||
   73           (state == SERVICE_STOPPED));
   74       }
   75   }

Save This Page
Home » j2ssh-0.2.9-src » com.sshtools.j2ssh.transport » [javadoc | source]