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) 2004-2005 TONBELLER AG
008// Copyright (C) 2005-2005 Julian Hyde
009// Copyright (C) 2005-2007 Pentaho
010// All Rights Reserved.
011*/
012package mondrian.spi;
013
014import mondrian.olap.Util;
015
016/**
017 * A dynamic schema processor is used to dynamically change
018 * a Mondrian schema at runtime.
019 *
020 * <p>Mondrian loads a DynamicSchemaProcessor when it sees the
021 * {@link mondrian.rolap.RolapConnectionProperties#DynamicSchemaProcessor}
022 * keyword in a connect string. The value of that property must be a class
023 * which implements this interface. Rather than loading the schema directly,
024 * Mondrian instantiates the class and calls the
025 * {@link #processSchema(String, mondrian.olap.Util.PropertyList)} method
026 * with the catalog URL and connection properties specified in the connect
027 * string.
028 *
029 * <p>By default, mondrian uses Apache VFS (virtual file system) to resolve
030 * catalog URLs. We recommend that implementations of DynamicSchemaProcessor
031 * do the same.
032 *
033 * <p>If you are writing an implementation of this class, we recommend that
034 * you use {@link mondrian.spi.impl.FilterDynamicSchemaProcessor} as a
035 * base class.
036 *
037 * @author hhaas
038 */
039public interface DynamicSchemaProcessor {
040
041    /**
042     * Modifies a Mondrian schema.
043     *
044     * <p>An implementation should generally interpret the URL string as
045     * an Apache VFS (virtual file system) URL.
046     *
047     * @param schemaUrl the URL of the catalog
048     * @param connectInfo Connection properties
049     * @return the modified schema
050     * @throws Exception if an error occurs
051     */
052    public String processSchema(
053        String schemaUrl,
054        Util.PropertyList connectInfo) throws Exception;
055}
056
057// End DynamicSchemaProcessor.java
058