View Javadoc

1   /*
2    * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3    * the spring framework, http://el4j.sf.net
4    * Copyright (C) 2005 by ELCA Informatique SA, Av. de la Harpe 22-24,
5    * 1000 Lausanne, Switzerland, http://www.elca.ch
6    *
7    * EL4J is published under the GNU Lesser General Public License (LGPL)
8    * Version 2.1. See http://www.gnu.org/licenses/
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU Lesser General Public License for more details.
14   *
15   * For alternative licensing, please contact info@elca.ch
16   */
17  
18  package ch.elca.el4j.services.exceptionhandler;
19  
20  import ch.elca.el4j.services.monitoring.notification.CoreNotificationHelper;
21  
22  /**
23   * Convenience proxy factory for creating safety facades.
24   *
25   * @svnLink $Revision: 3883 $;$Date: 2009-08-04 15:35:01 +0200 (Di, 04. Aug 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/modules/exception_handling/src/main/java/ch/elca/el4j/services/exceptionhandler/SafetyFacadeFactoryBean.java $
26   *
27   * @author Andreas Bur (ABU)
28   */
29  public class SafetyFacadeFactoryBean extends
30  		AbstractExceptionHandlerFactoryBean {
31  
32  	/** The exception configurations to use. */
33  	private ExceptionConfiguration[] m_exceptionConfigurations;
34  
35  	/**
36  	 * Default constructor. Configures the proxy to handle only those exceptions
37  	 * that are <b>not</b> defined in the signature (excluding unchecked
38  	 * exceptions, which are handled always).
39  	 */
40  	public SafetyFacadeFactoryBean() {
41  		super();
42  		// change this behaviour in the SafetyFacadeInterceptor too
43  		// (to be done manually since Java doesn't support multi inheritance).
44  		setForwardSignatureExceptions(true);
45  		setHandleRTSignatureExceptions(true);
46  	}
47  	
48  	/**
49  	 * @see SafetyFacadeInterceptor#setExceptionConfigurations(ExceptionConfiguration[])
50  	 */
51  	public void setExceptionConfigurations(
52  			ExceptionConfiguration[] exceptionConfigurations) {
53  		m_exceptionConfigurations = exceptionConfigurations;
54  	}
55  
56  	/**
57  	 * {@inheritDoc}
58  	 */
59  	public void afterPropertiesSet() throws Exception {
60  		CoreNotificationHelper.notifyIfEssentialPropertyIsEmpty(
61  				m_exceptionConfigurations, "exceptionConfigurations", this);
62  		
63  		super.afterPropertiesSet();
64  	}
65  
66  	/**
67  	 * {@inheritDoc}
68  	 */
69  	protected AbstractExceptionHandlerInterceptor
70  	createExceptionHandlerInterceptor() {
71  		
72  		SafetyFacadeInterceptor interceptor = new SafetyFacadeInterceptor();
73  		interceptor.setExceptionConfigurations(m_exceptionConfigurations);
74  		return interceptor;
75  	}
76  }