use of org.apache.knox.gateway.services.token.impl.JDBCTokenStateService in project knox by apache.
the class TokenStateServiceFactory method createService.
@Override
protected Service createService(GatewayServices gatewayServices, ServiceType serviceType, GatewayConfig gatewayConfig, Map<String, String> options, String implementation) throws ServiceLifecycleException {
Service service = null;
if (shouldCreateService(implementation)) {
if (matchesImplementation(implementation, DefaultTokenStateService.class)) {
service = new DefaultTokenStateService();
} else if (matchesImplementation(implementation, AliasBasedTokenStateService.class, true)) {
service = new AliasBasedTokenStateService();
((AliasBasedTokenStateService) service).setAliasService(getAliasService(gatewayServices));
} else if (matchesImplementation(implementation, JournalBasedTokenStateService.class)) {
service = new JournalBasedTokenStateService();
} else if (matchesImplementation(implementation, ZookeeperTokenStateService.class)) {
service = new ZookeeperTokenStateService(gatewayServices);
} else if (matchesImplementation(implementation, JDBCTokenStateService.class)) {
try {
service = new JDBCTokenStateService();
((JDBCTokenStateService) service).setAliasService(getAliasService(gatewayServices));
service.init(gatewayConfig, options);
} catch (ServiceLifecycleException e) {
LOG.errorInitializingService(implementation, e.getMessage(), e);
service = new AliasBasedTokenStateService();
((AliasBasedTokenStateService) service).setAliasService(getAliasService(gatewayServices));
}
}
logServiceUsage(isEmptyDefaultImplementation(implementation) ? AliasBasedTokenStateService.class.getName() : implementation, serviceType);
}
return service;
}
Aggregations