mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-13 22:15:26 +00:00
Implemented a support for multiple data source types
This commit is contained in:
1 parent
e1dc4fd514
commit
c72969d392
16 files changed
+131
-41
No files matched your search
@@ -15,7 +15,8 @@ Require-Bundle: com.sap.sailing.domain;bundle-version="1.0.0",
|
||||
com.sap.sse.datamining;bundle-version="1.0.0",
|
||||
com.sap.sse.datamining.shared;bundle-version="1.0.0",
|
||||
com.sap.sse,
|
||||
com.sap.sse.common
|
||||
com.sap.sse.common,
|
||||
org.eclipse.osgi
|
||||
Bundle-ClassPath: .
|
||||
Bundle-Activator: com.sap.sailing.datamining.Activator
|
||||
Bundle-ActivationPolicy: lazy
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.datamining;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -14,6 +15,7 @@ import com.sap.sailing.datamining.data.HasTrackedLegOfCompetitorContext;
|
||||
import com.sap.sailing.datamining.data.HasTrackedRaceContext;
|
||||
import com.sap.sse.datamining.DataMiningBundleService;
|
||||
import com.sap.sse.datamining.DataRetrieverChainDefinition;
|
||||
import com.sap.sse.datamining.DataSourceProvider;
|
||||
import com.sap.sse.i18n.ResourceBundleStringMessages;
|
||||
import com.sap.sse.i18n.impl.ResourceBundleStringMessagesImpl;
|
||||
|
||||
@@ -24,13 +26,14 @@ public class Activator implements BundleActivator, DataMiningBundleService {
|
||||
private static Activator INSTANCE;
|
||||
|
||||
private final ResourceBundleStringMessages sailingServerStringMessages;
|
||||
private final SailingDataRetrieverChainDefinitions dataRetrieverChainDefinitions;
|
||||
private final SailingDataRetrievalChainDefinitions dataRetrieverChainDefinitions;
|
||||
private final SailingClusterGroups clusterGroups;
|
||||
private DataSourceProvider<?> racingEventServiceProvider;
|
||||
|
||||
private ServiceReference<DataMiningBundleService> dataMiningBundleServiceReference;
|
||||
|
||||
public Activator() {
|
||||
dataRetrieverChainDefinitions = new SailingDataRetrieverChainDefinitions();
|
||||
dataRetrieverChainDefinitions = new SailingDataRetrievalChainDefinitions();
|
||||
sailingServerStringMessages = new ResourceBundleStringMessagesImpl(STRING_MESSAGES_BASE_NAME, getClass().getClassLoader());
|
||||
clusterGroups = new SailingClusterGroups();
|
||||
}
|
||||
@@ -38,6 +41,7 @@ public class Activator implements BundleActivator, DataMiningBundleService {
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
INSTANCE = this;
|
||||
racingEventServiceProvider = new RacingEventServiceProvider(context);
|
||||
|
||||
dataMiningBundleServiceReference = context.registerService(DataMiningBundleService.class, this, null).getReference();
|
||||
}
|
||||
@@ -68,6 +72,13 @@ public class Activator implements BundleActivator, DataMiningBundleService {
|
||||
return dataRetrieverChainDefinitions.getDataRetrieverChainDefinitions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<DataSourceProvider<?>> getDataSourceProviders() {
|
||||
Collection<DataSourceProvider<?>> dataSourceProviders = new HashSet<>();
|
||||
dataSourceProviders.add(racingEventServiceProvider);
|
||||
return dataSourceProviders;
|
||||
}
|
||||
|
||||
public SailingClusterGroups getClusterGroups() {
|
||||
return clusterGroups;
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.sap.sailing.datamining;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.util.tracker.ServiceTracker;
|
||||
|
||||
import com.sap.sailing.server.RacingEventService;
|
||||
import com.sap.sse.datamining.impl.AbstractDataSourceProvider;
|
||||
|
||||
public class RacingEventServiceProvider extends AbstractDataSourceProvider<RacingEventService> {
|
||||
|
||||
private final ServiceTracker<RacingEventService, RacingEventService> racingEventServiceTracker;
|
||||
|
||||
public RacingEventServiceProvider(BundleContext context) {
|
||||
super(RacingEventService.class);
|
||||
racingEventServiceTracker = createAndOpenRacingEventServiceTracker(context);
|
||||
}
|
||||
|
||||
private ServiceTracker<RacingEventService, RacingEventService> createAndOpenRacingEventServiceTracker(BundleContext context) {
|
||||
ServiceTracker<RacingEventService, RacingEventService> result = new ServiceTracker<>(context, RacingEventService.class.getName(), null);
|
||||
result.open();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RacingEventService getDataSource() {
|
||||
return racingEventServiceTracker.getService();
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -21,11 +21,11 @@ import com.sap.sailing.server.RacingEventService;
|
||||
import com.sap.sse.datamining.DataRetrieverChainDefinition;
|
||||
import com.sap.sse.datamining.impl.SimpleDataRetrieverChainDefinition;
|
||||
|
||||
public class SailingDataRetrieverChainDefinitions {
|
||||
public class SailingDataRetrievalChainDefinitions {
|
||||
|
||||
private final Collection<DataRetrieverChainDefinition<?, ?>> dataRetrieverChainDefinitions;
|
||||
|
||||
public SailingDataRetrieverChainDefinitions() {
|
||||
public SailingDataRetrievalChainDefinitions() {
|
||||
dataRetrieverChainDefinitions = new ArrayList<>();
|
||||
|
||||
final DataRetrieverChainDefinition<RacingEventService, HasTrackedLegOfCompetitorContext> trackedRaceRetrieverChainDefinition = new SimpleDataRetrieverChainDefinition<>(
|
||||
@@ -55,7 +55,7 @@ public class SailingDataRetrieverChainDefinitions {
|
||||
dataRetrieverChainDefinitions.add(gpsFixRetrieverChainDefinition);
|
||||
}
|
||||
|
||||
public Collection<DataRetrieverChainDefinition<?, ?>> getDataRetrieverChainDefinitions() {
|
||||
public Iterable<DataRetrieverChainDefinition<?, ?>> getDataRetrieverChainDefinitions() {
|
||||
return dataRetrieverChainDefinitions;
|
||||
}
|
||||
|
||||
+5
-20
@@ -34,16 +34,12 @@ public class DataMiningServiceImpl extends RemoteServiceServlet implements DataM
|
||||
private final BundleContext context;
|
||||
|
||||
private final ServiceTracker<DataMiningServer, DataMiningServer> dataMiningServerTracker;
|
||||
private final ServiceTracker<RacingEventService, RacingEventService> racingEventServiceTracker;
|
||||
|
||||
private final FunctionDTOFactory functionDTOFactory;
|
||||
|
||||
public DataMiningServiceImpl() {
|
||||
context = Activator.getDefault();
|
||||
|
||||
dataMiningServerTracker = createAndOpenDataMiningServerTracker(context);
|
||||
racingEventServiceTracker = createAndOpenRacingEventServiceTracker(context);
|
||||
|
||||
functionDTOFactory = new FunctionDTOFactory();
|
||||
}
|
||||
|
||||
@@ -58,17 +54,6 @@ public class DataMiningServiceImpl extends RemoteServiceServlet implements DataM
|
||||
private DataMiningServer getDataMiningServer() {
|
||||
return dataMiningServerTracker.getService();
|
||||
}
|
||||
|
||||
private ServiceTracker<RacingEventService, RacingEventService> createAndOpenRacingEventServiceTracker(BundleContext context) {
|
||||
ServiceTracker<RacingEventService, RacingEventService> result = new ServiceTracker<RacingEventService, RacingEventService>(
|
||||
context, RacingEventService.class.getName(), null);
|
||||
result.open();
|
||||
return result;
|
||||
}
|
||||
|
||||
private RacingEventService getRacingEventService() {
|
||||
return racingEventServiceTracker.getService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<FunctionDTO> getAllStatistics(String localeInfoName) {
|
||||
@@ -110,17 +95,17 @@ public class DataMiningServiceImpl extends RemoteServiceServlet implements DataM
|
||||
public Iterable<DataRetrieverChainDefinitionDTO> getDataRetrieverChainDefinitionsFor(FunctionDTO statisticToCalculate, String localeInfoName) {
|
||||
Class<?> baseDataType = getBaseDataType(statisticToCalculate);
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterable<DataRetrieverChainDefinition<RacingEventService, ?>> dataRetrieverChainDefinitions = (Iterable<DataRetrieverChainDefinition<RacingEventService,?>>)(Iterable<?>) getDataMiningServer().getDataRetrieverChainDefinitionsByDataType(baseDataType);
|
||||
Iterable<DataRetrieverChainDefinition<?, ?>> dataRetrieverChainDefinitions = (Iterable<DataRetrieverChainDefinition<?, ?>>)(Iterable<?>) getDataMiningServer().getDataRetrieverChainDefinitionsByDataType(baseDataType);
|
||||
return dataRetrieverChainDefinitionsAsDTOs(dataRetrieverChainDefinitions, localeInfoName);
|
||||
}
|
||||
|
||||
private Collection<DataRetrieverChainDefinitionDTO> dataRetrieverChainDefinitionsAsDTOs(
|
||||
Iterable<DataRetrieverChainDefinition<RacingEventService, ?>> dataRetrieverChainDefinitions, String localeInfoName) {
|
||||
Iterable<DataRetrieverChainDefinition<?, ?>> dataRetrieverChainDefinitions, String localeInfoName) {
|
||||
Locale locale = ResourceBundleStringMessages.Util.getLocaleFor(localeInfoName);
|
||||
ResourceBundleStringMessages ServerStringMessages = getDataMiningServer().getStringMessages();
|
||||
|
||||
Collection<DataRetrieverChainDefinitionDTO> DTOs = new ArrayList<>();
|
||||
for (DataRetrieverChainDefinition<RacingEventService, ?> dataRetrieverChainDefinition : dataRetrieverChainDefinitions) {
|
||||
for (DataRetrieverChainDefinition<?, ?> dataRetrieverChainDefinition : dataRetrieverChainDefinitions) {
|
||||
Collection<LocalizedTypeDTO> retrievedDataTypesChain = new ArrayList<>();
|
||||
for (DataRetrieverTypeWithInformation<?, ?> retrieverTypeWithInformation : dataRetrieverChainDefinition.getDataRetrieverTypesWithInformation()) {
|
||||
String typeName = retrieverTypeWithInformation.getRetrievedDataType().getSimpleName();
|
||||
@@ -142,7 +127,7 @@ public class DataMiningServiceImpl extends RemoteServiceServlet implements DataM
|
||||
DataRetrieverChainDefinition<RacingEventService, ?> retrieverChainDefinition = getDataMiningServer().getDataRetrieverChainDefinition(dataRetrieverChainDefinitionDTO.getId());
|
||||
Iterable<Function<?>> dimensions = functionDTOsAsFunctions(dimensionDTOs);
|
||||
Locale locale = ResourceBundleStringMessages.Util.getLocaleFor(localeInfoName);
|
||||
Query<Set<Object>> dimensionValuesQuery = getDataMiningServer().createDimensionValuesQuery(getRacingEventService(), retrieverChainDefinition, retrieverLevel, dimensions, locale);
|
||||
Query<Set<Object>> dimensionValuesQuery = getDataMiningServer().createDimensionValuesQuery(retrieverChainDefinition, retrieverLevel, dimensions, locale);
|
||||
QueryResult<Set<Object>> result = dimensionValuesQuery.run();
|
||||
return result;
|
||||
}
|
||||
@@ -159,7 +144,7 @@ public class DataMiningServiceImpl extends RemoteServiceServlet implements DataM
|
||||
@Override
|
||||
public <ResultType extends Number> QueryResult<ResultType> runQuery(QueryDefinitionDTO queryDefinitionDTO) throws Exception {
|
||||
QueryDefinition<RacingEventService, ?, ResultType> queryDefinition = getDataMiningServer().getQueryDefinitionForDTO(queryDefinitionDTO);
|
||||
Query<ResultType> query = getDataMiningServer().createQuery(getRacingEventService(), queryDefinition);
|
||||
Query<ResultType> query = getDataMiningServer().createQuery(queryDefinition);
|
||||
QueryResult<ResultType> result = query.run();
|
||||
return result;
|
||||
}
|
||||
|
||||
+1
@@ -10,6 +10,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sse.datamining.DataRetrieverChainDefinition;
|
||||
import com.sap.sse.datamining.DataRetrieverChainDefinitionRegistry;
|
||||
import com.sap.sse.datamining.components.Processor;
|
||||
import com.sap.sse.datamining.test.functions.registry.test_classes.Test_Regatta;
|
||||
import com.sap.sse.datamining.test.functions.registry.test_contexts.Test_HasLegOfCompetitorContext;
|
||||
|
||||
@@ -35,4 +35,9 @@ public interface DataMiningBundleService {
|
||||
*/
|
||||
public Iterable<DataRetrieverChainDefinition<?, ?>> getDataRetrieverChainDefinitions();
|
||||
|
||||
/**
|
||||
* @return a collection of {@link DataSourceProvider DataSourceProviders}, that are used to get the data sources for the queries
|
||||
*/
|
||||
public Iterable<DataSourceProvider<?>> getDataSourceProviders();
|
||||
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import java.util.concurrent.ExecutorService;
|
||||
|
||||
import com.sap.sse.datamining.functions.Function;
|
||||
import com.sap.sse.datamining.functions.FunctionProvider;
|
||||
import com.sap.sse.datamining.impl.DataRetrieverChainDefinitionProvider;
|
||||
import com.sap.sse.datamining.shared.QueryDefinitionDTO;
|
||||
import com.sap.sse.datamining.shared.dto.FunctionDTO;
|
||||
import com.sap.sse.i18n.ResourceBundleStringMessages;
|
||||
@@ -51,10 +50,9 @@ public interface DataMiningServer {
|
||||
|
||||
public <DataSourceType, DataType, ResultType> QueryDefinition<DataSourceType, DataType, ResultType> getQueryDefinitionForDTO(QueryDefinitionDTO queryDefinitionDTO);
|
||||
|
||||
public <DataSource> Query<Set<Object>> createDimensionValuesQuery(DataSource dataSource,
|
||||
DataRetrieverChainDefinition<DataSource, ?> dataRetrieverChainDefinition, int retrieverLevel,
|
||||
public <DataSourceType> Query<Set<Object>> createDimensionValuesQuery(DataRetrieverChainDefinition<DataSourceType, ?> dataRetrieverChainDefinition, int retrieverLevel,
|
||||
Iterable<Function<?>> dimensions, Locale locale);
|
||||
|
||||
public <DataSource, DataType, ResultType> Query<ResultType> createQuery(DataSource dataSource, QueryDefinition<DataSource, DataType, ResultType> queryDefinition);
|
||||
public <DataSourceType, ResultType> Query<ResultType> createQuery(QueryDefinition<DataSourceType, ?, ResultType> queryDefinition);
|
||||
|
||||
}
|
||||
+1
-3
@@ -1,10 +1,8 @@
|
||||
package com.sap.sse.datamining.impl;
|
||||
package com.sap.sse.datamining;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sse.datamining.DataRetrieverChainDefinition;
|
||||
|
||||
public interface DataRetrieverChainDefinitionProvider {
|
||||
|
||||
public <DataSourceType> Collection<DataRetrieverChainDefinition<DataSourceType, ?>> getBySourceType(
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
package com.sap.sse.datamining.impl;
|
||||
package com.sap.sse.datamining;
|
||||
|
||||
import com.sap.sse.datamining.DataRetrieverChainDefinition;
|
||||
|
||||
public interface DataRetrieverChainDefinitionRegistry extends DataRetrieverChainDefinitionProvider {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.sap.sse.datamining;
|
||||
|
||||
public interface DataSourceProvider<DataSourceType> {
|
||||
|
||||
public Class<DataSourceType> getDataSourceType();
|
||||
|
||||
public DataSourceType getDataSource();
|
||||
|
||||
}
|
||||
@@ -14,6 +14,9 @@ public interface ModifiableDataMiningServer extends DataMiningServer {
|
||||
public void registerAllWithExternalFunctionPolicy(Iterable<Class<?>> externalClassesToScan);
|
||||
|
||||
public void unregisterAllFunctionsOf(Iterable<Class<?>> classesToUnregister);
|
||||
|
||||
public void setDataSourceProvider(DataSourceProvider<?> dataSourceProvider);
|
||||
public void removeDataSourceProvider(DataSourceProvider<?> dataSourceProvider);
|
||||
|
||||
public void registerDataRetrieverChainDefinition(DataRetrieverChainDefinition<?, ?> dataRetrieverChainDefinition);
|
||||
public void unregisterDataRetrieverChainDefinition(DataRetrieverChainDefinition<?, ?> dataRetrieverChainDefinition);
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.sap.sse.datamining.impl;
|
||||
|
||||
import com.sap.sse.datamining.DataSourceProvider;
|
||||
|
||||
public abstract class AbstractDataSourceProvider<DataSourceType> implements DataSourceProvider<DataSourceType> {
|
||||
|
||||
private final Class<DataSourceType> dataSourceType;
|
||||
|
||||
public AbstractDataSourceProvider(Class<DataSourceType> dataSourceType) {
|
||||
this.dataSourceType = dataSourceType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<DataSourceType> getDataSourceType() {
|
||||
return dataSourceType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,6 +17,8 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
|
||||
import com.sap.sse.datamining.DataMiningBundleService;
|
||||
import com.sap.sse.datamining.DataMiningServer;
|
||||
import com.sap.sse.datamining.DataRetrieverChainDefinition;
|
||||
import com.sap.sse.datamining.DataRetrieverChainDefinitionRegistry;
|
||||
import com.sap.sse.datamining.DataSourceProvider;
|
||||
import com.sap.sse.datamining.ModifiableDataMiningServer;
|
||||
import com.sap.sse.datamining.impl.functions.FunctionManager;
|
||||
import com.sap.sse.i18n.impl.ResourceBundleStringMessagesImpl;
|
||||
@@ -75,6 +77,9 @@ public class DataMiningActivator implements BundleActivator {
|
||||
|
||||
dataMiningServer.registerAllClasses(dataMiningBundleService.getClassesWithMarkedMethods());
|
||||
|
||||
for (DataSourceProvider<?> dataSourceProvider : dataMiningBundleService.getDataSourceProviders()) {
|
||||
dataMiningServer.setDataSourceProvider(dataSourceProvider);
|
||||
}
|
||||
for (DataRetrieverChainDefinition<?, ?> dataRetrieverChainDefinition : dataMiningBundleService.getDataRetrieverChainDefinitions()) {
|
||||
dataMiningServer.registerDataRetrieverChainDefinition(dataRetrieverChainDefinition);
|
||||
}
|
||||
@@ -84,7 +89,11 @@ public class DataMiningActivator implements BundleActivator {
|
||||
dataMiningServer.removeStringMessages(dataMiningBundleService.getStringMessages());
|
||||
|
||||
dataMiningServer.unregisterAllFunctionsOf(dataMiningBundleService.getClassesWithMarkedMethods());
|
||||
|
||||
|
||||
for (DataSourceProvider<?> dataSourceProvider : dataMiningBundleService.getDataSourceProviders()) {
|
||||
dataMiningServer.removeDataSourceProvider(dataSourceProvider);
|
||||
}
|
||||
for (DataRetrieverChainDefinition<?, ?> dataRetrieverChainDefinition : dataMiningBundleService.getDataRetrieverChainDefinitions()) {
|
||||
dataMiningServer.unregisterDataRetrieverChainDefinition(dataRetrieverChainDefinition);
|
||||
}
|
||||
|
||||
+29
-6
@@ -2,6 +2,7 @@ package com.sap.sse.datamining.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@@ -10,6 +11,9 @@ import java.util.UUID;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import com.sap.sse.datamining.DataRetrieverChainDefinition;
|
||||
import com.sap.sse.datamining.DataRetrieverChainDefinitionProvider;
|
||||
import com.sap.sse.datamining.DataRetrieverChainDefinitionRegistry;
|
||||
import com.sap.sse.datamining.DataSourceProvider;
|
||||
import com.sap.sse.datamining.ModifiableDataMiningServer;
|
||||
import com.sap.sse.datamining.Query;
|
||||
import com.sap.sse.datamining.QueryDefinition;
|
||||
@@ -32,7 +36,8 @@ public class DataMiningServerImpl implements ModifiableDataMiningServer {
|
||||
private final FunctionRegistry functionRegistry;
|
||||
private final FunctionProvider functionProvider;
|
||||
|
||||
private DataRetrieverChainDefinitionRegistry dataRetrieverChainDefinitionRegistry;
|
||||
private final Map<Class<?>, DataSourceProvider<?>> dataSourceProviderMappedByDataSourceType;
|
||||
private final DataRetrieverChainDefinitionRegistry dataRetrieverChainDefinitionRegistry;
|
||||
|
||||
public DataMiningServerImpl(ExecutorService executorService, FunctionRegistry functionRegistry, FunctionProvider functionProvider, DataRetrieverChainDefinitionRegistry dataRetrieverChainDefinitionRegistry) {
|
||||
this.stringMessages = new CompoundResourceBundleStringMessages();
|
||||
@@ -40,6 +45,7 @@ public class DataMiningServerImpl implements ModifiableDataMiningServer {
|
||||
this.queryFactory = new QueryFactory();
|
||||
this.functionRegistry = functionRegistry;
|
||||
this.functionProvider = functionProvider;
|
||||
dataSourceProviderMappedByDataSourceType = new HashMap<>();
|
||||
this.dataRetrieverChainDefinitionRegistry = dataRetrieverChainDefinitionRegistry;
|
||||
}
|
||||
|
||||
@@ -118,6 +124,16 @@ public class DataMiningServerImpl implements ModifiableDataMiningServer {
|
||||
return functionProvider.getFunctionForDTO(functionDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDataSourceProvider(DataSourceProvider<?> dataSourceProvider) {
|
||||
dataSourceProviderMappedByDataSourceType.put(dataSourceProvider.getDataSourceType(), dataSourceProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDataSourceProvider(DataSourceProvider<?> dataSourceProvider) {
|
||||
dataSourceProviderMappedByDataSourceType.remove(dataSourceProvider.getDataSourceType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataRetrieverChainDefinitionProvider getDataRetrieverChainDefinitionProvider() {
|
||||
return dataRetrieverChainDefinitionRegistry;
|
||||
@@ -190,15 +206,22 @@ public class DataMiningServerImpl implements ModifiableDataMiningServer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <DataSource, DataType, ResultType> Query<ResultType> createQuery(DataSource dataSource, QueryDefinition<DataSource, DataType, ResultType> queryDefinition) {
|
||||
return queryFactory.createQuery(dataSource, queryDefinition, getStringMessages(), getExecutorService());
|
||||
public <DataSourceType, ResultType> Query<ResultType> createQuery(QueryDefinition<DataSourceType, ?, ResultType> queryDefinition) {
|
||||
DataSourceProvider<DataSourceType> dataSourceProvider = getDataSourceProviderFor(queryDefinition.getDataRetrieverChainDefinition().getDataSourceType());
|
||||
return queryFactory.createQuery(dataSourceProvider.getDataSource(), queryDefinition, getStringMessages(), getExecutorService());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <DataSource> Query<Set<Object>> createDimensionValuesQuery(DataSource dataSource,
|
||||
DataRetrieverChainDefinition<DataSource, ?> dataRetrieverChainDefinition, int retrieverLevel,
|
||||
public <DataSourceType> Query<Set<Object>> createDimensionValuesQuery(DataRetrieverChainDefinition<DataSourceType, ?> dataRetrieverChainDefinition, int retrieverLevel,
|
||||
Iterable<Function<?>> dimensions, Locale locale) {
|
||||
return queryFactory.createDimensionValuesQuery(dataSource, dataRetrieverChainDefinition, retrieverLevel, dimensions, locale, getStringMessages(), getExecutorService());
|
||||
DataSourceProvider<DataSourceType> dataSourceProvider = getDataSourceProviderFor(dataRetrieverChainDefinition.getDataSourceType());
|
||||
return queryFactory.createDimensionValuesQuery(dataSourceProvider.getDataSource(), dataRetrieverChainDefinition, retrieverLevel, dimensions, locale, getStringMessages(), getExecutorService());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <DataSourceType> DataSourceProvider<DataSourceType> getDataSourceProviderFor(Class<DataSourceType> dataSourceType) {
|
||||
assert dataSourceProviderMappedByDataSourceType.containsKey(dataSourceType) : "No DataSourceProvider found for '" + dataSourceType + "'";
|
||||
return (DataSourceProvider<DataSourceType>) dataSourceProviderMappedByDataSourceType.get(dataSourceType);
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -8,6 +8,7 @@ import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sse.datamining.DataRetrieverChainDefinition;
|
||||
import com.sap.sse.datamining.DataRetrieverChainDefinitionRegistry;
|
||||
|
||||
public class SimpleDataRetrieverChainDefinitionRegistry implements DataRetrieverChainDefinitionRegistry {
|
||||
|
||||
|
||||
Reference in new issue
Block a user