Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git://scm.gforge.inria.fr/simgrid/simgrid-java
[simgrid.git] / org / simgrid / msg / Msg.java
index 40c9ea2..c2b9cd7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * JNI interface to C code for MSG.
  * 
- * Copyright 2006,2007,2010 The SimGrid Team.           
+ * Copyright 2006,2007,2010,2011 The SimGrid Team.           
  * All right reserved. 
  *
  * This program is free software; you can redistribute 
@@ -9,51 +9,33 @@
  * (GNU LGPL) which comes with this package.
  */
 
-package simgrid.msg;
+package org.simgrid.msg;
 
 public final class Msg {
        /* Statically load the library which contains all native functions used in here */
        static {
                try {
-                       System.loadLibrary("simgrid");
+                       System.loadLibrary("SG_java");
                } catch(UnsatisfiedLinkError e) {
-                       System.err.println("Cannot load simgrid library: ");
+                       System.err.println("Cannot load the bindings to the simgrid library: ");
                        e.printStackTrace();
                        System.err.println(
-                                       "Please check your LD_LIBRARY_PATH, or copy the library to the current directory");
+                                       "Please check your LD_LIBRARY_PATH, or copy the simgrid and SG_java libraries to the current directory");
                        System.exit(1);
                }
        }
-
-       /* FIXME: kill these C crufts */
-       /** Returns the last error code of the simulation */
-       public final static native int getErrCode();
-
-       /** Everything is right. Keep on going the way ! */
-       public static final int SUCCESS = 0;
-
-       /** Something must be not perfectly clean (but I may be paranoid freak...) */
-       public static final int WARNING = 1;
-
-       /** There has been a problem during your task transfer.
-        *  Either the network is  down or the remote host has been shutdown */
-       public static final int TRANSFERT_FAILURE = 2;
-
-       /** System shutdown. 
-        *  The host on which you are running has just been rebooted.
-        *  Free your data structures and return now ! */
-       public static final int HOST_FAILURE = 3;
-
-       /** Canceled task. This task has been canceled by somebody ! */
-       public static final int TASK_CANCELLLED = 4;
-
-       /** You've done something wrong. You'd better look at it... */
-       public static final int FATAL_ERROR = 5;
-
-       /** Retrieve the simulation time */
+    /** Retrieve the simulation time
+     * @return
+     */
        public final static native double getClock();
-
-       /** Issue an information logging message */
+       /**
+        * Issue an "debug" logging message.
+        * @param s message to log.
+        */
+       public final static native void debug(String s);
+    /** Issue an information logging message
+     * @param s
+     */
        public final static native void info(String s);
 
        /*********************************************************************************
@@ -70,14 +52,29 @@ public final class Msg {
        public final static native void init(String[]args);
 
        /**
-        * Run the MSG simulation, and cleanup everything afterward.
+        * Run the MSG simulation.
         *
-        * If you want to chain simulations in the same process, you
-        * should call again createEnvironment and deployApplication afterward.
+        * The simulation is not cleaned afterward (see  
+        * {@link #clean()} if you really insist on cleaning the C side), so you can freely 
+        * retrieve the informations that you want from the simulation. In particular, retrieving the status 
+        * of a process or the current date is perfectly ok. 
         *
-        * @see                    MSG_run, MSG_clean
+        * @see                    MSG_run
         */
        public final static native void run() ;
+       
+       /**
+        * Cleanup the MSG simulation.
+        * 
+        * This function is only useful if you want to chain the simulations within 
+        * the same environment. But actually, it's not sure at all that cleaning the 
+        * JVM is faster than restarting a new one, so it's probable that using this 
+        * function is not a brilliant idea. Do so at own risk.
+        *      
+        * @see                    MSG_clean
+        */
+       public final static native void clean();
+       
 
        /**
         * The native implemented method to create the environment of the simulation.
@@ -90,11 +87,15 @@ public final class Msg {
        /**
         * The method to deploy the simulation.
         *
-        * @param platformFile    The XML file which contains the description of the application to deploy.
-        */
+     *
+     * @param deploymentFile
+     */
        public final static native void deployApplication(String deploymentFile);
 
-       /** Example launcher. You can use it or provide your own launcher, as you wish */
+    /** Example launcher. You can use it or provide your own launcher, as you wish
+     * @param args
+     * @throws MsgException
+     */
        static public void main(String[]args) throws MsgException {
                /* initialize the MSG simulation. Must be done before anything else (even logging). */
                Msg.init(args);