KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mondrian > spi > DataSourceChangeListener


1 /*
2 // $Id: //open/mondrian/src/main/mondrian/spi/DataSourceChangeListener.java#3 $
3 // This software is subject to the terms of the Common Public License
4 // Agreement, available at the following URL:
5 // http://www.opensource.org/licenses/cpl.html.
6 // Copyright (C) 2005-2007 Julian Hyde
7 // All Rights Reserved.
8 // You must accept the terms of that agreement to use this software.
9 */

10 package mondrian.spi;
11
12
13 import mondrian.rolap.RolapHierarchy;
14 import mondrian.rolap.agg.Aggregation;
15
16
17 /**
18  * Definition of a data source change listener.
19  *
20  * A change listener can be specified in the connection string. It is used
21  * to ask what is changed in the datasource (e.g. database).
22  *
23  * Everytime mondrian has to decide whether it will use data from cache, it
24  * will call the change listener. When the change listener tells mondrian
25  * the datasource has changed for a dimension, cube, ... then mondrian will
26  * flush the cache and read from database again.
27  *
28  * It is specified in the connection string, like this :
29  *
30  * <blockquote><code>
31  * Jdbc=jdbc:odbc:MondrianFoodMart; JdbcUser=ziggy; JdbcPassword=stardust; DataSourceChangeListener=com.acme.MyChangeListener;
32  * </code></blockquote>
33  *
34  * This class should be called in mondrian before any data is read, so
35  * even before cache is build. This way, the plugin is able to register
36  * the first timestamp mondrian tries to read the datasource.
37  *
38  * @author Bart Pappyn
39  * @version $Id: //open/mondrian/src/main/mondrian/spi/DataSourceChangeListener.java#3 $
40  * @since Dec 12, 2006
41  */

42
43 public interface DataSourceChangeListener {
44     
45     /**
46      * Checks if the given hierarchy has changed since the previous
47      * time this function was called.
48      *
49      * The first time, this function will be called when the cache
50      * is still empty. This is because the plugin is able to register
51      * the first timestamp the function was accessed.
52      *
53      * It is highly recommended to optimize the plugin and minimize
54      * the time needed to evaluate this function, because this plugin
55      * is called many times for each mondrian query.
56      */

57     public boolean isHierarchyChanged(RolapHierarchy hierarchy);
58
59     /**
60      * Checks if the given aggregation has changed since the previous
61      * time this function was called.
62      *
63      * The first time, this function will be called when the cache
64      * is still empty. This is because the plugin is able to register
65      * the first timestamp the function was accessed.
66      */

67     public boolean isAggregationChanged(Aggregation aggregation);
68 }
69
Popular Tags