Four Hamas members have been arrested for planning attacks on Jewish institutions in Europe, according to German prosecutors.