FileDocCategorySizeDatePackage
EventListeners.javaAPI DocHibernate 3.2.515183Sun Oct 16 08:27:54 BST 2005org.hibernate.event

EventListeners

public class EventListeners extends org.hibernate.util.Cloneable implements Serializable
A convience holder for all defined session event listeners.
author
Steve Ebersole

Fields Summary
private LoadEventListener[]
loadEventListeners
private SaveOrUpdateEventListener[]
saveOrUpdateEventListeners
private MergeEventListener[]
mergeEventListeners
private PersistEventListener[]
persistEventListeners
private PersistEventListener[]
persistOnFlushEventListeners
private ReplicateEventListener[]
replicateEventListeners
private DeleteEventListener[]
deleteEventListeners
private AutoFlushEventListener[]
autoFlushEventListeners
private DirtyCheckEventListener[]
dirtyCheckEventListeners
private FlushEventListener[]
flushEventListeners
private EvictEventListener[]
evictEventListeners
private LockEventListener[]
lockEventListeners
private RefreshEventListener[]
refreshEventListeners
private FlushEntityEventListener[]
flushEntityEventListeners
private InitializeCollectionEventListener[]
initializeCollectionEventListeners
private PostLoadEventListener[]
postLoadEventListeners
private PreLoadEventListener[]
preLoadEventListeners
private PreDeleteEventListener[]
preDeleteEventListeners
private PreUpdateEventListener[]
preUpdateEventListeners
private PreInsertEventListener[]
preInsertEventListeners
private PostDeleteEventListener[]
postDeleteEventListeners
private PostUpdateEventListener[]
postUpdateEventListeners
private PostInsertEventListener[]
postInsertEventListeners
private PostDeleteEventListener[]
postCommitDeleteEventListeners
private PostUpdateEventListener[]
postCommitUpdateEventListeners
private PostInsertEventListener[]
postCommitInsertEventListeners
private SaveOrUpdateEventListener[]
saveEventListeners
private SaveOrUpdateEventListener[]
updateEventListeners
private MergeEventListener[]
saveOrUpdateCopyEventListeners
private static Map
eventInterfaceFromType
Constructors Summary
Methods Summary
public AutoFlushEventListener[]getAutoFlushEventListeners()

		return autoFlushEventListeners;
	
public DeleteEventListener[]getDeleteEventListeners()

		return deleteEventListeners;
	
public DirtyCheckEventListener[]getDirtyCheckEventListeners()

		return dirtyCheckEventListeners;
	
public EvictEventListener[]getEvictEventListeners()

		return evictEventListeners;
	
public FlushEntityEventListener[]getFlushEntityEventListeners()

		return flushEntityEventListeners;
	
public FlushEventListener[]getFlushEventListeners()

		return flushEventListeners;
	
public InitializeCollectionEventListener[]getInitializeCollectionEventListeners()

		return initializeCollectionEventListeners;
	
public java.lang.ClassgetListenerClassFor(java.lang.String type)


	 
		eventInterfaceFromType = new HashMap();

		eventInterfaceFromType.put("auto-flush", AutoFlushEventListener.class);
		eventInterfaceFromType.put("merge", MergeEventListener.class);
		eventInterfaceFromType.put("create", PersistEventListener.class);
		eventInterfaceFromType.put("create-onflush", PersistEventListener.class);
		eventInterfaceFromType.put("delete", DeleteEventListener.class);
		eventInterfaceFromType.put("dirty-check", DirtyCheckEventListener.class);
		eventInterfaceFromType.put("evict", EvictEventListener.class);
		eventInterfaceFromType.put("flush", FlushEventListener.class);
		eventInterfaceFromType.put("flush-entity", FlushEntityEventListener.class);
		eventInterfaceFromType.put("load", LoadEventListener.class);
		eventInterfaceFromType.put("load-collection", InitializeCollectionEventListener.class);
		eventInterfaceFromType.put("lock", LockEventListener.class);
		eventInterfaceFromType.put("refresh", RefreshEventListener.class);
		eventInterfaceFromType.put("replicate", ReplicateEventListener.class);
		eventInterfaceFromType.put("save-update", SaveOrUpdateEventListener.class);
		eventInterfaceFromType.put("save", SaveOrUpdateEventListener.class);
		eventInterfaceFromType.put("update", SaveOrUpdateEventListener.class);
		eventInterfaceFromType.put("pre-load", PreLoadEventListener.class);
		eventInterfaceFromType.put("pre-update", PreUpdateEventListener.class);
		eventInterfaceFromType.put("pre-delete", PreDeleteEventListener.class);
		eventInterfaceFromType.put("pre-insert", PreInsertEventListener.class);
		eventInterfaceFromType.put("post-load", PostLoadEventListener.class);
		eventInterfaceFromType.put("post-update", PostUpdateEventListener.class);
		eventInterfaceFromType.put("post-delete", PostDeleteEventListener.class);
		eventInterfaceFromType.put("post-insert", PostInsertEventListener.class);
		eventInterfaceFromType.put("post-commit-update", PostUpdateEventListener.class);
		eventInterfaceFromType.put("post-commit-delete", PostDeleteEventListener.class);
		eventInterfaceFromType.put("post-commit-insert", PostInsertEventListener.class);
		eventInterfaceFromType = Collections.unmodifiableMap( eventInterfaceFromType );
	
		Class clazz = (Class) eventInterfaceFromType.get(type);
		
		if (clazz == null) {
			throw new MappingException("Unrecognized listener type [" + type + "]");
		}

		return clazz;
	
