Groovy Documentation

org.linkedin.glu.agent.rest.common
[Groovy] Class AgentRestUtils

java.lang.Object
  org.linkedin.glu.agent.rest.common.AgentRestUtils

class AgentRestUtils

Authors:
yan@pongasoft.com


Field Summary
static java.lang.String MODULE

static Logger log

 
Method Summary
static java.lang.Object demultiplexExecStream(java.io.InputStream execStream, java.io.OutputStream stdout, java.io.OutputStream stderr)

Demultiplexes the exec stream as generated by org.linkedin.glu.agent.api.Shell#exec(Map) when args.res is stream.

static java.lang.Throwable rebuildAgentException(RestException restException)

This method will try to rebuild the full stack trace based on the rest exception recursively.

static AgentException throwAgentException(Status status, RestException restException)

This method will try to rebuild the full stack trace based on the rest exception recursively.

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

MODULE

public static final java.lang.String MODULE


log

public static final Logger log


 
Method Detail

demultiplexExecStream

static java.lang.Object demultiplexExecStream(java.io.InputStream execStream, java.io.OutputStream stdout, java.io.OutputStream stderr)
Demultiplexes the exec stream as generated by org.linkedin.glu.agent.api.Shell#exec(Map) when args.res is stream. The following is equivalent: OutputStream myStdout = ... OutputStream myStderr = ... exec(command: xxx, stdout: myStdout, stderr: myStderr, res: exitValue) is 100% equivalent to: demultiplexExecStream(exec(command: xxx, res: stream), myStdout, myStderr)
throws:
org.linkedin.glu.agent.api.ShellExecException when there was an error executing the shell script and args.failOnError was set to true
Parameters:
execStream - the stream as generated by org.linkedin.glu.agent.api.Shell#exec(Map)
stdout - the stream to write the output (optional, can be null)
stderr - the stream to write the error (optional, can be null)
Returns:
the value returned by the executed subprocess


rebuildAgentException

static java.lang.Throwable rebuildAgentException(RestException restException)
This method will try to rebuild the full stack trace based on the rest exception recursively. Handles the case when the client does not know about an exception (or it simply cannot be created).


throwAgentException

static AgentException throwAgentException(Status status, RestException restException)
This method will try to rebuild the full stack trace based on the rest exception recursively. Handles the case when the client does not know about an exception (or it simply cannot be created).


 

Groovy Documentation