Class ArtifactResolver
java.lang.Object
de.iip_ecosphere.platform.services.spring.ArtifactResolver
Resolves artifacts to classpaths or class loaders.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate de.oktoflow.platform.tools.lib.loader.LoaderIndexprivate SpringCloudArtifactDescriptorstatic final Stringprivate File -
Constructor Summary
ConstructorsConstructorDescriptionArtifactResolver(SpringCloudArtifactDescriptor artifact, File homeDir) Creates an artifact resolver forartifact. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClasspathArguments(List<String> args, File homeDir) Adds the resolved classpath arguments toargstakinghomeDiras base directory.(package private) static voidaddUrlSafe(List<URL> urls, File file) Adds the URL offiletourls.Determines the class loader of theartifact.private voidfindAppJars(Consumer<File> jarConsumer) Finds app JARs inclasspathArtifactfolder and passes them on tojarConsumer.private static de.iip_ecosphere.platform.support.logging.LoggerReturns the logger.booleanReturns whether the resolved classpath artifact is a classpath file.booleanReturns whether the resolved classpath artifact is a classpath file.booleanReturns whether the resolved classpath artifact is a FAT Spring JAR.private de.oktoflow.platform.tools.lib.loader.LoaderIndexTries to load the classpath index if available.private static StringnormalizeName(File home, File file) Normalizes the given file name towards classpath file notation.private static Stringrelativize(File home, File file) Makesfilerelative tohomeif possible.
-
Field Details
-
CLASSPATH_FILE
- See Also:
-
jars
-
classpathArtifact
-
artifact
-
appIndex
private de.oktoflow.platform.tools.lib.loader.LoaderIndex appIndex
-
-
Constructor Details
-
ArtifactResolver
Creates an artifact resolver forartifact.- Parameters:
artifact- the artifact to determine the class loader forhomeDir- process home dir to use for unpacking, may be null for none/unknown
-
-
Method Details
-
loadIndex
private de.oktoflow.platform.tools.lib.loader.LoaderIndex loadIndex(File idxFile, List<File> jarFiles) Tries to load the classpath index if available.- Parameters:
idxFile- the index filejarFiles- the jar files in the classpath (for index substitution)
-
findAppJars
Finds app JARs inclasspathArtifactfolder and passes them on tojarConsumer.- Parameters:
jarConsumer- the jar file consumer
-
normalizeName
Normalizes the given file name towards classpath file notation.- Parameters:
home- the home directory (may be null for none)file- the file- Returns:
- the normalized file name
-
relativize
Makesfilerelative tohomeif possible.- Parameters:
home- the home directory (may be null for none)file- the file to make relative- Returns:
- the relative file name
-
addClasspathArguments
Adds the resolved classpath arguments toargstakinghomeDiras base directory.- Parameters:
args- the JVM arguments to be modified as a side effecthomeDir- process home dir to use for unpacking, may be null for none/unknown
-
addUrlSafe
Adds the URL offiletourls. Emits a warning if URL problems occur.- Parameters:
urls- the URL list to be modified as a side effectfile- the file to take the URL from
-
determineArtifactClassLoader
Determines the class loader of theartifact.- Returns:
- the class loader
-
isSpringJar
public boolean isSpringJar()Returns whether the resolved classpath artifact is a FAT Spring JAR.- Returns:
truefor Spring JAR
-
isClasspathFile
public boolean isClasspathFile()Returns whether the resolved classpath artifact is a classpath file.- Returns:
truefor Spring JAR
-
isClasspath
public boolean isClasspath()Returns whether the resolved classpath artifact is a classpath file.- Returns:
truefor Spring JAR
-
getLogger
private static de.iip_ecosphere.platform.support.logging.Logger getLogger()Returns the logger.- Returns:
- the logger
-