use of org.wso2.carbon.apimgt.impl.listeners.ServerStartupListener 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.wso2.carbon.apimgt.impl.listeners.ServerStartupListener in project carbon-apimgt by wso2.
the class APIHandlerServiceComponent method activate.
@Activate
protected void activate(ComponentContext context) {
BundleContext bundleContext = context.getBundleContext();
if (log.isDebugEnabled()) {
log.debug("API handlers component activated");
}
// Set public cert
ServiceReferenceHolder.getInstance().setPublicCert();
// Set private key
ServiceReferenceHolder.getInstance().setPrivateKey();
clientPool = APIKeyValidatorClientPool.getInstance();
GatewayStartupListener gatewayStartupListener = new GatewayStartupListener();
bundleContext.registerService(ServerStartupObserver.class.getName(), gatewayStartupListener, null);
bundleContext.registerService(ServerShutdownHandler.class, gatewayStartupListener, null);
bundleContext.registerService(Axis2ConfigurationContextObserver.class, gatewayStartupListener, null);
bundleContext.registerService(JMSListenerShutDownService.class, gatewayStartupListener, null);
// Register Tenant service creator to deploy tenant specific common synapse configurations
TenantServiceCreator listener = new TenantServiceCreator();
bundleContext.registerService(Axis2ConfigurationContextObserver.class.getName(), listener, null);
bundleContext.registerService(ServerStartupObserver.class.getName(), new ServerStartupListener(), null);
// Set APIM Gateway JWT Generator
registration = context.getBundleContext().registerService(AbstractAPIMgtGatewayJWTGenerator.class.getName(), new APIMgtGatewayJWTGeneratorImpl(), null);
registration = context.getBundleContext().registerService(AbstractAPIMgtGatewayJWTGenerator.class.getName(), new APIMgtGatewayUrlSafeJWTGeneratorImpl(), null);
// Start JWT revoked map cleaner.
RevokedJWTMapCleaner revokedJWTMapCleaner = new RevokedJWTMapCleaner();
revokedJWTMapCleaner.startJWTRevokedMapCleaner();
ServiceReferenceHolder.getInstance().setTracer(ServiceReferenceHolder.getInstance().getTracingService().buildTracer(APIMgtGatewayConstants.SERVICE_NAME));
RedisConfig redisConfig = ServiceReferenceHolder.getInstance().getAPIManagerConfiguration().getRedisConfig();
if (redisConfig.isRedisEnabled()) {
RedisBaseDistributedCountManager redisBaseDistributedCountManager = new RedisBaseDistributedCountManager(ServiceReferenceHolder.getInstance().getRedisPool());
context.getBundleContext().registerService(DistributedCounterManager.class, redisBaseDistributedCountManager, null);
ServiceReferenceHolder.getInstance().setRedisPool(getJedisPool(redisConfig));
}
// Create caches for the super tenant
ServerConfiguration.getInstance().overrideConfigurationProperty("Cache.ForceLocalCache", "true");
CacheProvider.createGatewayKeyCache();
CacheProvider.createResourceCache();
CacheProvider.createGatewayTokenCache();
CacheProvider.createInvalidTokenCache();
CacheProvider.createGatewayBasicAuthResourceCache();
CacheProvider.createGatewayUsernameCache();
CacheProvider.createInvalidUsernameCache();
CacheProvider.createGatewayApiKeyCache();
CacheProvider.createGatewayApiKeyDataCache();
CacheProvider.createInvalidGatewayApiKeyCache();
CacheProvider.createParsedSignJWTCache();
CacheProvider.createGatewayInternalKeyCache();
CacheProvider.createGatewayInternalKeyDataCache();
CacheProvider.createInvalidInternalKeyCache();
}
Aggregations