Skip to content

Commit 000e427

Browse files
committed
Refactor to replace DialectResolver with DialectFactory across
modules. - Added `DialectFactory` references in `BasicContext`. - Updated `CatalogsFileListener` to include `DialectFactory` properties. - Replaced `DialectResolver` with `DialectFactory` in `ServiceTest`. - Included `org.apache.felix.fileinstall` in `bndrun` configuration. - Removed unused imports from `BasicContext`. - Adjusted dialect initialization logic to use `DialectFactory`. Signed-off-by: Stefan Bischof <[email protected]>
1 parent 29e0fb3 commit 000e427

File tree

4 files changed

+15
-22
lines changed

4 files changed

+15
-22
lines changed

demo/server/play/src/main/java/org/eclipse/daanse/demo/server/play/CatalogsFileListener.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,10 @@ private void createContext(Path path, String matcherKey) throws IOException {
170170

171171
Dictionary<String, Object> props = new Hashtable<>();
172172
props.put(BasicContext.REF_NAME_DATA_SOURCE + TARGET_EXT, filterOfMatcherKey(matcherKey));
173-
props.put(BasicContext.REF_NAME_EXPRESSION_COMPILER_FACTORY + TARGET_EXT,
174-
"(component.name=" + PID_EXP_COMP_FAC + ")");
173+
props.put(BasicContext.REF_NAME_EXPRESSION_COMPILER_FACTORY + TARGET_EXT,
174+
"(component.name=" + PID_EXP_COMP_FAC + ")");
175+
props.put(BasicContext.REF_NAME_DIALECT_FACTORY + TARGET_EXT,
176+
"(org.eclipse.daanse.dialect.name=H2)");
175177
props.put(BasicContext.REF_NAME_CATALOG_MAPPING_SUPPLIER + TARGET_EXT, filterOfMatcherKey(matcherKey));
176178
props.put(BasicContext.REF_NAME_MDX_PARSER_PROVIDER + TARGET_EXT, "(component.name=" + PID_PARSER + ")");
177179

demo/server/play/xmla.demo.server.jdkhttp.bndrun

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
bnd.identity;id='org.eclipse.daanse.rolap.mapping.verifyer.basic',\
4141
bnd.identity;id='org.eclipse.daanse.sql.guard.api',\
4242
bnd.identity;id='org.eclipse.daanse.sql.guard.jsqltranspiler',\
43-
bnd.identity;id='org.eclipse.daanse.xmla.server.jdk.httpserver'
43+
bnd.identity;id='org.eclipse.daanse.xmla.server.jdk.httpserver',\
44+
bnd.identity;id='org.apache.felix.fileinstall'
4445

4546

4647
# This will help us keep -runbundles sorted
@@ -62,6 +63,7 @@
6263
json;version='[20250107.0.0,20250107.0.1)',\
6364
org.apache.aries.spifly.dynamic.framework.extension;version='[1.3.7,1.3.8)',\
6465
org.apache.felix.configadmin;version='[1.9.26,1.9.27)',\
66+
org.apache.felix.fileinstall;version='[3.7.4,3.7.5)',\
6567
org.apache.felix.metatype;version='[1.2.4,1.2.5)',\
6668
org.apache.felix.scr;version='[2.2.10,2.2.11)',\
6769
org.eclipse.daanse.demo.server.play;version='[0.0.1,0.0.2)',\

mondrian/src/main/java/org/eclipse/daanse/rolap/core/BasicContext.java

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,22 @@
2424
import javax.sql.DataSource;
2525

2626
import org.eclipse.daanse.jdbc.db.dialect.api.Dialect;
27-
import org.eclipse.daanse.jdbc.db.dialect.api.DialectResolver;
27+
import org.eclipse.daanse.jdbc.db.dialect.api.DialectFactory;
2828
import org.eclipse.daanse.mdx.parser.api.MdxParserProvider;
2929
import org.eclipse.daanse.olap.api.AggregationFactory;
3030
import org.eclipse.daanse.olap.api.ConfigConstants;
3131
import org.eclipse.daanse.olap.api.ConnectionProps;
3232
import org.eclipse.daanse.olap.api.Context;
3333
import org.eclipse.daanse.olap.api.Evaluator;
3434
import org.eclipse.daanse.olap.api.Statement;
35-
import org.eclipse.daanse.olap.api.calc.compiler.ExpressionCompiler;
36-
37-
import org.eclipse.daanse.olap.api.aggregator.Aggregator;
3835
import org.eclipse.daanse.olap.api.aggregator.CustomAggregatorFactory;
36+
import org.eclipse.daanse.olap.api.calc.compiler.ExpressionCompiler;
3937
import org.eclipse.daanse.olap.api.calc.compiler.ExpressionCompilerFactory;
4038
import org.eclipse.daanse.olap.api.function.FunctionService;
4139
import org.eclipse.daanse.olap.common.ExecuteDurationUtil;
4240
import org.eclipse.daanse.olap.core.LoggingEventBus;
41+
import org.eclipse.daanse.olap.server.ExecutionImpl;
4342
import org.eclipse.daanse.rolap.api.RolapContext;
44-
import org.eclipse.daanse.rolap.aggregator.AvgAggregator;
45-
import org.eclipse.daanse.rolap.aggregator.CountAggregator;
46-
import org.eclipse.daanse.rolap.aggregator.DistinctCountAggregator;
47-
import org.eclipse.daanse.rolap.aggregator.MaxAggregator;
48-
import org.eclipse.daanse.rolap.aggregator.MinAggregator;
49-
import org.eclipse.daanse.rolap.aggregator.SumAggregator;
50-
import org.eclipse.daanse.rolap.aggregator.experimental.NoneAggregator;
51-
import org.eclipse.daanse.rolap.aggregator.experimental.IppAggregator;
52-
import org.eclipse.daanse.rolap.aggregator.experimental.RndAggregator;
5343
import org.eclipse.daanse.rolap.mapping.api.CatalogMappingSupplier;
5444
import org.eclipse.daanse.rolap.mapping.api.model.AccessRoleMapping;
5545
import org.eclipse.daanse.rolap.mapping.api.model.CatalogMapping;
@@ -77,14 +67,13 @@
7767
import mondrian.rolap.RolapResultShepherd;
7868
import mondrian.rolap.agg.AggregationManager;
7969
import mondrian.rolap.aggregator.AggregationFactoryImpl;
80-
import org.eclipse.daanse.olap.server.ExecutionImpl;
8170

8271
@Component(service = Context.class, scope = ServiceScope.SINGLETON)
8372
public class BasicContext extends AbstractRolapContext implements RolapContext {
8473

8574
public static final String PID = "org.eclipse.daanse.rolap.core.BasicContext";
8675

87-
public static final String REF_NAME_DIALECT_RESOLVER = "dialectResolver";
76+
public static final String REF_NAME_DIALECT_FACTORY = "dialectFactory";
8877
public static final String REF_NAME_DATA_SOURCE = "dataSource";
8978
public static final String REF_NAME_CATALOG_MAPPING_SUPPLIER = "catalogMappingSuppier";
9079
public static final String REF_NAME_ROLAP_CONTEXT_MAPPING_SUPPLIER = "rolapContextMappingSuppliers";
@@ -99,8 +88,8 @@ public class BasicContext extends AbstractRolapContext implements RolapContext {
9988
@Reference(name = REF_NAME_DATA_SOURCE, target = UnresolvableNamespace.UNRESOLVABLE_FILTER)
10089
private DataSource dataSource = null;
10190

102-
@Reference(name = REF_NAME_DIALECT_RESOLVER)
103-
private DialectResolver dialectResolver = null;
91+
@Reference(name = REF_NAME_DIALECT_FACTORY)
92+
private DialectFactory dialectFactory = null;
10493

10594
@Reference(name = REF_NAME_CATALOG_MAPPING_SUPPLIER, target = UnresolvableNamespace.UNRESOLVABLE_FILTER, cardinality = ReferenceCardinality.MANDATORY)
10695
private CatalogMappingSupplier catalogMappingSupplier;
@@ -148,7 +137,7 @@ public void activate1() throws Exception {
148137
queryLimitSemaphore = new Semaphore(getConfigValue(ConfigConstants.QUERY_LIMIT, ConfigConstants.QUERY_LIMIT_DEFAULT_VALUE ,Integer.class));
149138

150139
try (Connection connection = dataSource.getConnection()) {
151-
Optional<Dialect> optionalDialect = dialectResolver.resolve(dataSource);
140+
Optional<Dialect> optionalDialect = dialectFactory.tryCreateDialect(connection);
152141
dialect = optionalDialect.orElseThrow(() -> new Exception(ERR_MSG_DIALECT_INIT));
153142
aggregationFactory = new AggregationFactoryImpl(dialect, this.getCustomAggregators());
154143
}

mondrian/src/test/java/org/eclipse/daanse/olap/rolap/core/ServiceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public void serviceExists(
124124
Dictionary<String, Object> props = new Hashtable<>();
125125

126126
props.put(BasicContext.REF_NAME_DATA_SOURCE + TARGET_EXT, "(ds=1)");
127-
props.put(BasicContext.REF_NAME_DIALECT_RESOLVER + TARGET_EXT, "(dr=2)");
127+
props.put(BasicContext.REF_NAME_DIALECT_FACTORY + TARGET_EXT, "(dr=2)");
128128
props.put(BasicContext.REF_NAME_EXPRESSION_COMPILER_FACTORY + TARGET_EXT, "(ecf=1)");
129129
props.put(BasicContext.REF_NAME_CATALOG_MAPPING_SUPPLIER + TARGET_EXT, "(dbmsp=1)");
130130
props.put(BasicContext.REF_NAME_MDX_PARSER_PROVIDER + TARGET_EXT, "(parser=1)");

0 commit comments

Comments
 (0)