Top Description Fields Constructors Methods
org.hibernate.boot.registry.classloading.internal

public Class ClassLoaderServiceImpl

extends Object
implements ClassLoaderService
Class Inheritance
All Implemented Interfaces
org.hibernate.boot.registry.classloading.spi.ClassLoaderService, org.hibernate.service.spi.Stoppable, org.hibernate.service.Service, java.io.Serializable, org.hibernate.boot.ResourceStreamLocator, org.hibernate.boot.ResourceLocator
Imports
java.io.InputStream, java.lang.reflect.InvocationHandler, .Proxy, java.net.URL, java.security.AccessController, .PrivilegedAction, java.util.ArrayList, .Collection, .Collections, .Enumeration, .LinkedHashSet, .List, .Map, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap, org.hibernate.Internal, org.hibernate.boot.registry.classloading.spi.ClassLoaderService, .ClassLoadingException, org.hibernate.cfg.AvailableSettings, org.hibernate.internal.CoreLogging, .CoreMessageLogger

Standard implementation of the service for interacting with class loaders
Authors
Steve Ebersole, Sanne Grinovero

Field Summary

Modifier and TypeField and Description
private volatile AggregatedClassLoader
private static final String
private static final CoreMessageLogger
private final ConcurrentMap<Class<?>, AggregatedServiceLoader<?>>

Constructor Summary

AccessConstructor and Description
public
ClassLoaderServiceImpl()

Constructs a ClassLoaderServiceImpl with standard set-up

public
ClassLoaderServiceImpl(ClassLoader
The ClassLoader to use
classLoader
)

Constructs a ClassLoaderServiceImpl with the given ClassLoader

public
ClassLoaderServiceImpl(Collection<ClassLoader>
The ClassLoader instances to use
providedClassLoaders
,
TcclLookupPrecedence
The lookup precedence of the thread context ClassLoader
lookupPrecedence
)

Constructs a ClassLoaderServiceImpl with the given ClassLoader instances

Method Summary

Modifier and TypeMethod and Description
public <T> Class<T>
classForName(String
The name of the class to locate
className
)

Implements org.hibernate.boot.registry.classloading.spi.ClassLoaderService.classForName.

Locate a class by name.
public static ClassLoaderServiceImpl

Returns:

The built service
fromConfigSettings
(Map<K, V>
The config values
configValues
)

Deprecated No longer used/supported!
No longer used/supported!
public <T> T
private AggregatedClassLoader
public <S> Collection<S>
loadJavaServices(Class<S>
The java type defining the service contract
serviceContract
)

Implements org.hibernate.boot.registry.classloading.spi.ClassLoaderService.loadJavaServices.

Discovers and instantiates implementations of the named service contract.
public URL
locateResource(String
The resource name.
name
)

Implements org.hibernate.boot.registry.classloading.spi.ClassLoaderService.locateResource.

Locate a resource by name (classpath lookup).
public List<URL>
locateResources(String
The resource name.
name
)

Implements org.hibernate.boot.registry.classloading.spi.ClassLoaderService.locateResources.

Locate a series of resource by name (classpath lookup).
public InputStream
locateResourceStream(String
The resource name.
name
)

Implements org.hibernate.boot.registry.classloading.spi.ClassLoaderService.locateResourceStream.

Locate a resource by name (classpath lookup) and gets its stream.
public Package
public void
stop()

Implements org.hibernate.service.spi.Stoppable.stop.

Stop phase notification
private String
public <T> T
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aggregatedClassLoaderback to summary
private volatile AggregatedClassLoader aggregatedClassLoader
CLASS_PATH_SCHEMEback to summary
private static final String CLASS_PATH_SCHEME
logback to summary
private static final CoreMessageLogger log
serviceLoadersback to summary
private final ConcurrentMap<Class<?>, AggregatedServiceLoader<?>> serviceLoaders

Constructor Detail

ClassLoaderServiceImplback to summary
public ClassLoaderServiceImpl()

Constructs a ClassLoaderServiceImpl with standard set-up

ClassLoaderServiceImplback to summary
public ClassLoaderServiceImpl(ClassLoader classLoader)

Constructs a ClassLoaderServiceImpl with the given ClassLoader

Parameters
classLoader:ClassLoader

The ClassLoader to use

ClassLoaderServiceImplback to summary
public ClassLoaderServiceImpl(Collection<ClassLoader> providedClassLoaders, TcclLookupPrecedence lookupPrecedence)

