001    /*
002    // $Id: MdxValidator.java 229 2009-05-08 19:11:29Z jhyde $
003    // This software is subject to the terms of the Eclipse Public License v1.0
004    // Agreement, available at the following URL:
005    // http://www.eclipse.org/legal/epl-v10.html.
006    // Copyright (C) 2006-2008 Julian Hyde
007    // All Rights Reserved.
008    // You must accept the terms of that agreement to use this software.
009    */
010    package org.olap4j.mdx.parser;
011    
012    import org.olap4j.OlapException;
013    import org.olap4j.mdx.SelectNode;
014    
015    /**
016     * Validator for the MDX query language.
017     *
018     * <p>A validator is reusable but not reentrant: you can call
019     * {@link #validateSelect(org.olap4j.mdx.SelectNode)} several times, but not at
020     * the same time from different threads.
021     *
022     * <p>To create a validator, use the
023     * {@link MdxParserFactory#createMdxValidator(org.olap4j.OlapConnection)}
024     * method.
025     *
026     * @see MdxParserFactory
027     * @see MdxParser
028     *
029     * @author jhyde
030     * @version $Id: MdxValidator.java 229 2009-05-08 19:11:29Z jhyde $
031     * @since Aug 22, 2006
032     */
033    public interface MdxValidator {
034        /**
035         * Validates an MDX SELECT statement.
036         *
037         * <p>The SelectNode representing the SELECT statement may have been
038         * created by an {@link MdxParser}, or it may have been built
039         * programmatically.
040         *
041         * <p>If the parse tree is invalid, throws an {@link OlapException}.
042         *
043         * <p>If it is valid, returns a parse tree. This parse tree may or may not
044         * be the same parse tree passed as an argument. After validation, you can
045         * ascertain the type of each node of the parse tree by calling its
046         * {@link org.olap4j.mdx.ParseTreeNode#getType()} method.
047         *
048         * @param selectNode Parse tree node representing a SELECT statement
049         *
050         * @return Validated parse tree
051         *
052         * @throws OlapException if node is invalid
053         */
054        SelectNode validateSelect(SelectNode selectNode) throws OlapException;
055    }
056    
057    // End MdxValidator.java