> + public boolean apply(VirtualAppliance input) {
> + return input.getName().equals(group);
> + }
> + });
> +
> + // Create the group if still does not exist
> + if (!vapp.isPresent()) {
> + logger.debug(">> Creating group %s", group);
> + VirtualAppliance newVapp = VirtualAppliance.builder(context,
> vdc).name(group).build();
> + newVapp.save();
> + logger.debug("<< group(%s) created", newVapp.getId());
> + } else {
> + logger.debug(">> Using existing group(%s)", vapp.get().getId());
> + }
> +
> + return super.execute(group, count, template, goodNodes, badNodes,
> customizationResponses);
> The more I think about it, the more I believe the cleanest approach might be
> the second point mentioned in the PR description.
> WDYT?
Worth a try, for sure, but the fact that you have to override so many methods
hints at the fact that you're trying to do something "differently from the
intended way", not that that's a problem ;-)
Alternatively, how about something like
```
VappCachingAbiquoTemplate extends AbiquoTemplateOptions { // package or
protected scope, so not accessible to users
// extra fields to store what we need
}
VappCachingAbiquoTemplate cachingTemplate =
VappCachingAbiquoTemplate.from(template).with(vApp).with(otherStuffWeNeed);
return super.execute(group, count, cachingTemplate, goodNodes, badNodes,
customizationResponses);
...
// at the use-site, cast to VappCachingAbiquoTemplate to get the value out. You
could even handle the case where it's **not** a
// VappCachingAbiquoTemplate (if that use case makes sense) by getting the vApp
etc. again
```
?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/25/files#r6074763