Query Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.service.devicetwin.Query

public class Query

Sql style query IotHub for twin, jobs, device jobs or raw data

Constructor Summary

Constructor Description
Query(int pageSize, QueryType requestQueryType)

Constructor for Query.

Query(String query, int pageSize, QueryType requestQueryType)

Constructor for Query.

Method Summary

Modifier and Type Method and Description
boolean hasNext()

Returns the availability of next element in the query response.

java.lang.Object next()

provides the next element in query response.

QueryResponse sendQueryRequest(IotHubConnectionString iotHubConnectionString, URL url, HttpMethod method, int httpConnectTimeout, int httpReadTimeout, Proxy proxy)

Sends request for the query to the IotHub.

QueryResponse sendQueryRequest(IotHubConnectionString iotHubConnectionString, URL url, HttpMethod method, Long timeoutInMs)

Deprecated

Sends request for the query to the IotHub.

QueryResponse sendQueryRequest(TokenCredentialCache credentialCache, AzureSasCredential azureSasCredential, IotHubConnectionString iotHubConnectionString, URL url, HttpMethod method, int httpConnectTimeout, int httpReadTimeout, Proxy proxy)

Sends request for the query to the IotHub.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

Query

public Query(int pageSize, QueryType requestQueryType)

Constructor for Query.

Parameters:

pageSize - page size for the query response to request query over.
requestQueryType - Type of query.

Throws:

java.lang.IllegalArgumentException - if the input parameters are invalid.

Query

public Query(String query, int pageSize, QueryType requestQueryType)

Constructor for Query.

Parameters:

query - Sql style query to be sent to IotHub.
pageSize - page size for the query response to request query over.
requestQueryType - Type of query.

Throws:

java.lang.IllegalArgumentException - if the input parameters are invalid.

Method Details

hasNext

public boolean hasNext()

Returns the availability of next element in the query response.

Returns:

the availability of next element in the query response.

Throws:

java.io.IOException - if sending the request is unsuccessful because of input parameters.
IotHubException - if sending the request is unsuccessful because of input parameters.

next

public Object next()

provides the next element in query response.

Returns:

the next element in query response.

Throws:

java.io.IOException - if sending the request is unsuccessful because of input parameters.
IotHubException - if sending the request is unsuccessful because of input parameters.
java.util.NoSuchElementException - if sending the request is unsuccessful because of input parameters.

sendQueryRequest

public QueryResponse sendQueryRequest(IotHubConnectionString iotHubConnectionString, URL url, HttpMethod method, int httpConnectTimeout, int httpReadTimeout, Proxy proxy)

Sends request for the query to the IotHub.

Parameters:

iotHubConnectionString - Hub Connection String.
url - URL to Query on.
method - HTTP Method for the requesting a query.
httpConnectTimeout - the http connect timeout to use for this request.
httpReadTimeout - the http read timeout to use for this request.
proxy - the proxy to use, or null if no proxy should be used.

Returns:

QueryResponse object which holds the response Iterator.

Throws:

java.io.IOException - If any of the input parameters are not valid.
IotHubException - If any of the input parameters are not valid.

sendQueryRequest


public QueryResponse sendQueryRequest(IotHubConnectionString iotHubConnectionString, URL url, HttpMethod method, Long timeoutInMs)

Deprecated

Sends request for the query to the IotHub.

Parameters:

iotHubConnectionString - Hub Connection String.
url - URL to Query on.
method - HTTP Method for the requesting a query.
timeoutInMs - Unused.

Returns:

QueryResponse object which holds the response Iterator.

Throws:

java.io.IOException - If any of the input parameters are not valid.
IotHubException - If any of the input parameters are not valid.

sendQueryRequest

public QueryResponse sendQueryRequest(TokenCredentialCache credentialCache, AzureSasCredential azureSasCredential, IotHubConnectionString iotHubConnectionString, URL url, HttpMethod method, int httpConnectTimeout, int httpReadTimeout, Proxy proxy)

Sends request for the query to the IotHub.

Parameters:

credentialCache - The RBAC authorization token provider. May be null if azureSasCredential or iotHubConnectionString is not.
azureSasCredential - The SAS authorization token provider. May be null if credential or iotHubConnectionString is not.
iotHubConnectionString - The iot hub connection string that SAS tokens will be derived from. May be null if azureSasCredential or credential is not.
url - URL to Query on.
method - HTTP Method for the requesting a query.
httpConnectTimeout - the http connect timeout to use for this request.
httpReadTimeout - the http read timeout to use for this request.
proxy - the proxy to use, or null if no proxy should be used.

Returns:

QueryResponse object which holds the response Iterator.

Throws:

java.io.IOException - If any of the input parameters are not valid.
IotHubException - If any of the input parameters are not valid.

Applies to