Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* This file is part of ClassGraph.
*
* Author: R. Kempees
*
* With contributions from @cpierceworld (#414)
*
* Hosted at: https://github.com/classgraph/classgraph
*
* --
*
* The MIT License (MIT)
*
* Copyright (c) 2017 R. Kempees (contributed to the ClassGraph project)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
* EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
* OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.hazelcast.shaded.nonapi.io.github.classgraph.classloaderhandler;
import java.io.File;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import com.hazelcast.shaded.nonapi.io.github.classgraph.classpath.ClassLoaderOrder;
import com.hazelcast.shaded.nonapi.io.github.classgraph.classpath.ClasspathOrder;
import com.hazelcast.shaded.nonapi.io.github.classgraph.reflection.ReflectionUtils;
import com.hazelcast.shaded.nonapi.io.github.classgraph.scanspec.ScanSpec;
import com.hazelcast.shaded.nonapi.io.github.classgraph.utils.LogNode;
/**
* WebsphereLibertyClassLoaderHandler.
*
*
* Used to support WAS Liberty Profile classloading in io.github.classgraph
*
* @author R. Kempees
*/
class WebsphereLibertyClassLoaderHandler implements ClassLoaderHandler {
/** {@code "com.ibm.ws.classloading.internal."} */
private static final String PKG_PREFIX = "com.ibm.ws.classloading.internal.";
/** {@code "com.ibm.ws.classloading.internal.AppClassLoader"} */
private static final String IBM_APP_CLASS_LOADER = PKG_PREFIX + "AppClassLoader";
/** {@code "com.ibm.ws.classloading.internal.ThreadContextClassLoader"} */
private static final String IBM_THREAD_CONTEXT_CLASS_LOADER = PKG_PREFIX + "ThreadContextClassLoader";
/** Class cannot be constructed. */
private WebsphereLibertyClassLoaderHandler() {
}
/**
* Check whether this {@link ClassLoaderHandler} can handle a given {@link ClassLoader}.
*
* @param classLoaderClass
* the {@link ClassLoader} class or one of its superclasses.
* @param log
* the log
* @return true if this {@link ClassLoaderHandler} can handle the {@link ClassLoader}.
*/
public static boolean canHandle(final Class> classLoaderClass, final LogNode log) {
return IBM_APP_CLASS_LOADER.equals(classLoaderClass.getName())
|| IBM_THREAD_CONTEXT_CLASS_LOADER.equals(classLoaderClass.getName());
}
/**
* Find the {@link ClassLoader} delegation order for a {@link ClassLoader}.
*
* @param classLoader
* the {@link ClassLoader} to find the order for.
* @param classLoaderOrder
* a {@link ClassLoaderOrder} object to update.
* @param log
* the log
*/
public static void findClassLoaderOrder(final ClassLoader classLoader, final ClassLoaderOrder classLoaderOrder,
final LogNode log) {
classLoaderOrder.delegateTo(classLoader.getParent(), /* isParent = */ true, log);
classLoaderOrder.add(classLoader, log);
}
/**
* Get the paths from a containerClassLoader object.
*
*
* The passed in object should be an instance of "com.ibm.ws.classloading.internal.ContainerClassLoader".
*
* Will attempt to use "getContainerURLs" methods to recap the classpath.
*
* @param containerClassLoader
* the containerClassLoader object
* @return Collection of path objects as a {@link URL} or {@link String}.
*/
private static Collection