Adaptive Beamforming for Distributed Relay Networks