Package io.spring.initializr.web.project
Class ProjectGenerationInvoker<R extends ProjectRequest>
java.lang.Object
io.spring.initializr.web.project.ProjectGenerationInvoker<R>
- Type Parameters:
R
- the concreteProjectRequest
type
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 Summary
ModifierConstructorDescriptionProjectGenerationInvoker
(org.springframework.context.ApplicationContext parentApplicationContext, ProjectRequestToDescriptionConverter<R> requestConverter) protected
ProjectGenerationInvoker
(org.springframework.context.ApplicationContext parentApplicationContext, org.springframework.context.ApplicationEventPublisher eventPublisher, ProjectRequestToDescriptionConverter<R> requestConverter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanTempFiles
(Path dir) Clean all the temporary files that are related to this root directory.createDistributionFile
(Path dir, String extension) Create a file in the same directory as the given directory using the directory name and extension.protected ProjectAssetGenerator<Path>
getProjectAssetGenerator
(ProjectDescription description) Return theProjectAssetGenerator
to use to generate the project structure for the specifiedProjectDescription
.byte[]
invokeBuildGeneration
(R request) Invokes the project generation API that knows how to just write the build file.invokeProjectStructureGeneration
(R request) Invokes the project generation API that generates the entire project structure for the specifiedProjectRequest
.
-
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
Invokes the project generation API that generates the entire project structure for the specifiedProjectRequest
.- Parameters:
request
- the project request- Returns:
- the
ProjectGenerationResult
-
getProjectAssetGenerator
Return theProjectAssetGenerator
to use to generate the project structure for the specifiedProjectDescription
.- Parameters:
description
- the project description- Returns:
- an asset generator for the specified request
-
invokeBuildGeneration
Invokes the project generation API that knows how to just write the build file. Returns a directory containing the project for the specifiedProjectRequest
.- Parameters:
request
- the project request- Returns:
- the generated build content
-
createDistributionFile
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 fileextension
- the extension to use for the new file- Returns:
- the newly created file
-
cleanTempFiles
Clean all the temporary files that are related to this root directory.- Parameters:
dir
- the directory to clean- See Also:
-