Class ClassLoaderUtils

java.lang.Object
org.apache.nifi.util.file.classloader.ClassLoaderUtils

public class ClassLoaderUtils extends Object
  • Field Details

    • LOGGER

      static final org.slf4j.Logger LOGGER
  • Constructor Details

    • ClassLoaderUtils

      public ClassLoaderUtils()
  • Method Details

    • getCustomClassLoader

      public static ClassLoader getCustomClassLoader(String modulePath, ClassLoader parentClassLoader, FilenameFilter filenameFilter) throws MalformedURLException
      Throws:
      MalformedURLException
    • getURLsForClasspath

      public static URL[] getURLsForClasspath(String modulePath, FilenameFilter filenameFilter, boolean suppressExceptions) throws MalformedURLException
      Parameters:
      modulePath - a module path to get URLs from, the module path may be a comma-separated list of paths
      filenameFilter - a filter to apply when a module path is a directory and performs a listing, a null filter will return all matches
      suppressExceptions - indicates whether to suppress exceptions
      Returns:
      an array of URL instances representing all of the modules resolved from processing modulePath
      Throws:
      MalformedURLException - if a module path does not exist
    • getURLsForClasspath

      public static URL[] getURLsForClasspath(Set<String> modulePaths, FilenameFilter filenameFilter, boolean suppressExceptions) throws MalformedURLException
      Parameters:
      modulePaths - one or modules paths to get URLs from, each module path may be a comma-separated list of paths
      filenameFilter - a filter to apply when a module path is a directory and performs a listing, a null filter will return all matches
      suppressExceptions - if true then all modules will attempt to be resolved even if some throw an exception, if false the first exception will be thrown
      Returns:
      an array of URL instances representing all of the modules resolved from processing modulePaths
      Throws:
      MalformedURLException - if a module path does not exist
    • isNotBlank

      private static boolean isNotBlank(String value)
    • toURLs

      protected static URL[] toURLs(Set<String> modulePaths, FilenameFilter filenameFilter, boolean suppressExceptions) throws MalformedURLException
      Throws:
      MalformedURLException
    • generateAdditionalUrlsFingerprint

      public static String generateAdditionalUrlsFingerprint(Set<URL> urls, String classloaderIsolationKey)
      Generate fingerprint from URLs associated with classpath resources
      Parameters:
      urls - URLs used for generating fingerprint string
      Returns:
      Fingerprint string from provided URLs
    • getLastModified

      private static long getLastModified(String url)
    • createModuleClassLoader

      protected static ClassLoader createModuleClassLoader(URL[] modules, ClassLoader parentClassLoader)