Class AppStarter.AccessibleLauncher
java.lang.Object
de.iip_ecosphere.platform.services.spring.loader.AppStarter.AccessibleLauncher
- Enclosing class:
AppStarter
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 Summary
FieldsModifier and TypeFieldDescriptionprivate org.springframework.boot.loader.archive.Archiveprivate AppStarter.ClassPathIndexFileprivate de.oktoflow.platform.tools.lib.loader.LoaderIndex(package private) static final org.springframework.boot.loader.archive.Archive.EntryFilterFilter for nested archive entries. -
Constructor Summary
ConstructorsConstructorDescriptionCreates the launcher by accessing the archive and trying to read the classpath index file.AccessibleLauncher(org.springframework.boot.loader.archive.Archive archive) Creates the launcher via an already existing archive. -
Method Summary
Modifier and TypeMethodDescriptionprivate Iterator<org.springframework.boot.loader.archive.Archive> applyClassPathArchivePostProcessing(Iterator<org.springframework.boot.loader.archive.Archive> archives) Performs class path archive post processing.protected final org.springframework.boot.loader.archive.ArchiveCreates the archive.Creates a Spring class loader via the JarLauncher setup for the archive passed in to this class.protected ClassLoadercreateClassLoader(URL[] urls) Creates the archive class loader based on the loaded index file.protected ClassLoadercreateClassLoader(Iterator<org.springframework.boot.loader.archive.Archive> archives) Creates the class loader based on an iterator of archives.createStackedLoader(ClassLoader parent) Creates a stacked class loader.protected final org.springframework.boot.loader.archive.ArchiveReturns the archive.protected Iterator<org.springframework.boot.loader.archive.Archive> Returns a iterator over the class path archives.protected AppStarter.ClassPathIndexFilegetClassPathIndex(org.springframework.boot.loader.archive.Archive archive) Loads the classpath index file.private intGuesses the classpath size.private booleanisEntryIndexed(org.springframework.boot.loader.archive.Archive.Entry entry) Returns whetherentryis indexed.protected booleanReturns whether the archive is exploded.protected booleanisNestedArchive(org.springframework.boot.loader.archive.Archive.Entry entry) Returns whetherentryis a nested archive.protected booleanReturns whether a post processing of the class path archives is needed.protected booleanisSearchCandidate(org.springframework.boot.loader.archive.Archive.Entry entry) Returns whetherentryis a search candidate.protected voidpostProcessClassPathArchives(List<org.springframework.boot.loader.archive.Archive> archives) Called to post-process archive entries before they are used.
-
Field Details
-
NESTED_ARCHIVE_ENTRY_FILTER
static final org.springframework.boot.loader.archive.Archive.EntryFilter NESTED_ARCHIVE_ENTRY_FILTERFilter for nested archive entries. -
archive
private org.springframework.boot.loader.archive.Archive archive -
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
Creates the archive.- Returns:
- Throws:
Exception
-
createClassLoader
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
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 ExceptionReturns 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:
truefor post processing
-
isNestedArchive
protected boolean isNestedArchive(org.springframework.boot.loader.archive.Archive.Entry entry) Returns whetherentryis a nested archive.- Parameters:
entry- the entry to analyze- Returns:
truefor nested archive,falsefor flat
-
isSearchCandidate
protected boolean isSearchCandidate(org.springframework.boot.loader.archive.Archive.Entry entry) Returns whetherentryis a search candidate.- Parameters:
entry- the entry- Returns:
truefor search candidate,falseelse
-
isEntryIndexed
private boolean isEntryIndexed(org.springframework.boot.loader.archive.Archive.Entry entry) Returns whetherentryis indexed.- Parameters:
entry- the entry- Returns:
truefor indexed,falseelse
-
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:
truefor 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
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
-