AbstractEvent.java

codebase/src/net/sourceforge/pain/logic/event/AbstractEvent.java · 963 B

From the archive pain_0_44.tgz

Download the archive   « Back to the archive contents

package net.sourceforge.pain.logic.event;

import net.sourceforge.pain.*;
import net.sourceforge.pain.db.*;
import net.sourceforge.pain.logic.*;

/**
 * AbstractEvent is a base class for any Event, this class is a first reloadable class in Events hierarchy
 */
public abstract class AbstractEvent implements Event {

	public Object processEvent(final Object param) throws Exception {
		final DbTransaction t = new DbTransaction() {
			public Object execute(Object[] params) throws Exception {
				return AbstractEvent.this.execute(param);
			}
		};
		Core.getDB().execute(t);
		return null;
	}

	public AbstractEvent() {
		// debug check
		ClassLoader loader = Core.getLogicLoader().getActiveClassLoader();
		if (loader != getClass().getClassLoader()) {
			throw new RuntimeException("BUG: all Act subclasses MUST be loaded via Core.createAct() method!");
		}
	}

	public abstract Object execute(Object param) throws Exception;

}

Site Stats

Snippets: 1791
Codebases: 571