JavaErrorTarget Class Reference

JavaErrorTarget implements ErrorTarget by calling back into the Farrago error handling facility. More...

#include <JavaErrorTarget.h>

Inheritance diagram for JavaErrorTarget:

ErrorTarget List of all members.

Public Member Functions

 ~JavaErrorTarget ()
 JavaErrorTarget (jobject javaErrorInit)
 Constructs a new JavaErrorTarget.
virtual void notifyError (const std::string &source, ErrorLevel level, const std::string &message, void *address, long capacity, int index)
 Receives notification when a row exception occurs.

Private Attributes

jobject javaError
 net.sf.farrago.fennel.FennelJavaErrorTarget object to which errors should be forwarded.
jmethodID methNotifyError
 FennelJavaErrorTarget.handleRowError method.

Detailed Description

JavaErrorTarget implements ErrorTarget by calling back into the Farrago error handling facility.

Definition at line 36 of file JavaErrorTarget.h.


Constructor & Destructor Documentation

JavaErrorTarget::~JavaErrorTarget (  ) 

Definition at line 49 of file JavaErrorTarget.cpp.

References JniUtil::decrementHandleCount(), and javaError.

00050 {
00051     JniEnvAutoRef pEnv;
00052 
00053     pEnv->DeleteGlobalRef(javaError);
00054     JniUtil::decrementHandleCount(JAVAERRORTARGET_TYPE_STR, this);
00055     javaError = NULL;
00056 }

JavaErrorTarget::JavaErrorTarget ( jobject  javaErrorInit  )  [explicit]

Constructs a new JavaErrorTarget.

Parameters:
javaErrorInit pointer to a java object of type net.sf.farrago.fennel.FennelJavaErrorTarget

Definition at line 34 of file JavaErrorTarget.cpp.

References JniUtil::incrementHandleCount(), javaError, and methNotifyError.

00035 {
00036     JniEnvAutoRef pEnv;
00037 
00038     JniUtil::incrementHandleCount(JAVAERRORTARGET_TYPE_STR, this);
00039     javaError = pEnv->NewGlobalRef(javaErrorInit);
00040 
00041     jclass classErrorTarget = pEnv->FindClass(
00042         "net/sf/farrago/fennel/FennelJavaErrorTarget");
00043     methNotifyError = pEnv->GetMethodID(
00044         classErrorTarget,
00045         "handleRowError",
00046         "(Ljava/lang/String;ZLjava/lang/String;Ljava/nio/ByteBuffer;I)Ljava/lang/Object;");
00047 }


Member Function Documentation

void JavaErrorTarget::notifyError ( const std::string &  source,
ErrorLevel  level,
const std::string &  message,
void *  address,
long  capacity,
int  index 
) [virtual]

Receives notification when a row exception occurs.

Parameters:
source the unique Fennel stream name
level the severity of the exception
message a description of the exception
address pointer to the buffer containing the error record
capacity the size of the error buffer
index position of the column whose processing caused the exception to occur. -1 indicates that no column was culpable. 0 indicates that a filter condition was being processed. Otherwise this parameter should be a 1-indexed column position.

Implements ErrorTarget.

Definition at line 58 of file JavaErrorTarget.cpp.

References javaError, methNotifyError, and ROW_WARNING.

00065 {
00066     JniEnvAutoRef pEnv;
00067 
00068     // NOTE jvs 21-Aug-2007:  use ref reapers here since this
00069     // may be called over and over before control returns to Java
00070 
00071     jstring javaSource = pEnv->NewStringUTF(source.c_str());
00072     JniLocalRefReaper javaSourceReaper(pEnv, javaSource);
00073     jboolean javaIsWarning = (level == ROW_WARNING) ? true : false;
00074     jstring javaMessage = pEnv->NewStringUTF(message.c_str());
00075     JniLocalRefReaper javaMessageReaper(pEnv, javaMessage);
00076     jobject javaByteBuffer =
00077         pEnv->NewDirectByteBuffer(address, capacity);
00078     JniLocalRefReaper javaByteBufferReaper(pEnv, javaByteBuffer);
00079     jint javaIndex = index;
00080 
00081     pEnv->CallObjectMethod(
00082         javaError, methNotifyError,
00083         javaSource, javaIsWarning, javaMessage,
00084         javaByteBuffer, javaIndex);
00085 }


Member Data Documentation

jobject JavaErrorTarget::javaError [private]

net.sf.farrago.fennel.FennelJavaErrorTarget object to which errors should be forwarded.

Definition at line 43 of file JavaErrorTarget.h.

Referenced by JavaErrorTarget(), notifyError(), and ~JavaErrorTarget().

jmethodID JavaErrorTarget::methNotifyError [private]

FennelJavaErrorTarget.handleRowError method.

Definition at line 48 of file JavaErrorTarget.h.

Referenced by JavaErrorTarget(), and notifyError().


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:33 2009 for Fennel by  doxygen 1.5.1