public class JarUtil
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
JarUtil.JarResource
Object returned by a search for a resource in a jar file.
|
| Constructor and Description |
|---|
JarUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
extractJarName(CentralLogger logger,
java.net.URL url)
Extract the jar name from the given URL.
|
static java.lang.String |
prettyName(java.lang.String path)
Get the actual jar name from the given path.
|
static java.util.List<java.lang.String> |
resolveClasspathJars(CentralLogger logger)
Returns a Set of resolved paths to the jars in the java class path.
|
static java.lang.String |
resolveJarName(CentralLogger logger,
java.lang.String jarName,
boolean fullPath)
Resolve the jar name and return it as an unique name.
|
private static java.lang.String |
resolveJarName(java.lang.String absolutePathToJar)
Returns the string of this abstract pathname to the found jar file.
|
static JarUtil.JarResource |
searchResourceJars(CentralLogger logger,
java.lang.String filename,
java.util.function.Function<JarClassLoader,java.util.function.Function<java.lang.String,java.lang.String>> searchFn,
java.util.function.Function<JarClassLoader,java.util.function.Function<java.lang.String,java.lang.String>> propathSearchFn,
java.util.function.Supplier<java.util.List<java.lang.String>> propathSupplier)
Search the resource jar files for the resource with the given filename.
|
public static JarUtil.JarResource searchResourceJars(CentralLogger logger, java.lang.String filename, java.util.function.Function<JarClassLoader,java.util.function.Function<java.lang.String,java.lang.String>> searchFn, java.util.function.Function<JarClassLoader,java.util.function.Function<java.lang.String,java.lang.String>> propathSearchFn, java.util.function.Supplier<java.util.List<java.lang.String>> propathSupplier)
The algorithm first attempts to find an exact match for the filename. If not found, it applies the PROPATH to the filename, first prepending the package root to the name.
filename - Filename of the resource, optionally including a path.searchFn - The search function for the resource with the given filenamepropathSearchFn - The propath search function for the resource with the given filename found in PROPATHpropathSupplier - The propath supplier that list PROPATH entries.JarResult object, if the search succeeds, else null.public static java.lang.String resolveJarName(CentralLogger logger, java.lang.String jarName, boolean fullPath)
null.jarName - The jar name.fullPath - true if the jarName contains also
the jar's path. When false, it is assumed that
the path is the one specified in the "customer_libs" system
property.public static java.util.List<java.lang.String> resolveClasspathJars(CentralLogger logger)
null if called from ClassLoader, otherwise causes recursion since the loader is still
not initialized.logger - null if called from ClassLoader, CentralLogger instance otherwise.public static java.lang.String prettyName(java.lang.String path)
path - The jar name, with full path.public static java.lang.String extractJarName(CentralLogger logger, java.net.URL url)
logger - The logger.url - The jar URL.private static java.lang.String resolveJarName(java.lang.String absolutePathToJar)
throws java.io.IOException
absolutePathToJar - The absolute path to the jar file.java.io.IOException - If the path doesn't exist or is not a file.