org.daisy.pipeline.client
Class Pipeline2WS

java.lang.Object
  extended by org.daisy.pipeline.client.Pipeline2WS

public class Pipeline2WS
extends java.lang.Object

Methods for communicating directly with the Pipeline 2 Web Service.

Author:
jostein

Field Summary
static boolean debug
           
static java.text.DateFormat iso8601
           
static java.util.Map<java.lang.String,java.lang.String> ns
          Used to provide a the namespace when querying a document using XPath.
 
Constructor Summary
Pipeline2WS()
           
 
Method Summary
static Pipeline2WSResponse get(java.lang.String endpoint, java.lang.String path, java.lang.String username, java.lang.String secret, java.util.Map<java.lang.String,java.lang.String> parameters)
          Send a GET request.
static Pipeline2WSResponse postMultipart(java.lang.String endpoint, java.lang.String path, java.lang.String username, java.lang.String secret, java.util.Map<java.lang.String,java.io.File> parts)
          POST a multipart request.
static Pipeline2WSResponse postXml(java.lang.String endpoint, java.lang.String path, java.lang.String username, java.lang.String secret, org.w3c.dom.Document xml)
          POST an XML document.
static java.lang.String url(java.lang.String endpoint, java.lang.String path, java.lang.String username, java.lang.String secret, java.util.Map<java.lang.String,java.lang.String> parameters)
          Sign a URL for communication with a Pipeline 2 Web Service running in authenticated mode.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug

ns

public static final java.util.Map<java.lang.String,java.lang.String> ns
Used to provide a the namespace when querying a document using XPath.


iso8601

public static java.text.DateFormat iso8601
Constructor Detail

Pipeline2WS

public Pipeline2WS()
Method Detail

get

public static Pipeline2WSResponse get(java.lang.String endpoint,
                                      java.lang.String path,
                                      java.lang.String username,
                                      java.lang.String secret,
                                      java.util.Map<java.lang.String,java.lang.String> parameters)
                               throws Pipeline2WSException
Send a GET request.

Parameters:
endpoint - WS endpoint, for instance "http://localhost:8182/ws".
path - Path to resource, for instance "/scripts".
username - Robot username. Can be null. If null, then the URL will not be signed.
secret - Robot secret. Can be null.
parameters - URL query string parameters
Returns:
The return body.
Throws:
Pipeline2WSException

postXml

public static Pipeline2WSResponse postXml(java.lang.String endpoint,
                                          java.lang.String path,
                                          java.lang.String username,
                                          java.lang.String secret,
                                          org.w3c.dom.Document xml)
                                   throws Pipeline2WSException
POST an XML document.

Parameters:
endpoint - WS endpoint, for instance "http://localhost:8182/ws".
path - Path to resource, for instance "/scripts".
username - Robot username. Can be null. If null, then the URL will not be signed.
secret - Robot secret. Can be null.
xml - The XML document to post.
Returns:
The return body.
Throws:
Pipeline2WSException

postMultipart

public static Pipeline2WSResponse postMultipart(java.lang.String endpoint,
                                                java.lang.String path,
                                                java.lang.String username,
                                                java.lang.String secret,
                                                java.util.Map<java.lang.String,java.io.File> parts)
                                         throws Pipeline2WSException
POST a multipart request.

Parameters:
endpoint - WS endpoint, for instance "http://localhost:8182/ws".
path - Path to resource, for instance "/scripts".
username - Robot username. Can be null. If null, then the URL will not be signed.
secret - Robot secret. Can be null.
parts - A map of all the parts.
Returns:
The return body.
Throws:
Pipeline2WSException

url

public static java.lang.String url(java.lang.String endpoint,
                                   java.lang.String path,
                                   java.lang.String username,
                                   java.lang.String secret,
                                   java.util.Map<java.lang.String,java.lang.String> parameters)
                            throws Pipeline2WSException
Sign a URL for communication with a Pipeline 2 Web Service running in authenticated mode.

Parameters:
endpoint -
path -
username -
secret -
parameters -
Returns:
Throws:
Pipeline2WSException