Use of Activator.java in CQ bundle | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Peter_Puzanovs
Peter_PuzanovsAccepted solution
New Participant
Oct 16, 2015 2:27 AM UTC

Hi,

Activator.java can be used to initialize(start) things.

headwire provides an excellent open source project that uses Activator.java to initialize logging:

https://github.com/headwirecom/aem-solr-search/blob/master/aemsolrsearch-services/src/main/java/com/headwire/aemsolrsearch/services/osgi/Activator.java

Thanks,

Peter

4 replies

ambivert09
New Participant
Jan 22, 2016 7:24 AM UTC

Hi Yogesh,

So does it mean that bundle activator class is optional for AEM OSGI bundles and i assume i can live fine by using @Activate/@Deactivate at service level and there will not be any bundle activator class at all in bundle. Here i assume that felix framework will initialize the bundle without any activator class with caveat that i am not doing any initialization at bundle level which we usually do not do.

It would be helpful if i can get reference to docs describing this.

Regards.

Translate
Peter_Puzanovs
Peter_PuzanovsAccepted solution
New Participant
Oct 16, 2015 2:27 AM UTC

Hi,

Activator.java can be used to initialize(start) things.

headwire provides an excellent open source project that uses Activator.java to initialize logging:

https://github.com/headwirecom/aem-solr-search/blob/master/aemsolrsearch-services/src/main/java/com/headwire/aemsolrsearch/services/osgi/Activator.java

Thanks,

Peter

Translate
partyush
New Participant
Jan 25, 2023 12:05 PM UTC

Thanks

Translate
Yogesh_Upadhyay
Level 6
Oct 16, 2015 2:27 AM UTC

Hello,

As far as name is concern you can use any name for activation class (Need not have to be Activator.java), you just have to mention that in your bundle configuration as

Bundle-Activator:fully-qualified-activator-class-name

Please use this only if you want to do some initialization at bundle level. For Service level initialization use something like this (This will get called when your service get initialized)

@Activate protected final void activate(final ComponentContext componentContext) { }

Yogesh

www.wemblog.com

Translate