- java.lang.Object
-
- jakarta.xml.soap.FactoryFinder
-
class FactoryFinder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static ServiceLoaderUtil.ExceptionHandler<SOAPException>EXCEPTION_HANDLERprivate static java.util.logging.Loggerloggerprivate static java.lang.StringOSGI_SERVICE_LOADER_CLASS_NAMEprivate static java.security.PrivilegedAction<java.lang.String>propertyAction
-
Constructor Summary
Constructors Constructor Description FactoryFinder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static <T> Tfind(java.lang.Class<T> factoryClass, java.lang.String defaultClassName, boolean tryFallback)Finds the implementationClassobject for the given factory type.private static java.lang.StringfromSystemProperty(java.lang.String factoryId)private static java.lang.ClassLoadergetClassClassLoader(java.lang.Class<?> c)private static java.lang.ClassLoadergetSystemClassLoader()private static java.lang.StringgetSystemProperty(java.lang.String property)private static booleanisOsgi()private static voidlogFound(java.lang.String value)private static <T> TlookupUsingOSGiServiceLoader(java.lang.String factoryId)private static java.lang.ObjectnewInstance(java.lang.String className, java.lang.String defaultClassName, java.lang.ClassLoader tccl)(package private) static java.net.URLwhich(java.lang.Class<?> clazz)Get the URL for the Class from it's ClassLoader.(package private) static java.net.URLwhich(java.lang.Class<?> clazz, java.lang.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 Detail
-
logger
private static final java.util.logging.Logger logger
-
EXCEPTION_HANDLER
private static final ServiceLoaderUtil.ExceptionHandler<SOAPException> EXCEPTION_HANDLER
-
propertyAction
private static final java.security.PrivilegedAction<java.lang.String> propertyAction
-
OSGI_SERVICE_LOADER_CLASS_NAME
private static final java.lang.String OSGI_SERVICE_LOADER_CLASS_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
find
static <T> T find(java.lang.Class<T> factoryClass, java.lang.String defaultClassName, boolean tryFallback) throws SOAPExceptionFinds the implementationClassobject for the given factory type. If it fails andtryFallbackistruefinds theClassobject 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;nullto indicate that there is no default class nametryFallback- whether to try the default class as a fallback- Returns:
- the
Classobject of the specified message factory; may not benull - Throws:
SOAPException- if there is a SOAP error
-
newInstance
private static java.lang.Object newInstance(java.lang.String className, java.lang.String defaultClassName, java.lang.ClassLoader tccl) throws SOAPException- Throws:
SOAPException
-
fromSystemProperty
private static java.lang.String fromSystemProperty(java.lang.String factoryId)
-
getSystemProperty
private static java.lang.String getSystemProperty(java.lang.String property)
-
logFound
private static void logFound(java.lang.String value)
-
isOsgi
private static boolean isOsgi()
-
lookupUsingOSGiServiceLoader
private static <T> T lookupUsingOSGiServiceLoader(java.lang.String factoryId)
-
which
static java.net.URL which(java.lang.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- The class to search for- Returns:
- the URL for the class or null if it wasn't found
-
which
static java.net.URL which(java.lang.Class<?> clazz, java.lang.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- 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
private static java.lang.ClassLoader getSystemClassLoader()
-
getClassClassLoader
private static java.lang.ClassLoader getClassClassLoader(java.lang.Class<?> c)
-
-