version 1.30, 2007/04/13 19:08:54
|
version 1.31, 2008/01/30 12:06:31
|
|
|
| |
#ifdef PEGASUS_PLATFORM_LINUX_GENERIC_GNU | #ifdef PEGASUS_PLATFORM_LINUX_GENERIC_GNU |
#if defined (__GNUC__) && GCC_VERSION >= 40000 | #if defined (__GNUC__) && GCC_VERSION >= 40000 |
// If gcc is compiled with -fvisibility=hidden then JMPI is broken. This is because |
// If gcc is compiled with -fvisibility=hidden then JMPI is broken. |
// the JNI h file defines JNIEXPORT as empty since the default is visible. |
// This is because the JNI h file defines JNIEXPORT as empty since |
|
// the default is visible. |
#undef JNIEXPORT | #undef JNIEXPORT |
#define JNIEXPORT __attribute__ ((visibility("default"))) | #define JNIEXPORT __attribute__ ((visibility("default"))) |
#endif | #endif |
|
|
#define Catch(jEnv) \ | #define Catch(jEnv) \ |
catch(CIMException & e) { \ | catch(CIMException & e) { \ |
JMPIjvm::cacheIDs(jEnv); \ | JMPIjvm::cacheIDs(jEnv); \ |
jobject ev=jEnv->NewObject(JMPIjvm::jv.CIMExceptionClassRef,JMPIjvm::jv.CIMExceptionNewISt,(jint)e.getCode(),jEnv->NewStringUTF(e.getMessage().getCString())); \ |
jobject ev=jEnv->NewObject( \ |
|
JMPIjvm::jv.CIMExceptionClassRef, \ |
|
JMPIjvm::jv.CIMExceptionNewISt, \ |
|
(jint)e.getCode(), \ |
|
jEnv->NewStringUTF(e.getMessage().getCString())); \ |
jEnv->Throw((jthrowable)ev); \ | jEnv->Throw((jthrowable)ev); \ |
} \ | } \ |
catch(Exception & e) { \ | catch(Exception & e) { \ |
JMPIjvm::cacheIDs(jEnv);\ | JMPIjvm::cacheIDs(jEnv);\ |
jobject ev=jEnv->NewObject(JMPIjvm::jv.CIMExceptionClassRef,JMPIjvm::jv.CIMExceptionNewISt,(jint)1,jEnv->NewStringUTF(e.getMessage().getCString())); \ |
jobject ev=jEnv->NewObject( \ |
|
JMPIjvm::jv.CIMExceptionClassRef, \ |
|
JMPIjvm::jv.CIMExceptionNewISt, \ |
|
(jint)1, \ |
|
jEnv->NewStringUTF(e.getMessage().getCString())); \ |
jEnv->Throw((jthrowable)ev); \ | jEnv->Throw((jthrowable)ev); \ |
} \ | } \ |
catch(...) { \ | catch(...) { \ |
JMPIjvm::cacheIDs(jEnv); \ | JMPIjvm::cacheIDs(jEnv); \ |
jobject ev=jEnv->NewObject(JMPIjvm::jv.CIMExceptionClassRef,JMPIjvm::jv.CIMExceptionNewISt,(jint)1,jEnv->NewStringUTF("Exception: Unknown")); \ |
jobject ev=jEnv->NewObject( \ |
|
JMPIjvm::jv.CIMExceptionClassRef, \ |
|
JMPIjvm::jv.CIMExceptionNewISt, \ |
|
(jint)1, \ |
|
jEnv->NewStringUTF("Exception: Unknown")); \ |
jEnv->Throw((jthrowable)ev); \ | jEnv->Throw((jthrowable)ev); \ |
} | } |
| |
|
|
static JNIEnv* attachThread(JvmVector **jvp); | static JNIEnv* attachThread(JvmVector **jvp); |
static void detachThread(); | static void detachThread(); |
static jobject getProvider(JNIEnv *env, const char *cn, jclass *cls) ; | static jobject getProvider(JNIEnv *env, const char *cn, jclass *cls) ; |
static jobject getProvider(JNIEnv *env, String jar, String cln, const char *cn, jclass *cls) ; |
static jobject getProvider( |
|
JNIEnv *env, |
|
String jar, |
|
String cln, |
|
const char *cn, |
|
jclass *cls) ; |
static void checkException(JNIEnv *env); | static void checkException(JNIEnv *env); |
static jstring NewPlatformString(JNIEnv *env,char *s); | static jstring NewPlatformString(JNIEnv *env,char *s); |
static jobjectArray NewPlatformStringArray(JNIEnv *env,char **strv, int strc); |
static jobjectArray NewPlatformStringArray( |
|
JNIEnv *env, |
|
char **strv, |
|
int strc); |
static int cacheIDs(JNIEnv *env); | static int cacheIDs(JNIEnv *env); |
static int destroyJVM(); | static int destroyJVM(); |
| |
|
|
static jclass getGlobalClassRef(JNIEnv *env, const char* name); | static jclass getGlobalClassRef(JNIEnv *env, const char* name); |
static int initJVM(); | static int initJVM(); |
| |
typedef HashTable<String,jclass,EqualFunc<String>,HashFunc<String> > ClassTable; |
typedef HashTable< |
typedef HashTable<String,jobject,EqualFunc<String>,HashFunc<String> > ObjectTable; |
String, |
|
jclass, |
|
EqualFunc<String>, |
|
HashFunc<String> > ClassTable; |
|
typedef HashTable< |
|
String, |
|
jobject, |
|
EqualFunc<String>, |
|
HashFunc<String> > ObjectTable; |
| |
static ClassTable _classTable; | static ClassTable _classTable; |
static ObjectTable _objectTable; | static ObjectTable _objectTable; |