001/*
002// This software is subject to the terms of the Eclipse Public License v1.0
003// Agreement, available at the following URL:
004// http://www.eclipse.org/legal/epl-v10.html.
005// You must accept the terms of that agreement to use this software.
006//
007// Copyright (C) 2010-2011 Pentaho
008// All Rights Reserved.
009*/
010package mondrian.parser;
011
012import mondrian.olap.*;
013import mondrian.server.Statement;
014
015import java.util.List;
016
017/**
018 * Parses and validates an MDX statement.
019 *
020 * <p>NOTE: API is subject to change. Current implementation is backwards
021 * compatible with the old parser based on JavaCUP.
022 *
023 * @author jhyde
024 */
025public interface MdxParserValidator {
026
027    /**
028      * Parses a string to create a {@link mondrian.olap.Query}.
029      * Called only by {@link mondrian.olap.ConnectionBase#parseQuery}.
030      */
031    QueryPart parseInternal(
032        Statement statement,
033        String queryString,
034        boolean debug,
035        FunTable funTable,
036        boolean strictValidation);
037
038    Exp parseExpression(
039        Statement statement,
040        String queryString,
041        boolean debug,
042        FunTable funTable);
043
044    interface QueryPartFactory {
045
046        /**
047         * Creates a {@link mondrian.olap.Query} object.
048         * Override this function to make your kind of query.
049         */
050        Query makeQuery(
051            Statement statement,
052            Formula[] formulae,
053            QueryAxis[] axes,
054            String cube,
055            Exp slicer,
056            QueryPart[] cellProps,
057            boolean strictValidation);
058
059        /**
060         * Creates a {@link mondrian.olap.DrillThrough} object.
061         */
062        DrillThrough makeDrillThrough(
063            Query query,
064            int maxRowCount,
065            int firstRowOrdinal,
066            List<Exp> returnList);
067
068        /**
069         * Creates an {@link mondrian.olap.Explain} object.
070         */
071        Explain makeExplain(
072            QueryPart query);
073    }
074}
075
076// End MdxParserValidator.java