Class ASClassLoaderUtil

java.lang.Object
org.glassfish.loader.util.ASClassLoaderUtil

public class ASClassLoaderUtil extends Object
  • Field Details

    • deplLogger

      public static final Logger deplLogger
  • Constructor Details

    • ASClassLoaderUtil

      public ASClassLoaderUtil()
  • Method Details

    • getModuleClassPath

      public static String getModuleClassPath(org.glassfish.hk2.api.ServiceLocator serviceLocator, String moduleId, String deploymentLibs)
      Gets the classpath associated with a module, suffixing libraries defined [if any] for the application
      Parameters:
      serviceLocator - the habitat the application resides in.
      moduleId - HK2Module id of the module
      deploymentLibs - libraries option passed through deployment
      Returns:
      A File.pathSeparator separated list of classpaths for the passed in module, including the module specified "libraries" defined for the module.
    • getModuleClassPath

      public static String getModuleClassPath(org.glassfish.hk2.api.ServiceLocator habitat, org.glassfish.api.deployment.DeploymentContext context)
    • getLibrariesAsURLs

      public static URL[] getLibrariesAsURLs(Set<String> libraries, org.glassfish.api.admin.ServerEnvironment env)
      converts libraries specified via EXTENSION_LIST entry in MANIFEST.MF of all of the libraries of the deployed archive to The libraries are made available to the application in the order specified.
      Parameters:
      libraries - is a comma-separated list of library JAR files
      env - the server environment
      Returns:
      array of URL
    • getDeployParamLibrariesAsURLs

      public static URL[] getDeployParamLibrariesAsURLs(String librariesStr, org.glassfish.api.admin.ServerEnvironment env)
      converts libraries specified via the --libraries deployment option to URL[]. The library JAR files are specified by either relative or absolute paths. The relative path is relative to instance-root/lib/applibs. The libraries are made available to the application in the order specified.
      Parameters:
      librariesStr - is a comma-separated list of library JAR files
      env - the server environment
      Returns:
      array of URL
    • getURLs

      public static URL[] getURLs(File[] dirs, File[] jarDirs, boolean ignoreZip) throws IOException
      Returns an array of urls that contains ..
          i.   all the valid directories from the given directory (dirs) array
          ii.  all jar files from the given directory (jarDirs) array
          iii. all zip files from the given directory (jarDirs) array if
               not ignoring zip file (ignoreZip is false).
       
      Parameters:
      dirs - array of directory path names
      jarDirs - array of path name to directories that contains JAR & ZIP files.
      ignoreZip - whether to ignore zip files
      Returns:
      an array of urls that contains all the valid dirs, *.jar & *.zip
      Throws:
      IOException - if an i/o error while constructing the urls
    • getURLsAsList

      public static List<URL> getURLsAsList(File[] dirs, File[] jarDirs, boolean ignoreZip) throws IOException
      Returns a list of urls that contains ..
          i.   all the valid directories from the given directory (dirs) array
          ii.  all jar files from the given directory (jarDirs) array
          iii. all zip files from the given directory (jarDirs) array if
               not ignoring zip file (ignoreZip is false).
       
      Parameters:
      dirs - array of directory path names
      jarDirs - array of path name to directories that contains JAR & ZIP files.
      ignoreZip - whether to ignore zip files
      Returns:
      an array of urls that contains all the valid dirs, *.jar & *.zip
      Throws:
      IOException - if an i/o error while constructing the urls
    • convertURLListToArray

      public static URL[] convertURLListToArray(List<URL> list)
      Converts the list to an array
      Parameters:
      list -
      Returns:
      an array, never null
    • getURLsFromClasspath

      public static List<URL> getURLsFromClasspath(String classpath, String delimiter, String rootPath)
      get URL list from classpath
      Parameters:
      classpath - classpath string containing the classpaths
      delimiter - delimiter to separate the classpath components in the classpath string
      rootPath - root path of the classpath if the paths are relative
      Returns:
      urlList URL list from the given classpath
    • getManifest

      public static Manifest getManifest(String rootPath)
      Returns the manifest file for the given root path. Example: |--repository/ | |--applications/ | |--converter/ | |--ejb-jar-ic_jar/ &lt;---- rootPath | |--META-INF/ | |--MANIFEST.MF
      Parameters:
      rootPath - absolute path to the module
      Returns:
      the manifest file for the given module
    • getManifestClassPathAsURLs

      public static List<URL> getManifestClassPathAsURLs(Manifest manifest, String rootPath)
      Returns the class path (if any) from the given manifest file as an URL list.
      Parameters:
      manifest - manifest file of an archive
      rootPath - root path to the module
      Returns:
      a list of URLs an empty list if given manifest is null
    • getAppLibDirLibraries

      public static URL[] getAppLibDirLibraries(File appRoot, String appLibDir, String compatibilityProp) throws IOException
      add all the libraries packaged in the application library directory
      Parameters:
      appRoot - the application root
      appLibDir - the Application library directory
      compatibilityProp - the version of the release that we need to maintain backward compatibility
      Returns:
      an array of URL
      Throws:
      IOException
    • getAppLibDirLibrariesAsList

      public static List<URL> getAppLibDirLibrariesAsList(File appRoot, String appLibDir, String compatibilityProp) throws IOException
      Throws:
      IOException
    • getLibDirectoryJarURIs

      public static List<URI> getLibDirectoryJarURIs(File moduleLibDirectory) throws Exception
      Throws:
      Exception