Source:
public Optional<EnvironmentImpl> createEnvironment( Tool recipeTool, RecipeFileContentProvider recipeFileContentProvider) throws BadRequestException { final String type = recipeTool.getType(); if (!KUBERNETES_TOOL_TYPE.equals(type) && !OPENSHIFT_TOOL_TYPE.equals(type)) { throw new BadRequestException("Environment cannot be created from such type of tool."); } if (recipeFileContentProvider == null) { throw new BadRequestException( format("There is no content provider registered for '%s' type tools.", type)); } String recipeFileContent = recipeFileContentProvider.fetchContent(recipeTool.getLocal()); if (isNullOrEmpty(recipeFileContent)) { throw new BadRequestException( format( "The local file '%s' defined in tool '%s' is unreachable or empty.", recipeTool.getLocal(), recipeTool.getName())); } try { final KubernetesList list = unmarshal(recipeFileContent, KubernetesList.class); if (recipeTool.getSelector() != null && !recipeTool.getSelector().isEmpty()) { List<HasMetadata> itemsList = list.getItems(); itemsList.removeIf( e -> !e.getMetadata() .getLabels() .entrySet() .containsAll(recipeTool.getSelector().entrySet())); list.setItems(itemsList); } RecipeImpl recipe = new RecipeImpl(type, DEFAULT_RECIPE_CONTENT_TYPE, asYaml(list), null); return Optional.of(new EnvironmentImpl(recipe, emptyMap())); } catch (KubernetesClientException ex) { throw new BadRequestException( format( "Unable to serialize or deserialize specified local file content for tool '%s'", recipeTool.getName())); } }

Target:
public EnvironmentImpl createEnvironment( Tool recipeTool, RecipeFileContentProvider recipeFileContentProvider) throws DevfileRecipeFormatException, DevfileException { final String type = recipeTool.getType(); if (!KUBERNETES_TOOL_TYPE.equals(type) && !OPENSHIFT_TOOL_TYPE.equals(type)) { throw new IllegalArgumentException( format( "Unable to create environment from tool '%s' - it has ineligible type '%s'.", recipeTool.getName(), type)); } if (recipeFileContentProvider == null) { throw new DevfileException( format( "Unable to process tool '%s' of type '%s' since there is no recipe content provider supplied. " + "That means you're trying to submit an devfile with recipe-type tools to the bare devfile API or used factory URL does not support this feature.", recipeTool.getName(), type)); } String recipeFileContent; try { recipeFileContent = recipeFileContentProvider.fetchContent(recipeTool.getLocal()); } catch (IOException e) { throw new DevfileException( format("Error during recipe content retrieval for tool '%s': ", recipeTool.getName()) + e.getMessage(), e); } if (isNullOrEmpty(recipeFileContent)) { throw new DevfileException( format( "The local file '%s' defined in tool '%s' is unreachable or empty.", recipeTool.getLocal(), recipeTool.getName())); } final KubernetesList list = unmarshal(recipeTool, recipeFileContent); if (recipeTool.getSelector() != null && !recipeTool.getSelector().isEmpty()) { List<HasMetadata> itemsList = list.getItems() .stream() .filter( e -> e.getMetadata() .getLabels() .entrySet() .containsAll(recipeTool.getSelector().entrySet())) .collect(Collectors.toList()); list.setItems(itemsList); } RecipeImpl recipe = new RecipeImpl(type, DEFAULT_RECIPE_CONTENT_TYPE, asYaml(recipeTool, list), null); return new EnvironmentImpl(recipe, emptyMap()); }