use of com.palantir.conjure.java.undertow.lib.UndertowService in project atlasdb by palantir.
the class TimeLockAgent method createAndRegisterResources.
private void createAndRegisterResources() {
registerTimeLockCorruptionJerseyFilter();
registerTimeLockCorruptionNotifiers();
registerPaxosResource();
registerExceptionMappers();
registerClientFeedbackService();
namespaces = new TimelockNamespaces(metricsManager, this::createInvalidatingTimeLockServices, Suppliers.compose(TimeLockRuntimeConfiguration::maxNumberOfClients, runtime::get), DisabledNamespaces.create(sqliteDataSource));
registerManagementResource();
// Finally, register the health check, and endpoints associated with the clients.
TimeLockResource resource = TimeLockResource.create(namespaces);
healthCheck = paxosResources.leadershipComponents().healthCheck(namespaces::getActiveClients);
registrar.accept(resource);
Function<String, LockService> lockServiceGetter = namespace -> namespaces.get(namespace).getLockService();
Function<String, AsyncTimelockService> asyncTimelockServiceGetter = namespace -> namespaces.get(namespace).getTimelockService();
Function<String, BackupTimeLockServiceView> backupTimeLockServiceViewGetter = namespace -> namespaces.getForRestore(namespace);
AuthHeaderValidator authHeaderValidator = getAuthHeaderValidator();
RedirectRetryTargeter redirectRetryTargeter = redirectRetryTargeter();
if (undertowRegistrar.isPresent()) {
Consumer<UndertowService> presentUndertowRegistrar = undertowRegistrar.get();
registerCorruptionHandlerWrappedService(presentUndertowRegistrar, ConjureTimelockResource.undertow(redirectRetryTargeter, asyncTimelockServiceGetter));
registerCorruptionHandlerWrappedService(presentUndertowRegistrar, ConjureLockWatchingResource.undertow(redirectRetryTargeter, asyncTimelockServiceGetter));
registerCorruptionHandlerWrappedService(presentUndertowRegistrar, ConjureLockV1Resource.undertow(redirectRetryTargeter, lockServiceGetter));
registerCorruptionHandlerWrappedService(presentUndertowRegistrar, TimeLockPaxosHistoryProviderResource.undertow(corruptionComponents.localHistoryLoader()));
registerCorruptionHandlerWrappedService(presentUndertowRegistrar, MultiClientConjureTimelockResource.undertow(redirectRetryTargeter, asyncTimelockServiceGetter));
registerCorruptionHandlerWrappedService(presentUndertowRegistrar, AtlasBackupResource.undertow(authHeaderValidator, redirectRetryTargeter, asyncTimelockServiceGetter));
registerCorruptionHandlerWrappedService(presentUndertowRegistrar, AtlasRestoreResource.undertow(authHeaderValidator, redirectRetryTargeter, backupTimeLockServiceViewGetter));
registerCorruptionHandlerWrappedService(presentUndertowRegistrar, DisabledNamespacesUpdaterResource.undertow(authHeaderValidator, redirectRetryTargeter, namespaces));
} else {
registrar.accept(ConjureTimelockResource.jersey(redirectRetryTargeter, asyncTimelockServiceGetter));
registrar.accept(ConjureLockWatchingResource.jersey(redirectRetryTargeter, asyncTimelockServiceGetter));
registrar.accept(ConjureLockV1Resource.jersey(redirectRetryTargeter, lockServiceGetter));
registrar.accept(TimeLockPaxosHistoryProviderResource.jersey(corruptionComponents.localHistoryLoader()));
registrar.accept(MultiClientConjureTimelockResource.jersey(redirectRetryTargeter, asyncTimelockServiceGetter));
registrar.accept(AtlasBackupResource.jersey(authHeaderValidator, redirectRetryTargeter, asyncTimelockServiceGetter));
registrar.accept(AtlasRestoreResource.jersey(authHeaderValidator, redirectRetryTargeter, backupTimeLockServiceViewGetter));
registrar.accept(DisabledNamespacesUpdaterResource.jersey(authHeaderValidator, redirectRetryTargeter, namespaces));
}
}
Aggregations