exam questions

Exam AD0-E103 All Questions

View all questions & answers for the AD0-E103 exam

Exam AD0-E103 topic 1 question 12 discussion

Actual exam question from Adobe's AD0-E103
Question #: 12
Topic #: 1
[All AD0-E103 Questions]

A developer needs to implement a service component that should be manually configured by operations to react on operational circumstances. The service component should NOT be active by default. The service has the properties myservice.name (one string value) and myservice.stringValues (a list of the string values) to be configured.
The developer needs to use OSGi Metatype annotations to make those properties configurable in the Apache Felix Web Console.
Which set of steps should the developer take to meet these requirements?

  • A. 1. For the class fields myserviceName and myserviceStringValues, add a @AttributeDefinition annotation each with names set to myservice.name and myservice.stringValues respectively. 2. Use the @Component annotation with configurationFactory = true on the service component class. 3. Use the @Service service component class. 4. Use the activate method of the service component class to get the configuration annotation interface class injected.
  • B. 1. Create an annotation interface as inner class of the service component and annotate it with @ObjectClassDefinition. 2. Apply @AttributeDefinition for the methods myservice.name and myservice.stringValues. 3. Use the @Component annotation with configurationPolicy = ConfigurationPolicy.REQUIRE on the service component. 4. Use the @Designate annotation to link the service component to the created configuration annotation interface. 5. Use the activate method of the service component class to get the configuration annotation interface class injected.
  • C. 1. Create an annotation interface as inner class of the service component and annotate it with @ObjectClassDefinition. 2. Apply @AttributeDefinition for the methods myservice_name and myservice_stringValues. 3. Use the @Component annotation with configurationPolicy = ConfigurationPolicy.REQUIRE on the service component. 4. Use the @Designate annotation to link the service component to the created configuration annotation interface. 5. Use the activate method of the service component class to get the configuration annotation interface class injected.
  • D. 1. For the class fields myserviceName and myserviceStringValues, add a @Property annotation each with names set to myservice.name and myservice.stringValues respectively. 2. Use the @Component annotation with configurationFactory = true on the service component class. 3. Use the @Service service component class. 4. The configuration is automatically injected into the field by the service component runtime.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
SufyanAyub
3 weeks, 5 days ago
Selected Answer: C
Option C
upvoted 1 times
...
chunpin
3 years, 11 months ago
Answer: C http://www.nateyolles.com/blog/2017/05/osgi-declarative-services-annotations-in-aem
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago