use of org.osgi.service.component.annotations.Activate in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class CoreFormHandlingServlet method activate.
@Activate
protected void activate(Configuration configuration) {
String[] dataNameWhitelist = PropertiesUtil.toStringArray(configuration.name_whitelist());
boolean allowExpressions = PropertiesUtil.toBoolean(configuration.allow_expressions(), PROP_ALLOW_EXPRESSION_DEFAULT);
formsHandlingServletHelper = new FormsHandlingServletHelper(dataNameWhitelist, validator, FormConstants.RT_ALL_CORE_FORM_CONTAINER, allowExpressions, formStructureHelperFactory);
}
use of org.osgi.service.component.annotations.Activate in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class AdaptiveImageServletMappingConfigurationConsumer method activate.
/**
* Activation method
*
* @param componentContext - Component context
* @param bundleContext - Bundle context
* @param config - Config properties
*/
@Activate
public void activate(ComponentContext componentContext, BundleContext bundleContext, Map<String, Object> config) {
try {
Configuration[] configurations = configurationAdmin.listConfigurations("(" + Constants.SERVICE_PID + "=" + AdaptiveImageServlet.class.getName() + ")");
if (ArrayUtils.isNotEmpty(configurations)) {
Configuration oldConfig = configurations[0];
oldAISDefaultResizeWidth = PropertiesUtil.toInteger(oldConfig.getProperties().get("defaultResizeWidth"), Integer.MIN_VALUE);
if (oldAISDefaultResizeWidth > 0) {
LOG.warn("Found previous custom configuration for the {}. The configuration will be reused to control the {} " + "registrations managed by this component. Please migrate the previous configuration to the {} factory" + " configurations.", AdaptiveImageServlet.class.getName(), AdaptiveImageServlet.class.getName(), AdaptiveImageServletMappingConfigurationFactory.class.getName());
}
}
} catch (IOException | InvalidSyntaxException | RuntimeException e) {
LOG.error("Unable to retrieve previous configuration for the " + AdaptiveImageServlet.class.getName() + " component. " + "The configuration, if it still exists, will not be reused to configure the defaultResizeWidth property of the " + "servlet's registrations managed by this component.", e);
}
this.bundleContext = bundleContext;
updateServletRegistrations();
}
use of org.osgi.service.component.annotations.Activate in project carbon-apimgt by wso2.
the class APITokenMgtServiceComponent method activate.
@Activate
protected void activate(ComponentContext ctxt) {
try {
TokenMgtDataHolder.initData();
listener = new KeyManagerUserOperationListener();
serviceRegistration = ctxt.getBundleContext().registerService(UserOperationEventListener.class.getName(), listener, null);
log.debug("Key Manager User Operation Listener is enabled.");
APIManagerConfigurationService configurationService = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService();
boolean accessTokenBindingEnable;
String firstProperty = configurationService.getAPIManagerConfiguration().getFirstProperty(APIConstants.AccessTokenBinding.ACCESS_TOKEN_BINDING_ENABLED);
if (firstProperty != null) {
accessTokenBindingEnable = Boolean.parseBoolean(firstProperty);
} else {
accessTokenBindingEnable = false;
}
if (!accessTokenBindingEnable) {
// registering logout token revoke listener
try {
SessionDataPublisherImpl dataPublisher = new SessionDataPublisherImpl();
ctxt.getBundleContext().registerService(AuthenticationDataPublisher.class.getName(), dataPublisher, null);
log.debug("SessionDataPublisherImpl bundle is activated");
} catch (Throwable e) {
log.error("SessionDataPublisherImpl bundle activation Failed", e);
}
}
} catch (Exception e) {
log.error("Failed to initialize key management service.", e);
}
}
use of org.osgi.service.component.annotations.Activate in project carbon-apimgt by wso2.
the class StartupServiceComponent method activate.
@Activate
protected void activate(ComponentContext componentContext) {
try {
log.debug("Startup Service Component activated");
BundleContext bundleContext = componentContext.getBundleContext();
registration = bundleContext.registerService(ServerStartupObserver.class.getName(), new ServerStartupListener(), null);
} catch (Exception e) {
log.error("Error occurred in startup service component activation", e);
}
}
use of org.osgi.service.component.annotations.Activate in project carbon-apimgt by wso2.
the class SolaceManagerComponent method activate.
@Activate
protected void activate(ComponentContext componentContext) throws Exception {
if (log.isDebugEnabled()) {
log.debug("Activating SolaceManager component");
}
BundleContext bundleContext = componentContext.getBundleContext();
// Registering Notifiers
bundleContext.registerService(Notifier.class.getName(), new SolaceSubscriptionsNotifier(), null);
bundleContext.registerService(Notifier.class.getName(), new SolaceApplicationNotifier(), null);
bundleContext.registerService(Notifier.class.getName(), new SolaceKeyGenNotifier(), null);
if (log.isDebugEnabled()) {
log.debug("SolaceManager component activated");
}
}
Aggregations