1 /* Functions related to the java storage API. */
3 /* Copyright (c) 2012-2014. 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"
15 * This function returns a new java storage instance.
17 * @param env The environment of the current thread
19 * @return A new java storage object.
21 * @exception If the class Storage is not found the function throws
22 * the ClassNotFoundException. If the constructor of
23 * this class is not found the function throws the exception
24 * 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
36 * the ClassNotFoundException. If the field bind of
37 * this class is not found the function throws the exception
38 * NotSuchFieldException.
40 void jstorage_bind(jobject jstorage, msg_storage_t storage, JNIEnv * env);
44 * This function returns a native storage from a java storage instance.
46 * @param jstorage The java storage object from which get the native storage.
47 * @param env The environment of the current thread
49 * @return The function returns the native storage associated to the
50 * java storage object.
52 * @exception If the class Storage is not found the function throws
53 * the ClassNotFoundException. If the field bind of
54 * this class is not found the function throws the exception
55 * NotSuchFieldException.
57 msg_storage_t jstorage_get_native(JNIEnv * env, jobject jstorage);
61 * Class org_simgrid_msg_Storage
65 JNIEXPORT void JNICALL
66 Java_org_simgrid_msg_Storage_nativeInit(JNIEnv*, jclass);
70 * This function returns a global reference to the java storage instance
71 * specified by the parameter jstorage.
73 * @param jstorage The original java storage instance.
74 * @param env The environment of the current thread
76 * @return The global reference to the original java storage
79 jobject jstorage_ref(JNIEnv * env, jobject jstorage);
81 * This function delete a global reference to a java storage instance.
83 * @param The global reference to delete.
84 * @param env The environment of the current thread
86 void jstorage_unref(JNIEnv * env, jobject jstorage);
89 * This function returns the name of a MSG storage.
91 * @param jstorage A java storage object.
92 * @param env The environment of the current thread
94 * @return The name of the storage.
96 const char *jstorage_get_name(jobject jstorage, JNIEnv * env);
99 * Class org_simgrid_msg_Storage
101 * Signature (Ljava/lang/String;)Lsimgrid/msg/Storage;
103 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv *, jclass, jstring);
106 * Class org_simgrid_msg_Storage
110 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getSize(JNIEnv *, jobject);
113 * Class org_simgrid_msg_Storage
117 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getFreeSize(JNIEnv *, jobject);
120 * Class org_simgrid_msg_Storage
124 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getUsedSize(JNIEnv *, jobject);
127 * Class org_simgrid_msg_Storage
129 * Signature (Ljava/lang/String;)Ljava/lang/String;
131 JNIEXPORT jobject JNICALL
132 Java_org_simgrid_msg_Storage_getProperty(JNIEnv *env, jobject jstorage, jobject jname);
134 * Class org_simgrid_msg_Storage
136 * Signature (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
138 JNIEXPORT void JNICALL
139 Java_org_simgrid_msg_Storage_setProperty(JNIEnv *env, jobject jstorage, jobject jname, jobject jvalue);
142 * Class org_simgrid_msg_Storage
144 * Signature (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
146 JNIEXPORT jobject JNICALL
147 Java_org_simgrid_msg_Storage_getHost(JNIEnv * env,jobject jstorage);
150 * Class org_simgrid_msg_Storage
153 JNIEXPORT jobjectArray JNICALL
154 Java_org_simgrid_msg_Storage_all(JNIEnv *, jclass);
157 #endif /*!MSG_JSTORAGE_H */