com.sshtools.j2ssh.transport
Class ServiceState

java.lang.Object
  |
  +--com.sshtools.j2ssh.transport.ServiceState

public class ServiceState
extends java.lang.Object

When a service is requested the transport layer sends an SSH_MSG_SERVICE_REQUEST message to the remote computer. This state object is used to synchronize with the input stream thread so that the transport layer can synchronously return either a new instance of the requested service or deny the service request. The object is additionally used when starting the service to indicate whether in was instansiated due to a service request (i.e is in server mode) or by the completion of a service request and the subsequent receipt of a service accept.

Version:
1.0
Author:
Lee David Painter ( lee@sshtools.com )

Field Summary
static int SERVICE_ACCEPTED
          The service has been accepted
static int SERVICE_REQUESTED
          The service has been requested
 
Constructor Summary
ServiceState()
           Constructor for the SshServiceState object, defaults the state to service requested.
 
Method Summary
 int getState()
           Gets the current state of the service.
 void setState(int state)
           Sets the state of the service and notifys any waiting threads.
 void waitForServiceAccept()
           Synchronized method that will wait on the state untill the state has changed from SERVICE_REQUEST to SERVICE_ACCEPT.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_REQUESTED

public static final int SERVICE_REQUESTED
The service has been requested

See Also:
Constant Field Values

SERVICE_ACCEPTED

public static final int SERVICE_ACCEPTED
The service has been accepted

See Also:
Constant Field Values
Constructor Detail

ServiceState

public ServiceState()

Constructor for the SshServiceState object, defaults the state to service requested.

Method Detail

setState

public final void setState(int state)
                    throws InvalidStateException

Sets the state of the service and notifys any waiting threads.

Parameters:
state - The new state value
Throws:
InvalidStateException - Thrown if an attempt is made to set the state to anything other than the public static values of this class

getState

public int getState()

Gets the current state of the service.

Returns:
The state value

waitForServiceAccept

public void waitForServiceAccept()

Synchronized method that will wait on the state untill the state has changed from SERVICE_REQUEST to SERVICE_ACCEPT.



Copyright © 2002 Sshtools.com. All Rights Reserved.