01: /*
02: * SSHTools - Java SSH2 API
03: *
04: * Copyright (C) 2002-2003 Lee David Painter and Contributors.
05: *
06: * Contributions made by:
07: *
08: * Brett Smith
09: * 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: * <p>
32: * This class represents the state of a transport protocol service.
33: * </p>
34: *
35: * @author Lee David Painter
36: * @version $Revision: 1.24 $
37: *
38: * @since 0.2.0
39: */
40: public class ServiceState extends State {
41: /** The service is unitialized */
42: public final static int SERVICE_UNINITIALIZED = 1;
43:
44: /** The service has started and can send/recieve messages */
45: public final static int SERVICE_STARTED = 2;
46:
47: /** The service has stopped and no messages can be sent or received */
48: public final static int SERVICE_STOPPED = 3;
49:
50: /**
51: * <p>
52: * Constructs the state instance
53: * </p>
54: */
55: public ServiceState() {
56: super (SERVICE_UNINITIALIZED);
57: }
58:
59: /**
60: * <p>
61: * Evaluates whether the state is valid.
62: * </p>
63: *
64: * @param state
65: *
66: * @return
67: *
68: * @since 0.2.0
69: */
70: public boolean isValidState(int state) {
71: return ((state == SERVICE_UNINITIALIZED)
72: || (state == SERVICE_STARTED) || (state == SERVICE_STOPPED));
73: }
74: }
|