4 * Copyright 2006,2007 Martin Quinson, Malek Cherier All right 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 * This contains the declarations of the functions in relation with the java
13 #ifndef MSG_JPROCESS_H
14 #define MSG_JPROCESS_H
20 * This function returns a global reference to the java process instance
21 * specified by the parameter jprocess.
23 * @param jprocess The original java process instance.
24 * @param env The env of the current thread
26 * @return The global reference to the original java process
30 jprocess_new_global_ref(jobject jprocess,JNIEnv* env);
33 * This function delete a global reference to a java process instance.
34 * If the java process is alive the function joins it and stops it before.
36 * @param The global refernce to delete.
37 * @param env The env of the current thread
39 * @see jprocess_join()
40 * @see jprocess_exit()
43 jprocess_delete_global_ref(jobject jprocess,JNIEnv* env);
47 * This function tests if the specified java process instance is alive.
48 * A java process object is alive if it has been started and has not yet
51 * @param jprocess The java process to test.
52 * @param env The env of the current thread
54 * @exception If the class Process is not found the function throws
55 * the ClassNotFoundException. If the methos isAlive() of
56 * this class is not found the function throws the exception
57 * NotSuchMethodException.
59 * @return If the java process is alive the function returns
60 * true. Otherwise the function returns false.
63 jprocess_is_alive(jobject jprocess,JNIEnv* env);
66 * This function waits for a java process to terminate.
68 * @param jprocess The java process ot wait for.
69 * @param env The env of the current thread
71 * @exception If the class Process is not found the function throws
72 * the ClassNotFoundException. If the methos join() of
73 * this class is not found the function throws the exception
74 * NotSuchMethodException.
78 jprocess_join(jobject jprocess,JNIEnv* env);
81 * This function starts the specified java process.
83 * @param jprocess The java process to start.
84 * @param env The env of the current thread
86 * @exception If the class Process is not found the function throws
87 * the ClassNotFoundException. If the methos start() of
88 * this class is not found the function throws the exception
89 * NotSuchMethodException.
92 jprocess_start(jobject jprocess,JNIEnv* env);
95 * This function forces the java process to stop.
97 * @param jprocess The java process to stop.
98 * @param env The env of the current thread
100 * @exception If the class Process is not found the function throws
101 * the ClassNotFoundException. If the methos stop() of
102 * this class is not found the function throws the exception
103 * NotSuchMethodException.
106 jprocess_exit(jobject jprocess,JNIEnv* env);
109 * This function associated a native process to a java process instance.
111 * @param jprocess The java process instance.
112 * @param process The native process to bind.
113 * @param env The env of the current thread
115 * @exception If the class Process is not found the function throws
116 * the ClassNotFoundException. If the field bind of
117 * this class is not found the function throws the exception
118 * NotSuchFieldException.
121 jprocess_bind(jobject jprocess,m_process_t process,JNIEnv* env);
124 * This function returns a native process from a java process instance.
126 * @param jprocess The java process object from which get the native process.
127 * @param env The env of the current thread
129 * @return The function returns the native process associated to the
130 * java process object.
132 * @exception If the class Process is not found the function throws
133 * the ClassNotFoundException. If the field bind of
134 * this class is not found the function throws the exception
135 * NotSuchFieldException.
138 jprocess_to_native_process(jobject jprocess,JNIEnv* env);
141 * This function gets the id of the specified java process.
143 * @param jprocess The java process to get the id.
144 * @param env The env of the current thread
146 * @exception If the class Process is not found the function throws
147 * the ClassNotFoundException. If the field id of
148 * this class is not found the function throws the exception
149 * NotSuchFieldException.
151 * @return The id of the specified java process.
154 jprocess_get_id(jobject jprocess,JNIEnv* env);
157 * This function tests if a java process instance is valid.
158 * A java process object is valid if it is bind to a native
161 * @param jprocess The java process to test the validity.
162 * @param env The env of the current thread
164 * @return If the java process is valid the function returns true.
165 * Otherwise the function returns false.
168 jprocess_is_valid(jobject jprocess,JNIEnv* env);
171 * This function gets the name of the specified java process.
173 * @param jprocess The java process to get the name.
174 * @param env The env of the current thread
176 * @exception If the class Process is not found the function throws
177 * the ClassNotFoundException. If the field name of
178 * this class is not found the function throws the exception
179 * NotSuchFieldException.
181 * @return The name of the specified java process.
184 jprocess_get_name(jobject jprocess,JNIEnv* env);
187 * This function yields the specified java process.
189 * @param jprocess The java process to yield.
190 * @param env The env of the current thread.
192 * @exception If the class Process is not found the function throws
193 * the ClassNotFoundException. If the method switchProcess of
194 * this class is not found the function throws the exception
195 * NotSuchMethodException.
198 jprocess_yield(jobject jprocess,JNIEnv* env);
201 * This function locks the mutex of the specified java process.
203 * @param jprocess The java process of the mutex to lock.
204 * @param env The env of the current thread.
206 * @exception If the class Process is not found the function throws
207 * the ClassNotFoundException. If the method lockMutex of
208 * this class is not found the function throws the exception
209 * NotSuchMethodException.
212 jprocess_lock_mutex(jobject jprocess,JNIEnv* env);
215 * This function unlocks the mutex of the specified java process.
217 * @param jprocess The java process of the mutex to unlock.
218 * @param env The env of the current thread.
220 * @exception If the class Process is not found the function throws
221 * the ClassNotFoundException. If the method unlockMutex of
222 * this class is not found the function throws the exception
223 * NotSuchMethodException.
226 jprocess_unlock_mutex(jobject jprocess,JNIEnv* env);
229 * This function signals the condition of the mutex of the specified java process.
231 * @param jprocess The java process of the condtion to signal.
232 * @param env The env of the current thread.
234 * @exception If the class Process is not found the function throws
235 * the ClassNotFoundException. If the method signalCond of
236 * this class is not found the function throws the exception
237 * NotSuchMethodException.
240 jprocess_signal_cond(jobject jprocess,JNIEnv* env);
243 * This function waits the condition of the mutex of the specified java process.
245 * @param jprocess The java process of the condtion to wait for.
246 * @param env The env of the current thread.
248 * @exception If the class Process is not found the function throws
249 * the ClassNotFoundException. If the method waitCond of
250 * this class is not found the function throws the exception
251 * NotSuchMethodException.
254 jprocess_wait_cond(jobject jprocess,JNIEnv* env);
257 #endif /* !MSG_JPROCESS_H */