I have created an event handler and used OSGi configuration as below.
@Component(immediate = true,
service=EventHandler.class,
property= {
EventConstants.EVENT_TOPIC + "=" + ReplicationAction.EVENT_TOPIC
}
)
@Designate(ocd = PagePublishEventHandler.Configuration.class)
public class PagePublishEventHandler implements EventHandler {
private static String rootPage = "";
@Override
public void handleEvent(final Event event) {
}
@Activate
@Modified
public void activate(Configuration config) {
String rootPage = config.getPath();
logger.info("********ConfigurationPropertyInterface**********activate**********************");
logger.info("********rootPage********",rootPage);
}
@ObjectClassDefinition(name="AEM Plugin OSGi Configuration")
public @interface Configuration {
@AttributeDefinition(
name = "Root Page For Web Site",
description = "Configurable paths for root page",
type = AttributeType.STRING
)
String getPath() default "/content";
}
}
Inside the activate method, Value of rootPage is always blank. Do anyone has the solution on this.
I Thanks
I ran your code in my machine and I don't see any issues with it except for the following things which I noticed.
rootPage
is defined as a static variable. Though this is not the cause of the issue in question, it might cause issues during runtime.logger.info("********rootPage******** {}",rootPage);