Class DaemonClient

  • All Implemented Interfaces:
    Loggable

    public class DaemonClient
    extends LoggedObject
    Client for the Cargo daemon manager
    • Constructor Summary

      Constructors 
      Constructor Description
      DaemonClient​(URL url)
      Creates a Cargo daemon manager wrapper for the specified URL that uses a username of admin, an empty password and ISO-8859-1 URL encoding.
      DaemonClient​(URL url, String username)
      Creates a Cargo daemon manager wrapper for the specified URL and username that uses an empty password and ISO-8859-1 URL encoding.
      DaemonClient​(URL url, String username, String password)
      Creates a Cargo daemon manager wrapper for the specified URL, username and password that uses ISO-8859-1 URL encoding.
      DaemonClient​(URL url, String username, String password, String charset)
      Creates a Cargo daemon manager wrapper for the specified URL, username, password and URL encoding.
    • Constructor Detail

      • DaemonClient

        public DaemonClient​(URL url)
        Creates a Cargo daemon manager wrapper for the specified URL that uses a username of admin, an empty password and ISO-8859-1 URL encoding.
        Parameters:
        url - the full URL of the Cargo daemon manager instance to use
      • DaemonClient

        public DaemonClient​(URL url,
                            String username)
        Creates a Cargo daemon manager wrapper for the specified URL and username that uses an empty password and ISO-8859-1 URL encoding.
        Parameters:
        url - the full URL of the Cargo daemon manager instance to use
        username - the username to use when authenticating with Cargo daemon manager
      • DaemonClient

        public DaemonClient​(URL url,
                            String username,
                            String password)
        Creates a Cargo daemon manager wrapper for the specified URL, username and password that uses ISO-8859-1 URL encoding.
        Parameters:
        url - the full URL of the Cargo daemon manager instance to use
        username - the username to use when authenticating with Cargo daemon manager
        password - the password to use when authenticating with Cargo daemon manager
      • DaemonClient

        public DaemonClient​(URL url,
                            String username,
                            String password,
                            String charset)
        Creates a Cargo daemon manager wrapper for the specified URL, username, password and URL encoding.
        Parameters:
        url - the full URL of the Cargo daemon manager instance to use
        username - the username to use when authenticating with Cargo daemon manager
        password - the password to use when authenticating with Cargo daemon manager
        charset - the URL encoding charset to use when communicating with Cargo daemon manager
    • Method Detail

      • getURL

        public URL getURL()
        Gets the full URL of the Cargo daemon manager instance.
        Returns:
        the full URL of the Cargo daemon manager instance
      • getUserName

        public String getUserName()
        Gets the username to use when authenticating with Cargo daemon manager.
        Returns:
        the username to use when authenticating with Cargo daemon manager
      • getPassword

        public String getPassword()
        Gets the password to use when authenticating with Cargo daemon manager.
        Returns:
        the password to use when authenticating with Cargo daemon manager
      • getCharset

        public String getCharset()
        Gets the URL encoding charset to use when communicating with Cargo daemon manager.
        Returns:
        the URL encoding charset to use when communicating with Cargo daemon manager
      • getUserAgent

        public String getUserAgent()
        Gets the user agent name to use when communicating with Cargo daemon manager.
        Returns:
        the user agent name to use when communicating with Cargo daemon manager
      • setUserAgent

        public void setUserAgent​(String userAgent)
        Sets the user agent name to use when communicating with Cargo daemon manager.
        Parameters:
        userAgent - the user agent name to use when communicating with Cargo daemon manager
      • stop

        public void stop​(String handleId)
                  throws DaemonException,
                         IOException
        Stops the container with the specified handle identifier.
        Parameters:
        handleId - The unique identifier of the container
        Throws:
        DaemonException - if the Cargo daemon manager request fails
        IOException - if an i/o error occurs
      • invoke

        protected String invoke​(String path,
                                DaemonParameters parameters)
                         throws DaemonException,
                                IOException
        Invokes Cargo daemon manager with a specified command and content data.
        Parameters:
        path - the Cargo daemon manager command to invoke
        parameters - an input stream to the content data
        Returns:
        the result of the invoking command, as returned by the Cargo daemon manager application
        Throws:
        DaemonException - if the Cargo daemon manager request fails
        IOException - if an i/o error occurs