Whats is the equivalent for "propertyPrivate = true" in r6 annotation ? | Community
Skip to main content
kamalakannank62
Level 3
Nov 14, 2018 4:32 PM UTC
Solved

Whats is the equivalent for "propertyPrivate = true" in r6 annotation ?

Hello folks,

We are migrating from 6.2 to aem 6.4, So we are replacing scr annotations with OSGI R6 annotations,

While migrating Servlets properties I am not able to find equivalent for "propertyPrivate = true".

Below is the annotation Kindly suggest me the equivalent.

@Component

@Service

@Properties({ @Property(name = "service.description", value = "Servlet used to render alerts"),

        @Property(name = "sling.servlet.resourceTypes", value = "sling/servlet/default", propertyPrivate = true),

        @Property(name = "sling.servlet.selectors", value = "alertbar", propertyPrivate = true),

        @Property(name = "sling.servlet.methods", value = { "GET" }) })

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Nov 14, 2018 5:20 PM UTC

Hi,

You need to declare property inside component annotation.

e.g.

@Component(service = Servlet.class,

                              property = {

Constants.SERVICE_DESCRIPTION + "=Servlet used to render alerts",

               "sling.servlet.methods=" + HttpConstants.METHOD_GET,

               "sling.servlet.resourceTypes=sling/servlet/default",

               "sling.servlet.selectors=alertbar"

               })

Arun Patidar

4 replies

kamalakannank62
Level 3
Nov 15, 2018 10:14 AM UTC

Thank You for the Reply,

Translate
arunpatidar
New Participant
Nov 15, 2018 10:09 AM UTC

Hi,

When you declare property under component annotation , it is considered as private property.

And configurable properties are define using ObjectClassDefinition annotation

@Component(

        service = Servlet.class,

        property =

  { "privateprop=value" }

);

//configurable properties

@Designate(ocd = MyServiceImplConfiguration.class)

public class MyServiceImpl extends MyService {

...

}

// Configuration

@ObjectClassDefinition(name = "My Service Config")

public @interface MyServiceImplConfiguration {

    String my_prop1_path() default "/etc/design/MyProj";

...

}

Translate
Arun Patidar
kamalakannank62
Level 3
Nov 15, 2018 9:27 AM UTC

Yeah I am declaring it under @component, But wasn't clear about the "privateProperty", thank you for the reply.

Translate
arunpatidar
arunpatidarAccepted solution
New Participant
Nov 14, 2018 5:20 PM UTC

Hi,

You need to declare property inside component annotation.

e.g.

@Component(service = Servlet.class,

                              property = {

Constants.SERVICE_DESCRIPTION + "=Servlet used to render alerts",

               "sling.servlet.methods=" + HttpConstants.METHOD_GET,

               "sling.servlet.resourceTypes=sling/servlet/default",

               "sling.servlet.selectors=alertbar"

               })

Translate
Arun Patidar