Class AppStarter.ClassPathIndexFile

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

static final class AppStarter.ClassPathIndexFile extends Object
A class path index file that provides ordering information for JARs. Taken over from spring as not accessible.
Author:
Spring
  • Field Details

    • root

      private final File root
    • lines

      private final List<String> lines
  • Constructor Details

    • ClassPathIndexFile

      private ClassPathIndexFile(File root, List<String> lines)
      Creates an instance based on a file root and a listing of index lines.
      Parameters:
      root - the root
      lines - the lines
  • Method Details

    • extractName

      private String extractName(String line)
      Extracts the name from the line.
      Parameters:
      line - the line
      Returns:
      the extracted name
      Throws:
      IllegalStateException - if the classpath index is malformed
    • size

      int size()
      Returns the size of the classpath index, i.e., the number of lines.
      Returns:
      the size
    • containsEntry

      boolean containsEntry(String name)
      Returns whether a given name is contained in the index.
      Parameters:
      name - the name to look for
      Returns:
      true whether an entry for that name is known, false else
    • getUrls

      List<URL> getUrls()
      Returns the URLs of all entries.
      Returns:
      the URLs
    • asUrl

      private URL asUrl(String line)
      Turns a line into an URL.
      Parameters:
      line - the line
      Returns:
      the URL
      Throws:
      IllegalStateException - if the URL cannot be constructed
    • loadIfPossible

      static AppStarter.ClassPathIndexFile loadIfPossible(URL root, String location) throws IOException
      Loads the classpath index file if possible.
      Parameters:
      root - the root URL
      location - the location of the classpath index file
      Returns:
      the classpath index file, may be null for none/not found (legacy loading)
      Throws:
      IOException - if the file cannot be read
    • loadIfPossible

      private static AppStarter.ClassPathIndexFile loadIfPossible(File root, String location) throws IOException
      Loads the classpath index file if possible.
      Parameters:
      root - the root URL
      location - the location of the classpath index file
      Returns:
      the classpath index file, may be null for none/not found (legacy loading)
      Throws:
      IOException - if the file cannot be read
    • loadIfPossible

      private static AppStarter.ClassPathIndexFile loadIfPossible(File root, File indexFile) throws IOException
      Loads the classpath index file if possible.
      Parameters:
      root - the root URL
      indexFile - the classpath index file
      Returns:
      the classpath index file, may be null for none/not found (legacy loading)
      Throws:
      IOException - if the file cannot be read
    • loadLines

      private static List<String> loadLines(InputStream inputStream) throws IOException
      Loads the lines of the index file.
      Parameters:
      inputStream - the input stream to load from
      Returns:
      the lines
      Throws:
      IOException - if reading the lines fails
    • asFile

      private static File asFile(URL url)
      Turns an URL into a file.
      Parameters:
      url - the URL
      Returns:
      the file