/** * Create a new instance of the RegistrationStatusManager using the provided connection * string and https as the transport protocol. * * @param contractApiHttp is the class that cares the Http connection. * @return The {@code RegistrationStatusManager} with the new instance of this class. * @throws IllegalArgumentException if the {@link ContractApiHttp} is {@code null}. */ public static RegistrationStatusManager createFromContractApiHttp(ContractApiHttp contractApiHttp) { /* SRS_REGISTRATION_STATUS_MANAGER_21_004: [The factory shall create a new instance of this.] */ return new RegistrationStatusManager(contractApiHttp); }
/** * Factory to create a registration status query. * * <p> This method will create a new registration status query for a specific enrollment group on the Device * Provisioning Service and return it as a {@link Query} iterator. * * <p> The Device Provisioning Service expects a SQL query in the {@link QuerySpecification}, for instance * {@code "SELECT * FROM enrollments"}. * * @param querySpecification the {@link QuerySpecification} with the SQL query. It cannot be {@code null}. * @param enrollmentGroupId the {@code String} that identifies the enrollmentGroup. It cannot be {@code null} or empty. * @return The {@link Query} iterator. */ public Query createEnrollmentGroupRegistrationStateQuery(QuerySpecification querySpecification, String enrollmentGroupId) { /* SRS_PROVISIONING_SERVICE_CLIENT_21_027: [The createEnrollmentGroupRegistrationStateQuery shall create a new deviceRegistrationState query by calling the createQuery in the registrationStatusManager.] */ return registrationStatusManager.createEnrollmentGroupQuery(querySpecification, enrollmentGroupId,0); }
/** * @deprecated As of release 1.0.0, replaced by {@link #deleteDeviceRegistrationState(String)} ()} * @param id the {@code String} that identifies the deviceRegistrationState. It cannot be {@code null} or empty. * @throws ProvisioningServiceClientException if the Provisioning Device Service was not able to delete the * deviceRegistrationState information for the provided registrationId. */ @Deprecated public void deleteDeviceRegistrationStatus(String id) throws ProvisioningServiceClientException { /* SRS_PROVISIONING_SERVICE_CLIENT_21_025: [The deleteDeviceRegistrationStatus shall delete the deviceRegistrationState for the provided id by calling the delete in the registrationStatusManager.] */ registrationStatusManager.delete(id, null); }
String targetPath = RegistrationStatusManager.getDeviceRegistrationStatePath(enrollmentGroupId);
return registrationStatusManager.get(id);
/** * PRIVATE CONSTRUCTOR * * @param connectionString the {@code String} that contains the connection string for the Provisioning service. * @throws IllegalArgumentException if the connectionString is {@code null}, empty, or invalid. */ private ProvisioningServiceClient(String connectionString) { /* SRS_PROVISIONING_SERVICE_CLIENT_21_002: [The constructor shall throw IllegalArgumentException if the provided connectionString is null or empty.] */ if(Tools.isNullOrEmpty(connectionString)) { throw new IllegalArgumentException("connectionString cannot be null or empty"); } /* SRS_PROVISIONING_SERVICE_CLIENT_21_003: [The constructor shall throw IllegalArgumentException if the ProvisioningConnectionString or one of the inner Managers failed to create a new instance.] */ /* SRS_PROVISIONING_SERVICE_CLIENT_21_004: [The constructor shall create a new instance of the ContractApiHttp class using the provided connectionString.] */ ProvisioningConnectionString provisioningConnectionString = ProvisioningConnectionStringBuilder.createConnectionString(connectionString); ContractApiHttp contractApiHttp = ContractApiHttp.createFromConnectionString(provisioningConnectionString); /* SRS_PROVISIONING_SERVICE_CLIENT_21_005: [The constructor shall create a new instance of the IndividualEnrollmentManger.] */ this.individualEnrollmentManager = IndividualEnrollmentManager.createFromContractApiHttp(contractApiHttp); /* SRS_PROVISIONING_SERVICE_CLIENT_21_006: [The constructor shall create a new instance of the EnrollmentGroupManager.] */ this.enrollmentGroupManager = EnrollmentGroupManager.createFromContractApiHttp(contractApiHttp); /* SRS_PROVISIONING_SERVICE_CLIENT_21_007: [The constructor shall create a new instance of the RegistrationStatusManager.] */ this.registrationStatusManager = RegistrationStatusManager.createFromContractApiHttp(contractApiHttp); }
String enrollmentPath = RegistrationStatusManager.getDeviceRegistrationStatePath(id);
/** * @deprecated As of release 1.0.0, replaced by {@link #deleteDeviceRegistrationState(DeviceRegistrationState)} ()} * @param deviceRegistrationState the {@link DeviceRegistrationState} that identifies the deviceRegistrationState. It cannot be {@code null}. * @throws ProvisioningServiceClientException if the Provisioning Device Service was not able to delete the * registration status information for the provided DeviceRegistrationState. */ @Deprecated public void deleteDeviceRegistrationStatus(DeviceRegistrationState deviceRegistrationState) throws ProvisioningServiceClientException { /* SRS_PROVISIONING_SERVICE_CLIENT_21_024: [The deleteDeviceRegistrationStatus shall delete the deviceRegistrationState for the provided DeviceRegistrationState by calling the delete in the registrationStatusManager.] */ registrationStatusManager.delete(deviceRegistrationState); }
/** * Factory to create a registration status query. * * <p> This method will create a new registration status query for a specific enrollment group on the Device * Provisioning Service and return it as a {@link Query} iterator. * * <p> The Device Provisioning Service expects a SQL query in the {@link QuerySpecification}, for instance * {@code "SELECT * FROM enrollments"}. * * <p> For each iteration, the Query will return a List of objects correspondent to the query result. The maximum * number of items per iteration can be specified by the pageSize. It is optional, you can provide <b>0</b> for * default pageSize or use the API {@link #createIndividualEnrollmentQuery(QuerySpecification)}. * * @param querySpecification the {@link QuerySpecification} with the SQL query. It cannot be {@code null}. * @param enrollmentGroupId the {@code String} that identifies the enrollmentGroup. It cannot be {@code null} or empty. * @param pageSize the {@code int} with the maximum number of items per iteration. It can be 0 for default, but not negative. * @return The {@link Query} iterator. * @throws IllegalArgumentException if the provided parameters are not correct. */ public Query createEnrollmentGroupRegistrationStateQuery(QuerySpecification querySpecification, String enrollmentGroupId, int pageSize) { /* SRS_PROVISIONING_SERVICE_CLIENT_21_028: [The createEnrollmentGroupRegistrationStateQuery shall create a new deviceRegistrationState query by calling the createQuery in the registrationStatusManager.] */ return registrationStatusManager.createEnrollmentGroupQuery(querySpecification, enrollmentGroupId, pageSize); }
String enrollmentPath = RegistrationStatusManager.getDeviceRegistrationStatePath(DeviceRegistrationState.getRegistrationId());
/** * @deprecated As of release 1.0.0, replaced by {@link #deleteDeviceRegistrationState(String, String)} ()} * @param id the {@code String} that identifies the deviceRegistrationState. It cannot be {@code null} or empty. * @param eTag the {@code String} with the deviceRegistrationState eTag. It can be {@code null} or empty. * The Device Provisioning Service will ignore it in all of these cases. * @throws ProvisioningServiceClientException if the Provisioning Device Service was not able to delete the * deviceRegistrationState information for the provided registrationId and eTag. */ @Deprecated public void deleteDeviceRegistrationStatus(String id, String eTag) throws ProvisioningServiceClientException { /* SRS_PROVISIONING_SERVICE_CLIENT_21_026: [The deleteDeviceRegistrationStatus shall delete the deviceRegistrationState for the provided id and eTag by calling the delete in the registrationStatusManager.] */ registrationStatusManager.delete(id, eTag); }
/** * @deprecated As of release 1.0.0, replaced by {@link #createEnrollmentGroupRegistrationStateQuery(QuerySpecification, String)} ()} * @param querySpecification the {@link QuerySpecification} with the SQL query. It cannot be {@code null}. * @param enrollmentGroupId the {@code String} that identifies the enrollmentGroup. It cannot be {@code null} or empty. * @return The {@link Query} iterator. */ @Deprecated public Query createEnrollmentGroupRegistrationStatusQuery(QuerySpecification querySpecification, String enrollmentGroupId) { /* SRS_PROVISIONING_SERVICE_CLIENT_21_027: [The createEnrollmentGroupRegistrationStatusQuery shall create a new deviceRegistrationState query by calling the createQuery in the registrationStatusManager.] */ return registrationStatusManager.createEnrollmentGroupQuery(querySpecification, enrollmentGroupId,0); }
String enrollmentPath = RegistrationStatusManager.getDeviceRegistrationStatePath(id);
registrationStatusManager.delete(id, null);
/** * @deprecated As of release 1.0.0, replaced by {@link #createEnrollmentGroupRegistrationStateQuery(QuerySpecification, String, int)} ()} * @param querySpecification the {@link QuerySpecification} with the SQL query. It cannot be {@code null}. * @param enrollmentGroupId the {@code String} that identifies the enrollmentGroup. It cannot be {@code null} or empty. * @param pageSize the {@code int} with the maximum number of items per iteration. It can be 0 for default, but not negative. * @return The {@link Query} iterator. * @throws IllegalArgumentException if the provided parameters are not correct. */ @Deprecated public Query createEnrollmentGroupRegistrationStatusQuery(QuerySpecification querySpecification, String enrollmentGroupId, int pageSize) { /* SRS_PROVISIONING_SERVICE_CLIENT_21_028: [The createEnrollmentGroupRegistrationStatusQuery shall create a new deviceRegistrationState query by calling the createQuery in the registrationStatusManager.] */ return registrationStatusManager.createEnrollmentGroupQuery(querySpecification, enrollmentGroupId, pageSize); } }
registrationStatusManager.delete(id, eTag);
registrationStatusManager.delete(deviceRegistrationState);