@Override
	public String retrievePublicIpAddress( TargetHandlerParameters parameters, String machineId )
	throws TargetException {

		NovaApi novaApi = novaApi( parameters.getTargetProperties());
		String zoneName = findZoneName( novaApi, parameters.getTargetProperties());

		String result = null;
		Server server = novaApi.getServerApiForZone( zoneName ).get( machineId );
		if( server != null ) {
			result = server.getAccessIPv4();

			// Nothing found? Check floating IPs
			if( result == null ) {
				FloatingIPApi floatingIPApi = novaApi.getFloatingIPExtensionForZone( zoneName ).get();
				List<FloatingIP> ips = floatingIPApi.list().filter( new InstancePredicate( machineId )).toList();
				if( ips.size() > 0 )
					result = ips.get( 0 ).getIp();
			}
		}

		return result;
	}
@ Override public String retrievePublicIpAddress ( TargetHandlerParameters parameters , String machineId ) throws TargetException { NovaApi novaApi = novaApi ( parameters . getTargetProperties ( ) ) ; String zoneName = findZoneName ( novaApi , parameters . getTargetProperties ( ) ) ; String result = null ; Server server = novaApi . getServerApiForZone ( zoneName ) . get ( machineId ) ; if ( server != null ) { result = server . getAccessIPv4 ( ) ; if ( result == null ) { FloatingIPApi floatingIPApi = novaApi . getFloatingIPExtensionForZone ( zoneName ) . get ( ) ; List < FloatingIP > ips = floatingIPApi . list ( ) . filter ( new InstancePredicate ( machineId ) ) . toList ( ) ; if ( ips . size ( ) > 0 ) result = ips . get ( 0 ) . getIp ( ) ; } } return result ; }
/* (non-Javadoc)
@see net.roboconf.target.api.TargetHandler
#retrievePublicIpAddress(net.roboconf.target.api.TargetHandlerParameters, java.lang.String)