/* * ************************************************************************************* * Copyright (C) 2008 EsperTech, Inc. All rights reserved. * * http://esper.codehaus.org * * http://www.espertech.com * * ---------------------------------------------------------------------------------- * * The software in this package is published under the terms of the GPL license * * a copy of which has been included with this distribution in the license.txt file. * * ************************************************************************************* */ package com.espertech.esper.dataflow.core; import com.asper.sources.net.sf.cglib.reflect.FastClass; import com.asper.sources.net.sf.cglib.reflect.FastMethod; import com.espertech.esper.client.dataflow.EPDataFlowSignal; import com.espertech.esper.dataflow.interfaces.EPDataFlowEmitter; import com.espertech.esper.dataflow.util.DataFlowSignalManager; public abstract class EPDataFlowEmitter1Stream1TargetBase implements EPDataFlowEmitter, SubmitHandler { protected final int operatorNum; protected final DataFlowSignalManager signalManager; protected final SignalHandler signalHandler; protected final EPDataFlowEmitterExceptionHandler exceptionHandler; protected final FastMethod fastMethod; protected final Object targetObject; public EPDataFlowEmitter1Stream1TargetBase(int operatorNum, DataFlowSignalManager signalManager, SignalHandler signalHandler, EPDataFlowEmitterExceptionHandler exceptionHandler, ObjectBindingPair target) { this.operatorNum = operatorNum; this.signalManager = signalManager; this.signalHandler = signalHandler; this.exceptionHandler = exceptionHandler; FastClass fastClass = FastClass.create(target.getTarget().getClass()); fastMethod = fastClass.getMethod(target.getBinding().getConsumingBindingDesc().getMethod()); targetObject = target.getTarget(); } public abstract void submitInternal(Object object); public void submit(Object object) { submitInternal(object); } public void submitSignal(EPDataFlowSignal signal) { signalManager.processSignal(operatorNum, signal); signalHandler.handleSignal(signal); } public void handleSignal(EPDataFlowSignal signal) { signalHandler.handleSignal(signal); } public void submitPort(int portNumber, Object object) { if (portNumber == 0) { submit(object); } } public FastMethod getFastMethod() { return fastMethod; } }