Skip to content
cketcham edited this page Jul 18, 2012 · 5 revisions

org.ohmage.probemanager
Class ProbeBuilder

Probe builder class which makes it easy to create the probe response and send it. More information on how the json data should be structured can be found on the wiki

See Also:
https://github.com/cens/ohmageServer/wiki/Observer-Manipulation

Constructor Summary
ProbeBuilder()
           
ProbeBuilder(java.lang.String observerName, int observerVersion)
           
 
Method Summary
 ProbeBuilder clear()
          Clears everything associated with this probe.
 ProbeBuilder clearMetadata()
          Clears all metadata for this probe.
 ProbeBuilder setData(java.lang.String data)
          Set the probe data.
 ProbeBuilder setMetadata(java.lang.String metadata)
          This should be a JSON object containing the metadata for this point.
 ProbeBuilder setObserver(java.lang.String observerId, int observerVersion)
          The unique ID for the observer and the number describing this observer's version.
 ProbeBuilder setStream(java.lang.String streamId, int streamVersion)
          The unique identifier for the stream to which this data applies and the version of this stream to which this data applies.
 ProbeBuilder setUploadPriority(int uploadPriority)
           
 ProbeBuilder withId(java.lang.String id)
          A UUID unique to this probe.
 ProbeBuilder withLocation(Location location, java.lang.String timezone)
          Location that this response was taken
 ProbeBuilder withLocation(long time, java.lang.String timezone, double latitude, double longitude, float accuracy, java.lang.String provider)
          Location that this response was taken
 ProbeBuilder withTime(long time, java.lang.String timezone)
          A long specifying the survey completion time by the number of milliseconds since the UNIX epoch and the timezone ID for the timezone of the device when this survey was taken.
 ProbeBuilder withTimestamp(java.lang.String timestamp)
          The ISO8601-formatted date-time-timezone string.
 void write(ProbeWriter writer)
           

Constructor Detail

ProbeBuilder

public ProbeBuilder()

ProbeBuilder

public ProbeBuilder(java.lang.String observerName,
                    int observerVersion)
Method Detail

setObserver

public ProbeBuilder setObserver(java.lang.String observerId,
                                int observerVersion)
The unique ID for the observer and the number describing this observer's version.

Parameters:
observerId -
observerVersion -
Returns:

setStream

public ProbeBuilder setStream(java.lang.String streamId,
                              int streamVersion)
The unique identifier for the stream to which this data applies and the version of this stream to which this data applies.

Parameters:
streamId -
streamVersion -
Returns:

setUploadPriority

public ProbeBuilder setUploadPriority(int uploadPriority)

setData

public ProbeBuilder setData(java.lang.String data)
Set the probe data.

Parameters:
data -
Returns:

setMetadata

public ProbeBuilder setMetadata(java.lang.String metadata)
This should be a JSON object containing the metadata for this point. This field is optional. This field will be ignored on write if any other metadata for this probe is supplied.

Parameters:
metadata -
Returns:

withId

public ProbeBuilder withId(java.lang.String id)
A UUID unique to this probe.

Parameters:
id -
Returns:

withTimestamp

public ProbeBuilder withTimestamp(java.lang.String timestamp)
The ISO8601-formatted date-time-timezone string. If this is not present, then the time and timezone fields will be used.

Parameters:
timestamp -
Returns:

withTime

public ProbeBuilder withTime(long time,
                             java.lang.String timezone)
A long specifying the survey completion time by the number of milliseconds since the UNIX epoch and the timezone ID for the timezone of the device when this survey was taken.

Parameters:
time -
timezone -
Returns:

withLocation

public ProbeBuilder withLocation(Location location,
                                 java.lang.String timezone)
Location that this response was taken

Parameters:
location -
timezone -
Returns:

withLocation

public ProbeBuilder withLocation(long time,
                                 java.lang.String timezone,
                                 double latitude,
                                 double longitude,
                                 float accuracy,
                                 java.lang.String provider)
Location that this response was taken

Parameters:
time -
timezone -
latitude -
longitude -
accuracy -
provider -
Returns:

clearMetadata

public ProbeBuilder clearMetadata()
Clears all metadata for this probe. Any other data will remain.

Returns:

clear

public ProbeBuilder clear()
Clears everything associated with this probe.

Returns:

write

public void write(ProbeWriter writer)
           throws RemoteException
Throws:
RemoteException