1 50 package org.apache.excalibur.instrument.manager; 51 52 import org.apache.excalibur.instrument.manager.interfaces.InstrumentManagerClient; 53 54 62 class InstrumentSampleFactory 63 { 64 77 static InstrumentSample getInstrumentSample( InstrumentProxy instrumentProxy, 78 int type, 79 String name, 80 long interval, 81 int size, 82 String description, 83 long lease ) 84 { 85 switch ( type ) 86 { 87 case InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_MAXIMUM: 88 return new MaximumValueInstrumentSample( 89 instrumentProxy, name, interval, size, description, lease ); 90 91 case InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_MINIMUM: 92 return new MinimumValueInstrumentSample( 93 instrumentProxy, name, interval, size, description, lease ); 94 95 case InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_MEAN: 96 return new MeanValueInstrumentSample( 97 instrumentProxy, name, interval, size, description, lease ); 98 99 case InstrumentManagerClient.INSTRUMENT_SAMPLE_TYPE_COUNTER: 100 return new CounterInstrumentSample( 101 instrumentProxy, name, interval, size, description, lease ); 102 103 default: 104 throw new IllegalArgumentException ( "'" + type + "' is not a valid sample type." ); 105 } 106 } 107 } 108 | Popular Tags |