public class DefaultLib
extends java.lang.Object
IResourceInitializer.resolve(URL).| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_LIB_FOLDER_NAME
The usual name of the default lib folder.
|
static int |
DEFAULT_MAX_NESTING
Maximum nesting to search for fallback locations.
|
private static java.util.List<java.net.URL> |
urls |
| Constructor and Description |
|---|
DefaultLib() |
| Modifier and Type | Method and Description |
|---|---|
static void |
append(java.util.List<java.net.URL> target,
java.net.URL url)
Adds
url to target. |
static void |
appendAll(java.util.List<java.net.URL> target)
Appends all registered URLs.
|
static java.net.URL |
appendDefaultLibURLQuietly(java.lang.ClassLoader loader,
org.osgi.service.component.ComponentContext context,
java.lang.String... parentFolderName)
Tries to find the default lib URL based on information provided by the component
context. |
static java.net.URL |
appendDefaultLibURLQuietly(java.lang.ClassLoader loader,
java.lang.String bundleId,
org.osgi.service.component.ComponentContext context,
java.lang.String... parentFolderName)
Tries to find the default lib URL based on information provided by the component
context. |
static void |
appendQuietly(java.util.List<java.net.URL> target,
java.net.URL url)
Adds
url to target. |
static void |
appendURL(java.net.URL url)
Appends a given URL to the list of default library URLs.
|
static void |
appendURLQuietly(java.net.URL url)
Appends a given URL to the list of default library URLs.
|
static java.lang.String |
composePluginPattern(java.lang.String pluginId)
Returns a plugin pattern for searching for the default library.
|
static java.net.URL |
findDefaultLibURL(java.lang.ClassLoader loader,
org.osgi.service.component.ComponentContext context,
java.lang.String... parentFolderName)
Tries to find the default lib URL based on information provided by the component
context. |
static java.net.URL |
findDefaultLibURL(java.lang.ClassLoader loader,
int maxNesting,
java.lang.String defaultLibFolderName,
java.lang.String... parentFolderName)
Tries to find the default lib URL.
|
static java.net.URL |
findDefaultLibURL(java.lang.ClassLoader loader,
java.lang.String... parentFolderName)
Tries to find the default lib URL.
|
static java.net.URL |
findDefaultLibURL(java.lang.ClassLoader loader,
java.lang.String bundleId,
org.osgi.service.component.ComponentContext context,
java.lang.String... parentFolderName)
Tries to find the default lib URL based on information provided by the component
context (with
precedence using the actual installation location of the bundle), but explicit fallback bundle id to be used
with composePluginPattern(String). |
private static java.io.File |
findFallbackLibFolder(java.io.File file,
int maxNesting,
java.lang.String folderName,
boolean prefix,
java.lang.String defaultLibFolderName)
Finds a fallback in
file or its recursive (for Jenkins) parent folders. |
static java.io.File |
findFallbackLibFolder(int maxNesting,
java.lang.String defaultLibFolderName,
java.lang.String... parentFolderName)
Tries to Find a fallback in the actual folder or its recursive (for Jenkins) parent folders.
|
private static EASyLoggerFactory.EASyLogger |
getLogger()
Returns the logger for this class.
|
private static java.net.URL |
prepare(java.net.URL url)
Prepares a given
url. |
static void |
prependURL(java.net.URL url)
Prepends a given URL to the list of default library URLs.
|
static void |
prependURLQuietly(java.net.URL url)
Appends a given URL to the list of default library URLs.
|
static void |
removeURL(java.net.URL url)
Removes a given URL.
|
static void |
removeURLQuietly(java.net.URL url)
Removes a given URL.
|
static java.lang.Iterable<java.net.URL> |
urls()
Returns an iterable to all registered URLs.
|
public static final java.lang.String DEFAULT_LIB_FOLDER_NAME
public static final int DEFAULT_MAX_NESTING
private static java.util.List<java.net.URL> urls
public static void appendURL(java.net.URL url)
throws java.io.IOException
url - the URL to append (may be null, is ignored then)java.io.IOException - in case that resolving the given URL (if not null) failspublic static void appendURLQuietly(java.net.URL url)
url - the URL to append (may be null, is ignored then)java.io.IOException - in case that resolving the given URL (if not null) failspublic static void prependURL(java.net.URL url)
throws java.io.IOException
url - the URL to prepend (may be null, is ignored then)java.io.IOException - in case that resolving the given URL (if not null) failspublic static void prependURLQuietly(java.net.URL url)
url - the URL to append (may be null, is ignored then)public static void removeURL(java.net.URL url)
throws java.io.IOException
url - the URL to remove (may be null, is ignored then)java.io.IOException - in case that resolving the given URL (if not null) failspublic static void removeURLQuietly(java.net.URL url)
url - the URL to remove (may be null, is ignored then)java.io.IOException - in case that resolving the given URL (if not null) failspublic static java.lang.Iterable<java.net.URL> urls()
public static void appendAll(java.util.List<java.net.URL> target)
target - the target collection to be modified as a side effectpublic static void append(java.util.List<java.net.URL> target,
java.net.URL url)
throws java.io.IOException
url to target. [helper]target - the target collection to be modified as a side effecturl - the URL to remove (may be null, is ignored then)java.io.IOException - in case that resolving the given URL (if not null) failspublic static void appendQuietly(java.util.List<java.net.URL> target,
java.net.URL url)
url to target. This operation logs occurred exceptions. [helper]target - the target collection to be modified as a side effecturl - the URL to remove (may be null, is ignored then)private static java.net.URL prepare(java.net.URL url)
throws java.io.IOException
url.url - the URL to be prepared (ignored if null)java.io.IOException - in case that resolving the given URL (if not null) failspublic static java.net.URL appendDefaultLibURLQuietly(java.lang.ClassLoader loader,
java.lang.String bundleId,
org.osgi.service.component.ComponentContext context,
java.lang.String... parentFolderName)
context. This
includes the symbolic bundle name (as pattern via composePluginPattern(String) or, with precedence,
the actual installation location of the bundle.
Uses #findDefaultLibURL(ClassLoader, ComponentContext, String, String...).loader - the class loader for holding the default libbundleId - the explicit bundle id to search for if we cannot identify the installation location from
context (may be null for none)context - the component context (may be null for none)parentFolderName - name(s) of the parent folder, may be a simple folder name, a folder name with path prefix
using / or a prefix name ending with * (path possible)java.io.IOException - in case of I/O problems or problems constructing the result URLpublic static java.net.URL appendDefaultLibURLQuietly(java.lang.ClassLoader loader,
org.osgi.service.component.ComponentContext context,
java.lang.String... parentFolderName)
context. This
includes the symbolic bundle name (as pattern via composePluginPattern(String) or, with precedence,
the actual installation location of the bundle.
Uses #findDefaultLibURL(ClassLoader, ComponentContext, String, String...).loader - the class loader for holding the default libcontext - the component context (may be null for none)parentFolderName - name(s) of the parent folder, may be a simple folder name, a folder name with path prefix
using / or a prefix name ending with * (path possible)java.io.IOException - in case of I/O problems or problems constructing the result URLpublic static java.net.URL findDefaultLibURL(java.lang.ClassLoader loader,
org.osgi.service.component.ComponentContext context,
java.lang.String... parentFolderName)
throws java.io.IOException
context. This
includes the symbolic bundle name (as pattern via composePluginPattern(String) or, with precedence,
the actual installation location of the bundle.
Uses #findDefaultLibURL(ClassLoader, ComponentContext, String, String...).loader - the class loader for holding the default libcontext - the component context (may be null for none)parentFolderName - name(s) of the parent folder, may be a simple folder name, a folder name with path prefix
using / or a prefix name ending with * (path possible)java.io.IOException - in case of I/O problems or problems constructing the result URLpublic static java.net.URL findDefaultLibURL(java.lang.ClassLoader loader,
java.lang.String bundleId,
org.osgi.service.component.ComponentContext context,
java.lang.String... parentFolderName)
throws java.io.IOException
context (with
precedence using the actual installation location of the bundle), but explicit fallback bundle id to be used
with composePluginPattern(String). Uses findDefaultLibURL(ClassLoader, String...).loader - the class loader for holding the default libbundleId - the explicit bundle id to search for if we cannot identify the installation location from
context (may be null for none)context - the component context (may be null for none)parentFolderName - name(s) of the parent folder, may be a simple folder name, a folder name with path prefix
using / or a prefix name ending with * (path possible)java.io.IOException - in case of I/O problems or problems constructing the result URLpublic static java.net.URL findDefaultLibURL(java.lang.ClassLoader loader,
java.lang.String... parentFolderName)
throws java.io.IOException
#findFallbackLibFolder(String, String), which searches for parentFolder
containing DEFAULT_LIB_FOLDER_NAME starting at the current folder walking up to the root
folder. This method limits the path to a nesting level of 3. This complicated
approach may be needed in standalone/CI testing.loader - the class loader for holding the default libparentFolderName - name(s) of the parent folder, may be a simple folder name, a folder name with path prefix
using / or a prefix name ending with * (path possible)java.io.IOException - in case of I/O problems or problems constructing the result URL#findDefaultLibURL(ClassLoader, String, String)public static java.net.URL findDefaultLibURL(java.lang.ClassLoader loader,
int maxNesting,
java.lang.String defaultLibFolderName,
java.lang.String... parentFolderName)
throws java.io.IOException
#findFallbackLibFolder(String, String), which searches for parentFolder
containing defaultLibFolderName starting at the current folder walking up to the root
folder. This complicated approach may be needed in standalon/CI testing.loader - the class loader for holding the default libmaxNesting - the maximum file path nesting to search for, 0 is none, negative is unlimiteddefaultLibFolderName - name of the contained default lib folderparentFolderName - name(s) of the parent folder(s), may be full names, paths or prefix search patterns
(ending with a star), see e.g., composePluginPattern(String).java.io.IOException - in case of I/O problems or problems constructing the result URLpublic static java.io.File findFallbackLibFolder(int maxNesting,
java.lang.String defaultLibFolderName,
java.lang.String... parentFolderName)
maxNesting - the maximum file path nesting to search for, 0 is none, negative is unlimiteddefaultLibFolderName - name of the contained default lib folderparentFolderName - name(s) of the parent folder(s), may be full names, paths or prefix search patterns
(ending with a star), see e.g., composePluginPattern(String).private static java.io.File findFallbackLibFolder(java.io.File file,
int maxNesting,
java.lang.String folderName,
boolean prefix,
java.lang.String defaultLibFolderName)
file or its recursive (for Jenkins) parent folders.maxNesting - the maximum file path nesting to search for, 0 is none, negative is unlimitedfile - the file/folder to searchfolderName - the folder name to search for, null to search for defaultLibFolderName
(second pass)prefix - whether folderName shall be considered as a file name prefix or a full file namedefaultLibFolderName - the default lib folder namepublic static java.lang.String composePluginPattern(java.lang.String pluginId)
pluginId - the plugin idprivate static EASyLoggerFactory.EASyLogger getLogger()
Copyright © 2009 - 2018 SSE. All Rights Reserved.