The Dirichlet problem for degenerate complex Monge-Ampere equations