00001
00002
00003
00004
00005 #ifndef xmog_jvm_inc
00006 #define xmog_jvm_inc
00007
00008
00009 class xmog_java_class;
00010 class xmog_java_field;
00011 class xmog_java_method;
00012 class xmog_error_handler;
00013
00014
00015 #include "xmog.h"
00016 #include "xmog_localenv.h"
00017
00018
00040 class XMOG_DECLSPEC xmog_jvm
00041 {
00042 public:
00043
00052 xmog_jvm( JavaVM * theJvm, jint jniVersion = JNI_VERSION_1_2, jint javaVersion = 0, bool inProcess = true );
00053
00057 ~xmog_jvm();
00058
00063 void * operator new ( size_t );
00064
00069 void operator delete( void * );
00070
00088 xmog_localenv * attach( jobject group = NULL, const char * name = NULL, bool bAsDaemon = false );
00089
00102 xmog_localenv * attach( JNIEnv * env );
00103
00112 static void static_detach( xmog_localenv * env = NULL );
00113
00122 void detach( xmog_localenv * env = NULL );
00123
00133 void destroy();
00134
00139 static xmog_localenv * getEnv();
00140
00151 virtual int initializeFieldID( xmog_java_class * clazz, xmog_java_field * field, xmog_localenv * env = NULL );
00152
00163 virtual int initializeMethodID( xmog_java_class * clazz, xmog_java_method * method, xmog_localenv * env = NULL );
00164
00169 jint getJNIVersion();
00170
00174 bool getInProcess();
00175
00179 bool getInDestroy();
00180
00184 JavaVM * getJavaVM();
00185
00189 jint getJavaVersion();
00190
00206 void setDefaultEncoding( const char * _enc );
00207
00223 void setDefaultEncoding( xmog_base * _enc );
00224
00240 xmog_base * getDefaultEncoding();
00241
00253 void set_error_handler( xmog_error_handler * _eh );
00254
00263 xmog_error_handler * get_error_handler();
00264
00265 protected:
00266
00271 JavaVM * jvm_;
00272
00276 xmog_error_handler* eh_;
00277
00282 xmog_base * default_enc_;
00283
00287 jint jniVersion_;
00288
00292 jint javaVersion_;
00293
00297 bool inProcess_;
00298
00302 bool inDestroy_;
00303
00304 };
00305
00306
00307 typedef xmog_jvm * xmog_jvm_ptr;
00308
00309
00310 #endif