Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

xmog_localenv Class Reference

A class representing per-thread information for the integration runtime. More...

#include <xmog_localenv.h>

Collaboration diagram for xmog_localenv:

Collaboration graph
[legend]
List of all members.

Public Member Functions

xmog_error_handlerget_error_handler ()
 Returns the error handler that's used for this local environment.
xmog_basegetDefaultEncoding ()
 Returns the default string encoding that is used when native strings are converted to Java strings.
JNIEnv * getEnv ()
 Returns the JNIEnv pointer this local environment wraps around.
JavaVM * getJavaVM ()
 Returns the JavaVM pointer that represents the JVM to which this thread is attached.
JNIEnv * getJNIEnv ()
 Returns the JNIEnv pointer this local environment wraps around.
jint getJNIVersion ()
 Returns the JNI version of the JVM to which this thread is attached.
xmog_jvmgetJvm ()
 Returns the xmog_jvm pointer that represents the JVM to which this local environment instance belongs.
bool in_delete ()
 Returns the value of the bInDelete_ field.
void in_delete (bool bInDelete)
 Sets the value of the bInDelete_ field.
bool in_detach ()
 Returns the value of the bInDetach_ field.
void in_detach (bool bInDetach)
 Sets the value of the bInDetach_ field.
bool in_exception ()
 Returns the value of the bInException_ field.
void in_exception (bool bInException)
 Sets the value of the bInException_ field.
void operator delete (void *)
void * operator new (size_t)
 The overloaded operator new.
void set_error_handler (xmog_error_handler *_eh)
 Sets the error handler that will be used for this local environment.
void setDefaultEncoding (xmog_base *_enc)
 Sets the default string encoding that is used when native strings are converted to Java strings.
 xmog_localenv (xmog_jvm *jvm, JNIEnv *env=NULL)

Static Public Member Functions

static xmog_localenvget_instance (JNIEnv *env)
 Returns a local environment for the JNIEnv pointer that is passed in.
static xmog_localenvget_instance (xmog_localenv *env)
 Returns a local environment.
static xmog_localenvget_localenv (JNIEnv *, XMOGVERSION, XMOGCONFIG, XMOGVERSION, const char *, jint)
 Returns a local environment.

Detailed Description

A class representing per-thread information for the integration runtime.

This class provides the necessary abstraction that allows us to support both in-process and out-of-process integration easily. Using APIs provided by this class rather than the internally maintained JNIEnv pointer will greatly improve performance in some scenarios.

This class also maintains several default settings that are, by virtue of this class only being used in a thread-local fashion, per thread settings. The errorhandling policy and the string default encoding are probably the most important of these thread-local settings.


Member Function Documentation

xmog_error_handler* xmog_localenv::get_error_handler  ) 
 

Returns the error handler that's used for this local environment.

Error handlers are thread specific because a programmer must be able to adjust the errorhandling policy in one thread without affecting the entire application.

static xmog_localenv* xmog_localenv::get_instance JNIEnv *  env  )  [static]
 

Returns a local environment for the JNIEnv pointer that is passed in.

While the thread does not have to be attached to the JVM anymore (after all, we already have a JNIEnv pointer), we might need to perform the framework initialization for the thread.

This method is useful in the context of manually implemented native methods, when you want to get a local call environment pointer in the context of a native method call.

Parameters:
env a JNIEnv pointer. Must be non-NULL.

static xmog_localenv* xmog_localenv::get_instance xmog_localenv env  )  [static]
 

Returns a local environment.

Attaches the thread if necessary by calling xmog_jvm::attach().

Parameters:
env a local environment. May be NULL.

static xmog_localenv* xmog_localenv::get_localenv JNIEnv *  ,
XMOGVERSION  ,
XMOGCONFIG  ,
XMOGVERSION  ,
const char *  ,
jint 
[static]
 

Returns a local environment.

Deprecated:
This method is only supplied to provide already written C++ code with an easier migration path to the 3.0 version of the runtime library. Use the get_instance() method instead when you're writing new code.

xmog_base* xmog_localenv::getDefaultEncoding  ) 
 

Returns the default string encoding that is used when native strings are converted to Java strings.

The default value will be based on the platform and the version of Java. A value of NULL is interpreted as meaning that we assume that native strings are UTF-8 strings.

Returns:
the current value of this setting on this thread.

JNIEnv* xmog_localenv::getEnv  ) 
 

Returns the JNIEnv pointer this local environment wraps around.

Deprecated:

void xmog_localenv::in_delete bool  bInDelete  ) 
 

Sets the value of the bInDelete_ field.

Don't call this method directly. It is used internally by the framework.

Parameters:
bInDelete the new value of the field.

void xmog_localenv::in_detach bool  bInDetach  ) 
 

Sets the value of the bInDetach_ field.

Don't call this method directly. It is used internally by the framework.

Parameters:
bInDetach the new value of the field.

void xmog_localenv::in_exception bool  bInException  ) 
 

Sets the value of the bInException_ field.

Don't call this method directly. It is used internally by the framework.

Parameters:
bInException the new value of the field.

void xmog_localenv::set_error_handler xmog_error_handler _eh  ) 
 

Sets the error handler that will be used for this local environment.

Error handlers are thread specific because a programmer must be able to adjust the errorhandling policy in one thread without affecting the entire application.

Parameters:
_eh the error handler instance to be used.

void xmog_localenv::setDefaultEncoding xmog_base _enc  ) 
 

Sets the default string encoding that is used when native strings are converted to Java strings.

The default value will be based on the platform and the version of Java. A value of NULL is interpreted as meaning that the JRE's default encoding is used for strings. The caller remains owner of the _enc instance that is passed into this method.

Parameters:
_enc the default encoding that is used to convert between native strings and Java strings on this thread.
See also:
xmog_jvm::setDefaultEncoding(xmog_base*)

xmog_options::setDefaultEncoding(const char*)


The documentation for this class was generated from the following file:
Generated on Fri Jun 16 10:19:11 2006 for JMS Courier for C++ by  doxygen 1.4.1