Class GassServer

  • All Implemented Interfaces:
    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 $
    • Constructor Detail

      • GassServer

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

        public GassServer​(int port)
                   throws 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:
        IOException
      • GassServer

        public GassServer​(GSSCredential cred,
                          int port)
                   throws 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:
        IOException
      • GassServer

        public GassServer​(boolean secure,
                          int port)
                   throws 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:
        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​(String lb,
                                            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​(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​(String lb,
                                              OutputStream out)
        Unregisters a job output stream. This method is deprecated.
      • handleConnection

        protected void handleConnection​(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
      • shutdown

        public static void shutdown​(GSSCredential cred,
                                    GlobusURL gassURL)
                             throws IOException,
                                    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:
        IOException
        GSSException