class NiciraCheckHealthCommandWrapper extends CommandWrapper<CheckHealthCommand, Answer, NiciraNvpResource> {

    @Override
    public Answer execute(final CheckHealthCommand command, final NiciraNvpResource serverResource) {
        final NiciraNvpApi niciraNvpApi = serverResource.getNiciraNvpApi();
        boolean healthy = true;
        try {
            final ControlClusterStatus clusterStatus = niciraNvpApi.getControlClusterStatus();
            final String status = clusterStatus.getClusterStatus();
            if (clusterIsUnstable(status)) {
                s_logger.warn("Control cluster is not stable. Current status is " + status);
                healthy = false;
            }
        } catch (final NiciraNvpApiException e) {
            s_logger.error("Exception caught while checking control cluster status during health check", e);
            healthy = false;
        }

        return new CheckHealthAnswer(command, healthy);
    }

}