if (resourceFactory == null) {
Resource resource = findResource(resourceTypeName);
if (resource == null) {
resourceFactory = EMPTY_RESOURCE_FACTORY;
} else {
ResourceGenerator generator = resource.getResourceGenerator().getValue();
resourceFactory = createResourceFactory(generator);
}
resourceFactories.put(resourceTypeName, resourceFactory);
}