Suppression and azimuthal anisotropy of prompt and nonprompt J/psi production in PbPb collisions at sqrt(s_NN) = 2.76 TeV