Codemesh Runtime v3 C++ API Reference  3.9.205
xmog_request.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 1999-2020 by Codemesh, Inc.. ALL RIGHTS RESERVED.
3 //
4 
5 // -*- C++ -*-
6 
7 
8 //==========================================================================
16 //==========================================================================
17 
18 #ifndef xmog_request_inc
19 #define xmog_request_inc
20 
21 class ACE_Message_Block;
22 #include "ace/Basic_Types.h"
23 #include "ace/Future.h"
24 #include "ace/Method_Request.h"
25 #include "ace/Time_Value.h"
26 
27 #include "xmog.h"
28 #include "xmog_JavaVM.h"
29 #include "xmog_JNIEnv.h"
30 #include "xmog_message_types.h"
31 #include "xmog_reply.h"
32 
33 
34 struct xmog_base;
35 
36 
51 {
52 public:
53 
54  enum { INIT_BLOCK_SIZE = 4096 };
55 
62  explicit xmog_request (xmog::xmog_message_id reqtype,
63  const void *orig = 0,
64  bool reply_expected = true);
65  ~xmog_request ();
66 
67  void dump();
68 
69  xmog::xmog_message_id type (void) const;
70 
80  ACE_Future<xmog_reply*> &reply (void);
81 
90  ACE_Message_Block *block (void) const;
91 
95  const void *originator (void) const;
96 
102  void expires (const ACE_Time_Value &expiration);
103 
110  bool expired (const ACE_Time_Value &now) const;
111 
120  void complete (xmog_reply *reply);
121 
128  bool reply_expected (void) const;
129 
133  int writeBoolean( bool b );
134 
138  int writeByte( jbyte b );
139 
143  int writeChar( jchar c );
144 
148  int writeDouble( jdouble d );
149 
153  int writeFloat( jfloat d );
154 
160  int writeInt( jint i );
161 
167  int writeShort( jshort s );
168 
174  int writeLong( jlong l );
175 
182  int writeDataCode( xmog::xmog_data_code code, int align = 4 );
183 
184  int writeDataBoolean( bool b );
185 
186  int writeDataByte( jbyte b );
187 
188  int writeDataChar( jchar ch );
189 
190  int writeDataDouble( jdouble d );
191 
192  int writeDataFloat( jfloat f );
193 
194  int writeDataInt( jint i );
195 
196  int writeDataLong( jlong l );
197 
198  int writeDataShort( jshort s );
199 
200  int writeDataNull( int align );
201 
202  int writeDataProxy( xmog_base * obj, int align, xmog_localenv * env = NULL );
203 
208 
219  int writeDataStringUtf( const char * str, size_t len = (size_t)-1 );
220 
230  int writeDataStringUtf16( const unsigned short * str, size_t len = (size_t)-1 );
231 
242  int writeString( const char * str, size_t len = (size_t)-1 );
243 
255  int writeString( const XMOG_WCHAR * str, size_t len = (size_t)-1 );
256 
269  int writeUTF( const char * utf, size_t len = (size_t)-1 );
270 
277  int writeParameter( const xmog_remote_java_value & val, int align, int & cbAdded );
278 
279 private:
280 
281  xmog::xmog_message_id type_;
282  const void *originator_;
283 
284 protected:
285 
286  ACE_Message_Block *block_;
287 
288 private:
289 
290  ACE_Time_Value expires_; // Abs time at which the request times out
291  ACE_Future<xmog_reply*> reply_;
292  bool reply_expected_;
293 };
294 
295 
297 
299 {
300 public:
301  xmog_request_sign_on () : xmog_request (xmog::SIGN_ON, 0) {}
302 
303  int add_args (const void *jvm_p,
304  int authType,
305  int stringCopyLimit,
306  int primArrayCopyLimit,
307  bool maintainObjID,
308  bool sendStringOnFirstRef,
309  bool alignDataForClient,
310  const char *clientSignOnNameUTF,
311  const char *clientCredentialsUTF,
312  const char *clientDisplayNameUTF,
313  const char *serverAppNameUTF);
314 };
315 
317 {
318 public:
320  : xmog_request (xmog::THREAD_ID_REQUEST, originator) {}
321 
322  int add_args (int fake_thread_id,
323  const JavaVMAttachArgs *args,
324  bool daemon);
325 };
326 
328 {
329 public:
331  : xmog_request (xmog::THREAD_TERMINATED, originator, false) {}
332 
333  int add_args (int threadId, const char *threadName = 0);
334 };
335 
337 {
338 public:
340  : xmog_request (xmog::SESSION_TERMINATED, 0, false) {}
341 };
342 
344 {
345 public:
347  : xmog_request (xmog::MEMBER_IDS_REQUEST, originator) {}
348 
349  int add_args (int threadID, int classID, const char *className, int numMembers = 0, ... /* member names */);
350 };
351 
353 {
354 public:
355  xmog_request_class_info (const void *originator)
356  : xmog_request (xmog::CLASS_INFO_REQUEST, originator) {}
357 
358  int add_args (int threadID, int classID );
359 };
360 
362 {
363 public:
364  xmog_request_drop_refs (const void *originator)
365  : xmog_request (xmog::DROP_OBJECT_REFS, originator, false) {}
366 
367  int add_args( int threadID, int numRefs, jint * pIdsCounts );
368 
369  int add_args( int threadID, jint id, jint count );
370 };
371 
373 {
374 public:
375  xmog_request_field_get (const void *originator)
376  : xmog_request (xmog::GET_FIELD_REQUEST, originator) {}
377 
378  int add_args (int threadID,
379  int classID,
380  int fieldID,
381  bool bLimitReturnValueCopying = true,
382  xmog_base * target = NULL );
383 };
384 
386 {
387 public:
388  xmog_request_field_set (const void *originator)
389  : xmog_request (xmog::SET_FIELD_REQUEST, originator) {}
390 
391  int add_args (int threadID,
392  int classID,
393  int fieldID,
394  xmog_base * target,
395  const xmog_remote_java_value & val,
396  xmog_localenv * env );
397 };
398 
400 {
401 public:
402 
404  : xmog_request (xmog::METHOD_CALL, originator),
405  pDataLengthOffset( 0 ),
406  pNumArgumentsOffset( 0 ),
407  numArgs( 0 ) {}
408 
409  int add_args ( int threadID,
410  xmog_JNIEnv * env,
411  int classID,
412  int methodID,
413  bool bLimitReturnValueCopying,
414  xmog_base * target );
415 
416  int add_param( const xmog_remote_java_value & param, int & cbAdded );
417 
418 private:
419 
420  jint pDataLengthOffset;
421  jint pNumArgumentsOffset;
422  int numArgs;
423 };
424 
426 {
427 public:
428 
429  xmog_request_ctor_call (const void *originator)
430  : xmog_request (xmog::CONSTRUCTOR_CALL, originator),
431  pDataLengthOffset( 0 ),
432  pNumArgumentsOffset( 0 ),
433  numArgs( 0 ) {}
434 
435  int add_args ( int threadID,
436  xmog_JNIEnv * env,
437  int classID,
438  int methodID );
439 
440  int add_param( const xmog_remote_java_value & param, int & cbAdded );
441 
442 private:
443 
444  jint pDataLengthOffset;
445  jint pNumArgumentsOffset;
446  int numArgs;
447 };
448 #endif /* __XMOG_REQUEST_H */
449 
xmog_request::writeEncodedDataString
int writeEncodedDataString(xmog_remote_java_value &data)
Appends an encoded string to the message.
xmog_request::originator
const void * originator(void) const
xmog_request_ctor_call
Definition: xmog_request.h:425
xmog_request::writeDataStringUtf
int writeDataStringUtf(const char *str, size_t len=(size_t) -1)
Appends a UTF-8 encoded string to the message.
xmog_request::writeFloat
int writeFloat(jfloat d)
Appends a jfloat to the message.
xmog_request::writeLong
int writeLong(jlong l)
Appends a 64-bit integer to the message.
xmog_request
Represents a request communicated between client and server.
Definition: xmog_request.h:50
xmog_request::complete
void complete(xmog_reply *reply)
xmog_request::reply_expected
bool reply_expected(void) const
xmog_request::block
ACE_Message_Block * block(void) const
xmog_request::xmog_request
xmog_request(xmog::xmog_message_id reqtype, const void *orig=0, bool reply_expected=true)
xmog_remote_java_value
A helper type used to convey remote Java arguments around.
Definition: xmog_java_value.h:20
xmog_request_thread_id_request
Definition: xmog_request.h:316
xmog_request_field_get
Definition: xmog_request.h:372
xmog_request_field_set
Definition: xmog_request.h:385
xmog_request::writeString
int writeString(const char *str, size_t len=(size_t) -1)
Appends a platform string to the message.
xmog_request::writeUTF
int writeUTF(const char *utf, size_t len=(size_t) -1)
Appends a UTF string to the message.
xmog_request_session_terminated
Definition: xmog_request.h:336
xmog::xmog_message_id
xmog_message_id
The message types that are used in the framework.
Definition: xmog_message_types.h:26
xmog_message_types.h
xmog_request::expires
void expires(const ACE_Time_Value &expiration)
xmog_request_member_ids_request
Definition: xmog_request.h:343
xmog_request::writeShort
int writeShort(jshort s)
Appends a 16bit integer to the message.
xmog_request_class_info
Definition: xmog_request.h:352
xmog_base
The baseclass for all proxy types in the framework.
Definition: xmog_base.h:29
xmog_request::writeBoolean
int writeBoolean(bool b)
Appends a bool to the message.
xmog_request_thread_terminated
Definition: xmog_request.h:327
xmog_request_method_call
Definition: xmog_request.h:399
xmog_request::writeDataStringUtf16
int writeDataStringUtf16(const unsigned short *str, size_t len=(size_t) -1)
Appends a UTF-16 encoded string to the message.
xmog_localenv
A class representing per-thread information for the integration runtime.
Definition: xmog_localenv.h:32
xmog_request::writeInt
int writeInt(jint i)
Appends a 32bit integer to the message.
xmog_request::writeDataCode
int writeDataCode(xmog::xmog_data_code code, int align=4)
Appends a data code with optional padding.
xmog_request::writeByte
int writeByte(jbyte b)
Appends a byte to the message.
xmog_reply
Definition: xmog_reply.h:31
xmog_reply.h
xmog_request::reply
ACE_Future< xmog_reply * > & reply(void)
xmog_request::expired
bool expired(const ACE_Time_Value &now) const
xmog_JNIEnv
An abstract baseclass for concrete JNIEnv implementations.
Definition: xmog_JNIEnv.h:26
xmog_request::writeChar
int writeChar(jchar c)
Appends a jchar to the message.
xmog_request_sign_on
Definition: xmog_request.h:298
xmog_request_drop_refs
Definition: xmog_request.h:361
xmog_request::writeParameter
int writeParameter(const xmog_remote_java_value &val, int align, int &cbAdded)
Writes a parameter to the message.
xmog_request::writeDouble
int writeDouble(jdouble d)
Appends a jdouble to the message.

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