Package org.glassfish.loader.util
Class ASClassLoaderUtil
java.lang.Object
org.glassfish.loader.util.ASClassLoaderUtil
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic URL[]convertURLListToArray(List<URL> list) static URL[]getAppLibDirLibraries(File appRoot, String appLibDir, String compatibilityProp) add all the libraries packaged in the application library directorygetAppLibDirLibrariesAsList(File appRoot, String appLibDir, String compatibilityProp) static URL[]getDeployParamLibrariesAsURLs(String librariesStr, org.glassfish.api.admin.ServerEnvironment env) converts libraries specified via the --libraries deployment option to URL[].getLibDirectoryJarURIs(File moduleLibDirectory) 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.static ManifestgetManifest(String rootPath) Returns the manifest file for the given root path.getManifestClassPathAsURLs(Manifest manifest, String rootPath) Returns the class path (if any) from the given manifest file as an URL list.static StringgetModuleClassPath(org.glassfish.hk2.api.ServiceLocator serviceLocator, String moduleId, String deploymentLibs) Gets the classpath associated with a module, suffixing libraries defined [if any] for the applicationstatic StringgetModuleClassPath(org.glassfish.hk2.api.ServiceLocator habitat, org.glassfish.api.deployment.DeploymentContext context) static URL[]Returns an array of urls that contains ..getURLsAsList(File[] dirs, File[] jarDirs, boolean ignoreZip) Returns a list of urls that contains ..getURLsFromClasspath(String classpath, String delimiter, String rootPath) get URL list from classpath
-
Field Details
-
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 moduledeploymentLibs- libraries option passed through deployment- Returns:
- A
File.pathSeparatorseparated 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 filesenv- 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 filesenv- the server environment- Returns:
- array of URL
-
getURLs
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 namesjarDirs- 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 namesjarDirs- 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
-
getURLsFromClasspath
get URL list from classpath- Parameters:
classpath- classpath string containing the classpathsdelimiter- delimiter to separate the classpath components in the classpath stringrootPath- root path of the classpath if the paths are relative- Returns:
- urlList URL list from the given classpath
-
getManifest
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
Returns the class path (if any) from the given manifest file as an URL list.- Parameters:
manifest- manifest file of an archiverootPath- 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 rootappLibDir- the Application library directorycompatibilityProp- 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
- Throws:
Exception
-