Skip to content

Commit da289fa

Browse files
committed
updated the Actions file
1 parent f7874bc commit da289fa

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

javav2/example_code/iotfleetwise/src/main/java/com/example/fleetwise/scenario/FleetwiseActions.java

+19-12
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import software.amazon.awssdk.services.iotfleetwise.IoTFleetWiseAsyncClient;
1717
import software.amazon.awssdk.services.iotfleetwise.model.Node;
1818
import software.amazon.awssdk.services.iotfleetwise.model.*;
19+
1920
import java.time.Duration;
2021
import java.util.HashMap;
2122
import java.util.List;
@@ -167,6 +168,7 @@ public static CompletableFuture<Void> deleteSignalCatalogIfExistsAsync(String si
167168
// snippet-end:[iotfleetwise.java2.delete.catalog.main]
168169

169170
// snippet-start:[iotfleetwise.java2.create.decoder.main]
171+
170172
/**
171173
* Creates a new decoder manifest.
172174
*
@@ -269,7 +271,7 @@ public CompletableFuture<Void> deleteDecoderManifestAsync(String name) {
269271
// snippet-start:[iotfleetwise.java2.delete.vehicle.main]
270272

271273
/**
272-
* Asynchronously deletes a vehicle with the specified name.
274+
* Deletes a vehicle with the specified name.
273275
*
274276
* @param vecName the name of the vehicle to be deleted
275277
* @return a {@link CompletableFuture} that completes when the vehicle has been deleted
@@ -299,7 +301,7 @@ public CompletableFuture<Void> deleteVehicleAsync(String vecName) {
299301
// snippet-start:[iotfleetwise.java2.update.manifest.main]
300302

301303
/**
302-
* Updates the model manifest asynchronously.
304+
* Updates the model manifest.
303305
*
304306
* @param name the name of the model manifest to update
305307
*/
@@ -322,7 +324,7 @@ public void updateModelManifestAsync(String name) {
322324
// snippet-start:[iotfleetwise.java2.update.decoder.main]
323325

324326
/**
325-
* Asynchronously updates the decoder manifest with the given name.
327+
* Updates the decoder manifest with the given name.
326328
*
327329
* @param name the name of the decoder manifest to update
328330
* @return a {@link CompletableFuture} that completes when the update operation is finished
@@ -347,7 +349,7 @@ public CompletableFuture<Void> updateDecoderManifestAsync(String name) {
347349
// snippet-start:[iotfleetwise.java2.create.vehicle.main]
348350

349351
/**
350-
* Asynchronously creates a new vehicle in the system.
352+
* Creates a new vehicle in the system.
351353
*
352354
* @param vecName the name of the vehicle to be created
353355
* @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
381383
// snippet-start:[iotfleetwise.java2.decoder.active.main]
382384

383385
/**
384-
* Waits for the decoder manifest to become active asynchronously.
386+
* Waits for the decoder manifest to become active.
385387
*
386388
* @param decoderName the name of the decoder to wait for
387389
* @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
393395
AtomicInteger secondsElapsed = new AtomicInteger(0);
394396
AtomicReference<ManifestStatus> lastStatus = new AtomicReference<>(ManifestStatus.DRAFT);
395397

396-
System.out.print("⏳ Elapsed: 0s | Decoder Status: DRAFT");
398+
logger.info("⏳ Elapsed: 0s | Decoder Status: DRAFT");
397399
final Runnable pollTask = new Runnable() {
398400
@Override
399401
public void run() {
@@ -456,13 +458,13 @@ public CompletableFuture<Void> waitForModelManifestActiveAsync(String manifestNa
456458
AtomicInteger secondsElapsed = new AtomicInteger(0);
457459
AtomicReference<ManifestStatus> lastStatus = new AtomicReference<>(ManifestStatus.DRAFT);
458460

459-
System.out.print("⏳ Elapsed: 0s | Status: DRAFT");
461+
logger.info("⏳ Elapsed: 0s | Status: DRAFT");
460462
final Runnable pollTask = new Runnable() {
461463
@Override
462464
public void run() {
463465
int elapsed = secondsElapsed.incrementAndGet();
464466

465-
// Only check status every 5 seconds
467+
// Only check status every 5 seconds.
466468
if (elapsed % 5 == 0) {
467469
GetModelManifestRequest request = GetModelManifestRequest.builder()
468470
.name(manifestName)
@@ -507,7 +509,7 @@ public void run() {
507509
// snippet-start:[iotfleetwise.java2.get.vehicle.main]
508510

509511
/**
510-
* Asynchronously fetches the details of a vehicle.
512+
* Fetches the details of a vehicle.
511513
*
512514
* @param vehicleName the name of the vehicle to fetch details for
513515
* @return a {@link CompletableFuture} that completes when the vehicle details have been fetched
@@ -534,7 +536,7 @@ public CompletableFuture<Void> getVehicleDetailsAsync(String vehicleName) {
534536
// Print details in a readable format
535537
logger.info("🚗 Vehicle Details:");
536538
details.forEach((key, value) -> {
537-
System.out.printf("• %-20s : %s%n", key, value);
539+
logger.info("• %-20s : %s%n", key, value);
538540
});
539541
}
540542
})
@@ -543,7 +545,7 @@ public CompletableFuture<Void> getVehicleDetailsAsync(String vehicleName) {
543545
// snippet-end:[iotfleetwise.java2.get.vehicle.main]
544546

545547
/**
546-
* Asynchronously creates an IoT Thing if it does not already exist.
548+
* Creates an IoT Thing if it does not already exist.
547549
*
548550
* @param thingName the name of the IoT Thing to create
549551
* @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
674676
public CompletableFuture<String> createModelManifestAsync(String name,
675677
String signalCatalogArn,
676678
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+
*/
678684
List<String> fqnList = nodes.stream()
679685
.map(node -> {
680686
if (node.sensor() != null) {
@@ -706,6 +712,7 @@ public CompletableFuture<String> createModelManifestAsync(String name,
706712
// snippet-end:[iotfleetwise.java2.create.model.main]
707713

708714
// snippet-start:[iotfleetwise.java2.delete.fleet.main]
715+
709716
/**
710717
* Deletes a fleet based on the provided fleet ID.
711718
*

0 commit comments

Comments
 (0)