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) 2005-2009 Pentaho
008// All Rights Reserved.
009*/
010package mondrian.spi;
011
012
013import mondrian.rolap.RolapHierarchy;
014import mondrian.rolap.agg.AggregationKey;
015
016
017/**
018 * Definition of a data source change listener.
019 *
020 * A change listener can be specified in the connection string.  It is used
021 * to ask what is changed in the datasource (e.g. database).
022 *
023 * Everytime mondrian has to decide whether it will use data from cache, it
024 * will call the change listener.  When the change listener tells mondrian
025 * the datasource has changed for a dimension, cube, ... then mondrian will
026 * flush the cache and read from database again.
027 *
028 * It is specified in the connection string, like this :
029 *
030 * <blockquote><code>
031 * Jdbc=jdbc:odbc:MondrianFoodMart; JdbcUser=ziggy; JdbcPassword=stardust;
032 * DataSourceChangeListener=com.acme.MyChangeListener;
033 * </code></blockquote>
034 *
035 * This class should be called in mondrian before any data is read, so
036 * even before cache is build.  This way, the plugin is able to register
037 * the first timestamp mondrian tries to read the datasource.
038 *
039 * @deprecated Will be removed with Mondrian 4.0.
040 * @author Bart Pappyn
041 * @since Dec 12, 2006
042 */
043@Deprecated
044public interface DataSourceChangeListener {
045
046    /**
047     * Checks if the given hierarchy has changed since the previous
048     * time this function was called.
049     *
050     * The first time, this function will be called when the cache
051     * is still empty.  This is because the plugin is able to register
052     * the first timestamp the function was accessed.
053     *
054     * It is highly recommended to optimize the plugin and minimize
055     * the time needed to evaluate this function, because this plugin
056     * is called many times for each mondrian query.
057     */
058    public boolean isHierarchyChanged(RolapHierarchy hierarchy);
059
060    /**
061     * Checks if the given aggregation has changed since the previous
062     * time this function was called.
063     *
064     * The first time, this function will be called when the cache
065     * is still empty.  This is because the plugin is able to register
066     * the first timestamp the function was accessed.
067     */
068    public boolean isAggregationChanged(AggregationKey aggregation);
069}
070
071// End DataSourceChangeListener.java