Cavity QED implementation of the discrete quantum Fourier transform