public LoadEventListener[]getLoadEventListeners()

        return loadEventListeners;
    
public LockEventListener[]getLockEventListeners()

		return lockEventListeners;
	
public MergeEventListener[]getMergeEventListeners()

		return mergeEventListeners;
	
public PersistEventListener[]getPersistEventListeners()

		return persistEventListeners;
	
public PersistEventListener[]getPersistOnFlushEventListeners()

		return persistOnFlushEventListeners;
	
public PostDeleteEventListener[]getPostCommitDeleteEventListeners()

		return postCommitDeleteEventListeners;
	
public PostInsertEventListener[]getPostCommitInsertEventListeners()

		return postCommitInsertEventListeners;
	
public PostUpdateEventListener[]getPostCommitUpdateEventListeners()

		return postCommitUpdateEventListeners;
	
public PostDeleteEventListener[]getPostDeleteEventListeners()

		return postDeleteEventListeners;
	
public PostInsertEventListener[]getPostInsertEventListeners()

		return postInsertEventListeners;
	
public PostLoadEventListener[]getPostLoadEventListeners()

		return postLoadEventListeners;
	
public PostUpdateEventListener[]getPostUpdateEventListeners()

		return postUpdateEventListeners;
	
public PreDeleteEventListener[]getPreDeleteEventListeners()

		return preDeleteEventListeners;
	
public PreInsertEventListener[]getPreInsertEventListeners()

		return preInsertEventListeners;
	
public PreLoadEventListener[]getPreLoadEventListeners()

		return preLoadEventListeners;
	
public PreUpdateEventListener[]getPreUpdateEventListeners()

		return preUpdateEventListeners;
	
public RefreshEventListener[]getRefreshEventListeners()

		return refreshEventListeners;
	
public ReplicateEventListener[]getReplicateEventListeners()

		return replicateEventListeners;
	
public SaveOrUpdateEventListener[]getSaveEventListeners()

		return saveEventListeners;
	
public MergeEventListener[]getSaveOrUpdateCopyEventListeners()

		return saveOrUpdateCopyEventListeners;
	
public SaveOrUpdateEventListener[]getSaveOrUpdateEventListeners()

		return saveOrUpdateEventListeners;
	
public SaveOrUpdateEventListener[]getUpdateEventListeners()

		return updateEventListeners;
	
public voidinitializeListeners(org.hibernate.cfg.Configuration cfg)
Call initialize() on any listeners that implement Initializable.

see
Initializable

		Field[] fields = getClass().getDeclaredFields();
		for ( int i = 0; i < fields.length; i++ ) {
			Object[] listeners;
			try {
				Object listener = fields[i].get(this);
				if (listener instanceof Object[]) {
					listeners = (Object[]) listener;
				}
				else {
					continue;
				}

			}
			catch (Exception e) {
				throw new AssertionFailure("could not init listeners");
			}
			int length = listeners.length;
			for (int index = 0 ; index < length ; index++) {
				Object listener = listeners[index];
				if (listener instanceof Initializable ) {
					( (Initializable) listener ).initialize(cfg);
				}
			}

		}
	
public voidsetAutoFlushEventListeners(AutoFlushEventListener[] autoFlushEventListener)

		this.autoFlushEventListeners = autoFlushEventListener;
	
public voidsetDeleteEventListeners(DeleteEventListener[] deleteEventListener)

		this.deleteEventListeners = deleteEventListener;
	
