org.hibernate.service.classloading.internal
Class ClassLoaderServiceImpl

java.lang.Object
  extended by org.hibernate.service.classloading.internal.ClassLoaderServiceImpl
All Implemented Interfaces:
Serializable, ClassLoaderService, Service

public class ClassLoaderServiceImpl
extends Object
implements ClassLoaderService

Standard implementation of the service for interacting with class loaders

See Also:
Serialized Form

Constructor Summary
ClassLoaderServiceImpl()
           
ClassLoaderServiceImpl(ClassLoader classLoader)
           
ClassLoaderServiceImpl(ClassLoader applicationClassLoader, ClassLoader resourcesClassLoader, ClassLoader hibernateClassLoader, ClassLoader environmentClassLoader)
           
 
Method Summary
<T> Class<T>
classForName(String className)
          Locate a class by name
static ClassLoaderServiceImpl fromConfigSettings(Map configVales)
           
<S> LinkedHashSet<S>
loadJavaServices(Class<S> serviceContract)
          Discovers and instantiates implementations of the named service contract.
 URL locateResource(String name)
          Locate a resource by name (classpath lookup)
 List<URL> locateResources(String name)
          Locate a series of resource by name (classpath lookup)
 InputStream locateResourceStream(String name)
          Locate a resource by name (classpath lookup) and gets its stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassLoaderServiceImpl

public ClassLoaderServiceImpl()

ClassLoaderServiceImpl

public ClassLoaderServiceImpl(ClassLoader classLoader)

ClassLoaderServiceImpl

public ClassLoaderServiceImpl(ClassLoader applicationClassLoader,
                              ClassLoader resourcesClassLoader,
                              ClassLoader hibernateClassLoader,
                              ClassLoader environmentClassLoader)
Method Detail

fromConfigSettings

public static ClassLoaderServiceImpl fromConfigSettings(Map configVales)

classForName

public <T> Class<T> classForName(String className)
Description copied from interface: ClassLoaderService
Locate a class by name

Specified by:
classForName in interface ClassLoaderService
Parameters:
className - The name of the class to locate
Returns:
The class reference

locateResource

public URL locateResource(String name)
Description copied from interface: ClassLoaderService
Locate a resource by name (classpath lookup)

Specified by:
locateResource in interface ClassLoaderService
Parameters:
name - The resource name.
Returns:
The located URL; may return null to indicate the resource was not found

locateResourceStream

public InputStream locateResourceStream(String name)
Description copied from interface: ClassLoaderService
Locate a resource by name (classpath lookup) and gets its stream

Specified by:
locateResourceStream in interface ClassLoaderService
Parameters:
name - The resource name.
Returns:
The stream of the located resource; may return null to indicate the resource was not found

locateResources

public List<URL> locateResources(String name)
Description copied from interface: ClassLoaderService
Locate a series of resource by name (classpath lookup)

Specified by:
locateResources in interface ClassLoaderService
Parameters:
name - The resource name.
Returns:
The list of URL matching; may return null to indicate the resource was not found

loadJavaServices

public <S> LinkedHashSet<S> loadJavaServices(Class<S> serviceContract)
Description copied from interface: ClassLoaderService
Discovers and instantiates implementations of the named service contract.

NOTE : the terms service here is used differently than Service. Instead here we are talking about services as defined by ServiceLoader.

Specified by:
loadJavaServices in interface ClassLoaderService
Type Parameters:
S - The type of the service contract
Parameters:
serviceContract - The java type defining the service contract
Returns:
The ordered set of discovered services.


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.