Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
New stable version with the add of the Maheve algorithm.
[mapping.git] / src / and / Mapping / Utils.java
index a5ec4d2..068789d 100644 (file)
@@ -69,7 +69,19 @@ public class Utils
                        e.printStackTrace();
                        System.exit( 1 ) ;
                } 
+               
+               /* Host IP */
+               String ip = null ;
+               try {
+                       InetAddress addr = InetAddress.getLocalHost() ;
+                       ip = addr.getHostAddress() ;
+               } catch( final Exception e ) {
+                       System.err.println( "Unalbe to retrieve host's name !" ) ;
+                       e.printStackTrace();
+                       System.exit( 1 ) ;
+               } 
 
+               String names[] = decodeG5Knames( name ) ;
                
                /* Updating node information */
                n.setFrequency( frequency ) ;
@@ -77,6 +89,9 @@ public class Utils
                n.setMemory( memory ) ;
                n.setNb_cores( nbCore ) ;
                n.setName( name ) ;
+               n.setCluster( names[1] ) ;
+               n.setSite( names[2] ) ;
+               n.setIP( ip ) ;
                n.setMapped( false ) ;
                
                return n ;
@@ -194,7 +209,7 @@ public class Utils
                
                if ( ! _file.endsWith( ".xml" ) )
                {
-                       _file = _file + ".xml"; // On ajoute l'extension xml au nom du fichier
+                       _file = _file + ".xml"; // Adding xml extension to file
                }
                
                if( ! _file.equals( "" ) )
@@ -244,7 +259,7 @@ public class Utils
                
                if ( ! _file.endsWith( ".xml" ) )
                {
-                       _file = _file + ".xml"; // On ajoute l'extension xml au nom du fichier
+                       _file = _file + ".xml"; // Adding xml extension to file
                }
                
                if( ! _file.equals( "" ) )
@@ -295,7 +310,7 @@ public class Utils
                
                if ( ! _file.endsWith( ".xml" ) )
                {
-                       _file = _file + ".xml"; // On ajoute l'extension xml au nom du fichier
+                       _file = _file + ".xml"; // Adding xml extension to file
                }
                
                if( ! _file.equals( "" ) )
@@ -346,7 +361,7 @@ public class Utils
                
                if ( ! _file.endsWith( ".xml" ) )
                {
-                       _file = _file + ".xml"; // On ajoute l'extension xml au nom du fichier
+                       _file = _file + ".xml"; // Adding xml extension to file
                }
                
                String path = "" ;
@@ -394,7 +409,7 @@ public class Utils
                
                if ( ! _file.endsWith( ".xml" ) )
                {
-                       _file = _file + ".xml"; // On ajoute l'extension xml au nom du fichier
+                       _file = _file + ".xml"; // Adding xml extension to file
                }
 
                String path = "" ;
@@ -442,7 +457,7 @@ public class Utils
                
                if ( ! _file.endsWith( ".xml" ) )
                {
-                       _file = _file + ".xml"; // On ajoute l'extension xml au nom du fichier
+                       _file = _file + ".xml"; // Adding xml extension to file
                }
 
                String path = "" ;