16
16
import software .amazon .awssdk .services .iotfleetwise .IoTFleetWiseAsyncClient ;
17
17
import software .amazon .awssdk .services .iotfleetwise .model .Node ;
18
18
import software .amazon .awssdk .services .iotfleetwise .model .*;
19
+
19
20
import java .time .Duration ;
20
21
import java .util .HashMap ;
21
22
import java .util .List ;
@@ -167,6 +168,7 @@ public static CompletableFuture<Void> deleteSignalCatalogIfExistsAsync(String si
167
168
// snippet-end:[iotfleetwise.java2.delete.catalog.main]
168
169
169
170
// snippet-start:[iotfleetwise.java2.create.decoder.main]
171
+
170
172
/**
171
173
* Creates a new decoder manifest.
172
174
*
@@ -269,7 +271,7 @@ public CompletableFuture<Void> deleteDecoderManifestAsync(String name) {
269
271
// snippet-start:[iotfleetwise.java2.delete.vehicle.main]
270
272
271
273
/**
272
- * Asynchronously deletes a vehicle with the specified name.
274
+ * Deletes a vehicle with the specified name.
273
275
*
274
276
* @param vecName the name of the vehicle to be deleted
275
277
* @return a {@link CompletableFuture} that completes when the vehicle has been deleted
@@ -299,7 +301,7 @@ public CompletableFuture<Void> deleteVehicleAsync(String vecName) {
299
301
// snippet-start:[iotfleetwise.java2.update.manifest.main]
300
302
301
303
/**
302
- * Updates the model manifest asynchronously .
304
+ * Updates the model manifest.
303
305
*
304
306
* @param name the name of the model manifest to update
305
307
*/
@@ -322,7 +324,7 @@ public void updateModelManifestAsync(String name) {
322
324
// snippet-start:[iotfleetwise.java2.update.decoder.main]
323
325
324
326
/**
325
- * Asynchronously updates the decoder manifest with the given name.
327
+ * Updates the decoder manifest with the given name.
326
328
*
327
329
* @param name the name of the decoder manifest to update
328
330
* @return a {@link CompletableFuture} that completes when the update operation is finished
@@ -347,7 +349,7 @@ public CompletableFuture<Void> updateDecoderManifestAsync(String name) {
347
349
// snippet-start:[iotfleetwise.java2.create.vehicle.main]
348
350
349
351
/**
350
- * Asynchronously creates a new vehicle in the system.
352
+ * Creates a new vehicle in the system.
351
353
*
352
354
* @param vecName the name of the vehicle to be created
353
355
* @param manifestArn the Amazon Resource Name (ARN) of the model manifest for the vehicle
@@ -381,7 +383,7 @@ public CompletableFuture<Void> createVehicleAsync(String vecName, String manifes
381
383
// snippet-start:[iotfleetwise.java2.decoder.active.main]
382
384
383
385
/**
384
- * Waits for the decoder manifest to become active asynchronously .
386
+ * Waits for the decoder manifest to become active.
385
387
*
386
388
* @param decoderName the name of the decoder to wait for
387
389
* @return a {@link CompletableFuture} that completes when the decoder manifest becomes active, or exceptionally if an error occurs or the manifest becomes invalid
@@ -393,7 +395,7 @@ public CompletableFuture<Void> waitForDecoderManifestActiveAsync(String decoderN
393
395
AtomicInteger secondsElapsed = new AtomicInteger (0 );
394
396
AtomicReference <ManifestStatus > lastStatus = new AtomicReference <>(ManifestStatus .DRAFT );
395
397
396
- System . out . print ("⏳ Elapsed: 0s | Decoder Status: DRAFT" );
398
+ logger . info ("⏳ Elapsed: 0s | Decoder Status: DRAFT" );
397
399
final Runnable pollTask = new Runnable () {
398
400
@ Override
399
401
public void run () {
@@ -456,13 +458,13 @@ public CompletableFuture<Void> waitForModelManifestActiveAsync(String manifestNa
456
458
AtomicInteger secondsElapsed = new AtomicInteger (0 );
457
459
AtomicReference <ManifestStatus > lastStatus = new AtomicReference <>(ManifestStatus .DRAFT );
458
460
459
- System . out . print ("⏳ Elapsed: 0s | Status: DRAFT" );
461
+ logger . info ("⏳ Elapsed: 0s | Status: DRAFT" );
460
462
final Runnable pollTask = new Runnable () {
461
463
@ Override
462
464
public void run () {
463
465
int elapsed = secondsElapsed .incrementAndGet ();
464
466
465
- // Only check status every 5 seconds
467
+ // Only check status every 5 seconds.
466
468
if (elapsed % 5 == 0 ) {
467
469
GetModelManifestRequest request = GetModelManifestRequest .builder ()
468
470
.name (manifestName )
@@ -507,7 +509,7 @@ public void run() {
507
509
// snippet-start:[iotfleetwise.java2.get.vehicle.main]
508
510
509
511
/**
510
- * Asynchronously fetches the details of a vehicle.
512
+ * Fetches the details of a vehicle.
511
513
*
512
514
* @param vehicleName the name of the vehicle to fetch details for
513
515
* @return a {@link CompletableFuture} that completes when the vehicle details have been fetched
@@ -534,7 +536,7 @@ public CompletableFuture<Void> getVehicleDetailsAsync(String vehicleName) {
534
536
// Print details in a readable format
535
537
logger .info ("🚗 Vehicle Details:" );
536
538
details .forEach ((key , value ) -> {
537
- System . out . printf ("• %-20s : %s%n" , key , value );
539
+ logger . info ("• %-20s : %s%n" , key , value );
538
540
});
539
541
}
540
542
})
@@ -543,7 +545,7 @@ public CompletableFuture<Void> getVehicleDetailsAsync(String vehicleName) {
543
545
// snippet-end:[iotfleetwise.java2.get.vehicle.main]
544
546
545
547
/**
546
- * Asynchronously creates an IoT Thing if it does not already exist.
548
+ * Creates an IoT Thing if it does not already exist.
547
549
*
548
550
* @param thingName the name of the IoT Thing to create
549
551
* @return a {@link CompletableFuture} that completes when the IoT Thing has been created or if it already exists
@@ -674,7 +676,11 @@ public CompletableFuture<List<Node>> listSignalCatalogNodeAsync(String signalCat
674
676
public CompletableFuture <String > createModelManifestAsync (String name ,
675
677
String signalCatalogArn ,
676
678
List <Node > nodes ) {
677
- // Extract fully qualified names from each Node.
679
+ /*
680
+ Extract the fully qualified names (FQNs) from each Node in the provided list.
681
+ The FQN is obtained by calling the appropriate getter method on the Node object
682
+ (sensor(), branch(), or attribute()) and then retrieving the fullyQualifiedName()
683
+ */
678
684
List <String > fqnList = nodes .stream ()
679
685
.map (node -> {
680
686
if (node .sensor () != null ) {
@@ -706,6 +712,7 @@ public CompletableFuture<String> createModelManifestAsync(String name,
706
712
// snippet-end:[iotfleetwise.java2.create.model.main]
707
713
708
714
// snippet-start:[iotfleetwise.java2.delete.fleet.main]
715
+
709
716
/**
710
717
* Deletes a fleet based on the provided fleet ID.
711
718
*
0 commit comments