1 /* 2 * JBoss, Home of Professional Open Source 3 * 4 * Distributable under LGPL license. 5 * See terms of license at gnu.org. 6 */ 7 package org.jboss.hibernate; 8 9 import org.hibernate.cfg.Configuration; 10 import org.jboss.deployment.DeploymentException; 11 12 import javax.management.ObjectName; 13 14 /** 15 * Implementors are responsible for injecting any custom Hibernate3 event listeners into the {@link 16 * org.hibernate.cfg.Configuration} which will then later be used to build the {@link org.hibernate.SessionFactory}. 17 * <p/> 18 * Implementors should have a no-arg constructor. 19 * 20 * @author <a HREF="mailto:steve@hibernate.org">Steve Ebersole</a> 21 * @version <tt>$Revision: 35017 $</tt> 22 */ 23 public interface ListenerInjector 24 { 25 /** 26 * Called by the {@link org.jboss.hibernate.jmx.Hibernate} MBean when it is time to generate any custom listeners. 27 * <p/> 28 * Implementors should use the {@link Configuration#setListener(String, Object)} method to inject the appropriate 29 * listener instance(s). 30 * <p/> 31 * Note that the {@link org.hibernate.SessionFactory} is not yet available; it has not even beeen built at this time. 32 * <p/> 33 * Note that it is possible to actually set some properties on the incoming configuration instance. It is not 34 * advisable to do this with any Hibernate-specific settings as the MBean will have final say after execution of this 35 * method regarding any settings it manages (potentially over-writing a setting done during this execution). Maybe 36 * useful for the listeners, themselves, being able to read custom settings later from the {@link 37 * org.hibernate.SessionFactory}. 38 * 39 * @param configuration The configuration into which the customer listeners should be injected. 40 * @param objectName The MBean object name. 41 * 42 * @throws DeploymentException If any problems occur which should lead to a deployment failure (i.e. do not build the 43 * {@link org.hibernate.SessionFactory}). 44 */ 45 public void injectListeners(ObjectName objectName, Configuration configuration) throws DeploymentException; 46 } 47