99import software .amazon .awssdk .services .iotfleetwise .model .Node ;
1010import software .amazon .awssdk .services .iotfleetwise .model .ResourceNotFoundException ;
1111import software .amazon .awssdk .services .iotfleetwise .model .ValidationException ;
12+
1213import java .util .List ;
1314import java .util .Scanner ;
1415import java .util .concurrent .CompletionException ;
@@ -22,17 +23,17 @@ public class FleetwiseScenario {
2223
2324 public static void main (String [] args ) {
2425 final String usage =
25- """
26- Usage:
27- <signalCatalogName> <manifestName> <fleetId> <vecName> <decName>
26+ """
27+ Usage:
28+ <signalCatalogName> <manifestName> <fleetId> <vecName> <decName>
2829
29- Where:
30- signalCatalogName - The name of the Signal Catalog to create (eg, catalog30).
31- manifestName - The name of the Vehicle Model (Model Manifest) to create (eg, manifest30).
32- fleetId - The ID of the Fleet to create (eg, fleet30).
33- vecName - The name of the Vehicle to create (eg, vehicle30).
34- decName - The name of the Decoder Manifest to create (eg, decManifest30).
35- """ ;
30+ Where:
31+ signalCatalogName - The name of the Signal Catalog to create (eg, catalog30).
32+ manifestName - The name of the Vehicle Model (Model Manifest) to create (eg, manifest30).
33+ fleetId - The ID of the Fleet to create (eg, fleet30).
34+ vecName - The name of the Vehicle to create (eg, vehicle30).
35+ decName - The name of the Decoder Manifest to create (eg, decManifest30).
36+ """ ;
3637
3738 if (args .length != 5 ) {
3839 System .out .println (usage );
@@ -46,28 +47,28 @@ public static void main(String[] args) {
4647 String decName = args [4 ];
4748
4849 logger .info (
49- """
50- AWS IoT FleetWise is a managed service that simplifies the
51- process of collecting, organizing, and transmitting vehicle
52- data to the cloud in near real-time. Designed for automakers
53- and fleet operators, it allows you to define vehicle models,
54- specify the exact data you want to collect (such as engine
55- temperature, speed, or battery status), and send this data to
56- AWS for analysis. By using intelligent data collection
57- techniques, IoT FleetWise reduces the volume of data
58- transmitted by filtering and transforming it at the edge,
59- helping to minimize bandwidth usage and costs.
60-
61- At its core, AWS IoT FleetWise helps organizations build
62- scalable systems for vehicle data management and analytics,
63- supporting a wide variety of vehicles and sensor configurations.
64- You can define signal catalogs and decoder manifests that describe
65- how raw CAN bus signals are translated into readable data, making
66- the platform highly flexible and extensible. This allows
67- manufacturers to optimize vehicle performance, improve safety,
68- and reduce maintenance costs by gaining real-time visibility
69- into fleet operations.
70- """ );
50+ """
51+ AWS IoT FleetWise is a managed service that simplifies the
52+ process of collecting, organizing, and transmitting vehicle
53+ data to the cloud in near real-time. Designed for automakers
54+ and fleet operators, it allows you to define vehicle models,
55+ specify the exact data you want to collect (such as engine
56+ temperature, speed, or battery status), and send this data to
57+ AWS for analysis. By using intelligent data collection
58+ techniques, IoT FleetWise reduces the volume of data
59+ transmitted by filtering and transforming it at the edge,
60+ helping to minimize bandwidth usage and costs.
61+
62+ At its core, AWS IoT FleetWise helps organizations build
63+ scalable systems for vehicle data management and analytics,
64+ supporting a wide variety of vehicles and sensor configurations.
65+ You can define signal catalogs and decoder manifests that describe
66+ how raw CAN bus signals are translated into readable data, making
67+ the platform highly flexible and extensible. This allows
68+ manufacturers to optimize vehicle performance, improve safety,
69+ and reduce maintenance costs by gaining real-time visibility
70+ into fleet operations.
71+ """ );
7172
7273 waitForInputToContinue (scanner );
7374 logger .info (DASHES );
@@ -104,15 +105,15 @@ private static void runScenario(String signalCatalogName,
104105 logger .info (DASHES );
105106 logger .info ("2. Create a fleet that represents a group of vehicles" );
106107 logger .info (
107- """
108- Creating an IoT FleetWise fleet allows you to efficiently collect,
109- organize, and transfer vehicle data to the cloud, enabling real-time
110- insights into vehicle performance and health.
111-
112- It helps reduce data costs by allowing you to filter and prioritize
113- only the most relevant vehicle signals, supporting advanced analytics
114- and predictive maintenance use cases.
115- """ );
108+ """
109+ Creating an IoT FleetWise fleet allows you to efficiently collect,
110+ organize, and transfer vehicle data to the cloud, enabling real-time
111+ insights into vehicle performance and health.
112+
113+ It helps reduce data costs by allowing you to filter and prioritize
114+ only the most relevant vehicle signals, supporting advanced analytics
115+ and predictive maintenance use cases.
116+ """ );
116117
117118 waitForInputToContinue (scanner );
118119 String fleetid ;
@@ -262,7 +263,17 @@ Before calling createVehicle(), you must create an AWS IoT Thing
262263 logger .info (DASHES );
263264 logger .info ("9. Display vehicle details" );
264265 waitForInputToContinue (scanner );
265- actions .getVehicleDetailsAsync (vecName ).join ();
266+ try {
267+ actions .getVehicleDetailsAsync (vecName ).join ();
268+ } catch (CompletionException ce ) {
269+ Throwable cause = ce .getCause ();
270+ if (cause instanceof ResourceNotFoundException ) {
271+ logger .error ("The resource was not found: {}" , cause .getMessage ());
272+ } else {
273+ logger .error ("An unexpected error occurred." , cause );
274+ }
275+ return ;
276+ }
266277 waitForInputToContinue (scanner );
267278 logger .info (DASHES );
268279
0 commit comments