org.globus.gram
Class CallbackHandler

java.lang.Object
  extended by org.globus.net.BaseServer
      extended by org.globus.gram.CallbackHandler
All Implemented Interfaces:
java.lang.Runnable

public class CallbackHandler
extends BaseServer

The Server class acts as a basic multi-threaded HTTPS server.

Version:
$Revision: 1.31 $

Field Summary
 
Fields inherited from class org.globus.net.BaseServer
_server, accept, authorization, credentials, deactivator, gssMode, SO_TIMEOUT, timeout, url
 
Constructor Summary
CallbackHandler()
          Construct a GRAM callback handler with default user credentials.
CallbackHandler(org.ietf.jgss.GSSCredential cred, int port)
          Construct a GRAM callback handler with specifed credentials and given port.
 
Method Summary
protected  GramJob getJob(java.lang.String url)
           
 int getRegisteredJobsSize()
          Returns number of registered jobs
 java.lang.String getURL()
          Returns url of this server
protected  void handleConnection(java.net.Socket socket)
          This method needs to be implemented by subclasses.
 void registerJob(GramJob job)
          Registers gram job to listen for status updates
 void unregisterJob(GramJob job)
          Unregisters gram job from listening to status updates
 
Methods inherited from class org.globus.net.BaseServer
getCredentials, getHost, getHostname, getPort, getProtocol, getTimeout, initialize, registerDefaultDeactivator, run, setAuthorization, setGssMode, setTimeout, shutdown, start, unregisterDefaultDeactivator, wrapSocket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallbackHandler

public CallbackHandler()
                throws java.io.IOException
Construct a GRAM callback handler with default user credentials. Port will be dynamically assigned.

Throws:
java.io.IOException

CallbackHandler

public CallbackHandler(org.ietf.jgss.GSSCredential cred,
                       int port)
                throws java.io.IOException
Construct a GRAM callback handler with specifed credentials and given port.

Parameters:
cred - credentials to use. if null default user credentials will be used
port - server port to listen on. if set to 0 the port will be dynamically assigned
Throws:
java.io.IOException
Method Detail

registerJob

public void registerJob(GramJob job)
Registers gram job to listen for status updates

Parameters:
job - gram job

unregisterJob

public void unregisterJob(GramJob job)
Unregisters gram job from listening to status updates

Parameters:
job - gram job

getJob

protected GramJob getJob(java.lang.String url)

getRegisteredJobsSize

public int getRegisteredJobsSize()
Returns number of registered jobs

Returns:
int number of jobs

getURL

public java.lang.String getURL()
Description copied from class: BaseServer
Returns url of this server

Overrides:
getURL in class BaseServer
Returns:
url of this server

handleConnection

protected void handleConnection(java.net.Socket socket)
Description copied from class: BaseServer
This method needs to be implemented by subclasses. Optimmaly, it should be a non-blocking call starting a separate thread to handle the client. Note that to start an SSL handshake, you need to call socket.getInput(Output) stream().

Specified by:
handleConnection in class BaseServer