Top Description Fields Constructors Methods
org.hibernate.internal.util

public final Class ConfigHelper

extends Object
Class Inheritance
Annotations
@Deprecated
Imports
java.io.IOException, .InputStream, java.net.MalformedURLException, .URL, org.hibernate.HibernateException, org.hibernate.cfg.Environment, org.hibernate.internal.CoreLogging, .CoreMessageLogger

Deprecated

Use org.hibernate.boot.registry.classloading.spi.ClassLoaderService instead

A simple class to centralize logic needed to locate config files on the system.
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private static final CoreMessageLogger

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static URL

Returns:

An appropriate URL or null.
findAsResource
(final String
The path representing the config location.
path
)

Try to locate a local URL representing the incoming path.

public static InputStream

Returns:

An input stream to the requested config resource.
getConfigStream
(final String
The path representing the config location.
path
)

Open an InputStream to the URL represented by the incoming path.

public static InputStream
public static InputStream
public static URL

Returns:

An appropriate URL or null.
locateConfig
(final String
The path representing the config location.
path
)

Try to locate a local URL representing the incoming path.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final CoreMessageLogger LOG

Constructor Detail

ConfigHelperback to summary
private ConfigHelper()

Method Detail

findAsResourceback to summary
public static URL findAsResource(final String path)

Try to locate a local URL representing the incoming path. This method only attempts to locate this URL as a java system resource.

Parameters
path:String

The path representing the config location.

Returns:URL

An appropriate URL or null.

getConfigStreamback to summary
public static InputStream getConfigStream(final String path) throws HibernateException

Open an InputStream to the URL represented by the incoming path. First makes a call to locateConfig(String) in order to find an appropriate URL. URL#openStream() is then called to obtain the stream.

Parameters
path:String

The path representing the config location.

Returns:InputStream

An input stream to the requested config resource.

Exceptions
HibernateException:
Unable to open stream to that resource.
getResourceAsStreamback to summary
public static InputStream getResourceAsStream(String resource)
getUserResourceAsStreamback to summary
public static InputStream getUserResourceAsStream(String resource)
locateConfigback to summary
public static URL locateConfig(final String path)

Try to locate a local URL representing the incoming path. The first attempt assumes that the incoming path is an actual URL string (file://, etc). If this does not work, then the next attempts try to locate this URL as a java system resource.

Parameters
path:String

The path representing the config location.

Returns:URL

An appropriate URL or null.