Class AppStarter.AccessibleLauncher

java.lang.Object
de.iip_ecosphere.platform.services.spring.loader.AppStarter.AccessibleLauncher
Enclosing class:
AppStarter

public static class AppStarter.AccessibleLauncher extends Object
Implements an accessible launcher just to access the Spring packaged JARs in the way Spring is doing it. Needed, as one method in the Spring Launcher hierarchy is final and the ClassPathIndexFile is package-local. Call createStackedLoader(ClassLoader) on an instance.
Author:
Spring, Holger Eichelberger, SSE
  • Field Details

    • NESTED_ARCHIVE_ENTRY_FILTER

      static final org.springframework.boot.loader.archive.Archive.EntryFilter NESTED_ARCHIVE_ENTRY_FILTER
      Filter for nested archive entries.
    • archive

      private org.springframework.boot.loader.archive.Archive archive
    • classPathIndex

      private AppStarter.ClassPathIndexFile classPathIndex
    • loaderIndex

      private de.oktoflow.platform.tools.lib.loader.LoaderIndex loaderIndex
  • Constructor Details

    • AccessibleLauncher

      public AccessibleLauncher()
      Creates the launcher by accessing the archive and trying to read the classpath index file.
      Throws:
      IllegalStateException - if the archive/classpath index cannot be accessed; anyway, there may not be a classpath index (legacy loading)
    • AccessibleLauncher

      public AccessibleLauncher(org.springframework.boot.loader.archive.Archive archive)
      Creates the launcher via an already existing archive.
      Throws:
      IllegalStateException - if the archive/classpath index cannot be accessed; anyway, there may not be a classpath index (legacy loading)
  • Method Details

    • getClassPathIndex

      protected AppStarter.ClassPathIndexFile getClassPathIndex(org.springframework.boot.loader.archive.Archive archive) throws IOException
      Loads the classpath index file.
      Parameters:
      archive - the archive to load from
      Returns:
      the classpath index file, may be null for none
      Throws:
      IOException - if loading fails
    • createArchive

      protected final org.springframework.boot.loader.archive.Archive createArchive() throws Exception
      Creates the archive.
      Returns:
      Throws:
      Exception
    • createClassLoader

      public ClassLoader createClassLoader() throws Exception
      Creates a Spring class loader via the JarLauncher setup for the archive passed in to this class.
      Returns:
      the classloader
      Throws:
      Exception - any kind of exception if loading the archive or constructing a class loader failed
    • createStackedLoader

      public ClassLoader createStackedLoader(ClassLoader parent) throws Exception
      Creates a stacked class loader.
      Parameters:
      parent - the parent classloader to be used as default
      Returns:
      the classloader or parent
      Throws:
      Exception - if creating the classloader fails
    • getClassPathArchivesIterator

      protected Iterator<org.springframework.boot.loader.archive.Archive> getClassPathArchivesIterator() throws Exception
      Returns a iterator over the class path archives.
      Returns:
      the iterator
      Throws:
      Exception - if accessing/constructing the iterator fails
    • isPostProcessingClassPathArchives

      protected boolean isPostProcessingClassPathArchives()
      Returns whether a post processing of the class path archives is needed.
      Returns:
      true for post processing
    • isNestedArchive

      protected boolean isNestedArchive(org.springframework.boot.loader.archive.Archive.Entry entry)
      Returns whether entry is a nested archive.
      Parameters:
      entry - the entry to analyze
      Returns:
      true for nested archive, false for flat
    • isSearchCandidate

      protected boolean isSearchCandidate(org.springframework.boot.loader.archive.Archive.Entry entry)
      Returns whether entry is a search candidate.
      Parameters:
      entry - the entry
      Returns:
      true for search candidate, false else
    • isEntryIndexed

      private boolean isEntryIndexed(org.springframework.boot.loader.archive.Archive.Entry entry)
      Returns whether entry is indexed.
      Parameters:
      entry - the entry
      Returns:
      true for indexed, false else
    • applyClassPathArchivePostProcessing

      private Iterator<org.springframework.boot.loader.archive.Archive> applyClassPathArchivePostProcessing(Iterator<org.springframework.boot.loader.archive.Archive> archives) throws Exception
      Performs class path archive post processing.
      Parameters:
      archives - the archives
      Returns:
      the archives iterator
      Throws:
      Exception - if accessing the iterator/postprocessing fails
      See Also:
    • postProcessClassPathArchives

      protected void postProcessClassPathArchives(List<org.springframework.boot.loader.archive.Archive> archives) throws Exception
      Called to post-process archive entries before they are used. Implementations can add and remove entries.
      Parameters:
      archives - the archives
      Throws:
      Exception - if the post processing fails
      See Also:
    • isExploded

      protected boolean isExploded()
      Returns whether the archive is exploded.
      Returns:
      true for exploded
    • getArchive

      protected final org.springframework.boot.loader.archive.Archive getArchive()
      Returns the archive.
      Returns:
      the archive
    • createClassLoader

      protected ClassLoader createClassLoader(Iterator<org.springframework.boot.loader.archive.Archive> archives) throws Exception
      Creates the class loader based on an iterator of archives.
      Parameters:
      archives - the archives
      Returns:
      the classloader
      Throws:
      Exception - if creating the class loader fails
      See Also:
    • guessClassPathSize

      private int guessClassPathSize()
      Guesses the classpath size.
      Returns:
      the guessed classpath size
    • createClassLoader

      protected ClassLoader createClassLoader(URL[] urls) throws Exception
      Creates the archive class loader based on the loaded index file.
      Parameters:
      urls - the URLs to construct the class loader
      Returns:
      the classloader
      Throws:
      Exception - if creating the class loader fails