Search in sources :

Example 1 with JournalBasedTokenStateService

use of org.apache.knox.gateway.services.token.impl.JournalBasedTokenStateService 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;
}
Also used : DefaultTokenStateService(org.apache.knox.gateway.services.token.impl.DefaultTokenStateService) AliasBasedTokenStateService(org.apache.knox.gateway.services.token.impl.AliasBasedTokenStateService) JDBCTokenStateService(org.apache.knox.gateway.services.token.impl.JDBCTokenStateService) DefaultTokenStateService(org.apache.knox.gateway.services.token.impl.DefaultTokenStateService) AliasBasedTokenStateService(org.apache.knox.gateway.services.token.impl.AliasBasedTokenStateService) ZookeeperTokenStateService(org.apache.knox.gateway.services.token.impl.ZookeeperTokenStateService) JournalBasedTokenStateService(org.apache.knox.gateway.services.token.impl.JournalBasedTokenStateService) Service(org.apache.knox.gateway.services.Service) JDBCTokenStateService(org.apache.knox.gateway.services.token.impl.JDBCTokenStateService) ServiceLifecycleException(org.apache.knox.gateway.services.ServiceLifecycleException) JournalBasedTokenStateService(org.apache.knox.gateway.services.token.impl.JournalBasedTokenStateService) ZookeeperTokenStateService(org.apache.knox.gateway.services.token.impl.ZookeeperTokenStateService)

Aggregations

Service (org.apache.knox.gateway.services.Service)1 ServiceLifecycleException (org.apache.knox.gateway.services.ServiceLifecycleException)1 AliasBasedTokenStateService (org.apache.knox.gateway.services.token.impl.AliasBasedTokenStateService)1 DefaultTokenStateService (org.apache.knox.gateway.services.token.impl.DefaultTokenStateService)1 JDBCTokenStateService (org.apache.knox.gateway.services.token.impl.JDBCTokenStateService)1 JournalBasedTokenStateService (org.apache.knox.gateway.services.token.impl.JournalBasedTokenStateService)1 ZookeeperTokenStateService (org.apache.knox.gateway.services.token.impl.ZookeeperTokenStateService)1