private Ejb3Configuration configuration;
private boolean isSecurity;
public EventListenerConfigurator(Ejb3Configuration configuration) {
this.configuration = configuration;
EventListeners listenerConfig = configuration.getEventListeners();
//Action event
//EJB3-specific ops listeners
listenerConfig.setFlushEventListeners( new FlushEventListener[] { EJB3FlushEventListener.INSTANCE } );
//EJB3-specific ops listeners
listenerConfig.setAutoFlushEventListeners( new AutoFlushEventListener[] { EJB3AutoFlushEventListener.INSTANCE } );
listenerConfig.setDeleteEventListeners( new DeleteEventListener[] { new EJB3DeleteEventListener() } );
listenerConfig.setFlushEntityEventListeners(
new FlushEntityEventListener[] { new EJB3FlushEntityEventListener() }
);
listenerConfig.setMergeEventListeners( new MergeEventListener[] { new EJB3MergeEventListener() } );
listenerConfig.setPersistEventListeners( new PersistEventListener[] { new EJB3PersistEventListener() } );
listenerConfig.setPersistOnFlushEventListeners(
new PersistEventListener[] { new EJB3PersistOnFlushEventListener() }
);
listenerConfig.setSaveEventListeners( new SaveOrUpdateEventListener[] { new EJB3SaveEventListener() } );
listenerConfig.setSaveOrUpdateEventListeners(
new SaveOrUpdateEventListener[] { new EJB3SaveOrUpdateEventListener() }
);
//Pre events
listenerConfig.setPreInsertEventListeners(
new PreInsertEventListener[] {
new JACCPreInsertEventListener(),
}
);
listenerConfig.setPreUpdateEventListeners(
new PreUpdateEventListener[] {
new JACCPreUpdateEventListener(),
}
);
listenerConfig.setPreDeleteEventListeners(
new PreDeleteEventListener[] {
new JACCPreDeleteEventListener()
}
);
//Add the default Hibernate Core PreLoadEventListener
//TODO shouldn't we read the value from getPreLoadEventListeners and add JACC?
//probably a better thing to do as it allows cfg.xml config but this is a big change and need more thoughts
listenerConfig.setPreLoadEventListeners(
new PreLoadEventListener[] {
new DefaultPreLoadEventListener(),
new JACCPreLoadEventListener()
}
);
//post events
listenerConfig.setPostDeleteEventListeners(
new PostDeleteEventListener[] { new EJB3PostDeleteEventListener() }
);
listenerConfig.setPostInsertEventListeners(
new PostInsertEventListener[] { new EJB3PostInsertEventListener() }
);
//Add the default Hibernate Core PostLoadEventListener
//TODO shouldn't we read the value from getPostLoadEventListeners
//probably a better thing to do as it allows cfg.xml config but this is a big change and need more thoughts
listenerConfig.setPostLoadEventListeners(
new PostLoadEventListener[] { new EJB3PostLoadEventListener(), new DefaultPostLoadEventListener() }
);
listenerConfig.setPostUpdateEventListeners(
new PostUpdateEventListener[] { new EJB3PostUpdateEventListener() }
);
}