Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / bindings / java / org / simgrid / msg / Host.java
index c00dd54..07dace8 100644 (file)
@@ -1,16 +1,15 @@
-/*
- * Bindings to the MSG hosts
- *
- * Copyright 2006-2012 The SimGrid Team           
- * All right 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. 
- *
- */  
+/* Bindings to the MSG hosts */
+
+/* Copyright (c) 2006-2014. 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. */
+
 package org.simgrid.msg;
 
+import org.simgrid.msg.Storage;
+
 /**
  * A host object represents a location (any possible place) where a process may run. 
  * Thus it is represented as a physical resource with computing capabilities, some 
@@ -53,7 +52,7 @@ public class Host {
        /**
         * Host name
         */
-       private String name;
+       protected String name;
 
        /**
         * User data.
@@ -66,6 +65,11 @@ public class Host {
                this.bind = 0;
                this.data = null;
        };
+       
+       public String toString (){
+               return this.name; 
+               
+       }
 
        /**
         * This static method gets an host instance associated with a native
@@ -101,6 +105,20 @@ public class Host {
         */ 
        public native static Host[] all();
 
+    /** 
+     * This static method sets a mailbox to receive in asynchronous mode.
+     * 
+     * All messages sent to this mailbox will be transferred to 
+     * the receiver without waiting for the receive call. 
+     * The receive call will still be necessary to use the received data.
+     * If there is a need to receive some messages asynchronously, and some not, 
+     * two different mailboxes should be used.
+     *
+     * @param mailboxName The name of the mailbox
+     */
+    public static native void setAsyncMailbox(String mailboxName);
+
+
        /**
         * This method returns the name of a host.
         * @return                      The name of the host.
@@ -109,6 +127,7 @@ public class Host {
        public String getName() {
                return name;
        }
+
        /**
         * Sets the data of the host.
      * @param data
@@ -134,6 +153,17 @@ public class Host {
                return null != this.data;
        }
 
+       /**
+        * This method start the host if it is off
+        */ 
+       public native void on();
+
+       /**
+        * This method stop the host if it is on
+        */ 
+       public native void off();
+
+
        /**
         * This method returns the number of tasks currently running on a host.
         * The external load is not taken in account.
@@ -150,18 +180,40 @@ public class Host {
         *
         */ 
        public native double getSpeed();
+
+       /**
+        * This method returns the number of core of a host.
+        *
+        * @return                      The speed of the processor of the host in flops.
+        *
+        */ 
+       public native double getCoreNumber();
+
        /**
         * Returns the value of a given host property. 
         */
        public native String getProperty(String name);
+       
        /**
         * Change the value of a given host property. 
         */
        public native void setProperty(String name, String value);
-    /** This method tests if a host is available.
-     * @return True if the host is available.
+    
+       /** This method tests if a host is up and running.
+        * @return True if the host is available.
+        */
+       public native boolean isOn();
+
+       /** This methods returns the list of mount point names on an host
+     * @return An array containing all mounted storages on the host
+     */
+       public native Storage[] getMountedStorage();
+
+       /** This methods returns the list of storages attached to an host
+     * @return An array containing all storages (name) attached to the host
      */
-       public native boolean isAvail();
+       public native String[] getAttachedStorage();
+       
        
        /**
         * Class initializer, to initialize various JNI stuff