Class ProjectGenerationInvoker<R extends ProjectRequest>

java.lang.Object
io.spring.initializr.web.project.ProjectGenerationInvoker<R>
Type Parameters:
R - the concrete ProjectRequest type

public class ProjectGenerationInvoker<R extends ProjectRequest> extends Object
Invokes the project generation API. This is an intermediate layer that can consume a ProjectRequest and trigger project generation based on the request.
Author:
Madhura Bhave
See Also:
  • Constructor Details

    • ProjectGenerationInvoker

      public ProjectGenerationInvoker(org.springframework.context.ApplicationContext parentApplicationContext, ProjectRequestToDescriptionConverter<R> requestConverter)
    • ProjectGenerationInvoker

      protected ProjectGenerationInvoker(org.springframework.context.ApplicationContext parentApplicationContext, org.springframework.context.ApplicationEventPublisher eventPublisher, ProjectRequestToDescriptionConverter<R> requestConverter)
  • Method Details

    • invokeProjectStructureGeneration

      public ProjectGenerationResult invokeProjectStructureGeneration(R request)
      Invokes the project generation API that generates the entire project structure for the specified ProjectRequest.
      Parameters:
      request - the project request
      Returns:
      the ProjectGenerationResult
    • getProjectAssetGenerator

      protected ProjectAssetGenerator<Path> getProjectAssetGenerator(ProjectDescription description)
      Return the ProjectAssetGenerator to use to generate the project structure for the specified ProjectDescription.
      Parameters:
      description - the project description
      Returns:
      an asset generator for the specified request
    • invokeBuildGeneration

      public byte[] invokeBuildGeneration(R request)
      Invokes the project generation API that knows how to just write the build file. Returns a directory containing the project for the specified ProjectRequest.
      Parameters:
      request - the project request
      Returns:
      the generated build content
    • createDistributionFile

      public Path createDistributionFile(Path dir, String extension)
      Create a file in the same directory as the given directory using the directory name and extension.
      Parameters:
      dir - the directory used to determine the path and name of the new file
      extension - the extension to use for the new file
      Returns:
      the newly created file
    • cleanTempFiles

      public void cleanTempFiles(Path dir)
      Clean all the temporary files that are related to this root directory.
      Parameters:
      dir - the directory to clean
      See Also: