Codemesh Runtime v3 C++ API Reference  3.9.205
Public Member Functions | List of all members
IPv4Sockets_JavaVM Class Reference

A JavaVM type that uses IPv4 sockets to communicate with an out-of-process JVM. More...

#include <IPv4Sockets_JavaVM.h>

Inheritance diagram for IPv4Sockets_JavaVM:
Inheritance graph
[legend]
Collaboration diagram for IPv4Sockets_JavaVM:
Collaboration graph
[legend]

Public Member Functions

 IPv4Sockets_JavaVM (xmog_i_comm_strategy *comm_strategy, const ACE_TCHAR *server_addr, unsigned int connect_timeout=0, unsigned int reply_timeout=0)
 
int signon (const char *serverAppNameUTF, const char *clientDisplayNameUTF=NULL, const char *clientSignOnNameUTF=NULL, const char *clientCredentialsUTF=NULL, int authenticationType=0, int strCopyLimit=256, int primArrayCopyLimit=256, bool bMaintainObjId=true, bool bSendStringOnFirstRef=true, bool bAlignData=true)
 Send a SIGNON request to the remote JVM and wait for its reply.
 
int attach (void **penv, JavaVMAttachArgs *args, bool daemon)
 
int submit (xmog_request *request)
 
jstring RemoteNewString (const unsigned short *str, xmog_JNIEnv *env, int len=-1)
 Attempts to create a string on the server.
 
jstring RemoteNewString (const char *str, xmog_JNIEnv *env, xmog_base *encoding, int len=-1)
 Attempts to create a string on the server.
 
jstring RemoteNewString (const char *str, xmog_JNIEnv *env, const char *encoding, int len=-1)
 Attempts to create a string on the server.
 
jstring RemoteNewStringUtf (const char *str, xmog_JNIEnv *env)
 Attempts to create a string on the server.
 
jarray RemoteNewArray (const char *arrType, jsize size, xmog_JNIEnv *env)
 Creates an array and returns the handle. More...
 
jarray RemoteNewPrimitiveArray (const char *arrType, void *pData, jsize size, xmog_JNIEnv *env)
 Creates a primitive array from the given data and returns the handle. More...
 
virtual jarray RemoteNewPrimitiveArray (const char *arrType, xmog::xmog_data_code elemCode, void *pData, jsize length, jsize size, xmog_JNIEnv *env)
 Creates a primitive array from the given data and returns the handle. More...
 
void RemoteGetArrayRegion (const char *arrType, jarray array, jsize start, jsize len, void *buf, xmog_JNIEnv *env)
 Returns the values in a region of an array. More...
 
void RemoteSetArrayRegion (const char *arrType, jarray array, jsize start, jsize len, void *buf, xmog_JNIEnv *env)
 Sets the values of a region of an array. More...
 
jclass RemoteGetSuperClass (jclass sub, xmog_JNIEnv *env)
 Queries for a subtype's superclass. More...
 
jboolean RemoteIsAssignableFrom (jclass sub, jclass sup, xmog_JNIEnv *env)
 Queries for an inheritance relationship between two types. More...
 
jboolean RemoteIsInstanceOf (jobject obj, jclass clazz, xmog_JNIEnv *env)
 Queries for an instance-of relationship between an object and a type. More...
 
jclass RemoteGetClass (jobject obj, xmog_JNIEnv *env)
 Queries for the type of an object. More...
 
- Public Member Functions inherited from xmog_JavaVM
 xmog_JavaVM ()
 The default constructor.
 
 ~xmog_JavaVM ()
 Destructor. More...
 
xmog_jvmgetJvm () const
 Returns the higher-level abstraction that owns this instance.
 
void setJvm (xmog_jvm *jvm_)
 Sets the higher-level abstraction that owns this instance. More...
 
bool getInDestroy ()
 Returns true if this instance has started destroy processing.
 
void setInDestroy (bool b)
 Sets flag to true if this instance has started destroy processing.
 
- Public Member Functions inherited from xmog_remote_ref_map
 xmog_remote_ref_map (xmog_remote_ref_map *parentFrame)
 Constructs a reference map.
 
