org.globus.io.gass.server
Class GassServer

java.lang.Object
  extended by org.globus.net.BaseServer
      extended by org.globus.io.gass.server.GassServer
All Implemented Interfaces:
java.lang.Runnable

public class GassServer
extends BaseServer

The GassServer class acts as a basic multi-threaded HTTPS server that handles GASS requests.

Version:
$Revision 1.21 $

Field Summary
static int CLIENT_SHUTDOWN_ENABLE
           
static int READ_ENABLE
           
static java.lang.String SHUTDOWN_STR
           
static int STDERR_ENABLE
           
static int STDOUT_ENABLE
           
static int WRITE_ENABLE
           
 
Fields inherited from class org.globus.net.BaseServer
_server, accept, authorization, credentials, deactivator, gssMode, SO_TIMEOUT, timeout, url
 
Constructor Summary
GassServer()
          Starts Gass Server with default user credentials.
GassServer(boolean secure, int port)
          Starts Gass Server on given port and mode.
GassServer(org.ietf.jgss.GSSCredential cred, int port)
          Starts Gass Server on given port and given credentials.
GassServer(int port)
          Starts Gass Server on given port with default user credentials.
 
Method Summary
protected  java.io.OutputStream getJobOutputStream(java.lang.String id)
           
 int getOptions()
          Returns current options of the server.
protected  void handleConnection(java.net.Socket socket)
          This method needs to be implemented by subclasses.
 void registerJobOutputStream(java.lang.String lb, java.io.OutputStream out)
          Registers a output stream with a job.
 void setOptions(int options)
          Sets the options of the gass server such as enabling client shutdown, etc.
static void shutdown(org.ietf.jgss.GSSCredential cred, GlobusURL gassURL)
          Shutdowns a remote gass server.
 java.lang.String toString()
           
 void unregisterJobOutputStream(java.lang.String lb)
          Unregisters a job output stream for specified output label.
 void unregisterJobOutputStream(java.lang.String lb, java.io.OutputStream out)
          Unregisters a job output stream.
 
Methods inherited from class org.globus.net.BaseServer
getCredentials, getHost, getHostname, getPort, getProtocol, getTimeout, getURL, initialize, registerDefaultDeactivator, run, setAuthorization, setGssMode, setTimeout, shutdown, start, unregisterDefaultDeactivator, wrapSocket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

READ_ENABLE

public static final int READ_ENABLE
See Also:
Constant Field Values

WRITE_ENABLE

public static final int WRITE_ENABLE
See Also:
Constant Field Values

STDOUT_ENABLE

public static final int STDOUT_ENABLE
See Also:
Constant Field Values

STDERR_ENABLE

public static final int STDERR_ENABLE
See Also:
Constant Field Values

CLIENT_SHUTDOWN_ENABLE

public static final int CLIENT_SHUTDOWN_ENABLE
See Also:
Constant Field Values

SHUTDOWN_STR

public static final java.lang.String SHUTDOWN_STR
See Also:
Constant Field Values
Constructor Detail

GassServer

public GassServer()
           throws java.io.IOException
Starts Gass Server with default user credentials. Port of the server will be dynamically assigned

Throws:
java.io.IOException

GassServer

public GassServer(int port)
           throws java.io.IOException
Starts Gass Server on given port with default user credentials.

Parameters:
port - port of the server, if 0 it will be dynamically assigned
Throws:
java.io.IOException

GassServer

public GassServer(org.ietf.jgss.GSSCredential cred,
                  int port)
           throws java.io.IOException
Starts Gass Server on given port and given credentials.

Parameters:
cred - credentials to use. if null default user credentials will be used
port - port of the server, if 0 it will be dynamically assigned
Throws:
java.io.IOException

GassServer

public GassServer(boolean secure,
                  int port)
           throws java.io.IOException
Starts Gass Server on given port and mode. If secure mode, it will use default user credentials

Parameters:
secure - if true starts server in secure mode, otherwise unsecure
port - port of the server, if 0 it will be dynamically assigned
Throws:
java.io.IOException
Method Detail

setOptions

public void setOptions(int options)
Sets the options of the gass server such as enabling client shutdown, etc.

Parameters:
options - server options

getOptions

public int getOptions()
Returns current options of the server.

Returns:
options of the server. O if not none set.

registerJobOutputStream

public void registerJobOutputStream(java.lang.String lb,
                                    java.io.OutputStream out)
Registers a output stream with a job. This is used for job stdout/err redirection. The label of the job should be the ending of the job redirected url. For example, given following RSL (stdout=$(GASS_URL)/dev/stdout-5) the label to register the output stream with should be 'out-5'.

Parameters:
lb - job label as described above.
out - the output stream to redirect output to.

unregisterJobOutputStream

public void unregisterJobOutputStream(java.lang.String lb)
Unregisters a job output stream for specified output label. See registerJobOutputStream() for more details.

Parameters:
lb - job output label.

unregisterJobOutputStream

public void unregisterJobOutputStream(java.lang.String lb,
                                      java.io.OutputStream out)
Unregisters a job output stream. This method is deprecated.


getJobOutputStream

protected java.io.OutputStream getJobOutputStream(java.lang.String id)

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

shutdown

public static void shutdown(org.ietf.jgss.GSSCredential cred,
                            GlobusURL gassURL)
                     throws java.io.IOException,
                            org.ietf.jgss.GSSException
Shutdowns a remote gass server. The server must have the CLIENT_SHUTDOWN option enabled for this to work.

Parameters:
cred - credentials to use.
gassURL - the url of the remote gass server.
Throws:
java.io.IOException
org.ietf.jgss.GSSException


Copyright © 2013. All Rights Reserved.