public class RestfulClient extends Object
| Constructor and Description |
|---|
RestfulClient(URL serverUrl,
Duration connectionTimeout,
Duration readTimeout)
Stores the HTTP URL.
|
| Modifier and Type | Method and Description |
|---|---|
String |
dumpData()
Dumps the text received from the server without trying to parse it.
|
List<Map<String,Object>> |
fetchData()
Reads sensor information in JSON format and parses it.
|
static void |
main(String[] args) |
public RestfulClient(URL serverUrl, Duration connectionTimeout, Duration readTimeout)
serverUrl - the URL for the sensor PC's data server.connectionTimeout - how long to wait for a connection to complete.readTimeout - how long to wait for data after connecting.public final String dumpData() throws IOException
IOException - if the the server could not be found or if data could not be read from it.public final List<Map<String,Object>> fetchData() throws IOException
Map<String, Object>. In each map the value with key "location" is a string
giving the name of the location such as "MAIN_NW" or "AUX". The other keys are all channel names.
A numerical channel name key such as "0.3" or "3.0" denotes a particle counter channel for
particles of that size or greater in microns. Anything else is the name of an analog channel such as
"temp".
A value for a particle counter channel is itself a map of items appropriate for such a channel:
A value for an analog channel is itself a map. It also has the keys "quality", "time", "status", "limitViolation" and "malfunction". In addition it has:
IOException - if no data could be read or could not be parsed.public static void main(String[] args) throws MalformedURLException, IOException
MalformedURLExceptionIOExceptionCopyright © 2021 LSST. All rights reserved.