/** * This constructor creates an instance of AmqpsDeviceAuthenticationSAS class and initializes member variables * * @param deviceClientConfig the device config to use for authentication. * @throws IllegalArgumentException if deviceClientConfig is null. */ public AmqpsDeviceAuthenticationX509(DeviceClientConfig deviceClientConfig) throws IllegalArgumentException { // Codes_SRS_AMQPSDEVICEAUTHENTICATIONX509_34_007: [This constructor shall call super with the provided user agent string.] super(deviceClientConfig); // Codes_SRS_AMQPSDEVICEAUTHENTICATIONX509_12_002: [The constructor shall save the deviceClientConfig parameter value to a member variable.] this.deviceClientConfig = deviceClientConfig; // Codes_SRS_AMQPSDEVICEAUTHENTICATIONX509_12_003: [The constructor shall set both the sender and the receiver link state to OPENED.] this.amqpsSendLinkState = AmqpsDeviceOperationLinkState.OPENED; this.amqpsRecvLinkState = AmqpsDeviceOperationLinkState.OPENED; this.logger = new CustomLogger(this.getClass()); }
/** * Internal initializer method for a new Message instance. */ private void initialize() { this.lockToken = UUID.randomUUID().toString(); this.messageId = UUID.randomUUID().toString(); this.correlationId = UUID.randomUUID().toString(); this.feedbackStatusCode = FeedbackStatusCodeEnum.none; this.ack = FeedbackStatusCodeEnum.none; this.properties = new ArrayList<>(); this.logger = new CustomLogger(this.getClass()); }
/** * Constructor for an IotHubTransport object with default values * @param defaultConfig the config used for opening connections, retrieving retry policy, and checking protocol * @throws IllegalArgumentException if defaultConfig is null */ public IotHubTransport(DeviceClientConfig defaultConfig) throws IllegalArgumentException { if (defaultConfig == null) { //Codes_SRS_IOTHUBTRANSPORT_34_002: [If the provided config is null, this function shall throw an // IllegalArgumentException.] throw new IllegalArgumentException("Config cannot be null"); } //Codes_SRS_IOTHUBTRANSPORT_34_001: [The constructor shall save the default config.] this.defaultConfig = defaultConfig; //Codes_SRS_IOTHUBTRANSPORT_34_003: [The constructor shall set the connection status as DISCONNECTED and the // current retry attempt to 0.] this.connectionStatus = IotHubConnectionStatus.DISCONNECTED; this.currentReconnectionAttempt = 0; this.logger = new CustomLogger(this.getClass()); }
InternalClient(IotHubAuthenticationProvider iotHubAuthenticationProvider, IotHubClientProtocol protocol, long sendPeriodMillis, long receivePeriodMillis) throws IOException, TransportException { this.config = new DeviceClientConfig(iotHubAuthenticationProvider); this.config.setProtocol(protocol); this.deviceIO = new DeviceIO(this.config, sendPeriodMillis, receivePeriodMillis); this.logger = new CustomLogger(this.getClass()); }
this.logger = new CustomLogger(this.getClass());
/** * This constructor creates an instance of AmqpsDeviceAuthenticationCBS class and initializes member variables * * @param deviceClientConfig the device config to use for authentication. * @throws IllegalArgumentException if deviceClientConfig is null. */ public AmqpsDeviceAuthenticationCBS(DeviceClientConfig deviceClientConfig) throws IllegalArgumentException { // Codes_SRS_AMQPSDEVICEAUTHENTICATIONCBS_34_050: [This constructor shall call super with the provided user agent string.] super(deviceClientConfig); this.deviceClientConfig = deviceClientConfig; // Codes_SRS_AMQPSDEVICEAUTHENTICATIONCBS_12_001: [The constructor shall set the sender and receiver endpoint path to IoTHub specific values.] this.senderLinkEndpointPath = SENDER_LINK_ENDPOINT_PATH; this.receiverLinkEndpointPath = RECEIVER_LINK_ENDPOINT_PATH; // Codes_SRS_AMQPSDEVICEAUTHENTICATIONCBS_12_002: [The constructor shall concatenate a sender specific prefix to the sender link tag's current value.] this.senderLinkTag = SENDER_LINK_TAG_PREFIX + senderLinkTag; this.receiverLinkTag = RECEIVER_LINK_TAG_PREFIX + receiverLinkTag; // Codes_SRS_AMQPSDEVICEAUTHENTICATIONCBS_12_003: [The constructor shall set the sender and receiver endpoint path.] this.senderLinkAddress = senderLinkEndpointPath; this.receiverLinkAddress = receiverLinkEndpointPath; // Codes_SRS_AMQPSDEVICEAUTHENTICATIONCBS_12_004: [The constructor shall add API version key and API version value to the amqpProperties.*] this.amqpProperties.put(Symbol.getSymbol(API_VERSION_KEY), TransportUtils.IOTHUB_API_VERSION); this.amqpProperties.put(Symbol.getSymbol(MessageProperty.CONNECTION_DEVICE_ID), deviceClientConfig.getDeviceId()); this.logger = new CustomLogger(this.getClass()); }
this.logger = new CustomLogger(this.getClass());
InternalClient(IotHubConnectionString iotHubConnectionString, IotHubClientProtocol protocol, String publicKeyCertificate, boolean isCertificatePath, String privateKey, boolean isPrivateKeyPath, long sendPeriodMillis, long receivePeriodMillis) throws URISyntaxException { // Codes_SRS_INTERNALCLIENT_34_078: [If the connection string or protocol is null, this function shall throw an IllegalArgumentException.] commonConstructorVerification(iotHubConnectionString, protocol); // Codes_SRS_INTERNALCLIENT_34_079: [This function shall save a new config using the provided connection string, and x509 certificate information.] this.config = new DeviceClientConfig(iotHubConnectionString, publicKeyCertificate, isCertificatePath, privateKey, isPrivateKeyPath); this.config.setProtocol(protocol); // Codes_SRS_INTERNALCLIENT_34_080: [This function shall save a new DeviceIO instance using the created config and the provided send/receive periods.] this.deviceIO = new DeviceIO(this.config, sendPeriodMillis, receivePeriodMillis); this.logger = new CustomLogger(this.getClass()); }
InternalClient(IotHubConnectionString iotHubConnectionString, IotHubClientProtocol protocol, long sendPeriodMillis, long receivePeriodMillis) { /* Codes_SRS_INTERNALCLIENT_21_004: [If the connection string is null or empty, the function shall throw an IllegalArgumentException.] */ commonConstructorVerification(iotHubConnectionString, protocol); this.config = new DeviceClientConfig(iotHubConnectionString); this.config.setProtocol(protocol); this.deviceIO = new DeviceIO(this.config, sendPeriodMillis, receivePeriodMillis); this.logger = new CustomLogger(this.getClass()); }
public DeviceClientConfig(IotHubAuthenticationProvider authenticationProvider) throws IllegalArgumentException { if (!(authenticationProvider instanceof IotHubSasTokenAuthenticationProvider)) { throw new UnsupportedOperationException("This constructor only support sas token authentication currently"); } this.authenticationProvider = authenticationProvider; this.useWebsocket = false; this.productInfo = new ProductInfo(); this.logger = new CustomLogger(this.getClass()); logger.LogInfo("DeviceClientConfig object is created successfully with IotHubName=%s, deviceID=%s , method name is %s ", this.authenticationProvider.getHostname(), authenticationProvider.getDeviceId(), logger.getMethodName()); }
logger = new CustomLogger(this.getClass()); logger.LogInfo("FileUpload object is created successfully, method name is %s ", logger.getMethodName());
this.deviceMethod = null; this.deviceTwin = null; this.logger = new CustomLogger(this.getClass());
this.amqpsDeviceOperationsList.add(new AmqpsDeviceTwin(this.deviceClientConfig)); this.logger = new CustomLogger(this.getClass());
this.logger = new CustomLogger(this.getClass());
public IotHubConnectionString(String hostName, String deviceId, String sharedAccessKey, String sharedAccessToken, String gatewayHostName) throws IllegalArgumentException, URISyntaxException { this.isUsingX509 = (sharedAccessKey == null && sharedAccessToken == null); /* Codes_SRS_IOTHUB_CONNECTIONSTRING_21_025: [If the parameters for the connection string is not valid, the constructor shall throw an IllegalArgumentException.] */ validateTerms(hostName, deviceId, sharedAccessKey, sharedAccessToken, this.isUsingX509); /* Codes_SRS_IOTHUB_CONNECTIONSTRING_21_020: [The constructor shall save the IoT Hub hostname as the value of `hostName` in the connection string.] */ this.hostName = hostName; /* Codes_SRS_IOTHUB_CONNECTIONSTRING_21_021: [The constructor shall save the first part of the IoT Hub hostname as the value of `hubName`, hostname split by `.`.] */ this.hubName = parseHubName(this.hostName); /* Codes_SRS_IOTHUB_CONNECTIONSTRING_21_022: [The constructor shall save the device ID as the UTF-8 URL-decoded value of `deviceId` in the connection string.] */ this.deviceId = deviceId; /* Codes_SRS_IOTHUB_CONNECTIONSTRING_21_023: [The constructor shall save the device key as the value of `sharedAccessKey` in the connection string.] */ this.sharedAccessKey = sharedAccessKey; /* Codes_SRS_IOTHUB_CONNECTIONSTRING_21_024: [The constructor shall save the shared access token as the value of `sharedAccessToken` in the connection string.] */ this.sharedAccessToken = sharedAccessToken; /* Codes_SRS_IOTHUB_CONNECTIONSTRING_34_036: [If the SAS Token has expired, throw a SecurityException.] */ if (this.sharedAccessToken != null && IotHubSasToken.isExpired(this.sharedAccessToken)) { throw new SecurityException("Your SAS Token has expired"); } this.gatewayHostName = gatewayHostName; if (this.gatewayHostName != null && !this.gatewayHostName.isEmpty()) { this.hostName = gatewayHostName; } this.logger = new CustomLogger(this.getClass()); logger.LogInfo("IotHubConnectionString object is created successfully, method name is %s ", logger.getMethodName()); }
this.logger = new CustomLogger(this.getClass()); logger.LogInfo("DeviceIO object is created successfully, method name is %s ", logger.getMethodName());
this.logger = new CustomLogger(this.getClass()); if (name == null) { logger.LogError("Property argument 'name' cannot be null, method name is %s ", logger.getMethodName());
publicKeyCertificate, isPathForPublic, privateKey, isPathForPrivate); this.logger = new CustomLogger(this.getClass()); logger.LogInfo("DeviceClientConfig object is created successfully, method name is %s ", logger.getMethodName());
this.logger = new CustomLogger(this.getClass()); logger.LogInfo("DeviceClient object is created successfully, method name is %s ", logger.getMethodName());
this.logger = new CustomLogger(this.getClass()); logger.LogInfo("DeviceClientConfig object is created successfully with IotHubName=%s, deviceID=%s , method name is %s ", iotHubConnectionString.getHostName(), iotHubConnectionString.getDeviceId(), logger.getMethodName());