int get_data (jobject _ref, void **pData, size_t *pLength)
 Returns the cached data associated with a reference.
 
int delete_global (jobject _ref)
 Deletes a global reference from the map. More...
 
jobject new_global (jobject _ref, void *data=NULL, size_t size=0)
 Adds a global reference to the map.
 
int delete_local (jobject _ref)
 Deletes a local reference from the map. More...
 
jobject new_local (jobject _ref, void *data=NULL, size_t size=0)
 Adds a local reference to the map.
 
int delete_weakglobal (jobject _ref)
 Deletes a weak global reference from the map. More...
 
jobject new_weakglobal (jobject _ref, void *data=NULL, size_t size=0)
 Adds a weak global reference to the map.
 
xmog_remote_ref_mappush_frame ()
 Pushes a new frame on the stack and returns the new frame.
 
xmog_remote_ref_mappop_frame ()
 Pops a frame from the stack and returns the parent frame.
 
- Public Member Functions inherited from xmog_class_info_mapper
 xmog_class_info_mapper ()
 Constructs a mapper instance.
 
int register_class (jclass id, jclass super_id, const char *name, size_t numIfcs, jclass *ifcs)
 
int get_super (jclass sub, jclass &sup) const
 
int get_class_name (jclass id, char *&name) const
 
int get_num_ifcs (jclass sub, size_t &size) const
 
int get_ifc (jclass sub, size_t index, jclass &ifc) const
 
int is_assignable (jclass sub, jclass sup, jboolean &bAssignable) const
 

Additional Inherited Members

- Public Types inherited from xmog_remote_ref_map
typedef jobject Key
 
typedef xmog_remote_refValue
 
typedef ACE_Map_Manager< Key, Value, ACE_Null_Mutex > ObjectFrame
 
- Public Types inherited from xmog_class_info_mapper
typedef ACE_Map_Manager< jclass, xmog_class_info, ACE_Recursive_Thread_Mutex > ClassToClassInfoMap
 
- Protected Attributes inherited from xmog_JavaVM
xmog_jvmtheJvm
 A pointer to the higher level abstraction instance that owns this instance. More...
 
bool bInDestroy_
 A guard flag against recursive invocation of the DestroyJavaVM() method.
 

Detailed Description

A JavaVM type that uses IPv4 sockets to communicate with an out-of-process JVM.

IPv4Sockets_JavaVM maintains session state for a process. It is a singleton.

Note
Alex - here is information that can be set to alter this class's work:
  • Comms strategy: As you specified, everything is done by TCP/IP now. However, it is possible to create different derivations from xmog_i_comm_strategy and use those instead. Maybe there can be a setting for which one to use (UDP, UNIX socket, etc.).
  • Server address: A string form address that's appropriate for the comm strategy. For TCP, it should be "host:port".
  • Connect timeout: For TCP, the limit of time to connect to the server, in seconds.
  • Reply timeout: If no reply to a client's request is received in this number of seconds, the server connection is abandoned.

Constructor & Destructor Documentation

◆ IPv4Sockets_JavaVM()

IPv4Sockets_JavaVM::IPv4Sockets_JavaVM ( xmog_i_comm_strategy comm_strategy,
const ACE_TCHAR *  server_addr,
unsigned int  connect_timeout = 0,
unsigned int  reply_timeout = 0 
)

Constructor. Specifies the communications strategy for talking to the server. Uses xmog_i_comm_tcp if not specified. If a xmog_i_comm_strategy pointer is passed in, xmog_jvm takes responsibility for releasing it - it will be deleted when no longer needed.

Member Function Documentation

◆ RemoteGetArrayRegion()

void IPv4Sockets_JavaVM::RemoteGetArrayRegion ( const char *  arrType,
jarray  array,
jsize  start,
jsize  len,
void *  buf,
xmog_JNIEnv env 
)
virtual

Returns the values in a region of an array.

