Package org.codehaus.cargo.tools.daemon
Class DaemonClient
- java.lang.Object
-
- org.codehaus.cargo.util.log.LoggedObject
-
- org.codehaus.cargo.tools.daemon.DaemonClient
-
- All Implemented Interfaces:
org.codehaus.cargo.util.log.Loggable
public class DaemonClient extends org.codehaus.cargo.util.log.LoggedObjectClient for the Cargo daemon
-
-
Constructor Summary
Constructors Constructor Description DaemonClient(URL url)Creates a Cargo daemon wrapper for the specified URL which has public access (no username nor password required).DaemonClient(URL url, String username, String password)Creates a Cargo daemon wrapper for the specified URL, username and password that uses UTF-8 URL encoding.DaemonClient(URL url, String username, String password, Charset charset)Creates a Cargo daemon wrapper for the specified URL, username, password and URL encoding.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CharsetgetCharset()Gets the URL encoding charset to use when communicating with Cargo daemon.StringgetPassword()Gets the password to use when authenticating with Cargo daemon.URLgetURL()Gets the full URL of the Cargo daemon instance.StringgetUserAgent()Gets the user agent name to use when communicating with Cargo daemon.StringgetUserName()Gets the username to use when authenticating with Cargo daemon.protected Stringinvoke(String path, DaemonParameters parameters)Invokes Cargo daemon with a specified command and content data.voidsetUserAgent(String userAgent)Sets the user agent name to use when communicating with Cargo daemon.voidstart(DaemonStart start)Starts a container specified by the start request.voidstop(String handleId)Stops the container with the specified handle identifier.
-
-
-
Constructor Detail
-
DaemonClient
public DaemonClient(URL url)
Creates a Cargo daemon wrapper for the specified URL which has public access (no username nor password required).- Parameters:
url- the full URL of the Cargo daemon instance to use
-
DaemonClient
public DaemonClient(URL url, String username, String password)
Creates a Cargo daemon wrapper for the specified URL, username and password that uses UTF-8 URL encoding.- Parameters:
url- the full URL of the Cargo daemon instance to useusername- the username to use when authenticating with Cargo daemonpassword- the password to use when authenticating with Cargo daemon
-
DaemonClient
public DaemonClient(URL url, String username, String password, Charset charset)
Creates a Cargo daemon wrapper for the specified URL, username, password and URL encoding.- Parameters:
url- the full URL of the Cargo daemon instance to useusername- the username to use when authenticating with Cargo daemonpassword- the password to use when authenticating with Cargo daemoncharset- the URL encoding charset to use when communicating with Cargo daemon
-
-
Method Detail
-
getURL
public URL getURL()
Gets the full URL of the Cargo daemon instance.- Returns:
- the full URL of the Cargo daemon instance
-
getUserName
public String getUserName()
Gets the username to use when authenticating with Cargo daemon.- Returns:
- the username to use when authenticating with Cargo daemon
-
getPassword
public String getPassword()
Gets the password to use when authenticating with Cargo daemon.- Returns:
- the password to use when authenticating with Cargo daemon
-
getCharset
public Charset getCharset()
Gets the URL encoding charset to use when communicating with Cargo daemon.- Returns:
- the URL encoding charset to use when communicating with Cargo daemon
-
getUserAgent
public String getUserAgent()
Gets the user agent name to use when communicating with Cargo daemon.- Returns:
- the user agent name to use when communicating with Cargo daemon
-
setUserAgent
public void setUserAgent(String userAgent)
Sets the user agent name to use when communicating with Cargo daemon.- Parameters:
userAgent- the user agent name to use when communicating with Cargo daemon
-
start
public void start(DaemonStart start) throws DaemonException, IOException
Starts a container specified by the start request.- Parameters:
start- The unique identifier of the container- Throws:
DaemonException- if the Cargo daemon request failsIOException- if an i/o error occurs
-
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 request failsIOException- if an i/o error occurs
-
invoke
protected String invoke(String path, DaemonParameters parameters) throws DaemonException, IOException
Invokes Cargo daemon with a specified command and content data.- Parameters:
path- the Cargo daemon command to invokeparameters- an input stream to the content data- Returns:
- the result of the invoking command, as returned by the Cargo daemon application
- Throws:
DaemonException- if the Cargo daemon request failsIOException- if an i/o error occurs
-
-