org.glassfish.loader.util
Class ASClassLoaderUtil

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

public class ASClassLoaderUtil
extends Object


Constructor Summary
ASClassLoaderUtil()
           
 
Method Summary
static URL[] convertURLListToArray(List<URL> list)
           
static URL[] getAppLibDirLibraries(File appRoot, String appLibDir, String compatibilityProp)
          add all the libraries packaged in the application library directory
static List<URL> getAppLibDirLibrariesAsList(File appRoot, String appLibDir, String compatibilityProp)
           
static URL[] getDeployParamLibrariesAsURLs(String librariesStr, ServerEnvironment env)
          converts libraries specified via the --libraries deployment option to URL[].
static URL[] getLibrariesAsURLs(Set<String> librariesStr, 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.
static Manifest getManifest(String rootPath)
          Returns the manifest file for the given root path.
static List<URL> getManifestClassPathAsURLs(Manifest manifest, String rootPath)
          Returns the class path (if any) from the given manifest file as an URL list.
static String getModuleClassPath(org.jvnet.hk2.component.Habitat habitat, DeploymentContext context)
           
static String getModuleClassPath(org.jvnet.hk2.component.Habitat habitat, String moduleId, String deploymentLibs)
          Gets the classpath associated with a module, suffixing libraries defined [if any] for the application
static URL[] getURLs(File[] dirs, File[] jarDirs, boolean ignoreZip)
          Returns an array of urls that contains ..
static List<URL> getURLsAsList(File[] dirs, File[] jarDirs, boolean ignoreZip)
          Returns a list of urls that contains ..
static List<URL> getURLsFromClasspath(String classpath, String delimiter, String rootPath)
          get URL list from classpath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASClassLoaderUtil

public ASClassLoaderUtil()
Method Detail

getModuleClassPath

public static String getModuleClassPath(org.jvnet.hk2.component.Habitat habitat,
                                        String moduleId,
                                        String deploymentLibs)
Gets the classpath associated with a module, suffixing libraries defined [if any] for the application

Parameters:
habitat - the habitat the application resides in.
moduleId - Module 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.jvnet.hk2.component.Habitat habitat,
                                        DeploymentContext context)

getLibrariesAsURLs

public static URL[] getLibrariesAsURLs(Set<String> librariesStr,
                                       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:
librariesStr - is a comma-separated list of library JAR files
env - the server environment
Returns:
array of URL

getDeployParamLibrariesAsURLs

public static URL[] getDeployParamLibrariesAsURLs(String librariesStr,
                                                  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)

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/ <---- 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


Copyright © 2012 GlassFish Community. All Rights Reserved.