info.sswap.impl.http
Class HTTPAPIImpl

java.lang.Object
  extended by info.sswap.impl.http.HTTPAPIImpl
All Implemented Interfaces:
HTTPClient, HTTPProvider

public class HTTPAPIImpl
extends java.lang.Object
implements HTTPProvider, HTTPClient


Nested Class Summary
 class HTTPAPIImpl.PDGResponse
          Exposes access to both a ready-to-use PDG on success or a network response object on failure.
 class HTTPAPIImpl.RDGResponse
          Exposes access to both a ready-to-use RDG on success or a network response object on failure.
 class HTTPAPIImpl.RIGResponse
          Exposes access to both a ready-to-use RIG on success or a network response object on failure.
 class HTTPAPIImpl.RQGResponse
          Exposes access to both a ready-to-use RQG on success or a network response object on failure.
 class HTTPAPIImpl.RRGResponse
          Exposes access to both a ready-to-use RRG on success or a network response object on failure.
 
Field Summary
private static java.net.URI MAKE_PDG_URI
           
private static java.net.URI MAKE_RDG_URI
           
private static java.net.URI MAKE_RIG_URI
           
private static java.net.URI MAKE_RQG_URI
           
private static java.net.URI MAKE_RRG_URI
           
private  com.clarkparsia.utils.web.Response response
           
private static java.lang.String SSWAP_API_URI_DEFAULT_VALUE
           
private static java.lang.String SSWAP_API_URI_SYSTEM_PROPERTY
           
 
Constructor Summary
HTTPAPIImpl()
           
 
Method Summary
private
<T extends SSWAPDocument>
T
makeAPI(java.net.URI apiURI, java.lang.Class<T> clazz, java.io.InputStream jsonStream)
           
 HTTPAPIImpl.PDGResponse makePDG(java.io.InputStream jsonStream)
          Make a Provider Description Graph (PDG) from a JSON (JavaScript Object Notation) specification.
 HTTPAPIImpl.PDGResponse makePDG(java.lang.String jsonString)
          Convenience method to makePDG(InputStream) with input as single JSON string.
 HTTPAPIImpl.RDGResponse makeRDG(java.io.InputStream jsonStream)
          Make a Resource Description Graph (RDG) from a JSON (JavaScript Object Notation) specification.
 HTTPAPIImpl.RDGResponse makeRDG(java.lang.String jsonString)
          Convenience method to makeRDG(InputStream) with input as single JSON string.
 HTTPAPIImpl.RIGResponse makeRIG(java.io.InputStream jsonStream)
          Make a Response Invocation Graph (RIG) from a JSON (JavaScript Object Notation) specification.
 HTTPAPIImpl.RIGResponse makeRIG(java.lang.String jsonString)
          Convenience method to makeRIG(InputStream) with input as single JSON string.
 HTTPAPIImpl.RQGResponse makeRQG(java.io.InputStream jsonStream)
          Make a Response Query Graph (RQG) from a JSON (JavaScript Object Notation) specification.
 HTTPAPIImpl.RQGResponse makeRQG(java.lang.String jsonString)
          Convenience method to makeRQG(InputStream) with input as single JSON string.
 HTTPAPIImpl.RRGResponse makeRRG(java.io.InputStream jsonStream)
          Make a Resource Response Graph (RRG) from a JSON (JavaScript Object Notation) specification.
 HTTPAPIImpl.RRGResponse makeRRG(java.lang.String jsonString)
          Convenience method to makeRRG(InputStream) with input as single JSON string.
private
<T extends SSWAPDocument>
T
setDocumentURI(T originalDoc, java.lang.Class<T> clazz)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

response

private com.clarkparsia.utils.web.Response response

SSWAP_API_URI_SYSTEM_PROPERTY

private static final java.lang.String SSWAP_API_URI_SYSTEM_PROPERTY
See Also:
Constant Field Values

SSWAP_API_URI_DEFAULT_VALUE

private static final java.lang.String SSWAP_API_URI_DEFAULT_VALUE
See Also:
Constant Field Values

MAKE_PDG_URI

private static java.net.URI MAKE_PDG_URI

MAKE_RDG_URI

private static java.net.URI MAKE_RDG_URI

MAKE_RIG_URI

private static java.net.URI MAKE_RIG_URI

MAKE_RRG_URI

private static java.net.URI MAKE_RRG_URI

MAKE_RQG_URI

private static java.net.URI MAKE_RQG_URI
Constructor Detail

HTTPAPIImpl

public HTTPAPIImpl()
Method Detail

makePDG

public HTTPAPIImpl.PDGResponse makePDG(java.io.InputStream jsonStream)
                                throws java.io.IOException
Description copied from interface: HTTPProvider
Make a Provider Description Graph (PDG) from a JSON (JavaScript Object Notation) specification. For the specification, see http://sswap.info/api/makePDG.

Specified by:
makePDG in interface HTTPProvider
Parameters:
jsonStream - a stream, for example from a file, of JSON input
Returns:
a compound object that allows one to get the PDG on success, or examine the connection response on error
Throws:
java.io.IOException - on network or parsing error
See Also:
PDG, HTTPProvider.PDGResponse.getPDG()

makePDG

public HTTPAPIImpl.PDGResponse makePDG(java.lang.String jsonString)
                                throws java.io.IOException
Description copied from interface: HTTPProvider
Convenience method to makePDG(InputStream) with input as single JSON string.

Specified by:
makePDG in interface HTTPProvider
Parameters:
jsonString - a string, for example from local variables and validated user input, of JSON input
Returns:
a compound object that allows one to get the PDG on success, or examine the connection response on error
Throws:
java.io.IOException - on network or parsing error
See Also:
HTTPProvider.makePDG(InputStream)

