Top Fields Constructors Methods
jakarta.xml.soap

pack-priv Class FactoryFinder

extends Object
Class Inheritance
Imports
java.io.InputStream, java.lang.reflect.Method, java.net.URL, java.nio.file.Files, .Path, .Paths, java.security.AccessController, .PrivilegedAction, java.util.Iterator, .Properties, java.util.logging.ConsoleHandler, .Level, .Logger

Field Summary

Modifier and TypeField and Description
private static final ServiceLoaderUtil.ExceptionHandler<SOAPException>
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 <T> T

Returns:

the Class object of the specified message factory; may not be null
find
(Class<T>
factory abstract class or interface to be found
factoryClass
,
String
the implementation class name, which is to be used only if nothing else is found; null to indicate that there is no default class name
defaultClassName
,
boolean
whether to try the default class as a fallback
tryFallback
)

Finds the implementation Class object for the given factory type.

private static String
private static ClassLoader
private static ClassLoader
private static String
getSystemProperty(final String property)

private static boolean
private static void
private static <T> T
private static Object
newInstance(String className, String defaultClassName, ClassLoader tccl)

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<SOAPException> 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 defaultClassName, boolean tryFallback) throws SOAPException

Finds the implementation Class object for the given factory type. If it fails and tryFallback is true finds the Class 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:Class<T>

factory abstract class or interface to be found

defaultClassName:String

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

tryFallback:boolean

whether to try the default class as a fallback

Returns:T

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

Annotations
@SuppressWarnings:unchecked
Exceptions
SOAPException:
if there is a SOAP error
fromSystemPropertyback to summary
private static String fromSystemProperty(String factoryId)
getClassClassLoaderback to summary
private static ClassLoader getClassClassLoader(final Class<?> c)
getSystemClassLoaderback to summary
private static ClassLoader getSystemClassLoader()
getSystemPropertyback to summary
private static String getSystemProperty(final String property)
isOsgiback to summary
private static boolean isOsgi()
logFoundback to summary
private static void logFound(String value)
lookupUsingOSGiServiceLoaderback to summary
private static <T> T lookupUsingOSGiServiceLoader(String factoryId)
newInstanceback to summary
private static Object newInstance(String className, String defaultClassName, ClassLoader tccl) throws SOAPException
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