Top Fields Constructors Methods
jakarta.xml.ws.spi

pack-priv Class FactoryFinder

extends Object
Class Inheritance
Imports
java.io.*, java.net.URL, java.nio.file.Files, .Path, .Paths, java.security.AccessController, .PrivilegedAction, java.util.Properties, java.util.logging.ConsoleHandler, .Level, .Logger, jakarta.xml.ws.WebServiceException

Field Summary

Modifier and TypeField and Description
private static final ServiceLoaderUtil.ExceptionHandler<WebServiceException>
private static final Logger
private static final String
private static final PrivilegedAction<String>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static <
type of the factory class
T
>
T

Returns:

the Class object of the specified message factory; may not be null
find
(Class<T>
the name of the factory to find, which is a system property
factoryClass
,
String
the implementation class name, which is to be used only if nothing else is found; null to indicate that there is no fallback class name
fallbackClassName
)

Finds the implementation Class object for the given factory name, or if that fails, finds the Class object for the given fallback class name.

private static <T> T
fromSystemProperty(String factoryId, String fallbackClassName, ClassLoader classLoader)

private static ClassLoader
private static ClassLoader
private static boolean
private static <T> T
private static <T> T
newInstance(String className, String defaultImplClassName, ClassLoader classLoader)

pack-priv static URL

Returns:

the URL for the class or null if it wasn't found
which
(Class<?>
The class to search for
clazz
)

Get the URL for the Class from it's ClassLoader.

pack-priv static URL

Returns:

the URL for the class or null if it wasn't found
which
(Class<?>
The class to search for
clazz
,
ClassLoader
The ClassLoader to search. If this parameter is null, then the system class loader will be searched
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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EXCEPTION_HANDLERback to summary
private static final ServiceLoaderUtil.ExceptionHandler<WebServiceException> EXCEPTION_HANDLER
LOGGERback to summary
private static final Logger LOGGER
OSGI_SERVICE_LOADER_CLASS_NAMEback to summary
private static final String OSGI_SERVICE_LOADER_CLASS_NAME
propertyActionback to summary
private static final PrivilegedAction<String> propertyAction

Constructor Detail

FactoryFinderback to summary
pack-priv FactoryFinder()

Method Detail

findback to summary
pack-priv static <T> T find(Class<T> factoryClass, String fallbackClassName)

Finds the implementation Class object for the given factory name, or if that fails, finds the Class object for the given fallback class name. The arguments supplied MUST be used in order. If using the first argument is successful, the second one will not be used.

This method is package private so that this code can be shared.

Parameters
<T>
type of the factory class
factoryClass:Class<T>

the name of the factory to find, which is a system property

fallbackClassName:String

the implementation class name, which is to be used only if nothing else is found; null to indicate that there is no fallback class name

Returns:T

the Class object of the specified message factory; may not be null

Annotations
@SuppressWarnings:unchecked
Exceptions
WebServiceException:
if there is an error
fromSystemPropertyback to summary
private static <T> T fromSystemProperty(String factoryId, String fallbackClassName, ClassLoader classLoader)
getClassClassLoaderback to summary
private static ClassLoader getClassClassLoader(final Class<?> c)
getSystemClassLoaderback to summary
private static ClassLoader getSystemClassLoader()
isOsgiback to summary
private static boolean isOsgi()
lookupUsingOSGiServiceLoaderback to summary
private static <T> T lookupUsingOSGiServiceLoader(String factoryId)
newInstanceback to summary
private static <T> T newInstance(String className, String defaultImplClassName, ClassLoader classLoader)
whichback to summary
pack-priv static URL which(Class<?> clazz)

Get the URL for the Class from it's ClassLoader. Convenience method for which(Class, ClassLoader). Equivalent to calling: which(clazz, clazz.getClassLoader())

Parameters
clazz:Class<?>

The class to search for

Returns:URL

the URL for the class or null if it wasn't found

whichback to summary
pack-priv 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.

Parameters
clazz:Class<?>

The class to search for

loader:ClassLoader

The ClassLoader to search. If this parameter is null, then the system class loader will be searched

Returns:URL

the URL for the class or null if it wasn't found