public abstract class AbstractBinderFactory extends Object implements BinderFactory
Modifier and Type | Field and Description |
---|---|
static String |
DEPRECATED_PERMISSIVE_AVAILABILITY_FLAG |
static int |
DRUID_DIM_LOADER_HC_LAST_RUN_PERIOD_MILLIS |
static int |
DRUID_UNCOVERED_INTERVAL_LIMIT |
static int |
HC_LAST_RUN_PERIOD_MILLIS_DEFAULT |
static String |
HEALTH_CHECK_NAME_DATASOURCE_METADATA |
static String |
HEALTH_CHECK_NAME_DIMENSION |
static String |
HEALTH_CHECK_NAME_DRUID_DIM_LOADER |
static String |
HEALTH_CHECK_NAME_LOOKUP_METADATA |
static String |
HEALTH_CHECK_VERSION |
static int |
LOADER_SCHEDULER_THREAD_POOL_SIZE |
static int |
LOADER_SCHEDULER_THREAD_POOL_SIZE_DEFAULT |
static int |
SEG_LOADER_HC_LAST_RUN_PERIOD_MILLIS |
static String |
SYSTEM_CONFIG_TIMEZONE_KEY |
Constructor and Description |
---|
AbstractBinderFactory()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterBinding(org.glassfish.hk2.utilities.binding.AbstractBinder abstractBinder)
Allows additional app-specific binding.
|
void |
afterRegistration(ResourceConfig resourceConfig)
Allows additional app-specific Jersey feature registration and config.
|
protected ApiJobStore |
buildApiJobStore()
Builds an instance of the interface to the storage system to use to store metadata about asynchronous
requests.
|
org.glassfish.hk2.utilities.Binder |
buildBinder()
Build an hk2 Binder instance.
|
protected BroadcastChannel<String> |
buildBroadcastChannel()
Builds an instance of a BroadcastChannel that broadcasts the tickets of asynchronous jobs that have been
successfully stored in the PreResponseStore .
|
protected DataCache<?> |
buildCache()
Build a cache for data requests and matching responses.
|
protected ConfigurationLoader |
buildConfigurationLoader(DimensionLoader dimensionLoader,
MetricLoader metricLoader,
TableLoader tableLoader)
Extension point for building custom Configuration Loaders.
|
protected DataApiRequestFactory |
buildDataApiRequestFactory()
Creates an factory that constructs DataApiRequests
.
|
protected DataSourceMetadataLoadTask |
buildDataSourceMetadataLoader(DruidWebService webService,
PhysicalTableDictionary physicalTableDictionary,
DataSourceMetadataService metadataService,
com.fasterxml.jackson.databind.ObjectMapper mapper)
Build a datasource metadata loader.
|
protected DimensionValueLoadTask |
buildDruidDimensionsLoader(DruidWebService webService,
PhysicalTableDictionary physicalTableDictionary,
DimensionDictionary dimensionDictionary)
Build a DimensionValueLoadTask.
|
protected DruidFilterBuilder |
buildDruidFilterBuilder()
Creates an object that constructs Druid dimension filters from Bard dimension filters.
|
protected Class<? extends DruidQueryBuilder> |
buildDruidQueryBuilder()
Initializes the factory that builds druid queries.
|
protected Class<? extends DruidResponseParser> |
buildDruidResponseParser()
Initializes the class that parses responses from Druid.
|
protected DruidWebService |
buildDruidWebService(DruidServiceConfig druidServiceConfig,
com.fasterxml.jackson.databind.ObjectMapper mapper)
Create a DruidWebService.
|
protected DruidWebService |
buildDruidWebService(com.fasterxml.jackson.databind.ObjectMapper mapper)
Create a DruidWebService for the UI connection.
|
protected Supplier<Map<String,String>> |
buildDruidWebServiceHeaderSupplier()
Build the Supplier for Druid data request headers.
|
protected HavingGenerator |
buildHavingGenerator(ConfigurationLoader loader)
Creates an object that generates map of Api Having from having string.
|
protected JobPayloadBuilder |
buildJobPayloadBuilder()
The Builder to be used to serialize a JobRow into the the job to be returned to the user.
|
protected JobRowBuilder |
buildJobRowBuilder()
Initializes the service for building JobRows based on the information in a query.
|
protected RegisteredLookupMetadataLoadTask |
buildLookupMetaDataLoader(DruidWebService webService,
DimensionDictionary dimensionDictionary)
Builds a lookup metadata loader.
|
protected DruidWebService |
buildMetadataDruidWebService(com.fasterxml.jackson.databind.ObjectMapper mapper)
Create a DruidWebService for metadata.
|
protected DruidWebService |
buildNonUiDruidWebService(com.fasterxml.jackson.databind.ObjectMapper mapper)
Deprecated.
removed non-ui webservice, this method is no longer used
|
protected PreResponseStore |
buildPreResponseStore(ResourceDictionaries resourceDictionaries)
Builds an instance of the interface to the storage system to use to store PreResponses of asynchronous
requests.
|
protected QuerySigningService<?> |
buildQuerySigningService(PhysicalTableDictionary physicalTableDictionary,
DataSourceMetadataService dataSourceMetadataService)
Build a QuerySigningService.
|
protected RateLimiter |
buildRateLimiter()
Creates a new RateLimiter for the RateLimitFilter.
|
protected ResponseFormatResolver |
buildResponseFormatResolver()
Create a ResponseFormatResolver for Servlet objects.
|
protected Class<? extends ResponseProcessorFactory> |
buildResponseProcessorFactory()
Returns the class to bind to
ResponseProcessorFactory . |
protected ResponseWriter |
buildResponseWriter(ObjectMappersSuite mappers)
Builder for ResponseWriter, a serializer allowing customized response from Fili.
|
protected Map<Class,RequestedIntervalsFunction> |
buildSigningFunctions()
Build a Map of Class to Function that should be used to get requestedIntervals from the DruidQuery.
|
protected List<FeatureFlag> |
collectFeatureFlags()
Asks for the valid feature flags that are expected to be defined in the system.
|
protected List<FeatureFlag> |
collectFeatureFlags(Class<? extends FeatureFlag>... enumerations)
Given specific enumeration classes containing feature flags it returns a list with all the valid enumerations.
|
protected List<FeatureFlag> |
collectFeatureFlags(List<Class<? extends FeatureFlag>> enumerations)
Given a list of enumeration classes containing feature flags it returns a list with all the valid enumerations.
|
protected void |
finalize()
Make sure the scheduler for loader tasks shuts down when the resources of this class are released.
|
protected Class<? extends AsynchronousWorkflowsBuilder> |
getAsynchronousProcessBuilder()
Initializes the factory that builds the asynchronous PreResponse processing workflow.
|
protected Clock |
getClock()
Returns a clock for generating instants for timestamps.
|
protected ConfigurationLoader |
getConfigurationLoader()
Get the application specific configuration loader, if not exist already, initialize with pluggable loaders.
|
protected DataSourceMetadataService |
getDataSourceMetadataService()
Get the stored metadata service, if not exist yet, create the service and store it.
|
protected abstract Set<DimensionConfig> |
getDimensionConfigurations()
A set of all dimension configurations for this application.
|
protected DimensionLoader |
getDimensionLoader()
Create a Dimension Loader which will populate the dimensionDictionary.
|
protected GranularityDictionary |
getGranularityDictionary()
Extension point for building a dictionary of base granularities for use in the system.
|
protected Class<? extends GranularityParser> |
getGranularityParser()
Extension point for selecting GranularityParser implementations.
|
protected Class<? extends HttpResponseMaker> |
getHttpResponseMaker()
Initializes the factory that builds HttpResponseMaker.
|
protected com.fasterxml.jackson.databind.ObjectMapper |
getMapper()
Return the instance of ObjectMapper defined in the current ObjectMappersSuite.
|
protected ObjectMappersSuite |
getMappers()
Build an ObjectMappersSuite for everyone to use, since they are heavy-weight.
|
protected abstract MetricLoader |
getMetricLoader()
Create a Metric Loader.
|
protected Class<? extends PhysicalTableResolver> |
getPhysicalTableResolver()
Select a physical table resolver class.
|
protected Map<String,RequestMapper> |
getRequestMappers(ResourceDictionaries resourceDictionaries)
Get a map of named RequestMappers.
|
protected abstract TableLoader |
getTableLoader()
Create a Table Loader.
|
protected VolatileIntervalsService |
getVolatileIntervalsService()
Initialize the service that decides which intervals in a request are volatile relative to a physical table.
|
protected Class<? extends RequestWorkflowProvider> |
getWorkflow()
Return a workflow class to bind to RequestWorkflowProvider.
|
protected MetricsFilterSetBuilder |
initializeMetricsFilterSetBuilder()
Initialize the FilteredMetricsHelper.
|
protected PreResponseDeserializer |
initializePreResponseDeserializer(DimensionDictionary dimensionDictionary,
com.fasterxml.jackson.databind.ObjectMapper nonResponseContextMapper,
com.fasterxml.jackson.databind.ObjectMapper responseContextMapper,
GranularityParser granularityParser)
Initialize the PreResponse deserializer to deserialize the custom serialized PreResponse.
|
protected FieldConverters |
initializeSketchConverter()
Initialize the field converter.
|
protected void |
scheduleLoader(LoadTask<?> loadTask)
Schedule a loadTask task.
|
protected void |
setupDataSourceMetaData(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry,
DataSourceMetadataLoadTask dataSourceMetadataLoader)
Schedule a datasource metadata loader and register its health check.
|
protected void |
setupDruidDimensionsLoader(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry,
DimensionValueLoadTask dataDimensionLoader)
Schedule DimensionValueLoadTask and register its health check.
|
protected void |
setupGauges()
Register global gauges.
|
protected void |
setupHealthChecks(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry,
DimensionDictionary dimensionDictionary)
Register required core health checks.
|
protected void |
setupLookUpMetadataLoader(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry,
RegisteredLookupMetadataLoadTask registeredLookupMetadataLoadTask)
Schedule a lookup metadata loader and register its health check.
|
protected void |
shutdownLoaderScheduler()
Shutdown the scheduler for loader tasks.
|
public static final String HEALTH_CHECK_NAME_DATASOURCE_METADATA
public static final String HEALTH_CHECK_NAME_LOOKUP_METADATA
public static final String HEALTH_CHECK_NAME_DRUID_DIM_LOADER
public static final String HEALTH_CHECK_VERSION
public static final String HEALTH_CHECK_NAME_DIMENSION
public static final int HC_LAST_RUN_PERIOD_MILLIS_DEFAULT
public static final int LOADER_SCHEDULER_THREAD_POOL_SIZE_DEFAULT
public static final int SEG_LOADER_HC_LAST_RUN_PERIOD_MILLIS
public static final int DRUID_DIM_LOADER_HC_LAST_RUN_PERIOD_MILLIS
public static final int LOADER_SCHEDULER_THREAD_POOL_SIZE
public static final String DEPRECATED_PERMISSIVE_AVAILABILITY_FLAG
public static final int DRUID_UNCOVERED_INTERVAL_LIMIT
public static final String SYSTEM_CONFIG_TIMEZONE_KEY
public final org.glassfish.hk2.utilities.Binder buildBinder()
BinderFactory
buildBinder
in interface BinderFactory
protected Class<? extends DruidQueryBuilder> buildDruidQueryBuilder()
DruidQueryBuilder
protected Class<? extends DruidResponseParser> buildDruidResponseParser()
DruidResponseParser
protected Clock getClock()
protected Class<? extends AsynchronousWorkflowsBuilder> getAsynchronousProcessBuilder()
DefaultAsynchronousWorkflowsBuilder
protected JobRowBuilder buildJobRowBuilder()
DefaultJobField
, using ids that are the concatenation of the user id with a uuid generated
by UUID.randomUUID()
.protected PreResponseStore buildPreResponseStore(ResourceDictionaries resourceDictionaries)
resourceDictionaries
- Hold the resource dictionariesNoOpPreResponseStore
, which does nothingprotected ApiJobStore buildApiJobStore()
NoOpApiJobStore
, which does nothingprotected BroadcastChannel<String> buildBroadcastChannel()
SimpleBroadcastChannel
, which uses a PublishSubject
to allow cross-thread communicationprotected PreResponseDeserializer initializePreResponseDeserializer(DimensionDictionary dimensionDictionary, com.fasterxml.jackson.databind.ObjectMapper nonResponseContextMapper, com.fasterxml.jackson.databind.ObjectMapper responseContextMapper, GranularityParser granularityParser)
dimensionDictionary
- Contains all the dimension detailsnonResponseContextMapper
- ObjectMapper instance without any customizationresponseContextMapper
- ObjectMapper instance with customization to store/retrieve the value typegranularityParser
- Granularity parser to get the time idprotected VolatileIntervalsService getVolatileIntervalsService()
protected FieldConverters initializeSketchConverter()
protected MetricsFilterSetBuilder initializeMetricsFilterSetBuilder()
protected final ObjectMappersSuite getMappers()
protected final com.fasterxml.jackson.databind.ObjectMapper getMapper()
protected final void setupHealthChecks(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry, DimensionDictionary dimensionDictionary)
healthCheckRegistry
- The health check registrydimensionDictionary
- The container with all dimensionsprotected final void setupGauges()
protected DruidFilterBuilder buildDruidFilterBuilder()
DefaultDruidFilterBuilder
by default.protected DataApiRequestFactory buildDataApiRequestFactory()
DefaultDataApiRequestFactory
by default.protected HavingGenerator buildHavingGenerator(ConfigurationLoader loader)
DefaultHavingApiGenerator
by default.loader
- Configuration loader that connects resource dictionaries with the loader.protected DataSourceMetadataService getDataSourceMetadataService()
protected QuerySigningService<?> buildQuerySigningService(PhysicalTableDictionary physicalTableDictionary, DataSourceMetadataService dataSourceMetadataService)
physicalTableDictionary
- the dictionary of physical tablesdataSourceMetadataService
- A datasource metadata serviceprotected Map<Class,RequestedIntervalsFunction> buildSigningFunctions()
protected DataSourceMetadataLoadTask buildDataSourceMetadataLoader(DruidWebService webService, PhysicalTableDictionary physicalTableDictionary, DataSourceMetadataService metadataService, com.fasterxml.jackson.databind.ObjectMapper mapper)
webService
- The web service used by the loader to query druid for segments availability.physicalTableDictionary
- The table to get the dimensions from.metadataService
- The service to be used to store the datasource metadata.mapper
- The object mapper to process the metadata json.protected RegisteredLookupMetadataLoadTask buildLookupMetaDataLoader(DruidWebService webService, DimensionDictionary dimensionDictionary)
webService
- The web service used by the loader to query druid for lookup statuses.dimensionDictionary
- A DimensionDictionary
that is used
to obtain a list of lookups in Fili.protected DimensionValueLoadTask buildDruidDimensionsLoader(DruidWebService webService, PhysicalTableDictionary physicalTableDictionary, DimensionDictionary dimensionDictionary)
webService
- The web service used by the loader to query dimension valuesphysicalTableDictionary
- The table to update dimensions ondimensionDictionary
- The dimensions to updateprotected final void setupDataSourceMetaData(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry, DataSourceMetadataLoadTask dataSourceMetadataLoader)
healthCheckRegistry
- The health check registry to register partial data health checks.dataSourceMetadataLoader
- The datasource metadata loader to use.protected final void setupLookUpMetadataLoader(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry, RegisteredLookupMetadataLoadTask registeredLookupMetadataLoadTask)
healthCheckRegistry
- The health check registry to register lookup health checks.registeredLookupMetadataLoadTask
- The RegisteredLookupMetadataLoadTask
to use.protected final void setupDruidDimensionsLoader(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry, DimensionValueLoadTask dataDimensionLoader)
healthCheckRegistry
- The health check registry to register Dimension lookup health checksdataDimensionLoader
- The DruidDimensionLoader used for monitoring and health checksprotected Class<? extends RequestWorkflowProvider> getWorkflow()
protected DataCache<?> buildCache()
protected List<FeatureFlag> collectFeatureFlags()
@Override protected List<FeatureFlag> collectFeatureFlags() {
return collectFeatureFlags(AdditionalFeatureFlags.class);
}
@SafeVarargs protected final List<FeatureFlag> collectFeatureFlags(Class<? extends FeatureFlag>... enumerations)
enumerations
- The enumeration classes that define feature flagsprotected final List<FeatureFlag> collectFeatureFlags(List<Class<? extends FeatureFlag>> enumerations)
enumerations
- A list with the enumeration classes that define feature flagsprotected final ConfigurationLoader getConfigurationLoader()
protected ConfigurationLoader buildConfigurationLoader(DimensionLoader dimensionLoader, MetricLoader metricLoader, TableLoader tableLoader)
dimensionLoader
- A dimension loadermetricLoader
- A metric loadertableLoader
- A table loaderprotected DimensionLoader getDimensionLoader()
getDimensionConfigurations()
method.protected JobPayloadBuilder buildJobPayloadBuilder()
protected Class<? extends HttpResponseMaker> getHttpResponseMaker()
HttpResponseMaker
protected ResponseWriter buildResponseWriter(ObjectMappersSuite mappers)
mappers
- Shared instance of ObjectMapper
protected abstract MetricLoader getMetricLoader()
Metric loader populates the metricDictionary
protected abstract Set<DimensionConfig> getDimensionConfigurations()
These dimension configurations will be used to build the dimensions dictionary
protected GranularityDictionary getGranularityDictionary()
protected Class<? extends GranularityParser> getGranularityParser()
protected Class<? extends PhysicalTableResolver> getPhysicalTableResolver()
protected abstract TableLoader getTableLoader()
Table loader populates the physicalTableDictionary and logicalTableDictionary
@NotNull protected Map<String,RequestMapper> getRequestMappers(ResourceDictionaries resourceDictionaries)
Create an empty map by default
resourceDictionaries
- the ResourceDictionaries used for constructing RequestMappersprotected DruidWebService buildDruidWebService(DruidServiceConfig druidServiceConfig, com.fasterxml.jackson.databind.ObjectMapper mapper)
Provided so subclasses can implement alternative druid web service implementations
druidServiceConfig
- Configuration for the Druid Servicemapper
- shared instance of ObjectMapper
protected Supplier<Map<String,String>> buildDruidWebServiceHeaderSupplier()
protected DruidWebService buildDruidWebService(com.fasterxml.jackson.databind.ObjectMapper mapper)
Provided so subclasses can implement alternative druid web service implementations for the UI connection
mapper
- shared instance of ObjectMapper
@Deprecated protected DruidWebService buildNonUiDruidWebService(com.fasterxml.jackson.databind.ObjectMapper mapper)
Provided so subclasses can implement alternative druid web service implementations for the non-UI connection
mapper
- shared instance of ObjectMapper
protected DruidWebService buildMetadataDruidWebService(com.fasterxml.jackson.databind.ObjectMapper mapper)
mapper
- shared instance of ObjectMapper
protected ResponseFormatResolver buildResponseFormatResolver()
Currently default types are json, jsonapi and csv types.
protected Class<? extends ResponseProcessorFactory> buildResponseProcessorFactory()
ResponseProcessorFactory
.
The ResponseProcessorFactory allows us to inject a custom ResponseProcessor
despite the fact that these processors depend
on objects that are built uniquely for each request.
ResponseProcessorFactory
.protected RateLimiter buildRateLimiter()
public void afterRegistration(ResourceConfig resourceConfig)
BinderFactory
afterRegistration
in interface BinderFactory
resourceConfig
- Resource config to use for accessing the configurationprotected void afterBinding(org.glassfish.hk2.utilities.binding.AbstractBinder abstractBinder)
abstractBinder
- Binder to use for bindingprotected void scheduleLoader(LoadTask<?> loadTask)
loadTask
- The loadTask task to run.protected void shutdownLoaderScheduler()
Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.