Expand my Community achievements bar.

SOLVED

Is there any difference between read osgi config values versus read normal node property values

Avatar

Level 9

Hi All,

The article https://helpx.adobe.com/experience-manager/using/osgi_config.html talks about reading property values from sling:osgi config nodes.

1] Is it different from reading values from the ordinary jcr nodes , the reason being

a] We have made use of activate method. Not sure what is the exact purpose that it is serving here.

b] There are @Property annotations used.

And I guess these are nowhere made use of when reading ordinary jcr nodes [unlike details provided in http://aem.matelli.org/fetching-properties-from-dialogs/ ]

Any thoughts on this will be helpful.

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

you can find details here[1], that should explain the principle. Basically, whenever you update an OSGI configuration parameter it gets saved to the repository so it is available even if you restart the instance(i.e. unlike if it were held in memory). In the article, the readProperties method is getting the values held within nodes specifically created for the service.

This is the standard approach, as you can then use runmodes to setup the configuration for your OSGI services per instance. [1]

Using @Property is used to affect the behaviour of your service, with access to changing the configuration being done using the Felix console, so only a user with the appropriate privileges being able to make changes.

So the article is using @Property to define a property that a user can change in the OSGI Felix configuration console, when the service is initiated by the OSGI container, the activate method is called, at this point you initialise your service, hence loading the properties.

More details on using activate[2]

Regards,

Opkar

[1] http://blogs.adobe.com/experiencedelivers/experience-management/osig-config-101/

[2] https://thecarlhall.wordpress.com/2011/02/04/when-to-immediately-activate-an-osgi-component/

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

Hi,

you can find details here[1], that should explain the principle. Basically, whenever you update an OSGI configuration parameter it gets saved to the repository so it is available even if you restart the instance(i.e. unlike if it were held in memory). In the article, the readProperties method is getting the values held within nodes specifically created for the service.

This is the standard approach, as you can then use runmodes to setup the configuration for your OSGI services per instance. [1]

Using @Property is used to affect the behaviour of your service, with access to changing the configuration being done using the Felix console, so only a user with the appropriate privileges being able to make changes.

So the article is using @Property to define a property that a user can change in the OSGI Felix configuration console, when the service is initiated by the OSGI container, the activate method is called, at this point you initialise your service, hence loading the properties.

More details on using activate[2]

Regards,

Opkar

[1] http://blogs.adobe.com/experiencedelivers/experience-management/osig-config-101/

[2] https://thecarlhall.wordpress.com/2011/02/04/when-to-immediately-activate-an-osgi-component/