Class ArtifactResolver

java.lang.Object
de.iip_ecosphere.platform.services.spring.ArtifactResolver

public class ArtifactResolver extends Object
Resolves artifacts to classpaths or class loaders.
Author:
Holger Eichelberger, SSE
  • Field Details

  • Constructor Details

    • ArtifactResolver

      public ArtifactResolver(SpringCloudArtifactDescriptor artifact, File homeDir)
      Creates an artifact resolver for artifact.
      Parameters:
      artifact - the artifact to determine the class loader for
      homeDir - 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 file
      jarFiles - the jar files in the classpath (for index substitution)
    • findAppJars

      private void findAppJars(Consumer<File> jarConsumer)
      Finds app JARs in classpathArtifact folder and passes them on to jarConsumer.
      Parameters:
      jarConsumer - the jar file consumer
    • normalizeName

      private static String normalizeName(File home, File file)
      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

      private static String relativize(File home, File file)
      Makes file relative to home if possible.
      Parameters:
      home - the home directory (may be null for none)
      file - the file to make relative
      Returns:
      the relative file name
    • addClasspathArguments

      public void addClasspathArguments(List<String> args, File homeDir)
      Adds the resolved classpath arguments to args taking homeDir as base directory.
      Parameters:
      args - the JVM arguments to be modified as a side effect
      homeDir - process home dir to use for unpacking, may be null for none/unknown
    • addUrlSafe

      static void addUrlSafe(List<URL> urls, File file)
      Adds the URL of file to urls. Emits a warning if URL problems occur.
      Parameters:
      urls - the URL list to be modified as a side effect
      file - the file to take the URL from
    • determineArtifactClassLoader

      public ClassLoader determineArtifactClassLoader()
      Determines the class loader of the artifact.
      Returns:
      the class loader
    • isSpringJar

      public boolean isSpringJar()
      Returns whether the resolved classpath artifact is a FAT Spring JAR.
      Returns:
      true for Spring JAR
    • isClasspathFile

      public boolean isClasspathFile()
      Returns whether the resolved classpath artifact is a classpath file.
      Returns:
      true for Spring JAR
    • isClasspath

      public boolean isClasspath()
      Returns whether the resolved classpath artifact is a classpath file.
      Returns:
      true for Spring JAR
    • getLogger

      private static de.iip_ecosphere.platform.support.logging.Logger getLogger()
      Returns the logger.
      Returns:
      the logger