Class AbstractBootOperation<T extends AbstractBootOperation<T>>

java.lang.Object
rife.bld.operations.AbstractOperation<AbstractBootOperation<T>>
rife.bld.extension.AbstractBootOperation<T>
Type Parameters:
T - the type parameter
Direct Known Subclasses:
BootJarOperation, BootWarOperation

public abstract class AbstractBootOperation<T extends AbstractBootOperation<T>> extends AbstractOperation<AbstractBootOperation<T>>
Implements common methods used by Spring Boot operations, such as BootJarOperation and BootWarOperation.
Since:
1.0
Author:
Erik C. Thauvin
  • Constructor Details

    • AbstractBootOperation

      public AbstractBootOperation()
  • Method Details

    • destinationDirectory

      public File destinationDirectory()
      Retrieves the destination directory in which the archive will be created.
      Returns:
      the destination directory
    • destinationDirectory

      public T destinationDirectory(File directory) throws IOException
      Provides the destination directory in which the archive will be created.
      Parameters:
      directory - the destination directory
      Returns:
      this operation instance
      Throws:
      IOException - if an error occurs
    • destinationDirectory

      public T destinationDirectory(String directory) throws IOException
      Provides the destination directory in which the archive will be created.
      Parameters:
      directory - the destination directory
      Returns:
      this operation instance
      Throws:
      IOException - if an error occurs
    • destinationDirectory

      public T destinationDirectory(Path directory) throws IOException
      Provides the destination directory in which the archive will be created.
      Parameters:
      directory - the destination directory
      Returns:
      this operation instance
      Throws:
      IOException - if an error occurs
    • destinationFileName

      public T destinationFileName(String name)
      Provides the file name that will be used for the archive creation.
      Parameters:
      name - the archive file name
      Returns:
      this operation instance
    • destinationFileName

      public String destinationFileName()
      Retrieves the file name that will be used for the archive creation.
      Returns:
      the archive file name
    • executeCopyBootLoader

      protected void executeCopyBootLoader(File stagingDirectory) throws FileUtilsErrorException, ExitStatusException
      Part of the execute operation, copies the Spring Boot loader launcher archive content to the staging directory.
      Parameters:
      stagingDirectory - the staging directory
      Throws:
      FileUtilsErrorException - if an error occurs
      ExitStatusException
    • executeCopyInfClassesFiles

      protected void executeCopyInfClassesFiles(File stagingInfDirectory) throws IOException
      Part of the execute operation, copies the BOOT-INF or WEB-INF classes.
      Parameters:
      stagingInfDirectory - Tte staging INF directory
      Throws:
      IOException - if an error occurs
    • executeCopyInfLibs

      protected void executeCopyInfLibs(File stagingInfDirectory) throws IOException
      Part of the execute operation, copies the BOOT-INF or (@code WEB-INF) libs.
      Parameters:
      stagingInfDirectory - the staging INF directory
      Throws:
      IOException - if an error occurs
    • executeCreateArchive

      protected File executeCreateArchive(File stagingDirectory) throws IOException
      Part of the execute operation, creates the archive from the staging directory.
      Parameters:
      stagingDirectory - the staging directory
      Returns:
      the archive
      Throws:
      IOException - if an error occurs
    • executeCreateManifest

      protected void executeCreateManifest(File stagingDirectory) throws IOException
      Part of the execute operation, creates the manifest for the archive.
      Parameters:
      stagingDirectory - the staging directory
      Throws:
      IOException - if an error occurs
    • fromProject

      public abstract T fromProject(Project project) throws IOException
      Configures the operation from a Project.
      Parameters:
      project - the project
      Returns:
      this operation instance
      Throws:
      IOException - if an error occurs
    • infLibs

      public T infLibs(Collection<File> jars)
      Provides the libraries that will be stored in BOOT-INF or WEB-INF.
      Parameters:
      jars - a collection of Java archive files
      Returns:
      this operation instance
      See Also:
    • infLibs

      public T infLibs(File... jars)
      Provides the libraries that will be stored in BOOT-INF or WEB-INF.
      Parameters:
      jars - one or more Java archive files
      Returns:
      this operation instance
      See Also:
    • infLibs

      public T infLibs(Path... jars)
      Provides the libraries that will be stored in BOOT-INF or WEB-INF.
      Parameters:
      jars - one or more Java archive files
      Returns:
      this operation instance
      See Also:
    • infLibs

      public T infLibs(String... jars)
      Provides the libraries that will be stored in BOOT-INF or WEB-INF.
      Parameters:
      jars - one or more Java archive files
      Returns:
      this operation instance
      See Also:
    • infLibs

      public Collection<File> infLibs()
      Retrieves the libraries in BOOT-INF or WEB-INF.
      Returns:
      the Java archives
    • infLibsPaths

      public T infLibsPaths(Collection<Path> jars)
      Provides the libraries that will be stored in BOOT-INF or WEB-INF.
      Parameters:
      jars - one or more Java archive files
      Returns:
      this operation instance
      See Also:
    • infLibsStrings

      public T infLibsStrings(Collection<String> jars)
      Provides the libraries that will be stored in BOOT-INF or WEB-INF.
      Parameters:
      jars - one or more Java archive files
      Returns:
      this operation instance
      See Also:
    • launcherClass

      public T launcherClass(String className)
      Provides the Spring Boot loader launcher fully-qualified class name.

      For examples:

      • org.springframework.boot.loader.JarLauncher
      • org.springframework.boot.loader.PropertiesLauncher
      • org.springframework.boot.loader.WarLauncher
      Parameters:
      className - the launcher class name
      Returns:
      this operation instance
    • launcherClass

      protected String launcherClass()
      Retrieves the Spring Boot loader launcher fully-qualified class name.
      Returns:
      the launcher class name
    • launcherLibs

      public Collection<File> launcherLibs()
      Retrieves the Spring Boot loader launcher libraries.
      Returns:
      the Java archives
    • launcherLibs

      public T launcherLibs(Collection<File> jars) throws IOException
      Provides the libraries for the Spring Boot loader launcher.
      Parameters:
      jars - a collection of Java archives
      Returns:
      this operation instance
      Throws:
      IOException - if a JAR could not be found
      See Also:
    • launcherLibs

      public T launcherLibs(File... jars) throws IOException
      Provides the libraries for the Spring Boot loader launcher.
      Parameters:
      jars - one or more Java archives
      Returns:
      this operation instance
      Throws:
      IOException - if a JAR could not be found
      See Also:
    • launcherLibs

      public T launcherLibs(String... jars) throws IOException
      Provides the libraries for the Spring Boot loader launcher.
      Parameters:
      jars - one or more Java archives
      Returns:
      this operation instance
      Throws:
      IOException - if a JAR could not be found
      See Also:
    • launcherLibs

      public T launcherLibs(Path... jars) throws IOException
      Provides the libraries for the Spring Boot loader launcher.
      Parameters:
      jars - one or more Java archives
      Returns:
      this operation instance
      Throws:
      IOException - if a JAR could not be found
      See Also:
    • launcherLibsPaths

      public T launcherLibsPaths(Collection<Path> jars) throws IOException
      Provides the libraries for the Spring Boot loader launcher.
      Parameters:
      jars - one or more Java archives
      Returns:
      this operation instance
      Throws:
      IOException - if a JAR could not be found
      See Also:
    • launcherLibsStrings

      public T launcherLibsStrings(Collection<String> jars) throws IOException
      Provides the libraries for the Spring Boot loader launcher.
      Parameters:
      jars - one or more Java archives
      Returns:
      this operation instance
      Throws:
      IOException - if a JAR could not be found
      See Also:
    • mainClass

      protected T mainClass(String className)
      Provides the fully-qualified main class name.
      Parameters:
      className - the class name
      Returns:
      this operation instance
    • mainClass

      public String mainClass()
      Retrieves the main class name.
      Returns:
      the class name
    • manifestAttribute

      public T manifestAttribute(String name, String value)
      Provides an attribute to put in the archive manifest.
      Parameters:
      name - the attribute name
      value - the attribute value
      Returns:
      this operation instance
    • manifestAttributes

      public Map<String,String> manifestAttributes()
      Retrieves the attributes that will be put in the archive manifest.
      Returns:
      the manifest attributes
    • manifestAttributes

      public T manifestAttributes(Map<String,String> attributes)
      Provides a map of attributes to put in the archive manifest.
      Parameters:
      attributes - the manifest attributes
      Returns:
      this operation instance
      See Also:
    • sourceDirectories

      public T sourceDirectories(Collection<File> directories)
      Provides source directories that will be used for the archive creation.
      Parameters:
      directories - one or more source directories
      Returns:
      this operation instance
      See Also:
    • sourceDirectories

      public T sourceDirectories(File... directories)
      Provides source directories that will be used for the archive creation.
      Parameters:
      directories - one or more source directories
      Returns:
      this operation instance
      See Also:
    • sourceDirectories

      public T sourceDirectories(String... directories)
      Provides source directories that will be used for the archive creation.
      Parameters:
      directories - one or more source directories
      Returns:
      this operation instance
      See Also:
    • sourceDirectories

      public T sourceDirectories(Path... directories)
      Provides source directories that will be used for the archive creation.
      Parameters:
      directories - one or more source directories
      Returns:
      this operation instance
      See Also:
    • sourceDirectories

      public Collection<File> sourceDirectories()
      Retrieves the source directories that will be used for the archive creation.
      Returns:
      the source directories
    • sourceDirectoriesPaths

      public T sourceDirectoriesPaths(Collection<Path> directories)
      Provides source directories that will be used for the archive creation.
      Parameters:
      directories - one or more source directories
      Returns:
      this operation instance
      See Also:
    • sourceDirectoriesStrings

      public T sourceDirectoriesStrings(Collection<String> directories)
      Provides source directories that will be used for the archive creation.
      Parameters:
      directories - one or more source directories
      Returns:
      this operation instance
      See Also:
    • verifyExecute

      protected boolean verifyExecute() throws IllegalArgumentException
      Verifies that all the elements (mainClass, launcherClass and launcherLibs) required to create the archive have been provided, throws an IllegalArgumentException otherwise.
      Returns:
      true or an IllegalArgumentException
      Throws:
      IllegalArgumentException - if an error occurs