Parameters
arrTypethe array type in JNI representation ("Z" for bool, etc).
arraythe array object handle.
startthe starting index of the region in the array.
lenthe length of the region.
bufthe native buffer into which we get the value.
envthe local environment.

Implements xmog_JavaVM.

◆ RemoteGetClass()

jclass IPv4Sockets_JavaVM::RemoteGetClass ( jobject  obj,
xmog_JNIEnv env 
)
virtual

Queries for the type of an object.

Parameters
objthe object we're testing.
envthe local environment.

Implements xmog_JavaVM.

◆ RemoteGetSuperClass()

jclass IPv4Sockets_JavaVM::RemoteGetSuperClass ( jclass  sub,
xmog_JNIEnv env 
)
virtual

Queries for a subtype's superclass.

Parameters
subthe subtype's handle.
envthe local environment.

Implements xmog_JavaVM.

◆ RemoteIsAssignableFrom()

jboolean IPv4Sockets_JavaVM::RemoteIsAssignableFrom ( jclass  sub,
jclass  sup,
xmog_JNIEnv env 
)
virtual

Queries for an inheritance relationship between two types.

Parameters
subthe subtype's handle.
supthe supertype's handle.
envthe local environment.

Implements xmog_JavaVM.

◆ RemoteIsInstanceOf()

jboolean IPv4Sockets_JavaVM::RemoteIsInstanceOf ( jobject  obj,
jclass  clazz,
xmog_JNIEnv env 
)
virtual

Queries for an instance-of relationship between an object and a type.

Parameters
objthe object we're testing.
clazzthe type we're testing against.
envthe local environment.

Implements xmog_JavaVM.

◆ RemoteNewArray()

jarray IPv4Sockets_JavaVM::RemoteNewArray ( const char *  arrType,
jsize  size,
xmog_JNIEnv env 
)
virtual

Creates an array and returns the handle.

Parameters
arrTypethe array type name in UTF-8 representation.
sizethe array size.
envthe local environment.

Implements xmog_JavaVM.

◆ RemoteNewPrimitiveArray() [1/2]

jarray IPv4Sockets_JavaVM::RemoteNewPrimitiveArray ( const char *  arrType,
void *  pData,
jsize  size,
xmog_JNIEnv env 
)

Creates a primitive array from the given data and returns the handle.

Parameters
arrTypethe array type name in UTF-8 representation.
pDatathe array data.
sizethe array size.
envthe local environment.

◆ RemoteNewPrimitiveArray() [2/2]

virtual jarray IPv4Sockets_JavaVM::RemoteNewPrimitiveArray ( const char *  arrType,
xmog::xmog_data_code  elemCode,
void *  pData,
jsize  length,
jsize  size,
xmog_JNIEnv env 
)
virtual

Creates a primitive array from the given data and returns the handle.

Parameters
arrTypethe array type name in UTF-8 representation.
elemCodethe data code of the element type.
pDatathe array data.
lengththe array length (number of elements).
sizethe array size in bytes.
envthe local environment.

Implements xmog_JavaVM.

◆ RemoteSetArrayRegion()

void IPv4Sockets_JavaVM::RemoteSetArrayRegion ( const char *  arrType,
jarray  array,
jsize  start,
jsize  len,
void *  buf,
xmog_JNIEnv env 
)
virtual

Sets the values of a region of an array.

Parameters
arrTypethe array type in JNI representation ("Z" for bool, etc).
arraythe array object handle.
startthe starting index of the region in the array.
lenthe length of the region.
bufthe native buffer into which we get the value.
envthe local environment.

Implements xmog_JavaVM.

◆ submit()

int IPv4Sockets_JavaVM::submit ( xmog_request request)

Submit a xmog_request for processing on the server. This method queues the xmog_request.

Parameters
requestAn xmog_request that gets queued for processing. On successful completion, the caller must not refer to the request; control is passed to this xmog_jvm object, which will delete it when done. If this operation fails, the caller remains responsible for properly disposing of the request. When completed, the contained ACE_Future is set with the reply information.
Return values
0for success, -1 if the request could not be queued.

The documentation for this class was generated from the following file:

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