001 /* 002 // $Id: //open/mondrian/src/main/mondrian/spi/impl/DataSourceChangeListenerImpl.java#6 $ 003 // This software is subject to the terms of the Common Public License 004 // Agreement, available at the following URL: 005 // http://www.opensource.org/licenses/cpl.html. 006 // Copyright (C) 2005-2008 Julian Hyde 007 // All Rights Reserved. 008 // You must accept the terms of that agreement to use this software. 009 */ 010 package mondrian.spi.impl; 011 012 import mondrian.spi.DataSourceChangeListener; 013 import mondrian.olap.MondrianDef; 014 import mondrian.rolap.RolapHierarchy; 015 import mondrian.rolap.agg.Aggregation; 016 017 018 /** 019 * Default implementation of a data source change listener 020 * that always returns that the datasource is unchanged. 021 * 022 * A change listener can be specified in the connection string. It is used 023 * to ask what is changed in the datasource (e.g. database). 024 * 025 * Everytime mondrian has to decide whether it will use data from cache, it 026 * will call the change listener. When the change listener tells mondrian 027 * the datasource has changed for a dimension, cube, ... then mondrian will 028 * flush the cache and read from database again. 029 * 030 * It is specified in the connection string, like this: 031 * 032 * <blockquote><code> 033 * Jdbc=jdbc:odbc:MondrianFoodMart; JdbcUser=ziggy; JdbcPassword=stardust; DataSourceChangeListener=com.acme.MyChangeListener; 034 * </code></blockquote> 035 * 036 * This class should be called in mondrian before any data is read, so 037 * even before cache is build. This way, the plugin is able to register 038 * the first timestamp mondrian tries to read the datasource. 039 * 040 * @author Bart Pappyn 041 * @version $Id: //open/mondrian/src/main/mondrian/spi/impl/DataSourceChangeListenerImpl.java#6 $ 042 * @since Dec 12, 2006 043 */ 044 045 public class DataSourceChangeListenerImpl implements DataSourceChangeListener { 046 047 /** Creates a new instance of DataSourceChangeListenerImpl */ 048 public DataSourceChangeListenerImpl() { 049 } 050 051 052 public synchronized boolean isHierarchyChanged(RolapHierarchy hierarchy) { 053 return false; 054 } 055 056 public synchronized boolean isAggregationChanged(Aggregation aggregation) { 057 return false; 058 } 059 060 public String getTableName(RolapHierarchy hierarchy) { 061 MondrianDef.RelationOrJoin relation = hierarchy.getRelation(); 062 if (relation instanceof MondrianDef.Table) { 063 MondrianDef.Table tableRelation = (MondrianDef.Table) relation; 064 return tableRelation.name; 065 } else { 066 return null; 067 } 068 } 069 } 070 071 // End DataSourceChangeListenerImpl.java