Skip to content

Commit

Permalink
Makes the DefaultMdxParserImpl class not depend on OlapConnection. Th…
Browse files Browse the repository at this point in the history
…e validator must still depend on it since it must resolve members.

I marked the default parser's constructor which takes an olap connection as an argument as deprecated. Anyone who has access commit privilege on Mondrian, please change the object instanciation code.

I would have modified the MdxParserFactory but this would break Mondrian olap4j connection class. Someone should do this for me as well.

git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@307 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
lucboudreau committed Apr 6, 2010
1 parent 518c99b commit cc9f9d1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ public PreparedOlapStatement prepareOlapStatement(
public MdxParserFactory getParserFactory() {
return new MdxParserFactory() {
public MdxParser createMdxParser(OlapConnection connection) {
return new DefaultMdxParserImpl(connection);
return new DefaultMdxParserImpl();
}

public MdxValidator createMdxValidator(OlapConnection connection) {
Expand Down
12 changes: 2 additions & 10 deletions src/org/olap4j/mdx/parser/impl/DefaultMdxParser.cup
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
// Agreement, available at the following URL:
// http://www.eclipse.org/legal/epl-v10.html.
// Copyright (C) 1999-2002 Kana Software, Inc.
// Copyright (C) 2002-2009 Julian Hyde and others.
// Copyright (C) 2002-2010 Julian Hyde and others.
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
*/

import java_cup.runtime.*;
import java.util.*;
import org.olap4j.OlapConnection;
import org.olap4j.Axis;
import org.olap4j.mdx.*;
import org.olap4j.mdx.parser.MdxParseException;
Expand All @@ -21,7 +20,6 @@ parser code {:
// Generated from $Id$
Scanner scanner;
private String queryString;
private OlapConnection mdxConnection;
private DefaultMdxParserImpl.FunTable funTable;
private boolean load;

Expand All @@ -31,22 +29,20 @@ parser code {:
ParseTreeNode recursivelyParseExp(String s)
{
return new DefaultMdxParser().parseExpression(
mdxConnection, s, false, funTable);
s, false, funTable);
}

/**
* Parses a string to create a {@link SelectNode}.
*/
SelectNode parseSelect(
OlapConnection mdxConnection,
String queryString,
boolean debug,
DefaultMdxParserImpl.FunTable funTable,
boolean load)
{
Symbol parse_tree = null;
this.scanner = new StringScanner(queryString, debug);
this.mdxConnection = mdxConnection;
this.queryString = queryString;
this.funTable = funTable;
this.load = load;
Expand All @@ -63,7 +59,6 @@ parser code {:
e);
} finally {
this.scanner = null;
this.mdxConnection = null;
this.queryString = null;
this.funTable = null;
}
Expand All @@ -73,7 +68,6 @@ parser code {:
* Parses a string to create an expression.
*/
ParseTreeNode parseExpression(
OlapConnection mdxConnection,
String queryString,
boolean debug,
DefaultMdxParserImpl.FunTable funTable)
Expand All @@ -83,7 +77,6 @@ parser code {:
debug,
new StringScanner(queryString, debug),
new int[] {DefaultMdxParserSym._VALUE_EXPRESSION});
this.mdxConnection = mdxConnection;
this.queryString = queryString;
this.funTable = funTable;
try {
Expand All @@ -100,7 +93,6 @@ parser code {:
e);
} finally {
this.scanner = null;
this.mdxConnection = null;
this.queryString = null;
this.funTable = null;
}
Expand Down
11 changes: 6 additions & 5 deletions src/org/olap4j/mdx/parser/impl/DefaultMdxParserImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// This software is subject to the terms of the Eclipse Public License v1.0
// Agreement, available at the following URL:
// http://www.eclipse.org/legal/epl-v10.html.
// Copyright (C) 2006-2008 Julian Hyde
// Copyright (C) 2006-2010 Julian Hyde
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
*/
Expand All @@ -22,7 +22,6 @@
* @since Aug 22, 2006
*/
public class DefaultMdxParserImpl implements MdxParser {
private final OlapConnection connection;
private boolean debug = false;
private boolean load = false;
private final FunTable funTable = new FunTable() {
Expand All @@ -31,14 +30,17 @@ public boolean isProperty(String s) {
}
};

@Deprecated
public DefaultMdxParserImpl(OlapConnection olapConnection) {
super();
connection = olapConnection;
}

public DefaultMdxParserImpl() {
super();
}

public SelectNode parseSelect(String mdx) {
return new DefaultMdxParser().parseSelect(
connection,
mdx,
debug,
funTable,
Expand All @@ -47,7 +49,6 @@ public SelectNode parseSelect(String mdx) {

public ParseTreeNode parseExpression(String mdx) {
return new DefaultMdxParser().parseExpression(
connection,
mdx,
debug,
funTable);
Expand Down

0 comments on commit cc9f9d1

Please sign in to comment.