@Override public URL locateResource(String resourceName) { return classLoaderService.locateResource( resourceName ); }
private ScriptSourceInput interpretLegacyImportScriptSetting( String resourceName, ClassLoaderService classLoaderService, String charsetName) { try { final URL resourceUrl = classLoaderService.locateResource( resourceName ); if ( resourceUrl == null ) { return ScriptSourceInputNonExistentImpl.INSTANCE; } else { return new ScriptSourceInputFromUrl( resourceUrl, charsetName ); } } catch (Exception e) { throw new SchemaManagementException( "Error resolving legacy import resource : " + resourceName, e ); } }
private Schema resolveLocalSchema(String schemaName, String schemaLanguage) { URL url = classLoaderService.locateResource( schemaName ); if ( url == null ) { throw new XsdException( "Unable to locate schema [" + schemaName + "] via classpath", schemaName );
public static ScriptSourceInput interpretScriptSourceSetting( Object scriptSourceSetting, ClassLoaderService classLoaderService, String charsetName ) { if ( Reader.class.isInstance( scriptSourceSetting ) ) { return new ScriptSourceInputFromReader( (Reader) scriptSourceSetting ); } else { final String scriptSourceSettingString = scriptSourceSetting.toString(); log.debugf( "Attempting to resolve script source setting : %s", scriptSourceSettingString ); // setting could be either: // 1) string URL representation (i.e., "file://...") // 2) relative file path (resource lookup) // 3) absolute file path log.trace( "Trying as URL..." ); // ClassLoaderService.locateResource() first tries the given resource name as url form... final URL url = classLoaderService.locateResource( scriptSourceSettingString ); if ( url != null ) { return new ScriptSourceInputFromUrl( url, charsetName ); } // assume it is a File path final File file = new File( scriptSourceSettingString ); return new ScriptSourceInputFromFile( file, charsetName ); } }
public static ScriptTargetOutput interpretScriptTargetSetting( Object scriptTargetSetting, ClassLoaderService classLoaderService, String charsetName ) { if ( scriptTargetSetting == null ) { return null; } else if ( Writer.class.isInstance( scriptTargetSetting ) ) { return new ScriptTargetOutputToWriter( (Writer) scriptTargetSetting ); } else { final String scriptTargetSettingString = scriptTargetSetting.toString(); log.debugf( "Attempting to resolve script source setting : %s", scriptTargetSettingString ); // setting could be either: // 1) string URL representation (i.e., "file://...") // 2) relative file path (resource lookup) // 3) absolute file path log.trace( "Trying as URL..." ); // ClassLoaderService.locateResource() first tries the given resource name as url form... final URL url = classLoaderService.locateResource( scriptTargetSettingString ); if ( url != null ) { return new ScriptTargetOutputToUrl( url, charsetName ); } // assume it is a File path final File file = new File( scriptTargetSettingString ); return new ScriptTargetOutputToFile( file, charsetName ); } }
private static URL loadResource(String configurationResourceName, SessionFactoryOptions settings) { URL url = settings.getServiceRegistry() .getService( ClassLoaderService.class ) .locateResource( configurationResourceName );
protected URI getUri(SessionFactoryOptions settings, Map properties) { String cacheManagerUri = getProp( properties, ConfigSettings.CONFIG_URI ); if ( cacheManagerUri == null ) { return null; } URL url = settings.getServiceRegistry() .getService( ClassLoaderService.class ) .locateResource( cacheManagerUri ); if ( url == null ) { throw new CacheException( "Couldn't load URI from " + cacheManagerUri ); } try { return url.toURI(); } catch (URISyntaxException e) { throw new CacheException( "Couldn't load URI from " + cacheManagerUri, e ); } }
public Binding bind(String resource) { LOG.tracef( "reading mappings from resource : %s", resource ); final Origin origin = new Origin( SourceType.RESOURCE, resource ); final URL url = classLoaderService.locateResource( resource ); if ( url == null ) { throw new MappingNotFoundException( origin ); } return new UrlXmlSource( origin, url ).doBind( getMappingBinder() ); }
final URL url = classLoaderService.locateResource( name ); if ( url == null ) { throw new MappingException( final URL classFileUrl = classLoaderService.locateResource( classFileName ); if ( classFileUrl != null ) { managedResources.addAnnotatedClassName( unresolvedListedClassName ); final URL packageInfoFileUrl = classLoaderService.locateResource( packageInfoFileName ); if ( packageInfoFileUrl != null ) { managedResources.addAnnotatedPackageName( unresolvedListedClassName );
@Override public URL locateResource(String resourceName) { return classLoaderService.locateResource( resourceName ); }
@Override public URL locateResource(String name) { URL url = hibernateClassLoaderService.locateResource( name ); if ( url == null ) { url = internalClassResolver.locateResource( name ); } return url; }
@Override public URL locateResource(String name) { URL url = hibernateClassLoaderService.locateResource( name ); if ( url == null ) { url = internalClassLoaderService.locateResource( name ); } return url; }
private ScriptSourceInput interpretLegacyImportScriptSetting( String resourceName, ClassLoaderService classLoaderService, String charsetName) { try { final URL resourceUrl = classLoaderService.locateResource( resourceName ); if ( resourceUrl == null ) { return ScriptSourceInputNonExistentImpl.INSTANCE; } else { return new ScriptSourceInputFromUrl( resourceUrl, charsetName ); } } catch (Exception e) { throw new SchemaManagementException( "Error resolving legacy import resource : " + resourceName, e ); } }
public static ScriptSourceInput interpretScriptSourceSetting( Object scriptSourceSetting, ClassLoaderService classLoaderService, String charsetName ) { if ( Reader.class.isInstance( scriptSourceSetting ) ) { return new ScriptSourceInputFromReader( (Reader) scriptSourceSetting ); } else { final String scriptSourceSettingString = scriptSourceSetting.toString(); log.debugf( "Attempting to resolve script source setting : %s", scriptSourceSettingString ); // setting could be either: // 1) string URL representation (i.e., "file://...") // 2) relative file path (resource lookup) // 3) absolute file path log.trace( "Trying as URL..." ); // ClassLoaderService.locateResource() first tries the given resource name as url form... final URL url = classLoaderService.locateResource( scriptSourceSettingString ); if ( url != null ) { return new ScriptSourceInputFromUrl( url, charsetName ); } // assume it is a File path final File file = new File( scriptSourceSettingString ); return new ScriptSourceInputFromFile( file, charsetName ); } }
private Schema resolveLocalSchema(String schemaName, String schemaLanguage) { URL url = classLoaderService.locateResource( schemaName ); if ( url == null ) { throw new XsdException( "Unable to locate schema [" + schemaName + "] via classpath", schemaName );
public static ScriptTargetOutput interpretScriptTargetSetting( Object scriptTargetSetting, ClassLoaderService classLoaderService, String charsetName ) { if ( scriptTargetSetting == null ) { return null; } else if ( Writer.class.isInstance( scriptTargetSetting ) ) { return new ScriptTargetOutputToWriter( (Writer) scriptTargetSetting ); } else { final String scriptTargetSettingString = scriptTargetSetting.toString(); log.debugf( "Attempting to resolve script source setting : %s", scriptTargetSettingString ); // setting could be either: // 1) string URL representation (i.e., "file://...") // 2) relative file path (resource lookup) // 3) absolute file path log.trace( "Trying as URL..." ); // ClassLoaderService.locateResource() first tries the given resource name as url form... final URL url = classLoaderService.locateResource( scriptTargetSettingString ); if ( url != null ) { return new ScriptTargetOutputToUrl( url, charsetName ); } // assume it is a File path final File file = new File( scriptTargetSettingString ); return new ScriptTargetOutputToFile( file, charsetName ); } }
private static URL loadResource(String configurationResourceName, SessionFactoryOptions settings) { URL url = settings.getServiceRegistry() .getService( ClassLoaderService.class ) .locateResource( configurationResourceName );
protected URI getUri(SessionFactoryOptions settings, Map properties) { String cacheManagerUri = getProp( properties, ConfigSettings.CONFIG_URI ); if ( cacheManagerUri == null ) { return null; } URL url = settings.getServiceRegistry() .getService( ClassLoaderService.class ) .locateResource( cacheManagerUri ); if ( url == null ) { throw new CacheException( "Couldn't load URI from " + cacheManagerUri ); } try { return url.toURI(); } catch (URISyntaxException e) { throw new CacheException( "Couldn't load URI from " + cacheManagerUri, e ); } }
public Binding bind(String resource) { LOG.tracef( "reading mappings from resource : %s", resource ); final Origin origin = new Origin( SourceType.RESOURCE, resource ); final URL url = classLoaderService.locateResource( resource ); if ( url == null ) { throw new MappingNotFoundException( origin ); } return new UrlXmlSource( origin, url ).doBind( getMappingBinder() ); }
final URL url = classLoaderService.locateResource( name ); if ( url == null ) { throw new MappingException( final URL classFileUrl = classLoaderService.locateResource( classFileName ); if ( classFileUrl != null ) { managedResources.addAnnotatedClassName( unresolvedListedClassName ); final URL packageInfoFileUrl = classLoaderService.locateResource( packageInfoFileName ); if ( packageInfoFileUrl != null ) { managedResources.addAnnotatedPackageName( unresolvedListedClassName );