Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Implementation of the Java native function deployAppliction()
authorcherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 9 Jul 2008 08:06:42 +0000 (08:06 +0000)
committercherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 9 Jul 2008 08:06:42 +0000 (08:06 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5863 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/java/jmsg.c
src/java/jmsg.h

index cff2db5..908c9c1 100644 (file)
 #include "jmsg_host.h"
 #include "jmsg_task.h"
 #include "jmsg_channel.h"
 #include "jmsg_host.h"
 #include "jmsg_task.h"
 #include "jmsg_channel.h"
+#include "jmsg_application_handler.h"
 #include "jxbt_utilities.h"
 
 #include "jxbt_utilities.h"
 
+
 #include "jmsg.h"
 
 #include "msg/mailbox.h"
 
 #include "jmsg.h"
 
 #include "msg/mailbox.h"
 
+#include "surf/surfxml_parse.h"
+
+
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
 static JavaVM * __java_vm = NULL;
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
 static JavaVM * __java_vm = NULL;
@@ -1135,4 +1140,33 @@ Java_simgrid_msg_MsgNative_taskListenFrom(JNIEnv* env, jclass cls, jstring jalia
   
   return (jint)rv;
 }
   
   return (jint)rv;
 }
+
+JNIEXPORT void JNICALL 
+Java_simgrid_msg_Msg_deployApplication(JNIEnv* env, jclass cls,jstring jdeploymentFile) {
+       
+       const char* deploymentFile = (*env)->GetStringUTFChars(env, jdeploymentFile, 0);
+       
+       surf_parse_reset_parser();
+       
+       surfxml_add_callback(STag_surfxml_process_cb_list, japplication_handler_on_begin_process);
+       
+       surfxml_add_callback(ETag_surfxml_argument_cb_list, japplication_handler_on_process_arg);
+       
+       surfxml_add_callback(STag_surfxml_prop_cb_list, japplication_handler_on_property);
+       
+       surfxml_add_callback(ETag_surfxml_process_cb_list, japplication_handler_on_end_process);
+
+       surf_parse_open(deploymentFile);
+       
+       japplication_handler_on_start_document();
+       
+       if(surf_parse())
+               jxbt_throw_native(env, xbt_strdup("surf_parse() failed"));
+       
+       surf_parse_close();
+       
+       japplication_handler_on_end_document();
+       
+  (*env)->ReleaseStringUTFChars(env, jdeploymentFile, deploymentFile); 
+}
   
   
index 6690965..5d80fc0 100644 (file)
@@ -390,4 +390,7 @@ Java_simgrid_msg_MsgNative_taskListenFromHost(JNIEnv*, jclass, jstring, jobject)
 JNIEXPORT jint JNICALL 
 Java_simgrid_msg_MsgNative_taskListenFrom(JNIEnv*, jclass, jstring);
 
 JNIEXPORT jint JNICALL 
 Java_simgrid_msg_MsgNative_taskListenFrom(JNIEnv*, jclass, jstring);
 
+JNIEXPORT void JNICALL 
+Java_simgrid_msg_Msg_deployApplication(JNIEnv* env, jclass cls,jstring jdeploymentFile);
+
 #endif /* !MSG4JAVA_H */ 
 #endif /* !MSG4JAVA_H */