Constructs a ClassLoaderServiceImpl with the given ClassLoader instances

Parameters
providedClassLoaders:Collection<ClassLoader>

The ClassLoader instances to use

lookupPrecedence:TcclLookupPrecedence

The lookup precedence of the thread context ClassLoader

Method Detail

classForNameback to summary
public <T> Class<T> classForName(String className)

Implements org.hibernate.boot.registry.classloading.spi.ClassLoaderService.classForName.

Doc from org.hibernate.boot.registry.classloading.spi.ClassLoaderService.classForName.

Locate a class by name.

Parameters
<T>
The returned class type.
className:String

The name of the class to locate

Returns:Class<T>

The class reference

Annotations
@Override
@SuppressWarnings:unchecked
fromConfigSettingsback to summary
public static ClassLoaderServiceImpl fromConfigSettings(Map<K, V> configValues)

Deprecated

No longer used/supported!

No longer used/supported!

Parameters
configValues:Map<K, V>

The config values

Returns:ClassLoaderServiceImpl

The built service

Annotations
@Deprecated
@SuppressWarnings:unchecked
@Internal
generateProxyback to summary
public <T> T generateProxy(InvocationHandler handler, Class<T>... interfaces)

Implements org.hibernate.boot.registry.classloading.spi.ClassLoaderService.generateProxy.

Annotations
@Override
@SuppressWarnings:unchecked
getAggregatedClassLoaderback to summary
private AggregatedClassLoader getAggregatedClassLoader()
loadJavaServicesback to summary
public <S> Collection<S> loadJavaServices(Class<S> serviceContract)

Implements org.hibernate.boot.registry.classloading.spi.ClassLoaderService.loadJavaServices.

Doc from org.hibernate.boot.registry.classloading.spi.ClassLoaderService.loadJavaServices.

Discovers and instantiates implementations of the named service contract.

Parameters
<S>
The type of the service contract
serviceContract:Class<S>

The java type defining the service contract

Returns:Collection<S>

The ordered set of discovered services.

Annotations
@Override
@SuppressWarnings:unchecked
locateResourceback to summary
public URL locateResource(String name)

Implements org.hibernate.boot.registry.classloading.spi.ClassLoaderService.locateResource.

Doc from org.hibernate.boot.registry.classloading.spi.ClassLoaderService.locateResource.

Locate a resource by name (classpath lookup).

Parameters
name:String

The resource name.

Returns:URL

The located URL; may return null to indicate the resource was not found

Annotations
@Override
locateResourcesback to summary
public List<URL> locateResources(String name)

Implements org.hibernate.boot.registry.classloading.spi.ClassLoaderService.locateResources.

Doc from org.hibernate.boot.registry.classloading.spi.ClassLoaderService.locateResources.

Locate a series of resource by name (classpath lookup).

Parameters
name:String

The resource name.

Returns:List<URL>

The list of URL matching; may return null to indicate the resource was not found

Annotations
@Override
locateResourceStreamback to summary
public InputStream locateResourceStream(String name)

Implements org.hibernate.boot.registry.classloading.spi.ClassLoaderService.locateResourceStream.

Doc from org.hibernate.boot.registry.classloading.spi.ClassLoaderService.locateResourceStream.

Locate a resource by name (classpath lookup) and gets its stream.

Parameters
name:String

The resource name.

Returns:InputStream

The stream of the located resource; may return null to indicate the resource was not found

Annotations
@Override
packageForNameOrNullback to summary
public Package packageForNameOrNull(String packageName)

Implements org.hibernate.boot.registry.classloading.spi.ClassLoaderService.packageForNameOrNull.

Doc from org.hibernate.boot.registry.classloading.spi.ClassLoaderService.packageForNameOrNull.

Loading a Package from the ClassLoader.

Returns:Package

The Package. null if no such Package is found, or if the ClassLoader call leads to an exception (LinkageError, e.g.).

Annotations
@Override
stopback to summary
public void stop()

Implements org.hibernate.service.spi.Stoppable.stop.

Doc from org.hibernate.service.spi.Stoppable.stop.

Stop phase notification

Annotations
@Override
stripClasspathSchemeback to summary
private String stripClasspathScheme(String name)
workWithClassLoaderback to summary
public <T> T workWithClassLoader(ClassLoaderService.Work<T> work)

Implements org.hibernate.boot.registry.classloading.spi.ClassLoaderService.workWithClassLoader.

Annotations
@Override