protected InternalEnvironment( InternalRecipe recipe, Map<String, InternalMachineConfig> machines, List<Warning> warnings) { this.recipe = recipe; this.machines = machines; this.warnings = new CopyOnWriteArrayList<>(); if (warnings != null) { this.warnings.addAll(warnings); } this.type = recipe != null ? recipe.getType() : null; }
@Override protected DockerImageEnvironment doCreate( @Nullable InternalRecipe recipe, Map<String, InternalMachineConfig> machines, List<Warning> warnings) throws InfrastructureException, ValidationException { checkNotNull(recipe, "Null recipe is not supported by docker image environment factory"); if (!DockerImageEnvironment.TYPE.equals(recipe.getType())) { throw new ValidationException( format( "Docker image environment parser doesn't support recipe type '%s'", recipe.getType())); } String dockerImage = recipe.getContent(); checkArgument(dockerImage != null, "Docker image should not be null."); addRamAttributes(machines); return new DockerImageEnvironment(dockerImage, recipe, machines, warnings); }
@Override protected DockerfileEnvironment doCreate( @Nullable InternalRecipe recipe, Map<String, InternalMachineConfig> machines, List<Warning> warnings) throws InfrastructureException, ValidationException { checkNotNull(recipe, "Null recipe is not supported by docker file environment factory"); if (!DockerfileEnvironment.TYPE.equals(recipe.getType())) { throw new ValidationException( format( "Dockerfile environment parser doesn't support recipe type '%s'", recipe.getType())); } String dockerfile = recipe.getContent(); checkArgument(dockerfile != null, "Dockerfile content should not be null."); addRamAttributes(machines); return new DockerfileEnvironment(dockerfile, recipe, machines, warnings); }
protected InternalEnvironment(InternalEnvironment internalEnvironment) { this.recipe = internalEnvironment.getRecipe(); this.type = recipe != null ? recipe.getType() : null; this.machines = internalEnvironment.getMachines(); this.warnings = new CopyOnWriteArrayList<>(internalEnvironment.getWarnings()); this.attributes = internalEnvironment.getAttributes(); this.commands = internalEnvironment.getCommands(); }