/**
* {@inheritDoc}
*/
@Override
public VServerMetadata getNode(String id) {
Builder builder = VServerMetadata.builder();
builder.id(id);
List<ListenableFuture<?>> futures = Lists.newArrayList();
futures.add(asyncApi.getVirtualServerApi().getDetails(id));
futures.add(asyncApi.getVirtualServerApi().getStatus(id));
futures.add(asyncApi.getVirtualServerApi().getInitialPassword(id));
// mapped public ips?
String fwId = toFirewallId.apply(id);
// futures.add(asyncApi.getBuiltinServerApi().getConfiguration(fwId,
// BuiltinServerConfiguration.SLB_RULE));
try {
List<Object> results = Futures.successfulAsList(futures).get();
VServerWithDetails server = (VServerWithDetails) results.get(0);
VServerStatus status = (VServerStatus) results.get(1);
System.out.println("getNode(" + id + ")'s getDetails: " + status +" - " + server);
if (server == null) {
server = api.getVirtualServerApi().getDetails(id);
System.out.println("getNode(" + id + ")'s getDetails(2) returns: " + server);
}
builder.serverWithDetails(server);
builder.status(status == null ? VServerStatus.UNRECOGNIZED : status);
// System.out.println("status in adapter#getNode: "
// + (VServerStatus) results.get(1)
// +" for "
// + server.getId());
builder.initialPassword((String) results.get(2));
// SLB slb = ((BuiltinServer) results.get(4)).;
// slb.
} catch (InterruptedException e) {
throw Throwables.propagate(e);
} catch (ExecutionException e) {
throw Throwables.propagate(e);
}
return builder.build();
}