> + *
> + * @param context
> + * The API context.
> + * @param dto
> + * The dto used to generate the domain object.
> + * @return The task domain object.
> + */
> + protected static AsyncTask<?, ?> newTask(final ApiContext<AbiquoApi>
> context, final TaskDto dto) {
> + // Can be null in untrackable tasks
> + if (dto == null) {
> + return null;
> + }
> +
> + Class<? extends AsyncTask<?, ?>> taskClass = null;
> +
> + switch (dto.getType().getOwnerType()) {
If I understand what you mean, I think it is not possible. The task
representation (in XML) does not contain a type. In the Abiquo API, there is
only a generic Task type, which has an owner (not an api user, but an entity;
the task owner is the entity that "has" that task: virtual machines can have
tasks, images can have tasks too, etc), and depending on that owner, the task
may produce a result of a type or another (the task may produce a
VirtualMachine, an Image, and so on).
This purpose of this method is to fill that gap, and provide, in jclouds, a
concrete class type for each Task, and I'm doing that by looking at the owner
of the task definition.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/9/files#r5003985