X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3080c6b0d097d6b3b7d5b3dda0592154ce438f64..a6c64d74cc84ef31accb835f570f990f5c45ecf8:/src/bindings/java/jmsg_storage.h diff --git a/src/bindings/java/jmsg_storage.h b/src/bindings/java/jmsg_storage.h index eeda61e123..ea6dc3651e 100644 --- a/src/bindings/java/jmsg_storage.h +++ b/src/bindings/java/jmsg_storage.h @@ -1,157 +1,50 @@ -/* Functions related to the java storage API. */ +/* Java bindings of the Storage API. */ -/* Copyright (c) 2012-2014. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ #ifndef MSG_JSTORAGE_H #define MSG_JSTORAGE_H + +#include "simgrid/msg.h" #include -#include "msg/msg.h" -/** - * This function returns a new java storage instance. - * - * @param env The environment of the current thread - * - * @return A new java storage object. - * - * @exception If the class Storage is not found the function throws - * the ClassNotFoundException. If the constructor of - * this class is not found the function throws the exception - * NotSuchMethodException. - */ +SG_BEGIN_DECL() + +/** Returns a new java instance of a storage. */ jobject jstorage_new_instance(JNIEnv * env); -/** - * This function associated a native storage to a java storage instance. - * - * @param jstorage The java storage instance. - * @param storage The native storage to bind. - * @param env The environment of the current thread - * - * @exception If the class Storage is not found the function throws - * the ClassNotFoundException. If the field bind of - * this class is not found the function throws the exception - * NotSuchFieldException. - */ +/** Binds a native instance to a java instance. */ void jstorage_bind(jobject jstorage, msg_storage_t storage, JNIEnv * env); - -/** - * This function returns a native storage from a java storage instance. - * - * @param jstorage The java storage object from which get the native storage. - * @param env The environment of the current thread - * - * @return The function returns the native storage associated to the - * java storage object. - * - * @exception If the class Storage is not found the function throws - * the ClassNotFoundException. If the field bind of - * this class is not found the function throws the exception - * NotSuchFieldException. - */ +/** Extracts the native instance associated to a java instance. */ msg_storage_t jstorage_get_native(JNIEnv * env, jobject jstorage); +/** Initialize the native world, called from the Java world at startup */ +JNIEXPORT void JNICALL Java_org_simgrid_msg_Storage_nativeInit(JNIEnv *env, jclass cls); -/** - * Class org_simgrid_msg_Storage - * Method nativeInit - * Signature ()V - */ -JNIEXPORT void JNICALL -Java_org_simgrid_msg_Storage_nativeInit(JNIEnv*, jclass); - - -/** - * This function returns a global reference to the java storage instance - * specified by the parameter jstorage. - * - * @param jstorage The original java storage instance. - * @param env The environment of the current thread - * - * @return The global reference to the original java storage - * instance. - */ +/** Take a ref onto the java instance (to prevent its collection) */ jobject jstorage_ref(JNIEnv * env, jobject jstorage); -/** - * This function delete a global reference to a java storage instance. - * - * @param The global reference to delete. - * @param env The environment of the current thread - */ + +/** Release a ref onto the java instance */ void jstorage_unref(JNIEnv * env, jobject jstorage); -/** - * This function returns the name of a MSG storage. - * - * @param jstorage A java storage object. - * @param env The environment of the current thread - * - * @return The name of the storage. - */ +/** Get the name of a java instance. */ const char *jstorage_get_name(jobject jstorage, JNIEnv * env); -/* - * Class org_simgrid_msg_Storage - * Method getByName - * Signature (Ljava/lang/String;)Lsimgrid/msg/Storage; - */ -JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv *, jclass, jstring); - -/* - * Class org_simgrid_msg_Storage - * Method getSize - * Signature ()D - */ -JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getSize(JNIEnv *, jobject); - -/* - * Class org_simgrid_msg_Storage - * Method getFreeSize - * Signature ()D - */ -JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getFreeSize(JNIEnv *, jobject); - -/* - * Class org_simgrid_msg_Storage - * Method getUsedSize - * Signature ()D - */ -JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getUsedSize(JNIEnv *, jobject); - -/* - * Class org_simgrid_msg_Storage - * Method getProperty - * Signature (Ljava/lang/String;)Ljava/lang/String; - */ -JNIEXPORT jobject JNICALL -Java_org_simgrid_msg_Storage_getProperty(JNIEnv *env, jobject jstorage, jobject jname); -/* - * Class org_simgrid_msg_Storage - * Method setProperty - * Signature (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; - */ -JNIEXPORT void JNICALL -Java_org_simgrid_msg_Storage_setProperty(JNIEnv *env, jobject jstorage, jobject jname, jobject jvalue); - -/* - * Class org_simgrid_msg_Storage - * Method getHost - * Signature (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; - */ -JNIEXPORT jobject JNICALL -Java_org_simgrid_msg_Storage_getHost(JNIEnv * env,jobject jstorage); - -/** - * Class org_simgrid_msg_Storage - * Method all - */ -JNIEXPORT jobjectArray JNICALL -Java_org_simgrid_msg_Storage_all(JNIEnv *, jclass); +/* Implement the Java API */ +JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv* env, jclass cls, jstring jname); +JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getSize(JNIEnv *env, jobject jstorage); +JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getFreeSize(JNIEnv *env, jobject jstorage); +JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getUsedSize(JNIEnv *env, jobject jstorage); +JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getProperty(JNIEnv *env, jobject jstorage, jobject jname); +JNIEXPORT void JNICALL Java_org_simgrid_msg_Storage_setProperty(JNIEnv* env, jobject jstorage, jobject jname, + jobject jvalue); +JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getHost(JNIEnv * env,jobject jstorage); +JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Storage_all(JNIEnv *env, jclass cls); -#endif /*!MSG_JSTORAGE_H */ +SG_END_DECL() +#endif