public MeasurementFactory getMeasurementFactory(String resourceTypeName) {
MeasurementFactory measurementFactory = measurementFactories.get(resourceTypeName);
// Lazy load the factory
if (measurementFactory == null) {
Resource resource = findResource(resourceTypeName);
if (resource == null) {
measurementFactory = EMPTY_MEASUREMENT_FACTORY;
} else {
JAXBElement<? extends MeasurementGenerator> element = resource.getMeasurementGenerator();
if (element == null) {
measurementFactory = EMPTY_MEASUREMENT_FACTORY;
} else {
MeasurementGenerator generator = element.getValue();
measurementFactory = createMeasurementFactory(generator);