Microscopic nonequilibrium theory of double-barrier Josephson junctions