public voidsetDirtyCheckEventListeners(DirtyCheckEventListener[] dirtyCheckEventListener)

		this.dirtyCheckEventListeners = dirtyCheckEventListener;
	
public voidsetEvictEventListeners(EvictEventListener[] evictEventListener)

		this.evictEventListeners = evictEventListener;
	
public voidsetFlushEntityEventListeners(FlushEntityEventListener[] flushEntityEventListener)

		this.flushEntityEventListeners = flushEntityEventListener;
	
public voidsetFlushEventListeners(FlushEventListener[] flushEventListener)

		this.flushEventListeners = flushEventListener;
	
public voidsetInitializeCollectionEventListeners(InitializeCollectionEventListener[] initializeCollectionEventListener)

		this.initializeCollectionEventListeners = initializeCollectionEventListener;
	
public voidsetLoadEventListeners(LoadEventListener[] loadEventListener)

        this.loadEventListeners = loadEventListener;
    
public voidsetLockEventListeners(LockEventListener[] lockEventListener)

		this.lockEventListeners = lockEventListener;
	
public voidsetMergeEventListeners(MergeEventListener[] mergeEventListener)

		this.mergeEventListeners = mergeEventListener;
	
public voidsetPersistEventListeners(PersistEventListener[] createEventListener)

		this.persistEventListeners = createEventListener;
	
public voidsetPersistOnFlushEventListeners(PersistEventListener[] createEventListener)

		this.persistOnFlushEventListeners = createEventListener;
	
public voidsetPostCommitDeleteEventListeners(PostDeleteEventListener[] postCommitDeleteEventListeners)

		this.postCommitDeleteEventListeners = postCommitDeleteEventListeners;
	
public voidsetPostCommitInsertEventListeners(PostInsertEventListener[] postCommitInsertEventListeners)

		this.postCommitInsertEventListeners = postCommitInsertEventListeners;
	
public voidsetPostCommitUpdateEventListeners(PostUpdateEventListener[] postCommitUpdateEventListeners)

		this.postCommitUpdateEventListeners = postCommitUpdateEventListeners;
	
public voidsetPostDeleteEventListeners(PostDeleteEventListener[] postDeleteEventListener)

		this.postDeleteEventListeners = postDeleteEventListener;
	
public voidsetPostInsertEventListeners(PostInsertEventListener[] postInsertEventListener)

		this.postInsertEventListeners = postInsertEventListener;
	
public voidsetPostLoadEventListeners(PostLoadEventListener[] postLoadEventListener)

		this.postLoadEventListeners = postLoadEventListener;
	
public voidsetPostUpdateEventListeners(PostUpdateEventListener[] postUpdateEventListener)

		this.postUpdateEventListeners = postUpdateEventListener;
	
public voidsetPreDeleteEventListeners(PreDeleteEventListener[] preDeleteEventListener)

		this.preDeleteEventListeners = preDeleteEventListener;
	
public voidsetPreInsertEventListeners(PreInsertEventListener[] preInsertEventListener)

		this.preInsertEventListeners = preInsertEventListener;
	
public voidsetPreLoadEventListeners(PreLoadEventListener[] preLoadEventListener)

		this.preLoadEventListeners = preLoadEventListener;
	
public voidsetPreUpdateEventListeners(PreUpdateEventListener[] preUpdateEventListener)

		this.preUpdateEventListeners = preUpdateEventListener;
	
public voidsetRefreshEventListeners(RefreshEventListener[] refreshEventListener)

		this.refreshEventListeners = refreshEventListener;
	
public voidsetReplicateEventListeners(ReplicateEventListener[] replicateEventListener)

		this.replicateEventListeners = replicateEventListener;
	
public voidsetSaveEventListeners(SaveOrUpdateEventListener[] saveEventListener)

		this.saveEventListeners = saveEventListener;
	
public voidsetSaveOrUpdateCopyEventListeners(MergeEventListener[] saveOrUpdateCopyEventListener)

		this.saveOrUpdateCopyEventListeners = saveOrUpdateCopyEventListener;
	
public voidsetSaveOrUpdateEventListeners(SaveOrUpdateEventListener[] saveOrUpdateEventListener)

		this.saveOrUpdateEventListeners = saveOrUpdateEventListener;
	
public voidsetUpdateEventListeners(SaveOrUpdateEventListener[] updateEventListener)

		this.updateEventListeners = updateEventListener;