/*************************************************************************************
 * Copyright (c) 2004 Actuate Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Actuate Corporation - Initial implementation.
 ************************************************************************************/

package org.eclipse.birt.report.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.service.ReportEngineService;
import org.eclipse.birt.report.utility.ParameterAccessor;

/**
 * Servlet Context Listener for BIRT viewer web application. Do some necessary
 * jobs when web application servelt loading it or destroying it.
 * <p>
 */
public class ViewerServletContextListener implements ServletContextListener
{

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
	 */
	public void contextDestroyed( ServletContextEvent event )
	{
		// When trying to destroy application, shutdown Platform and
		// ReportEngineService.
		Platform.shutdown( );
		ReportEngineService.shutdown( );

		// Reset initialized parameter
		ParameterAccessor.reset( );
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
	 */
	public void contextInitialized( ServletContextEvent event )
	{
		// workaround for Bugzilla Bug 181377. Don't initialize report service
		// instance
		/*
		 * ParameterAccessor.initParameters( event.getServletContext( ) ); //
		 * initialize ViewerReportService instance IViewerReportService instance =
		 * new BirtViewerReportService( event .getServletContext( ) );
		 * BirtReportServiceFactory.init( instance );
		 */
	}
}

@@ -1779,19 +1779,16 @@
 %0A%09%09/*%0A%09%09
- * 
 Paramete
@@ -1846,57 +1846,11 @@
 ) );
- //%0A%09%09 * initialize ViewerReportService instance 
+%0A%09%09
 IVie
@@ -1876,21 +1876,16 @@
 stance =
-%0A%09%09 *
  new Bir
@@ -1911,17 +1911,21 @@
 e( event
- 
+%0A%09%09%09%09
 .getServ
@@ -1943,19 +1943,16 @@
  ) );%0A%09%09
- * 
 BirtRepo
@@ -1988,17 +1988,16 @@
 ce );%0A%09%09
- 
 */%0A%09%7D%0A%7D%0A

Fix Bugzilla Bug 181377