+
+ @Override
+ public void addSavingNeighbor( ServicesClient _sn )
+ {
+ if( _sn != null )
+ {
+ try {
+ System.out.println( "Adding save neighbor: " + _sn.getName() ) ;
+ } catch( RemoteException e ) {
+ System.err.println( "Unable to retrieve the name of a save neighbor!" ) ;
+ e.printStackTrace() ;
+ }
+
+ machine.getSaveNeighbors().add( _sn ) ;
+ }
+ }
+
+
+ @Override
+ public void addSavingNeighbors( ArrayList<ServicesClient> _sn )
+ {
+ if( _sn != null && _sn.size() > 0 )
+ {
+ System.out.print( "Adding save neighbors: " ) ;
+ for( int i = 0 ; i < _sn.size() ; i++ )
+ {
+ try {
+ System.out.print( _sn.get( i ).getName() ) ;
+ } catch( RemoteException e ) {
+ System.err.println( "Unable to retrieve the name of a save neighbor!" ) ;
+ e.printStackTrace() ;
+ }
+
+ if( i != _sn.size() - 1 )
+ {
+ System.out.print( ", " ) ;
+ } else {
+ System.out.println( "." ) ;
+ }
+
+ machine.getSaveNeighbors().add( _sn.get( i ) ) ;
+ }
+ }
+ }
+
+
+ @Override
+ public void replaceSavingNeighbor( ServicesClient _old, ServicesClient _new )
+ {
+ System.out.print( "Replacing a save neihgbor ... " ) ;
+ if( _old != null && _new != null )
+ {
+ int i = 0 ;
+
+ for( i = 0 ; i < machine.getSaveNeighbors().size() ; i++ )
+ {
+ try {
+ if( machine.getSaveNeighbors().get( i ).getIPHost().equalsIgnoreCase( _old.getIPVM() ) )
+ {
+ machine.getSaveNeighbors().set( i, _new ) ;
+ System.out.println( "Save neighbor successfully changed." ) ;
+ break ;
+ }
+ } catch( RemoteException e ) {
+ System.err.println( "Unable to retrieve the IP address of a save neighbor!" ) ;
+ e.printStackTrace() ;
+ }
+ }
+
+ if( i == machine.getSaveNeighbors().size() )
+ {
+ System.out.println( "I am not concerned by the modification." ) ;
+ }
+ }
+ }
+
+