1 9 package mondrian.rolap; 10 11 import java.util.ArrayList ; 12 import java.util.List ; 13 14 import mondrian.olap.Exp; 15 import mondrian.olap.FunDef; 16 import mondrian.olap.NativeEvaluator; 17 18 22 public class RolapNativeRegistry extends RolapNative { 23 24 private List <RolapNative> natives = new ArrayList <RolapNative>(); 25 26 public RolapNativeRegistry() { 27 super.setEnabled(true); 28 register(new RolapNativeCrossJoin()); 29 register(new RolapNativeTopCount()); 30 register(new RolapNativeFilter()); 31 } 32 33 37 public NativeEvaluator createEvaluator( 38 RolapEvaluator evaluator, FunDef fun, Exp[] args) 39 { 40 if (!isEnabled()) { 41 return null; 42 } 43 for (RolapNative rn : natives) { 44 NativeEvaluator ne = rn.createEvaluator(evaluator, fun, args); 45 if (ne != null) { 46 if (listener != null) { 47 NativeEvent e = new NativeEvent(this, ne); 48 listener.foundEvaluator(e); 49 } 50 return ne; 51 } 52 } 53 return null; 54 } 55 56 public void register(RolapNative rn) { 57 natives.add(rn); 58 } 59 60 61 void setListener(Listener listener) { 62 super.setListener(listener); 63 for (RolapNative rn : natives) { 64 rn.setListener(listener); 65 } 66 } 67 68 69 void useHardCache(boolean hard) { 70 for (RolapNative rn : natives) { 71 rn.useHardCache(hard); 72 } 73 } 74 75 } 76 77 | Popular Tags |