Releases: iobeam/iobeam-client-java
[0.6.0] Remove deprecated DataPoint functionality, less checked Exceptions
Deprecations
This release removes some functionality that was deprecated, related to using the deprecated DataPoint
type. DataPoint
is still around, however it will be removed in the v0.7.x line. Please upgrade to using DataStore
s instead.
Unchecked Exceptions
We also removed some checked exceptions for the async functions (send/register). Now, if a callback is provided, the Exception will be passed to that; otherwise it will be thrown as a runtime exception. This should allow cleaner code while also failing-fast in the case of an unrecoverable error.
Auto retry + user callback
Additionally, using autoRetry
with a user-supplied callback now calls the user callback instead of ignoring it.
Changelog
- Auto retry will now also call the user callback as well.
- Add methods for re-fetching a DataStore based on column names.
- Use unchecked IobeamException for async ops.
- Remove deprecated size method
- Remove deprecated DataPoint static parsing methods.
- Remove deprecated Iobeam constructors.
[0.5.13] registerOrSetDevice functionality, more clean ups
This release fixes some bugs, introduces new registerOrSetDevice
calls, and renames register
-* calls for consistency.
registerOrSetDevice
Instead of having to check or remember if a device is registered, you can know use registerOrSetDevice
(or async variants) to attempt to register a device or if the ID exists it simply returns as successful.
[0.5.8] Reject certain device & series name as invalid, more fixes
Please upgrade to this release as soon as possible. Future changes to our REST API may be incompatible with older versions.
- Device IDs are checked against a regex to prevent unnecessary calls to the server
- Series names are checked to make sure they are not reserved or empty
- An invalid 'created' format for a Device is no longer a fatal parsing error.
Introducing DataStore and the v0.5.x line
The 0.5.x releases mark a significant change for how data is stored by the iobeam client. Users are now encouraged to use a DataStore
object instead of DataPoint
s. DataStore
s use a table-like format to store data values, where series of points are columns and each row represents a specific time.
Deprecation Notice
Many of the DataPoint
functions and types have been marked as deprecated in the 0.5.x releases. We will remove these classes and methods in a future release, likely 0.6.0. Please migrate your code to using DataStore
s as soon as possible.
Using DataStore
Users should group series together in a single DataStore
where it makes sense, i.e., when two types of values are always or mostly collected together. For example, if you are collecting both temperature and humidity every 10s, you would use a single DataStore
for them.
Iobeam iobeam = ... // Initialize iobeam
// Initialize DataStores
DataStore conditions = iobeam.createDataStore("temperature", "humidity");
// Called every 10s
public void addConditionsData(temperature, humidity) {
Map<String, Object> values = new HashMap<String, Object>();
values.put("temperature", temperature);
values.put("humidity", humidity);
conditions.add(values);
}
DataStore
s are initialized once, usually along with the Iobeam
client itself. You can then add as many rows as you want to them, and when ready call send()
/sendAsync()
as before. You can have multiple DataStore
s if, for example, data is collected on different cycles. If you are also collecting battery every minute:
Iobeam iobeam = ... // Initialize iobeam
// Initialize DataStores
DataStore conditions = iobeam.createDataStore("temperature", "humidity");
DataStore battery = iobeam.createDataStore("batteryPct");
// Called every 10s
public void addConditionsData(temperature, humidity) {
Map<String, Object> values = new HashMap<String, Object>();
values.put("temperature", temperature);
values.put("humidity", humidity);
conditions.add(values);
}
// Called every minute
public void addBatteryData(percent) {
Map<String, Object> values = new HashMap<String, Object>();
values.put("batteryPct", percent);
battery.add(values);
}
You can add data to a DataStore
as a map (shown above), or as two arrays (columns and values), or as two Lists (columns and values). Additionally, you can optionally include the timestamp as the first argument to the add()
call to set a specific time, otherwise it defaults to the value of System.currentTimeMillis()
.
[0.4.5] "Zip" functionality and change-able backends
This release introduces two new features:
-
Changing backend with
Iobeam.Builder.setBackend(backend)
-
"Zip" field names and data points. If you have a list of fields and list of datapoints, you can now
have them sorted correctly in the datastore with one method:
String[] seriesNames = {"series1", "series2", "series3"};
DataPoint[] datapoints = {
new DataPoint(1000, 2000),
new DataPoint(2000, 3000),
new DataPoint(3000, 4000)
};
Iobeam iobeam = getBuilder().build();
iobeam.addDataMapToSeries(seriesNames, datapoints);
// DataPoint(1000, 2000) now in 'series1', etc
[0.4.4] Builder pattern
This release introduces constructing iobeam clients using the Builder design pattern instead of constructors.
To create a new client:
Iobeam iobeam = Iobeam.Builder(PROJECT_ID, PROJECT_TOKEN).build();
// with retry:
Iobeam iobeam = Iobeam.Builder(PROJECT_ID, PROJECT_TOKEN).autoRetry().build();
// persist id to disk
Iobeam iobeam = new Iobeam.Builder(PROJECT_ID, PROJECT_TOKEN).saveIdToPath(PATH).build();
The constructors for Iobeam
are deprecated and will be removed in a future release.
[0.4.3] DataPointParser and byte serialization
This release introduces a DataPointParser
class that will help turn arrays of ints, longs, floats, and doubles into a list of DataPoint
s. Additionally, a first byte serialization format is included when needed by other protocols (such as Android).