|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.chukwa.datacollection.agent.rest.AdaptorController
public class AdaptorController
JAX-RS controller to handle all HTTP request to the Agent that deal with adaptors. To return all adaptors: GET /rest/v1/adaptor Optional QS params: viewType=text|xml (default=xml) To return a single adaptor: GET /rest/v1/adaptor/[adaptorId] Optional QS params: viewType=text|xml (default=xml) To remove an adaptor: DELETE /rest/v1/adaptor/[adaptorId] To add an adaptor: POST /rest/v1/adaptor Content-Type: application/json Optional QS params: viewType=text|xml (default=xml) { "DataType" : "foo", "AdaptorClass" : "FooAdaptor", "AdaptorParams" : "params", "Offset" : "0" } The first 3 params above are the only required ones.
| Constructor Summary | |
|---|---|
AdaptorController()
|
|
| Method Summary | |
|---|---|
javax.ws.rs.core.Response |
addAdaptor(javax.servlet.ServletContext context,
String viewType,
String postBody)
Adds an adaptor to the agent and returns the adaptor info. |
protected static void |
appendElement(StringBuilder out,
String name,
Object value,
Object... attributeNvps)
XML helper to append an Element and it's child text value. |
protected static void |
appendEndTag(StringBuilder out,
String name)
XML helper to append a Element end tag. |
protected static void |
appendNvp(StringBuilder out,
int indent,
String name,
Object value)
Helper for appending name/value pairs to the ServletOutputStream in the format [name]: [value] with indent number of spaces prepended. |
protected static void |
appendNvp(StringBuilder out,
int indent,
String name,
Object value,
boolean stringLiteral)
Helper for appending name/value pairs to the ServletOutputStream in the format [name]: [value] with indent number of spaces prepended. |
protected static void |
appendNvp(StringBuilder out,
String name,
Object value)
Helper for appending name/value pairs to the ServletOutputStream in the format [name]: [value] |
protected static void |
appendStartTag(StringBuilder out,
String name,
Object... attributeNvps)
XML helper to append a Element start tag. |
protected String |
buildAdaptorText(ChukwaAgent agent,
String adaptorId)
Renders info for one or all adaptors in plain text (YAML). |
protected String |
buildAdaptorXML(ChukwaAgent agent,
String adaptorId)
Renders info for one or all adaptors in XML. |
javax.ws.rs.core.Response |
getAdaptor(javax.servlet.ServletContext context,
String viewType,
String adaptorId)
Get a single adaptor |
javax.ws.rs.core.Response |
getAdaptors(javax.servlet.ServletContext context,
String viewType)
Get all adaptors |
protected static void |
indent(StringBuilder out,
int indent)
Helper to insert a number of spaces into the output stream. |
javax.ws.rs.core.Response |
removeAdaptor(javax.servlet.ServletContext context,
String adaptorId)
Remove an adaptor from the agent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AdaptorController()
| Method Detail |
|---|
public javax.ws.rs.core.Response addAdaptor(@Context
javax.servlet.ServletContext context,
String viewType,
String postBody)
context - servletContextviewType - type of view to return (text|xml)postBody - JSON post body
public javax.ws.rs.core.Response removeAdaptor(@Context
javax.servlet.ServletContext context,
String adaptorId)
context - ServletContextadaptorId - id of adaptor to remove.
public javax.ws.rs.core.Response getAdaptors(@Context
javax.servlet.ServletContext context,
String viewType)
context - ServletContextviewType - type of view to return (text|xml)
public javax.ws.rs.core.Response getAdaptor(@Context
javax.servlet.ServletContext context,
String viewType,
String adaptorId)
context - ServletContextviewType - type of view to return (text|xml)adaptorId - id of the adaptor to return
protected String buildAdaptorXML(ChukwaAgent agent,
String adaptorId)
protected String buildAdaptorText(ChukwaAgent agent,
String adaptorId)
protected static void appendNvp(StringBuilder out,
String name,
Object value)
protected static void appendNvp(StringBuilder out,
int indent,
String name,
Object value)
protected static void appendNvp(StringBuilder out,
int indent,
String name,
Object value,
boolean stringLiteral)
protected static void indent(StringBuilder out,
int indent)
protected static void appendStartTag(StringBuilder out,
String name,
Object... attributeNvps)
protected static void appendEndTag(StringBuilder out,
String name)
protected static void appendElement(StringBuilder out,
String name,
Object value,
Object... attributeNvps)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||