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
24 * the ClassNotFoundException. If the constructor of
25 * this class is not found the function throws the exception
26 * NotSuchMethodException.
28 jobject jstorage_new_instance(JNIEnv * env);
31 * This function associated a native storage to a java storage instance.
33 * @param jstorage The java storage instance.
34 * @param storage The native storage to bind.
35 * @param env The environment of the current thread
37 * @exception If the class Storage is not found the function throws
38 * the ClassNotFoundException. If the field bind of
39 * this class is not found the function throws the exception
40 * NotSuchFieldException.
42 void jstorage_bind(jobject jstorage, msg_storage_t storage, JNIEnv * env);
46 * This function returns a native storage from a java storage instance.
48 * @param jstorage The java storage object from which get the native storage.
49 * @param env The environment of the current thread
51 * @return The function returns the native storage associated to the
52 * java storage object.
54 * @exception If the class Storage is not found the function throws
55 * the ClassNotFoundException. If the field bind of
56 * this class is not found the function throws the exception
57 * NotSuchFieldException.
59 msg_storage_t jstorage_get_native(JNIEnv * env, jobject jstorage);
63 * Class org_simgrid_msg_Storage
67 JNIEXPORT void JNICALL
68 Java_org_simgrid_msg_Storage_nativeInit(JNIEnv*, jclass);
72 * This function returns a global reference to the java storage instance
73 * specified by the parameter jstorage.
75 * @param jstorage The original java storage instance.
76 * @param env The environment of the current thread
78 * @return The global reference to the original java storage
81 jobject jstorage_ref(JNIEnv * env, jobject jstorage);
83 * This function delete a global reference to a java storage instance.
85 * @param The global reference to delete.
86 * @param env The environment of the current thread
88 void jstorage_unref(JNIEnv * env, jobject jstorage);
91 * This function returns the name of a MSG storage.
93 * @param jstorage A java storage object.
94 * @param env The environment of the current thread
96 * @return The name of the storage.
98 const char *jstorage_get_name(jobject jstorage, JNIEnv * env);
101 * Class org_simgrid_msg_Storage
103 * Signature (Ljava/lang/String;)Lsimgrid/msg/Storage;
105 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv *, jclass, jstring);
108 * Class org_simgrid_msg_Storage
112 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getSize(JNIEnv *, jobject);
115 * Class org_simgrid_msg_Storage
119 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getFreeSize(JNIEnv *, jobject);
122 * Class org_simgrid_msg_Storage
126 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getUsedSize(JNIEnv *, jobject);
129 * Class org_simgrid_msg_Storage
131 * Signature (Ljava/lang/String;)Ljava/lang/String;
133 JNIEXPORT jobject JNICALL
134 Java_org_simgrid_msg_Storage_getProperty(JNIEnv *env, jobject jstorage, jobject jname);
136 * Class org_simgrid_msg_Storage
138 * Signature (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
140 JNIEXPORT void JNICALL
141 Java_org_simgrid_msg_Storage_setProperty(JNIEnv *env, jobject jstorage, jobject jname, jobject jvalue);
144 * Class org_simgrid_msg_Storage
146 * Signature (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
148 JNIEXPORT jobject JNICALL
149 Java_org_simgrid_msg_Storage_getHost(JNIEnv * env,jobject jstorage);
152 * Class org_simgrid_msg_Storage
155 JNIEXPORT jobjectArray JNICALL
156 Java_org_simgrid_msg_Storage_all(JNIEnv *, jclass);
160 #endif /*!MSG_JSTORAGE_H */