use of com.bakdata.conquery.metrics.ActiveUsersFilter in project conquery by bakdata.
the class ApiV1 method registerResources.
@Override
public void registerResources(ManagerNode manager) {
DatasetRegistry datasets = manager.getDatasetRegistry();
JerseyEnvironment environment = manager.getEnvironment().jersey();
environment.setUrlPattern("/api");
// inject required services
environment.register(new AbstractBinder() {
@Override
protected void configure() {
bind(manager.getConfig()).to(ConqueryConfig.class);
bind(manager.getDatasetRegistry()).to(DatasetRegistry.class);
bind(manager.getStorage()).to(MetaStorage.class);
bind(new ConceptsProcessor(manager.getDatasetRegistry())).to(ConceptsProcessor.class);
bind(new MeProcessor(manager.getStorage(), datasets)).to(MeProcessor.class);
bind(new QueryProcessor(datasets, manager.getStorage(), manager.getConfig())).to(QueryProcessor.class);
bind(new FormConfigProcessor(manager.getValidator(), manager.getStorage(), datasets)).to(FormConfigProcessor.class);
}
});
environment.register(CORSPreflightRequestFilter.class);
environment.register(CORSResponseFilter.class);
environment.register(new ActiveUsersFilter(manager.getStorage(), Duration.ofMinutes(manager.getConfig().getMetricsConfig().getUserActiveDuration().toMinutes())));
/*
* Register the authentication filter which protects all resources registered in this servlet.
* We use the same instance of the filter for the api servlet and the admin servlet to have a single
* point for authentication.
*/
environment.register(manager.getAuthController().getAuthenticationFilter());
environment.register(QueryResource.class);
environment.register(IdParamConverter.Provider.INSTANCE);
environment.register(new ConfigResource(manager.getConfig()));
environment.register(FormConfigResource.class);
environment.register(DatasetsResource.class);
environment.register(ConceptResource.class);
environment.register(DatasetResource.class);
environment.register(FilterResource.class);
environment.register(MeResource.class);
for (ResultRendererProvider resultProvider : manager.getConfig().getResultProviders()) {
resultProvider.registerResultResource(environment, manager);
}
environment.register(new IdRefPathParamConverterProvider(manager.getDatasetRegistry(), manager.getDatasetRegistry().getMetaRegistry()));
}
Aggregations