Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Adobe AD0-E137 Exam - Topic 1 Question 5 Discussion

Actual exam question for Adobe's AD0-E137 exam
Question #: 5
Topic #: 1
[All AD0-E137 Questions]

A client has a requirement to get the location of stores based on the zip code authored in the component dialog. Location needs to be pulled from an external API using OSGi services.

Which OSGi Service code snippet should be used to represent the requirement?

A)

@OSGIService(component = Service.class)

public class ServiceImpl implements Service {

@Override

public List getStoresByZipCode(String zipCode) {

List storeLocations = new ArrayList<>();

// Create an HTTP client

try (CloseableHttpClient httpClient = HttpClients.createDefault()) {

// Processing logic to get all the locations from external api

} catch (IOException e) {

}

return storeLocations;

}

}

B)

@Component(service = Service.class)

public class ServiceImpl implements Service {

@Override

public List getStoresByZipCode(String zipCode) {

List storeLocations = new ArrayList<>();

// Create an HTTP client

try (CloseableHttpClient httpClient = HttpClients.createDefault()) {

// Processing logic to get all the locations from external api

} catch (IOException e) {

}

return storeLocations;

}

}

C)

@Service(service = Component.class)

public class ServiceImpl implements Service {

@Override

public List getStoresByZipCode(String zipCode) {

List storeLocations = new ArrayList<>();

// Create an HTTP client

try (CloseableHttpClient httpClient = HttpClients.createDefault()) {

// Processing logic to get all the locations from external api

} catch (IOException e) {

}

return storeLocations;

}

}

Show Suggested Answer Hide Answer
Suggested Answer: B

Contribute your Thoughts:

0/2000 characters
Lashandra
2 days ago
Simplicity matters in exams.
upvoted 0 times
...
Lemuel
21 days ago
True, but B is simpler for beginners.
upvoted 0 times
...
Felix
26 days ago
But A is more aligned with OSGi standards.
upvoted 0 times
...
Lashandra
1 month ago
It’s straightforward with @Component.
upvoted 0 times
...
Lemuel
1 month ago
What’s good about B?
upvoted 0 times
...
Lashandra
1 month ago
I prefer Option B.
upvoted 0 times
...
Felix
2 months ago
It uses @OSGIService, which is more appropriate here.
upvoted 0 times
...
Lemuel
2 months ago
Why A?
upvoted 0 times
...
Twila
2 months ago
Wait, is D even a valid option?
upvoted 0 times
...
Leanora
2 months ago
I think A is the right choice!
upvoted 0 times
...
Rasheeda
2 months ago
I definitely remember that we should be using the right annotations for OSGi services, but I can't shake the feeling that Option A might be a trick question.
upvoted 0 times
...
Noe
2 months ago
I feel like I might be overthinking this. Wasn't there something about the service annotations needing to match the implementation? I can't recall clearly.
upvoted 0 times
...
Crista
3 months ago
I think Option B looks familiar; it seems like the standard way to declare an OSGi service. I just hope I’m not mixing it up with another question we practiced.
upvoted 0 times
...
Felix
3 months ago
I think Option A is the best choice.
upvoted 0 times
...
Gianna
3 months ago
I remember we discussed the differences between @OSGIService and @Component annotations in class, but I'm not entirely sure which one is correct here.
upvoted 0 times
...
Claribel
3 months ago
Option B looks solid for OSGi services.
upvoted 0 times
...
Irma
3 months ago
Not sure about C, seems off to me.
upvoted 0 times
...
Alease
4 months ago
B is definitely the way to go!
upvoted 0 times
...
Cornell
4 months ago
Option B is the way to go. Who needs those other fancy annotations anyway? Keep it simple!
upvoted 0 times
...
Willodean
4 months ago
Option B is the correct answer. The @Component annotation is the way to go for OSGi services.
upvoted 0 times
...
Selma
4 months ago
Haha, Option C is a trap! @Service is for Spring, not OSGi.
upvoted 0 times
...
Lazaro
4 months ago
I'm leaning towards Option B as well. The @Component annotation is the standard way to define OSGi services.
upvoted 0 times
...
Shakira
5 months ago
Option B looks good to me. The @Component annotation is the way to go for OSGi services.
upvoted 0 times
...
Elly
5 months ago
Based on the requirement to use OSGi services to pull data from an external API, I think Option B is the way to go. The @Component annotation is the standard way to define an OSGi service, and the implementation logic looks appropriate.
upvoted 0 times
...
Mona
5 months ago
Option A seems close, but the @OSGIService annotation is not the correct way to define an OSGi service. I'll double-check the OSGi service best practices to make sure I understand the right approach.
upvoted 0 times
...
Lashon
5 months ago
I'm a bit confused by the different annotations used in the options. I'll need to review the OSGi service definitions more carefully to understand the differences between @OSGIService, @Component, and @Service.
upvoted 0 times
...
Laine
5 months ago
I think Option B looks the most promising. The @Component annotation is the correct way to define an OSGi service, and the service interface implementation matches the requirement.
upvoted 0 times
...

Save Cancel