java.lang.Object
jakarta.xml.soap.FactoryFinder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ServiceLoaderUtil.ExceptionHandler
<SOAPException> private static final Logger
private static final String
private static final PrivilegedAction
<String> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static <T> T
Finds the implementationClass
object for the given factory type.private static String
fromSystemProperty
(String factoryId) private static ClassLoader
getClassClassLoader
(Class<?> c) private static ClassLoader
private static String
getSystemProperty
(String property) private static boolean
isOsgi()
private static void
private static <T> T
lookupUsingOSGiServiceLoader
(String factoryId) private static Object
newInstance
(String className, String defaultClassName, ClassLoader tccl) (package private) static URL
Get the URL for the Class from it's ClassLoader.(package private) static URL
which
(Class<?> clazz, ClassLoader loader) Search the given ClassLoader for an instance of the specified class and return a string representation of the URL that points to the resource.
-
Field Details
-
logger
-
EXCEPTION_HANDLER
-
propertyAction
-
OSGI_SERVICE_LOADER_CLASS_NAME
- See Also:
-
-
Constructor Details
-
FactoryFinder
FactoryFinder()
-
-
Method Details
-
find
static <T> T find(Class<T> factoryClass, String defaultClassName, boolean tryFallback) throws SOAPException Finds the implementationClass
object for the given factory type. If it fails andtryFallback
istrue
finds theClass
object for the given default class name. The arguments supplied must be used in order Note the default class name may be needed even if fallback is not to be attempted in order to check if requested type is fallback.This method is package private so that this code can be shared.
- Parameters:
factoryClass
- factory abstract class or interface to be founddefaultClassName
- the implementation class name, which is to be used only if nothing else is found;null
to indicate that there is no default class nametryFallback
- whether to try the default class as a fallback- Returns:
- the
Class
object of the specified message factory; may not benull
- Throws:
SOAPException
- if there is a SOAP error
-
newInstance
private static Object newInstance(String className, String defaultClassName, ClassLoader tccl) throws SOAPException - Throws:
SOAPException
-
fromSystemProperty
-
getSystemProperty
-
logFound
-
isOsgi
private static boolean isOsgi() -
lookupUsingOSGiServiceLoader
-
which
Get the URL for the Class from it's ClassLoader. Convenience method forwhich(Class, ClassLoader)
. Equivalent to calling: which(clazz, clazz.getClassLoader())- Parameters:
clazz
- The class to search for- Returns:
- the URL for the class or null if it wasn't found
-
which
Search the given ClassLoader for an instance of the specified class and return a string representation of the URL that points to the resource.- Parameters:
clazz
- The class to search forloader
- The ClassLoader to search. If this parameter is null, then the system class loader will be searched- Returns:
- the URL for the class or null if it wasn't found
-
getSystemClassLoader
-
getClassClassLoader
-