00001 /* 00002 // $Id: //open/dev/fennel/farrago/JavaTransformExecStream.h#10 $ 00003 // Fennel is a library of data storage and processing components. 00004 // Copyright (C) 2006-2009 The Eigenbase Project 00005 // Copyright (C) 2006-2009 SQLstream, Inc. 00006 // Copyright (C) 2006-2009 LucidEra, Inc. 00007 // 00008 // This program is free software; you can redistribute it and/or modify it 00009 // under the terms of the GNU General Public License as published by the Free 00010 // Software Foundation; either version 2 of the License, or (at your option) 00011 // any later version approved by The Eigenbase Project. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with this program; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 #ifndef Fennel_JavaTransformExecStream_Included 00023 #define Fennel_JavaTransformExecStream_Included 00024 00025 #include "fennel/exec/ExecStream.h" 00026 #include "fennel/exec/ExecStreamDefs.h" 00027 #include "fennel/farrago/CmdInterpreter.h" 00028 #include "fennel/segment/SegPageLock.h" 00029 #include "fennel/tuple/TupleData.h" 00030 #include <string> 00031 #include <iostream> 00032 00033 #include <jni.h> 00034 00035 FENNEL_BEGIN_NAMESPACE 00036 00037 struct JavaTransformExecStreamParams : 00038 virtual public ExecStreamParams 00039 { 00043 TupleDescriptor outputTupleDesc; 00044 TupleFormat outputTupleFormat; 00045 00050 std::string javaClassName; 00051 00055 CmdInterpreter::StreamGraphHandle *pStreamGraphHandle; 00056 00057 explicit JavaTransformExecStreamParams(); 00058 }; 00059 00060 00065 class FENNEL_FARRAGO_EXPORT JavaTransformExecStream 00066 : virtual public ExecStream 00067 { 00068 CmdInterpreter::StreamGraphHandle *pStreamGraphHandle; 00069 std::string javaClassName; 00070 jobject outputByteBuffer1; 00071 jobject outputByteBuffer2; 00072 PBuffer pBuffer1; 00073 PBuffer pBuffer2; 00074 00075 00076 protected: 00077 std::vector<SharedExecStreamBufAccessor> inAccessors; 00078 SharedExecStreamBufAccessor pOutAccessor; 00079 00083 void checkEmptyInputs(); 00084 00089 jobject farragoTransform; 00090 00091 public: 00092 JavaTransformExecStream(); 00093 virtual ~JavaTransformExecStream(); 00094 00095 // implement ExecStream 00096 virtual void prepare(JavaTransformExecStreamParams const ¶ms); 00097 virtual void setInputBufAccessors( 00098 std::vector<SharedExecStreamBufAccessor> const &inAccessors); 00099 virtual void setOutputBufAccessors( 00100 std::vector<SharedExecStreamBufAccessor> const &outAccessors); 00101 virtual void open(bool restart); 00102 virtual ExecStreamResult execute(ExecStreamQuantum const &quantum); 00103 virtual void closeImpl(); 00104 virtual ExecStreamBufProvision getInputBufProvision() const; 00105 virtual ExecStreamBufProvision getOutputBufProvision() const; 00106 virtual ExecStreamBufProvision getOutputBufConversion() const; 00107 }; 00108 00109 FENNEL_END_NAMESPACE 00110 00111 #endif 00112 00113 // End JavaTransformExecStream.h