4141import software .amazon .awssdk .services .location .model .CreateTrackerResponse ;
4242import software .amazon .awssdk .services .location .model .GetDevicePositionRequest ;
4343import software .amazon .awssdk .services .location .model .GetDevicePositionResponse ;
44- import software .amazon .awssdk .services .location .model .ListGeofencesRequest ;
4544import software .amazon .awssdk .services .location .model .LocationException ;
4645import software .amazon .awssdk .services .location .model .MapConfiguration ;
4746import software .amazon .awssdk .services .location .model .PutGeofenceRequest ;
5049import software .amazon .awssdk .services .location .model .ServiceQuotaExceededException ;
5150import software .amazon .awssdk .services .location .model .ThrottlingException ;
5251import software .amazon .awssdk .services .location .model .ValidationException ;
53- import software .amazon .awssdk .services .location .paginators .ListGeofencesPublisher ;
5452import java .time .Duration ;
5553import java .time .Instant ;
56- import java .util .ArrayList ;
5754import java .util .Arrays ;
5855import java .util .List ;
5956import java .util .concurrent .CompletableFuture ;
@@ -143,10 +140,10 @@ public void searchNearBy() {
143140
144141 // Process the response and print the results
145142 response .resultItems ().forEach (result -> {
146- System . out . println ("Place Name: " + result .placeType ().name ());
147- System . out . println ("Address: " + result .address ().label ());
148- System . out . println ("Distance: " + result .distance () + " meters" );
149- System . out . println ("-------------------------" );
143+ logger . info ("Place Name: " + result .placeType ().name ());
144+ logger . info ("Address: " + result .address ().label ());
145+ logger . info ("Distance: " + result .distance () + " meters" );
146+ logger . info ("-------------------------" );
150147 });
151148 }).join ();
152149 }
@@ -177,7 +174,7 @@ public void searchText(String searchQuery) {
177174 // Process the response and fetch detailed information about the place.
178175 response .resultItems ().stream ().findFirst ().ifPresent (result -> {
179176 String placeId = result .placeId (); // Get Place ID
180- System . out . println ("Found Place with id: " + placeId );
177+ logger . info ("Found Place with id: " + placeId );
181178
182179 // Fetch detailed info using getPlace.
183180 GetPlaceRequest getPlaceRequest = GetPlaceRequest .builder ()
@@ -191,21 +188,21 @@ public void searchText(String searchQuery) {
191188 }
192189
193190 // Print detailed place information.
194- System . out . println ("Detailed Place Information:" );
195- System . out . println ("Name: " + placeResponse .placeType ().name ());
196- System . out . println ("Address: " + placeResponse .address ().label ());
191+ logger . info ("Detailed Place Information:" );
192+ logger . info ("Name: " + placeResponse .placeType ().name ());
193+ logger . info ("Address: " + placeResponse .address ().label ());
197194
198195 // Print each food type (if any).
199196 if (placeResponse .foodTypes () != null && !placeResponse .foodTypes ().isEmpty ()) {
200- System . out . println ("Food Types:" );
197+ logger . info ("Food Types:" );
201198 placeResponse .foodTypes ().forEach (foodType -> {
202- System . out . println (" - " + foodType );
199+ logger . info (" - " + foodType );
203200 });
204201 } else {
205- System . out . println ("No food types available." );
202+ logger . info ("No food types available." );
206203 }
207204
208- System . out . println ("-------------------------" );
205+ logger . info ("-------------------------" );
209206 }).join ();
210207 });
211208 }).join ();
@@ -221,7 +218,7 @@ public void searchText(String searchQuery) {
221218 public void reverseGeocode () {
222219 double latitude = 37.7749 ; // San Francisco
223220 double longitude = -122.4194 ;
224- System . out . println ("Use latitude 37.7749 and longitude -122.4194" );
221+ logger . info ("Use latitude 37.7749 and longitude -122.4194" );
225222
226223 // AWS expects [longitude, latitude].
227224 List <Double > queryPosition = List .of (longitude , latitude );
@@ -237,7 +234,7 @@ public void reverseGeocode() {
237234 }
238235
239236 response .resultItems ().forEach (result ->
240- System . out . println ("The address is: " + result .address ().label ())
237+ logger . info ("The address is: " + result .address ().label ())
241238 );
242239 }).join ();
243240 }
0 commit comments