Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
throw the right exception corresponding to TimeoutFailureException
[simgrid.git] / src / java / jmsg_host.h
1 /*
2  * $Id$
3  *
4  * Copyright 2006,2007 Martin Quinson, Malek Cherier All right reserved. 
5  *
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.
8  *
9  * This contains the declarations of the functions in relation with the java
10  * host instance.
11  */
12
13 #ifndef MSG_JHOST_H
14 #define MSG_JHOST_H
15
16 #include <jni.h>
17 #include "msg/msg.h"
18
19 /**
20  * This function returns a new java host instance.
21  *
22  * @param env                   The environment of the current thread
23  *
24  * @return                              A new java host object.
25  *
26  * @exception                   If the class Host is not found the function throws 
27  *                                              the ClassNotFoundException. If the constructor of 
28  *                                              this class is not found the function throws the exception 
29  *                                              NotSuchMethodException.
30  */
31 jobject jhost_new_instance(JNIEnv * env);
32
33 /**
34  * This function returns a global reference to the  java host instance 
35  * specified by the parameter jhost.
36  *
37  * @param jhost                 The original java host instance.
38  * @param env                   The environment of the current thread
39  *
40  * @return                              The global reference to the original java host 
41  *                                              instance.
42  */
43 jobject jhost_ref(JNIEnv * env, jobject jhost);
44 /**
45  * This function delete a global reference to a java host instance.
46  *
47  * @param                               The global refernce to delete.
48  * @param env                   The environment of the current thread
49  */
50 void jhost_unref(JNIEnv * env, jobject jhost);
51
52 /**
53  * This function associated a native host to a java host instance.
54  *
55  * @param jhost                 The java host instance.
56  * @param host                  The native host to bind.
57  * @param env                   The environment of the current thread
58  *
59  * @exception                   If the class Host is not found the function throws 
60  *                                              the ClassNotFoundException. If the field bind of 
61  *                                              this class is not found the function throws the exception 
62  *                                              NotSuchFieldException.  
63  */
64 void jhost_bind(jobject jhost, m_host_t host, JNIEnv * env);
65
66 /**
67  * This function returns a native host from a java host instance.
68  *
69  * @param jhost                 The java host object from which get the native host.
70  * @param env                   The environment of the current thread
71  *
72  * @return                              The function returns the native host associated to the
73  *                                              java host object.
74  *
75  * @exception                   If the class Host is not found the function throws 
76  *                                              the ClassNotFoundException. If the field bind of 
77  *                                              this class is not found the function throws the exception 
78  *                                              NotSuchFieldException.  
79  */
80 m_host_t jhost_get_native(JNIEnv * env, jobject jhost);
81
82 /**
83  * This function returns the name of a MSG host.
84  *
85  * @param jhost                 A java host object.
86  * @param env                   The environment of the current thread
87  *
88  * @return                              The name of the host.
89  */
90 const char *jhost_get_name(jobject jhost, JNIEnv * env);
91
92
93 /**
94  * This function sets the name of a MSG host.
95  *
96  * @param host                  The host concerned by the operation.
97  * @param jname                 The new name of the host.
98  * @param env                   The environment of the current thread
99  */
100 void jhost_set_name(jobject jhost, jstring jname, JNIEnv * env);
101
102 /**
103  * This function tests if a java host instance is valid.
104  * A java host object is valid if it is bind to a native host.
105  *
106  * @param jhost                 The host to test the validity.
107  * @param env                   The environment of the current thread
108  *
109  * @return                              If the java host is valid the function returns true.
110  *                                              Otherwise the function returns false.
111  */
112 jboolean jhost_is_valid(jobject jhost, JNIEnv * env);
113
114 #endif /*!MSG_JHOST_H */