A man who attempted to kill three children when he attacked a group of children outside a school in Dublin has been jailed for life.