1 /* Functions related to the java storage API. */
3 /* Copyright (c) 2012-2015. 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. */
10 #define MSG_JSTORAGE_H
12 #include "simgrid/msg.h"
17 * This function returns a new java storage instance.
19 * @param env The environment of the current thread
21 * @return A new java storage object.
23 * @exception If the class Storage is not found the function throws the ClassNotFoundException. If the constructor of
24 * this class is not found the function throws the exception NotSuchMethodException.
26 jobject jstorage_new_instance(JNIEnv * env);
29 * This function associated a native storage to a java storage instance.
31 * @param jstorage The java storage instance.
32 * @param storage The native storage to bind.
33 * @param env The environment of the current thread
35 * @exception If the class Storage is not found the function throws the ClassNotFoundException. If the field bind
36 * of this class is not found the function throws the exception NotSuchFieldException.
38 void jstorage_bind(jobject jstorage, msg_storage_t storage, JNIEnv * env);
41 * This function returns a native storage from a java storage instance.
43 * @param jstorage The java storage object from which get the native storage.
44 * @param env The environment of the current thread
46 * @return The function returns the native storage associated to the java storage object.
48 * @exception If the class Storage is not found the function throws the ClassNotFoundException. If the field bind
49 * of this class is not found the function throws the exception NotSuchFieldException.
51 msg_storage_t jstorage_get_native(JNIEnv * env, jobject jstorage);
54 * Class org_simgrid_msg_Storage
58 JNIEXPORT void JNICALL Java_org_simgrid_msg_Storage_nativeInit(JNIEnv*, jclass);
61 * This function returns a global reference to the java storage instance specified by the parameter jstorage.
63 * @param jstorage The original java storage instance.
64 * @param env The environment of the current thread
66 * @return The global reference to the original java storage instance.
68 jobject jstorage_ref(JNIEnv * env, jobject jstorage);
71 * This function delete a global reference to a java storage instance.
73 * @param The global reference to delete.
74 * @param env The environment of the current thread
76 void jstorage_unref(JNIEnv * env, jobject jstorage);
79 * This function returns the name of a MSG storage.
81 * @param jstorage A java storage object.
82 * @param env The environment of the current thread
84 * @return The name of the storage.
86 const char *jstorage_get_name(jobject jstorage, JNIEnv * env);
89 * Class org_simgrid_msg_Storage
91 * Signature (Ljava/lang/String;)Lsimgrid/msg/Storage;
93 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv *, jclass, jstring);
96 * Class org_simgrid_msg_Storage
100 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getSize(JNIEnv *, jobject);
103 * Class org_simgrid_msg_Storage
107 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getFreeSize(JNIEnv *, jobject);
110 * Class org_simgrid_msg_Storage
114 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getUsedSize(JNIEnv *, jobject);
117 * Class org_simgrid_msg_Storage
119 * Signature (Ljava/lang/String;)Ljava/lang/String;
121 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getProperty(JNIEnv *env, jobject jstorage, jobject jname);
124 * Class org_simgrid_msg_Storage
126 * Signature (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
128 JNIEXPORT void JNICALL
129 Java_org_simgrid_msg_Storage_setProperty(JNIEnv *env, jobject jstorage, jobject jname, jobject jvalue);
132 * Class org_simgrid_msg_Storage
134 * Signature (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
136 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getHost(JNIEnv * env,jobject jstorage);
139 * Class org_simgrid_msg_Storage
142 JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Storage_all(JNIEnv *, jclass);
145 #endif /*!MSG_JSTORAGE_H */