File file = File.createTempFile( "TempInvalidMapping", ".hbm.xml" ); file.deleteOnExit(); copy( ConfigHelper.getConfigStream( resourceName ), file );
/** Open an Reader to the URL represented by the incoming path. First makes a call * to {@link #locateConfig(java.lang.String)} in order to find an appropriate URL. * {@link java.net.URL#openStream()} is then called to obtain a stream, which is then * wrapped in a Reader. * * @param path The path representing the config location. * @return An input stream to the requested config resource. * @throws HibernateException Unable to open reader to that resource. */ public static Reader getConfigStreamReader(final String path) throws HibernateException { return new InputStreamReader( getConfigStream(path) ); }
/** Open an Reader to the URL represented by the incoming path. First makes a call * to {@link #locateConfig(java.lang.String)} in order to find an appropriate URL. * {@link java.net.URL#openStream()} is then called to obtain a stream, which is then * wrapped in a Reader. * * @param path The path representing the config location. * @return An input stream to the requested config resource. * @throws HibernateException Unable to open reader to that resource. */ public static Reader getConfigStreamReader(final String path) throws HibernateException { return new InputStreamReader( getConfigStream(path) ); }
/** Loads a properties instance based on the data at the incoming config location. * * @param path The path representing the config location. * @return The loaded properties instance. * @throws HibernateException Unable to load properties from that resource. */ public static Properties getConfigProperties(String path) throws HibernateException { try { Properties properties = new Properties(); properties.load( getConfigStream(path) ); return properties; } catch(IOException e) { throw new HibernateException("Unable to load properties from specified config file: " + path, e); } }
/** Loads a properties instance based on the data at the incoming config location. * * @param path The path representing the config location. * @return The loaded properties instance. * @throws HibernateException Unable to load properties from that resource. */ public static Properties getConfigProperties(String path) throws HibernateException { try { Properties properties = new Properties(); properties.load( getConfigStream(path) ); return properties; } catch(IOException e) { throw new HibernateException("Unable to load properties from specified config file: " + path, e); } }