Codemesh Runtime v3 C++ API Reference  3.9.205
xmog_jvm.h
1 //
2 // Copyright (c) 1999-2020 by Codemesh, Inc.. ALL RIGHTS RESERVED.
3 //
4 
5 
6 #ifndef xmog_jvm_inc
7 #define xmog_jvm_inc
8 
9 
10 class xmog_java_class;
11 class xmog_java_field;
12 class xmog_java_method;
13 class xmog_error_handler;
14 
15 
16 #include "xmog.h"
17 #include "xmog_localenv.h"
18 
19 
41 class XMOG_DECLSPEC xmog_jvm
42 {
43 public:
44 
53  xmog_jvm( JavaVM * theJvm, jint jniVersion = JNI_VERSION_1_2, jint javaVersion = 0, bool inProcess = true );
54 
58  ~xmog_jvm();
59 
64  void * operator new ( size_t );
65 
70  void operator delete( void * );
71 
89  xmog_localenv * attach( jobject group = NULL, const char * name = NULL, bool bAsDaemon = false );
90 
103  xmog_localenv * attach( JNIEnv * env );
104 
113  static void static_detach( xmog_localenv * env = NULL );
114 
123  void detach( xmog_localenv * env = NULL );
124 
134  void destroy();
135 
140  static xmog_localenv * getEnv();
141 
152  virtual int initializeFieldID( xmog_java_class * clazz, xmog_java_field * field, xmog_localenv * env = NULL );
153 
164  virtual int initializeMethodID( xmog_java_class * clazz, xmog_java_method * method, xmog_localenv * env = NULL );
165 
170  jint getJNIVersion();
171 
175  bool getInProcess();
176 
180  bool getInDestroy();
181 
185  JavaVM * getJavaVM();
186 
190  jint getJavaVersion();
191 
207  void setDefaultEncoding( const char * _enc );
208 
224  void setDefaultEncoding( xmog_base * _enc );
225 
241  xmog_base * getDefaultEncoding();
242 
254  void set_error_handler( xmog_error_handler * _eh );
255 
264  xmog_error_handler * get_error_handler();
265 
266 protected:
267 
272  JavaVM * jvm_;
273 
278 
284 
289 
294 
299 
304 
308  bool native_;
309 
310 
311 
312 };
313 
314 
315 typedef xmog_jvm * xmog_jvm_ptr;
316 
317 
318 #endif /* xmog_jvm_inc */
xmog_error_handler
The type responsible for error handling.
Definition: xmog_error_handler.h:162
xmog_jvm::eh_
xmog_error_handler * eh_
The error handler that is used for newly attached threads.
Definition: xmog_jvm.h:277
xmog_jvm::inDestroy_
bool inDestroy_
true if we have already invoked the detroy() method, false otherwise.
Definition: xmog_jvm.h:303
xmog_jvm::native_
bool native_
true if we are running in native mode, false otherwise.
Definition: xmog_jvm.h:308
xmog_java_field
A class implementing the xmog_java_dynamic interface for accessing Java fields via JNI or Codemesh's ...
Definition: xmog_java_field.h:36
xmog_jvm::jniVersion_
jint jniVersion_
The JNI version of the JVM.
Definition: xmog_jvm.h:288
xmog_jvm::default_enc_
xmog_base * default_enc_
The default string encoding that is used for newly attached threads to translate between native and J...
Definition: xmog_jvm.h:283
xmog_java_method
A class implementing the xmog_java_dynamic interface for accessing Java methods via JNI or Codemesh's...
Definition: xmog_java_method.h:38
xmog_jvm::jvm_
JavaVM * jvm_
A pointer to the JNI-type JavaVM instance that is represented by this object.
Definition: xmog_jvm.h:272
xmog_base
The baseclass for all proxy types in the framework.
Definition: xmog_base.h:29
xmog_jvm
The class that represents a Java Virtual Machine in the framework.
Definition: xmog_jvm.h:41
xmog_jvm::javaVersion_
jint javaVersion_
The Java version of the JVM.
Definition: xmog_jvm.h:293
xmog_localenv
A class representing per-thread information for the integration runtime.
Definition: xmog_localenv.h:32
xmog_jvm::inProcess_
bool inProcess_
true if we have an in-process JVM, false otherwise.
Definition: xmog_jvm.h:298
xmog_java_class
A C++ wrapper for Java types.
Definition: xmog_java_class.h:31

Copyright (c) 1999-2020 by Codemesh, Inc., ALL RIGHTS RESERVED.