1 19 20 package org.apache.excalibur.instrument.manager.impl; 21 22 import org.apache.excalibur.instrument.manager.DefaultInstrumentManager; 23 24 30 class InstrumentSampleFactory 31 { 32 45 static InstrumentSample getInstrumentSample( InstrumentProxy instrumentProxy, 46 int type, 47 String name, 48 long interval, 49 int size, 50 String description, 51 long lease ) 52 { 53 switch ( type ) 54 { 55 case DefaultInstrumentManager.INSTRUMENT_SAMPLE_TYPE_MAXIMUM: 56 return new MaximumValueInstrumentSample( 57 instrumentProxy, name, interval, size, description, lease ); 58 59 case DefaultInstrumentManager.INSTRUMENT_SAMPLE_TYPE_MINIMUM: 60 return new MinimumValueInstrumentSample( 61 instrumentProxy, name, interval, size, description, lease ); 62 63 case DefaultInstrumentManager.INSTRUMENT_SAMPLE_TYPE_MEAN: 64 return new MeanValueInstrumentSample( 65 instrumentProxy, name, interval, size, description, lease ); 66 67 case DefaultInstrumentManager.INSTRUMENT_SAMPLE_TYPE_COUNTER: 68 return new CounterInstrumentSample( 69 instrumentProxy, name, interval, size, description, lease ); 70 71 default: 72 throw new IllegalArgumentException ( "'" + type + "' is not a valid sample type." ); 73 } 74 } 75 } 76 | Popular Tags |