1 /* Upcalls to the Java functions used as callback to the FleXML parser. */
3 /* Copyright (c) 2008, 2009, 2010. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
9 #include "jmsg_application_handler.h"
13 #include "surf/surfxml_parse.h"
14 #include "jxbt_utilities.h"
15 void japplication_handler_on_start_document(void)
18 JNIEnv *env = get_current_thread_env();
20 jxbt_get_static_smethod(env, "org/simgrid/msg/ApplicationHandler",
21 "onStartDocument", "()V");
24 || !(cls = jxbt_get_class(env, "org/simgrid/msg/ApplicationHandler")))
27 (*env)->CallStaticVoidMethod(env, cls, id);
30 void japplication_handler_on_end_document(void)
33 JNIEnv *env = get_current_thread_env();
35 jxbt_get_static_smethod(env, "org/simgrid/msg/ApplicationHandler",
36 "onEndDocument", "()V");
39 || !(cls = jxbt_get_class(env, "org/simgrid/msg/ApplicationHandler")))
42 (*env)->CallStaticVoidMethod(env, cls, id);
45 void japplication_handler_on_begin_process(void)
50 JNIEnv *env = get_current_thread_env();
52 jxbt_get_static_smethod(env, "org/simgrid/msg/ApplicationHandler",
54 "(Ljava/lang/String;Ljava/lang/String;)V");
56 || !(cls = jxbt_get_class(env, "org/simgrid/msg/ApplicationHandler")))
58 jhostName = (jstring) (*env)->NewStringUTF(env, A_surfxml_process_host);
60 (jstring) (*env)->NewStringUTF(env, A_surfxml_process_function);
61 (*env)->CallStaticVoidMethod(env, cls, id, jhostName, jfunction);
64 void japplication_handler_on_process_arg(void)
68 JNIEnv *env = get_current_thread_env();
70 jxbt_get_static_smethod(env, "org/simgrid/msg/ApplicationHandler",
71 "onProcessArg", "(Ljava/lang/String;)V");
73 || !(cls = jxbt_get_class(env, "org/simgrid/msg/ApplicationHandler")))
75 jarg = (jstring) (*env)->NewStringUTF(env, A_surfxml_argument_value);
77 (*env)->CallStaticVoidMethod(env, cls, id, jarg);
80 void japplication_handler_on_property(void)
85 JNIEnv *env = get_current_thread_env();
87 jxbt_get_static_smethod(env, "org/simgrid/msg/ApplicationHandler",
89 "(Ljava/lang/String;Ljava/lang/String;)V");
91 || !(cls = jxbt_get_class(env, "org/simgrid/msg/ApplicationHandler")))
94 jid = (jstring) (*env)->NewStringUTF(env, A_surfxml_prop_id);
95 jvalue = (jstring) (*env)->NewStringUTF(env, A_surfxml_prop_value);
96 (*env)->CallStaticVoidMethod(env, cls, id, jid, jvalue);
99 void japplication_handler_on_end_process(void)
101 JNIEnv *env = get_current_thread_env();
104 jxbt_get_static_smethod(env, "org/simgrid/msg/ApplicationHandler",
105 "onEndProcess", "()V");
107 || !(cls = jxbt_get_class(env, "org/simgrid/msg/ApplicationHandler")))
109 (*env)->CallStaticVoidMethod(env, cls, id);