Class BootableJarSupport


  • public class BootableJarSupport
    extends Object
    Various utilities for packing a bootable JAR.
    Author:
    jdenise, James R. Perkins
    • 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