|
1 | 1 | package com.bakdata.conquery.mode.local; |
2 | 2 |
|
| 3 | +import java.time.Clock; |
3 | 4 | import java.util.Collection; |
4 | 5 | import java.util.Collections; |
5 | 6 | import java.util.List; |
|
14 | 15 | import com.bakdata.conquery.models.worker.DatasetRegistry; |
15 | 16 | import com.bakdata.conquery.models.worker.LocalNamespace; |
16 | 17 | import com.bakdata.conquery.models.worker.ShardNodeInformation; |
17 | | -import com.bakdata.conquery.sql.conversion.dialect.SqlDialectFactory; |
18 | 18 | import io.dropwizard.core.setup.Environment; |
| 19 | +import lombok.RequiredArgsConstructor; |
19 | 20 |
|
| 21 | +@RequiredArgsConstructor |
20 | 22 | public class LocalManagerProvider implements ManagerProvider { |
21 | 23 |
|
22 | 24 | private static final Supplier<Collection<ShardNodeInformation>> EMPTY_NODE_PROVIDER = Collections::emptyList; |
| 25 | + private final Clock clock; |
23 | 26 |
|
24 | | - private final SqlDialectFactory dialectFactory; |
25 | | - |
26 | | - public LocalManagerProvider() { |
27 | | - this.dialectFactory = new SqlDialectFactory(); |
28 | | - } |
29 | | - |
30 | | - public LocalManagerProvider(SqlDialectFactory dialectFactory) { |
31 | | - this.dialectFactory = dialectFactory; |
32 | | - } |
33 | | - |
| 27 | + @Override |
34 | 28 | public DelegateManager<LocalNamespace> provideManager(ConqueryConfig config, Environment environment) { |
35 | 29 |
|
| 30 | + final ConnectionManager connectionManager = config.getSqlConnectorConfig().toConnectionManager(environment); |
| 31 | + |
36 | 32 | final MetaStorage storage = new MetaStorage(config.getStorage()); |
37 | 33 | final InternalMapperFactory internalMapperFactory = new InternalMapperFactory(config, environment.getValidator()); |
38 | | - final NamespaceHandler<LocalNamespace> namespaceHandler = new LocalNamespaceHandler(config, internalMapperFactory, dialectFactory); |
| 34 | + final NamespaceHandler<LocalNamespace> namespaceHandler = new LocalNamespaceHandler(config, internalMapperFactory, connectionManager, clock); |
39 | 35 | final DatasetRegistry<LocalNamespace> datasetRegistry = ManagerProvider.createDatasetRegistry(namespaceHandler, config, internalMapperFactory); |
40 | 36 |
|
41 | | - |
42 | 37 | return new DelegateManager<>( |
43 | 38 | config, |
44 | 39 | environment, |
|
0 commit comments