What are SCR annotations?
SCR stands for Service Component Runtime. The ”maven-scr-plugin” uses scr annotations from the corresponding subproject at Apache Felix. All annotations are in “org. annotations” package. The Apache Felix SCR described by the OSGi Declarative Services Specification is implemented by the “org.
What are the basic SCR annotations used for creating an OSGi component?
The Basic SCR Annotation used for developing a component or service in OSGi are listed and explained below:
- @Service.
- @Property.
- @Reference.
- @Component.
What are OSGi annotations?
OSGi annotations provided a flexibility to create configuration in a separate interface and we can use it in any place. The OSGi Configurations generates metatype specification that provides a way to describe configuration of the component.
What are annotations in AEM?
The @Reference annotation defines references to other services made available to the component by the Service Component Runtime. This annotation may be declared on a Class level or any Java field to which it might apply. Depending on where the annotation is declared, the parameters may have different default values.
What is OSGi service in AEM?
An OSGi service is a java object instance, registered into an OSGi framework with a set of properties. The client of a service is always an OSGi bundle, i.e. a piece of java code possible to start via the BundleActivator interface. Each bundle may register zero or more services.
What are sling models?
Sling Models are “pure” POJOs which maps Sling objects (resources, request objects etc.). Since Sling Models are annotation-driven Plain Old Java Objects (POJOs), annotations are used a lot. They allow you to map resource properties, assign default values, inject OSGi services and much more.
What is OSGi blueprint?
The OSGi Blueprint Container Specification defines a dependency injection framework for OSGi derived from the Spring Dynamic Modules project. The specification defines a component model for OSGi based on the core Spring framework in which an OSGi bundle is augmented by an XML module blueprint .
What is SCR in AEM?
So far, any AEM project started from scratch used to implement OSGi Declarative Services on the back-end bundle using Apache Felix’s Service Component Runtime (SCR) annotations.
What is OSGi bundle in AEM?
OSGi stands for Open Service Gateway initiative. It is a Java framework for developing and deploying modular software programs and libraries. The first part is a specification for modular components called bundles, which are commonly referred to as plug-ins.
How use OSGi service in Sling model?
A Sling Model is implemented as an OSGi bundle. A Java class located in the OSGi bundle is annotated with @Model and the adaptable class (for example, @Model(adaptables = Resource….Sling Models Annotations:
Annotation | Description |
---|---|
@Model | declares a model class or interface |
@Inject | marks a field or method as injectable |
What is the difference between Felix annotations and OSGi annotations?
The most noticeable difference between Felix SCR annotations and OSGi DS annotations is where service reference properties are defined. With Felix annotations everything is in the Properties and Property annotations either at the head of the class file or inline.
Does AEM support OSGi declarative services annotations?
By now you’re pretty comfortable writing OSGi components and services using the Felix SCR annotations. However, with AEM 6.2 and greater comes support for the official OSGi Declarative Services annotations. This is exciting for two reasons.
How easy is it to develop components with OSGi?
I will show that developing components with OSGi is really simple and straightforward with no additional cruft – and I think it can’t really get much easier than this. We’ll be using the Declarative Services specification (see OSGi Compendium Chapter 112) in it’s latest version (R6).
Is the Apache Felix Maven SCR plugin compatible with OSGi?
“While the Apache Felix Maven SCR Plugin is a great tool for developing OSGi components using Declarative Services you should use the official annotations from the OSGi R6 specification. The development of the Apache Felix SCR Plugin is in maintenance mode.”