File parent = file.getParentFile( ); if ( parent != null && !parent.exists( ) ) { parent.mkdirs( ); }
	public void initialize( IEmitterServices services )	{		this.services = services;		Object fd = services.getOption( RenderOptionBase.OUTPUT_FILE_NAME );		File file = null;		try		{			if ( fd != null )			{				file = new File( fd.toString( ) );				out = new BufferedOutputStream( new FileOutputStream( file ) );			}		}		catch ( FileNotFoundException e )		{			logger.log( Level.WARNING, e.getMessage( ), e );		}		if ( out == null )		{			Object value = services.getOption( RenderOptionBase.OUTPUT_STREAM );			if ( value != null && value instanceof OutputStream )			{				out = (OutputStream) value;			}			else			{				try				{					// FIXME					file = new File( REPORT_FILE );					out = new BufferedOutputStream( new FileOutputStream( file ) );				}				catch ( FileNotFoundException e )				{					// FIXME					logger.log( Level.SEVERE, e.getMessage( ), e );				}			}		}		Object emitterConfig = services.getEmitterConfig( ).get( "html" ); //$NON-NLS-1$		if ( emitterConfig != null				&& emitterConfig instanceof HTMLEmitterConfig )		{			imageHandler = ( (HTMLEmitterConfig) emitterConfig )					.getImageHandler( );			actionHandler = ( (HTMLEmitterConfig) emitterConfig )					.getActionHandler( );		}		Object im = services.getOption( HTMLRenderOption.IMAGE_HANDLER );		if ( im != null && im instanceof IHTMLImageHandler )		{			imageHandler = (IHTMLImageHandler) im;		}		Object ac = services.getOption( HTMLRenderOption.ACTION_HANDLER );		if ( ac != null && ac instanceof IHTMLActionHandler )		{			actionHandler = (IHTMLActionHandler) ac;		}		if ( services.getRenderContext( ) instanceof Map )		{			renderContext = ( (Map) services.getRenderContext( ) )					.get( EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT );		}		else		{			renderContext = services.getRenderContext( ); // Handle the			// old-style render			// context, follow			// the same code			// path as before.		}		renderOption = services.getRenderOption( );		runnable = services.getReportRunnable( );		if ( renderOption != null && renderOption instanceof HTMLRenderOption )		{			isEmbeddable = ( (HTMLRenderOption) renderOption ).getEmbeddable( );			HashMap options = renderOption.getOutputSetting( );			assert options != null;			urlEncoding = (String) options.get( HTMLRenderOption.URL_ENCODING );		}		writer = new HTMLWriter( );	}