public class RegistryManager extends Object
| Constructor and Description |
|---|
RegistryManager() |
| Modifier and Type | Method and Description |
|---|---|
Configuration |
addConfiguration(Configuration configuration)
Add configuration using the given Configuration object
Return with the response configuration object from IotHub
|
Device |
addDevice(Device device)
Add device using the given Device object
Return with the response device object from IotHub
|
CompletableFuture<Device> |
addDeviceAsync(Device device)
Async wrapper for add() operation
|
Module |
addModule(Module module)
Add module using the given Module object
Return with the response module object from IotHub
|
void |
applyConfigurationContentOnDevice(String deviceId,
ConfigurationContent content)
Apply the provided configuration content to the provided device
|
void |
close()
Gracefully close running threads, and then shutdown the underlying executor service
|
static RegistryManager |
createFromConnectionString(String connectionString)
Static constructor to create instance from connection string
|
JobProperties |
exportDevices(String exportBlobContainerUri,
Boolean excludeKeys)
Create a bulk export job.
|
CompletableFuture<JobProperties> |
exportDevicesAsync(String exportBlobContainerUri,
Boolean excludeKeys)
Async wrapper for exportDevices() operation
|
Configuration |
getConfiguration(String configurationId)
Get configuration by configuration Id from IotHub
|
List<Configuration> |
getConfigurations(Integer maxCount)
Get list of Configuration
|
Device |
getDevice(String deviceId)
Get device data by device Id from IotHub
|
CompletableFuture<Device> |
getDeviceAsync(String deviceId)
Async wrapper for getDevice() operation
|
String |
getDeviceConnectionString(Device device)
Return the iothub device connection string for a provided device.
|
ArrayList<Device> |
getDevices(Integer maxCount)
Deprecated.
as of release 1.12.0. Please use
DeviceTwin.queryTwin(String sqlQuery, Integer pageSize)
to query for all devices. |
CompletableFuture<ArrayList<Device>> |
getDevicesAsync(Integer maxCount)
Deprecated.
as of release 1.12.0. Please use
DeviceTwin.queryTwin(String sqlQuery, Integer pageSize)
to query for all devices. |
JobProperties |
getJob(String jobId)
Get the properties of an existing job.
|
CompletableFuture<JobProperties> |
getJobAsync(String jobId)
Async wrapper for getJob() operation
|
Module |
getModule(String deviceId,
String moduleId)
Get module data by device Id and module Id from IotHub
|
List<Module> |
getModulesOnDevice(String deviceId)
Get modules data by device Id from IotHub
|
RegistryStatistics |
getStatistics()
Get device statistics
|
CompletableFuture<RegistryStatistics> |
getStatisticsAsync()
Async wrapper for getStatistics() operation
|
JobProperties |
importDevices(String importBlobContainerUri,
String outputBlobContainerUri)
Create a bulk import job.
|
CompletableFuture<JobProperties> |
importDevicesAsync(String importBlobContainerUri,
String outputBlobContainerUri)
Async wrapper for importDevices() operation
|
void |
open()
Deprecated.
as of release 1.13.0 this API is no longer supported and open is done implicitly by the respective APIs
Opens this registry manager's executor service after it has been closed.
|
void |
removeConfiguration(Configuration config)
Send remove configuration request and verify response
|
void |
removeConfiguration(String configurationId)
Send remove configuration request and verify response
|
void |
removeDevice(Device device)
Remove device
|
void |
removeDevice(String deviceId)
Remove device
|
CompletableFuture<Boolean> |
removeDeviceAsync(String deviceId)
Async wrapper for removeDevice() operation
|
void |
removeModule(Module module)
Remove module
|
void |
removeModule(String deviceId,
String moduleId)
Remove module
|
Configuration |
updateConfiguration(Configuration configuration)
Update configuration not forced
|
Configuration |
updateConfiguration(Configuration configuration,
Boolean forceUpdate)
Update configuration with forceUpdate input parameter
|
Device |
updateDevice(Device device)
Update device not forced
|
Device |
updateDevice(Device device,
Boolean forceUpdate)
Update device with forceUpdate input parameter
|
CompletableFuture<Device> |
updateDeviceAsync(Device device)
Async wrapper for updateDevice() operation
|
CompletableFuture<Device> |
updateDeviceAsync(Device device,
Boolean forceUpdate)
Async wrapper for forced updateDevice() operation
|
Module |
updateModule(Module module)
Update module not forced
|
Module |
updateModule(Module module,
Boolean forceUpdate)
Update module with forceUpdate input parameter
|
public static RegistryManager createFromConnectionString(String connectionString) throws IOException
connectionString - The iot hub connection stringIOException - This exception is thrown if the object creation failed@Deprecated public void open()
public void close()
public Device addDevice(Device device) throws IOException, IotHubException, com.google.gson.JsonSyntaxException
device - The device object to addIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic CompletableFuture<Device> addDeviceAsync(Device device) throws IOException, IotHubException
device - The device object to addIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedpublic Device getDevice(String deviceId) throws IOException, IotHubException, com.google.gson.JsonSyntaxException
deviceId - The id of requested deviceIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic CompletableFuture<Device> getDeviceAsync(String deviceId) throws IOException, IotHubException
deviceId - The id of requested deviceIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failed@Deprecated public ArrayList<Device> getDevices(Integer maxCount) throws IOException, IotHubException, com.google.gson.JsonSyntaxException
DeviceTwin.queryTwin(String sqlQuery, Integer pageSize)
to query for all devices.maxCount - The requested count of devicesIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxException@Deprecated public CompletableFuture<ArrayList<Device>> getDevicesAsync(Integer maxCount) throws IOException, IotHubException
DeviceTwin.queryTwin(String sqlQuery, Integer pageSize)
to query for all devices.maxCount - The requested count of devicesIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedpublic String getDeviceConnectionString(Device device)
device - The device object to get the connectionStringpublic Device updateDevice(Device device) throws IOException, IotHubException
device - The device object containing updated dataIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedpublic Device updateDevice(Device device, Boolean forceUpdate) throws IOException, IotHubException, com.google.gson.JsonSyntaxException
device - The device object containing updated dataforceUpdate - True if the update has to be forced regardless of the device stateIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic CompletableFuture<Device> updateDeviceAsync(Device device) throws IOException, IotHubException
device - The device object containing updated dataIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedpublic CompletableFuture<Device> updateDeviceAsync(Device device, Boolean forceUpdate) throws IOException, IotHubException
device - The device object containing updated dataforceUpdate - True is the update has to be forced regardless if the device stateIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedpublic void removeDevice(String deviceId) throws IOException, IotHubException
deviceId - The device name to removeIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedpublic void removeDevice(Device device) throws IOException, IotHubException, IllegalArgumentException
device - The device name to removeIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedIllegalArgumentException - This exception is thrown if the device is nullpublic CompletableFuture<Boolean> removeDeviceAsync(String deviceId) throws IOException, IotHubException
deviceId - The device object to removeIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedpublic RegistryStatistics getStatistics() throws IOException, IotHubException, com.google.gson.JsonSyntaxException
IOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic CompletableFuture<RegistryStatistics> getStatisticsAsync() throws IOException, IotHubException
IOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedpublic JobProperties exportDevices(String exportBlobContainerUri, Boolean excludeKeys) throws IllegalArgumentException, IOException, IotHubException, com.google.gson.JsonSyntaxException
exportBlobContainerUri - URI containing SAS token to a blob container where export data will be placedexcludeKeys - Whether the devices keys should be excluded from the exported data or notIllegalArgumentException - This exception is thrown if the exportBlobContainerUri or excludeKeys parameters are nullIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic CompletableFuture<JobProperties> exportDevicesAsync(String exportBlobContainerUri, Boolean excludeKeys) throws IllegalArgumentException, IOException, IotHubException, com.google.gson.JsonSyntaxException
excludeKeys - if to exclude keys or notexportBlobContainerUri - the blob storage container URI to store at.IllegalArgumentException - This exception is thrown if the exportBlobContainerUri or excludeKeys parameters are nullIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic JobProperties importDevices(String importBlobContainerUri, String outputBlobContainerUri) throws IllegalArgumentException, IOException, IotHubException, com.google.gson.JsonSyntaxException
importBlobContainerUri - URI containing SAS token to a blob container that contains registry data to syncoutputBlobContainerUri - URI containing SAS token to a blob container where the result of the bulk import operation will be placedIllegalArgumentException - This exception is thrown if the importBlobContainerUri or outputBlobContainerUri parameters are nullIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic CompletableFuture<JobProperties> importDevicesAsync(String importBlobContainerUri, String outputBlobContainerUri) throws IllegalArgumentException, IOException, IotHubException, com.google.gson.JsonSyntaxException
importBlobContainerUri - Uri for importBlobContaineroutputBlobContainerUri - Uri for outputBlobContainerIllegalArgumentException - This exception is thrown if the exportBlobContainerUri or excludeKeys parameters are nullIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic JobProperties getJob(String jobId) throws IllegalArgumentException, IOException, IotHubException, com.google.gson.JsonSyntaxException
jobId - The id of the job to be retrieved.IllegalArgumentException - This exception is thrown if the jobId parameter is nullIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic CompletableFuture<JobProperties> getJobAsync(String jobId) throws IllegalArgumentException, IOException, IotHubException
jobId - jobID as StringIllegalArgumentException - This exception is thrown if the jobId parameter is nullIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedpublic Module addModule(Module module) throws IOException, IotHubException, com.google.gson.JsonSyntaxException
module - The module object to addIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic Module getModule(String deviceId, String moduleId) throws IOException, IotHubException, com.google.gson.JsonSyntaxException
deviceId - The id of requested devicemoduleId - The id of requested moduleIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic List<Module> getModulesOnDevice(String deviceId) throws IOException, IotHubException, com.google.gson.JsonSyntaxException
deviceId - The id of requested deviceIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic Module updateModule(Module module) throws IOException, IotHubException
module - The module object containing updated dataIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedpublic Module updateModule(Module module, Boolean forceUpdate) throws IOException, IotHubException, com.google.gson.JsonSyntaxException
module - The module object containing updated dataforceUpdate - True if the update has to be forced regardless of the module stateIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic void removeModule(String deviceId, String moduleId) throws IOException, IotHubException
deviceId - The device name associated with the module to be removedmoduleId - The module name to be removedIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedpublic void removeModule(Module module) throws IOException, IotHubException, IllegalArgumentException
module - The module to be removedIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedIllegalArgumentException - This exception is thrown if the input module is nullpublic Configuration addConfiguration(Configuration configuration) throws IOException, IotHubException, com.google.gson.JsonSyntaxException
configuration - The configuration object to addIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic Configuration getConfiguration(String configurationId) throws IOException, IotHubException, com.google.gson.JsonSyntaxException
configurationId - The id of requested configurationIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic List<Configuration> getConfigurations(Integer maxCount) throws IOException, IotHubException, com.google.gson.JsonSyntaxException
maxCount - The requested count of configurationsIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic Configuration updateConfiguration(Configuration configuration) throws IOException, IotHubException
configuration - The configuration object containing updated dataIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedpublic Configuration updateConfiguration(Configuration configuration, Boolean forceUpdate) throws IOException, IotHubException, com.google.gson.JsonSyntaxException
configuration - The configuration object containing updated dataforceUpdate - True if the update has to be forced regardless of the configuration stateIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedcom.google.gson.JsonSyntaxExceptionpublic void removeConfiguration(String configurationId) throws IOException, IotHubException
configurationId - The configuration to be removedIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedpublic void removeConfiguration(Configuration config) throws IOException, IotHubException, IllegalArgumentException
config - The configuration to be removedIOException - This exception is thrown if the IO operation failedIotHubException - This exception is thrown if the response verification failedIllegalArgumentException - This exception is thrown if the input configuration is nullpublic void applyConfigurationContentOnDevice(String deviceId, ConfigurationContent content) throws IOException, IotHubException
deviceId - The device to apply the configuration tocontent - The configuration content to apply to the deviceIOException - If the iot hub cannot be reachedIotHubException - If the response from the hub was an error code. This exception will contain that codeCopyright © 2018. All rights reserved.