001/*
002// $Id: MdxValidator.java 482 2012-01-05 23:27:27Z jhyde $
003//
004// Licensed to Julian Hyde under one or more contributor license
005// agreements. See the NOTICE file distributed with this work for
006// additional information regarding copyright ownership.
007//
008// Julian Hyde licenses this file to you under the Apache License,
009// Version 2.0 (the "License"); you may not use this file except in
010// compliance with the License. You may obtain a copy of the License at:
011//
012// http://www.apache.org/licenses/LICENSE-2.0
013//
014// Unless required by applicable law or agreed to in writing, software
015// distributed under the License is distributed on an "AS IS" BASIS,
016// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017// See the License for the specific language governing permissions and
018// limitations under the License.
019*/
020package org.olap4j.mdx.parser;
021
022import org.olap4j.OlapException;
023import org.olap4j.mdx.SelectNode;
024
025/**
026 * Validator for the MDX query language.
027 *
028 * <p>A validator is reusable but not reentrant: you can call
029 * {@link #validateSelect(org.olap4j.mdx.SelectNode)} several times, but not at
030 * the same time from different threads.
031 *
032 * <p>To create a validator, use the
033 * {@link MdxParserFactory#createMdxValidator(org.olap4j.OlapConnection)}
034 * method.
035 *
036 * @see MdxParserFactory
037 * @see MdxParser
038 *
039 * @author jhyde
040 * @version $Id: MdxValidator.java 482 2012-01-05 23:27:27Z jhyde $
041 * @since Aug 22, 2006
042 */
043public interface MdxValidator {
044    /**
045     * Validates an MDX SELECT statement.
046     *
047     * <p>The SelectNode representing the SELECT statement may have been
048     * created by an {@link MdxParser}, or it may have been built
049     * programmatically.
050     *
051     * <p>If the parse tree is invalid, throws an {@link OlapException}.
052     *
053     * <p>If it is valid, returns a parse tree. This parse tree may or may not
054     * be the same parse tree passed as an argument. After validation, you can
055     * ascertain the type of each node of the parse tree by calling its
056     * {@link org.olap4j.mdx.ParseTreeNode#getType()} method.
057     *
058     * @param selectNode Parse tree node representing a SELECT statement
059     *
060     * @return Validated parse tree
061     *
062     * @throws OlapException if node is invalid
063     */
064    SelectNode validateSelect(SelectNode selectNode) throws OlapException;
065}
066
067// End MdxValidator.java