makeRDG

public HTTPAPIImpl.RDGResponse makeRDG(java.io.InputStream jsonStream)
                                throws java.io.IOException
Description copied from interface: HTTPProvider
Make a Resource Description Graph (RDG) from a JSON (JavaScript Object Notation) specification. For the specification, see http://sswap.info/api/makeRDG.

Specified by:
makeRDG in interface HTTPProvider
Parameters:
jsonStream - a stream, for example from a file, of JSON input
Returns:
a compound object that allows one to get the RDG on success, or examine the connection response on error
Throws:
java.io.IOException - on network or parsing error
See Also:
RDG, HTTPProvider.RDGResponse.getRDG()

makeRDG

public HTTPAPIImpl.RDGResponse makeRDG(java.lang.String jsonString)
                                throws java.io.IOException
Description copied from interface: HTTPProvider
Convenience method to makeRDG(InputStream) with input as single JSON string.

Specified by:
makeRDG in interface HTTPProvider
Parameters:
jsonString - a string, for example from local variables and validated user input, of JSON input
Returns:
a compound object that allows one to get the RDG on success, or examine the connection response on error
Throws:
java.io.IOException - on network or parsing error
See Also:
HTTPProvider.makeRDG(InputStream)

makeRIG

public HTTPAPIImpl.RIGResponse makeRIG(java.io.InputStream jsonStream)
                                throws java.io.IOException
Description copied from interface: HTTPClient
Make a Response Invocation Graph (RIG) from a JSON (JavaScript Object Notation) specification. For the specification, see http://sswap.info/api/makeRIG.

Specified by:
makeRIG in interface HTTPClient
Parameters:
jsonStream - a stream, for example from a file, of JSON input
Returns:
a compound object that allows one to get the RIG on success, or examine the connection response on error
Throws:
java.io.IOException - on network or parsing error
See Also:
RIG, HTTPClient.RIGResponse.getRIG()

makeRIG

public HTTPAPIImpl.RIGResponse makeRIG(java.lang.String jsonString)
                                throws java.io.IOException
Description copied from interface: HTTPClient
Convenience method to makeRIG(InputStream) with input as single JSON string.

Specified by:
makeRIG in interface HTTPClient
Parameters:
jsonString - a string, for example from local variables and validated user input, of JSON input
Returns:
a compound object that allows one to get the RIG on success, or examine the connection response on error
Throws:
java.io.IOException - on network or parsing error
See Also:
HTTPClient.makeRIG(InputStream)

makeRRG

public HTTPAPIImpl.RRGResponse makeRRG(java.io.InputStream jsonStream)
                                throws java.io.IOException
Description copied from interface: HTTPProvider
Make a Resource Response Graph (RRG) from a JSON (JavaScript Object Notation) specification. For the specification, see http://sswap.info/api/makeRRG.

Specified by:
makeRRG in interface HTTPProvider
Parameters:
jsonStream - a stream, for example from a file, of JSON input
Returns:
a compound object that allows one to get the RRG on success, or examine the connection response on error
Throws:
java.io.IOException - on network or parsing error
See Also:
RRG, HTTPProvider.RRGResponse.getRRG()

makeRRG

public HTTPAPIImpl.RRGResponse makeRRG(java.lang.String jsonString)
                                throws java.io.IOException
Description copied from interface: HTTPProvider
Convenience method to makeRRG(InputStream) with input as single JSON string.

Specified by:
makeRRG in interface HTTPProvider
Parameters:
jsonString - a string, for example from local variables and validated user input, of JSON input
Returns:
a compound object that allows one to get the RRG on success, or examine the connection response on error
Throws:
java.io.IOException - on network or parsing error
See Also:
HTTPProvider.makeRRG(InputStream)

makeRQG

public HTTPAPIImpl.RQGResponse makeRQG(java.io.InputStream jsonStream)
                                throws java.io.IOException
Description copied from interface: HTTPClient
Make a Response Query Graph (RQG) from a JSON (JavaScript Object Notation) specification. For the specification, see http://sswap.info/api/makeRQG.

Specified by:
makeRQG in interface HTTPClient
Parameters:
jsonStream - a stream, for example from a file, of JSON input
Returns:
a compound object that allows one to get the RQG on success, or examine the connection response on error
Throws:
java.io.IOException - on network or parsing error
See Also:
RQG, HTTPClient.RQGResponse.getRQG()

makeRQG

public HTTPAPIImpl.RQGResponse makeRQG(java.lang.String jsonString)
                                throws java.io.IOException
Description copied from interface: HTTPClient
Convenience method to makeRQG(InputStream) with input as single JSON string.

Specified by:
makeRQG in interface HTTPClient
Parameters:
jsonString - a string, for example from local variables and validated user input, of JSON input
Returns:
a compound object that allows one to get the RQG on success, or examine the connection response on error
Throws:
java.io.IOException - on network or parsing error
See Also:
HTTPClient.makeRQG(InputStream)

makeAPI

private <T extends SSWAPDocument> T makeAPI(java.net.URI apiURI,
                                            java.lang.Class<T> clazz,
                                            java.io.InputStream jsonStream)
                                 throws java.io.IOException
Throws:
java.io.IOException

setDocumentURI

private <T extends SSWAPDocument> T setDocumentURI(T originalDoc,
                                                   java.lang.Class<T> clazz)
                                        throws java.io.IOException
Throws:
java.io.IOException


Copyright (c) 2011, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.