private void addCacheableFile(Origin origin, File file) { xmlBindings.add( new CacheableFileXmlSource( origin, file, false ).doBind( getXmlMappingBinderAccess().getMappingBinder() ) ); }
public static void createSerFile(File xmlFile, Binder binder) { final Origin origin = new Origin( SourceType.FILE, xmlFile.getAbsolutePath() ); writeSerFile( FileXmlSource.doBind( binder, xmlFile, origin ), xmlFile, determineCachedFile( xmlFile ) ); }
if ( strict ) { try { return new Binding( readSerFile(), getOrigin() ); String.format( "Unable to deserialize from cached file [%s]", getOrigin().getName() ) , e, getOrigin() ); String.format( "Unable to locate cached file [%s]", getOrigin().getName() ) , e, getOrigin() ); if ( !isSerfileObsolete() ) { try { return readSerFile(); final Binding binding = FileXmlSource.doBind( binder, xmlFile, getOrigin() ); writeSerFile( binding );
public CacheableFileXmlSource(Origin origin, File xmlFile, boolean strict) { super( origin ); this.xmlFile = xmlFile; this.strict = strict; this.serFile = determineCachedFile( xmlFile ); if ( strict ) { if ( !serFile.exists() ) { throw new MappingException( String.format( "Cached file [%s] could not be found", origin.getName() ), origin ); } if ( isSerfileObsolete() ) { throw new MappingException( String.format( "Cached file [%s] could not be used as the mapping file is newer", origin.getName() ), origin ); } } }
private void writeSerFile(Object binding) { writeSerFile( (Serializable) binding, xmlFile, serFile ); }
public CacheableFileXmlSource(Origin origin, File xmlFile, boolean strict) { super( origin ); this.xmlFile = xmlFile; this.strict = strict; this.serFile = determineCachedFile( xmlFile ); if ( strict ) { if ( !serFile.exists() ) { throw new MappingException( String.format( "Cached file [%s] could not be found", origin.getName() ), origin ); } if ( isSerfileObsolete() ) { throw new MappingException( String.format( "Cached file [%s] could not be used as the mapping file is newer", origin.getName() ), origin ); } } }
private void writeSerFile(Object binding) { writeSerFile( (Serializable) binding, xmlFile, serFile ); }
if ( strict ) { try { return new Binding( readSerFile(), getOrigin() ); String.format( "Unable to deserialize from cached file [%s]", getOrigin().getName() ) , e, getOrigin() ); String.format( "Unable to locate cached file [%s]", getOrigin().getName() ) , e, getOrigin() ); if ( !isSerfileObsolete() ) { try { return readSerFile(); final Binding binding = FileXmlSource.doBind( binder, xmlFile, getOrigin() ); writeSerFile( binding );
/** * <b>INTENDED FOR TESTSUITE USE ONLY!</b> * <p/> * Much like {@link #addCacheableFile(java.io.File)} except that here we will fail immediately if * the cache version cannot be found or used for whatever reason * * @param file The xml file, not the bin! * * @return The dom "deserialized" from the cached file. * * @throws org.hibernate.type.SerializationException Indicates a problem deserializing the cached dom tree * @throws java.io.FileNotFoundException Indicates that the cached file was not found or was not usable. */ public MetadataSources addCacheableFileStrictly(File file) throws SerializationException, FileNotFoundException { final Origin origin = new Origin( SourceType.FILE, file.getAbsolutePath() ); xmlBindings.add( new CacheableFileXmlSource( origin, file, true ).doBind( getXmlMappingBinderAccess().getMappingBinder() ) ); return this; }
public static void createSerFile(File xmlFile, Binder binder) { final Origin origin = new Origin( SourceType.FILE, xmlFile.getAbsolutePath() ); writeSerFile( FileXmlSource.doBind( binder, xmlFile, origin ), xmlFile, determineCachedFile( xmlFile ) ); }
private void addCacheableFile(Origin origin, File file) { xmlBindings.add( new CacheableFileXmlSource( origin, file, false ).doBind( getXmlMappingBinderAccess().getMappingBinder() ) ); }
/** * <b>INTENDED FOR TESTSUITE USE ONLY!</b> * <p/> * Much like {@link #addCacheableFile(java.io.File)} except that here we will fail immediately if * the cache version cannot be found or used for whatever reason * * @param file The xml file, not the bin! * * @return The dom "deserialized" from the cached file. * * @throws org.hibernate.exception.SerializationException Indicates a problem deserializing the cached dom tree * @throws java.io.FileNotFoundException Indicates that the cached file was not found or was not usable. */ public MetadataSources addCacheableFileStrictly(File file) throws SerializationException, FileNotFoundException { final Origin origin = new Origin( SourceType.FILE, file.getAbsolutePath() ); xmlBindings.add( new CacheableFileXmlSource( origin, file, true ).doBind( getXmlMappingBinderAccess().getMappingBinder() ) ); return this; }