Which set of steps should the developer take to meet these requirements?

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.

Download Printable PDF. VALID exam to help you PASS.

One thought on “Which set of steps should the developer take to meet these requirements?

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.