Package org.wildfly.plugin.tools.bootablejar

## Class BootableJarSupport

- java.lang.Object
- - org.wildfly.plugin.tools.bootablejar.BootableJarSupport

-     public class BootableJarSupport
      extends Object

  Various utilities for packing a bootable JAR.
  Author:
    jdenise, James R. Perkins

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `BOOTABLE_SUFFIX` |
    `static String` | `JBOSS_MODULES_ARTIFACT_ID` |
    `static String` | `JBOSS_MODULES_GROUP_ID` |
    `static String` | `WILDFLY_ARTIFACT_VERSIONS_RESOURCE_PATH` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BootableJarSupport()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static void` | `buildJar​(Path contentDir, Path jarFile, ScannedArtifacts bootable, org.jboss.galleon.universe.maven.repo.MavenRepoManager resolver)` | Builds a JAR file for the bootable JAR.
    `static void` | `packageBootableJar​(Path targetJarFile, Path workDir, org.jboss.galleon.api.config.GalleonProvisioningConfig config, Path serverHome, org.jboss.galleon.universe.maven.repo.MavenRepoManager resolver, org.jboss.galleon.MessageWriter writer)` | Package a server as a bootable JAR.
    `static ScannedArtifacts` | `scanArtifacts​(org.jboss.galleon.api.Provisioning pm, org.jboss.galleon.api.config.GalleonProvisioningConfig config, org.jboss.galleon.MessageWriter writer)` | Scans the provisioning session for required artifacts.
    `static void` | `unzipCloudExtension​(Path contentDir, String version, org.jboss.galleon.universe.maven.repo.MavenRepoManager resolver)` | Resolves the cloud extension for the version provided.
    `static void` | `zipServer​(Path source, Path targetDir)` | Creates a ZIP archive for the server.
    `static void` | `zipServer​(Path source, Path targetDir, String zipFileName)` | Creates a ZIP archive for the server.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### BOOTABLE_SUFFIX

          public static final String BOOTABLE_SUFFIX

      See Also:
        Constant Field Values

    - #### JBOSS_MODULES_GROUP_ID

          public static final String JBOSS_MODULES_GROUP_ID

      See Also:
        Constant Field Values

    - #### JBOSS_MODULES_ARTIFACT_ID

          public static final String JBOSS_MODULES_ARTIFACT_ID

      See Also:
        Constant Field Values

    - #### WILDFLY_ARTIFACT_VERSIONS_RESOURCE_PATH

          public static final String WILDFLY_ARTIFACT_VERSIONS_RESOURCE_PATH

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### BootableJarSupport

          public BootableJarSupport()

  - ### Method Detail

    - #### packageBootableJar

          public static void packageBootableJar​(Path targetJarFile,
                                                Path workDir,
                                                org.jboss.galleon.api.config.GalleonProvisioningConfig config,
                                                Path serverHome,
                                                org.jboss.galleon.universe.maven.repo.MavenRepoManager resolver,
                                                org.jboss.galleon.MessageWriter writer)
                                         throws IOException,
                                                org.jboss.galleon.ProvisioningException

      Package a server as a bootable JAR.
      Parameters:
        `targetJarFile` - the path to the JAR file to create
        `workDir` - the working directory used to generate and store content
        `config` - the Galleon provisioning configuration
        `serverHome` - the server directory
        `resolver` - the Maven resolver used to resolve artifacts
        `writer` - the message writer where messages will be written to
      Throws:
        `IOException` - if an error occurs packaging the bootable JAR
        `org.jboss.galleon.ProvisioningException` - if an error occurs packaging the bootable JAR

    - #### unzipCloudExtension

          public static void unzipCloudExtension​(Path contentDir,
                                                 String version,
                                                 org.jboss.galleon.universe.maven.repo.MavenRepoManager resolver)
                                          throws org.jboss.galleon.universe.maven.MavenUniverseException,
                                                 IOException

      Resolves the cloud extension for the version provided. It then unpacks the extension into the content directory.
      Parameters:
        `contentDir` - the directory the cloud extension should be extracted to
        `version` - the version of the cloud extension to use
        `resolver` - the Maven resolver used to resolve the cloud extension
      Throws:
        `org.jboss.galleon.universe.maven.MavenUniverseException` - if an error occurs while resolving the artifact
        `IOException` - if en error occurs extracting the extension

    - #### zipServer

          public static void zipServer​(Path source,
                                       Path targetDir)
                                throws IOException

      Creates a ZIP archive for the server. The archive name will be `wildfly.zip`.
      Parameters:
        `source` - path for the content to archive
        `targetDir` - the target directory for the archive to be created in
      Throws:
        `IOException` - if an error occurs creating the archive

    - #### zipServer

          public static void zipServer​(Path source,
                                       Path targetDir,
                                       String zipFileName)
                                throws IOException

      Creates a ZIP archive for the server.
      Parameters:
        `source` - path for the content to archive
        `targetDir` - the target directory for the archive to be created in
        `zipFileName` - the of the archive to create
      Throws:
        `IOException` - if an error occurs creating the archive

    - #### scanArtifacts

          public static ScannedArtifacts scanArtifacts​(org.jboss.galleon.api.Provisioning pm,
                                                       org.jboss.galleon.api.config.GalleonProvisioningConfig config,
                                                       org.jboss.galleon.MessageWriter writer)
                                                throws org.jboss.galleon.ProvisioningException

      Scans the provisioning session for required artifacts. These include `jboss-modules`, the `wildfly-jar-boot` artifact and CLI artifacts.
      Parameters:
        `pm` - the provisioning session
        `config` - the provisioning configuration
        `writer` - the message writer
      Returns:
        the scanned artifacts
      Throws:
        `org.jboss.galleon.ProvisioningException` - if an error occurs scanning

    - #### buildJar

          public static void buildJar​(Path contentDir,
                                      Path jarFile,
                                      ScannedArtifacts bootable,
                                      org.jboss.galleon.universe.maven.repo.MavenRepoManager resolver)
                               throws IOException,
                                      org.jboss.galleon.universe.maven.MavenUniverseException

      Builds a JAR file for the bootable JAR.
      Parameters:
        `contentDir` - the directory which stores the bootable JAR's content
        `jarFile` - the target JAR file
        `bootable` - the scanned artifacts
        `resolver` - the Maven resolver used to resolve artifacts
      Throws:
        `IOException` - if an error occurs building the JAR
        `org.jboss.galleon.universe.maven.MavenUniverseException` - if an error occurs resolving artifacts