So I guess we're stuck with that godawful amount of text for 1.6.x, and
slightly less for 1.7. It'd still be nice to have something like the old
CONTEXT_TOKEN for the de-async world, though.
If I understand correctly, the goal here is to verify that the
"unwrap" call will succeed, and I guess we're looking to avoid nasty
"try...catch"-style solutions?
How about something like the following - not exactly less typing, but still:
ApiMetadata apiMeta = ctx.getProviderMetadata().getApiMetadata();
if ((apiMeta instanceof HttpApiMetadata) &&
EC2Api.class.isAssignableFrom((HttpApiMetdata) apiMeta).getApi())){
...
}
Of course, if you're expecting it to be an HttpApiMetdata, you can
skip the instanceof check..?
ap
PS: Detail on the whole discussion around the deprecation of
CONTEXT_TOKEN here:
https://issues.apache.org/jira/browse/JCLOUDS-82