.getParcelsResource(cluster.getName()).getParcelResource(repository, parcelVersion.toString());
String refMsg = referCmfUrlMsg(domain + "/cmf/parcel/status");
if (AvailableParcelStage.valueOf(apiParcelResource.readParcel().getStage()).ordinal() < AvailableParcelStage.DOWNLOADED.ordinal()) {
String action = "Downloading parcel...";
ParcelProvisionPoller poll = new ParcelProvisionPoller(apiParcelResource, AvailableParcelStage.DOWNLOADED, cluster.getCurrentReport(),
reportQueue, ProgressSplit.DOWNLOAD_PARCEL.getProgress());
if (apiParcelResource.readParcel().getStage().equals(AvailableParcelStage.DOWNLOADING.toString())) {
// Another thread is downloading this parcel, just wait for its completion
executeAndReport(action, null, ProgressSplit.DOWNLOAD_PARCEL.getProgress(),
cluster.getCurrentReport(), reportQueue, poll, false);
} else {
// the ApiCommand instance for parcel is inaccessible, so do not check the return value
executeAndReport(action, apiParcelResource.startDownloadCommand(),
ProgressSplit.DOWNLOAD_PARCEL.getProgress(),
cluster.getCurrentReport(), reportQueue, poll, false);
}
if (AvailableParcelStage.valueOf(apiParcelResource.readParcel().getStage()).ordinal() < AvailableParcelStage.DOWNLOADED.ordinal()) {
throw ClouderaManagerException.DOWNLOAD_PARCEL_FAIL(apiParcelResource.readParcel().getProduct(),
apiParcelResource.readParcel().getVersion(), refMsg);
}
}
if (AvailableParcelStage.valueOf(apiParcelResource.readParcel().getStage()).ordinal() < AvailableParcelStage.DISTRIBUTED.ordinal()) {
String action = "Distributing parcel...";
final StatusPoller poller = new ParcelProvisionPoller(apiParcelResource, AvailableParcelStage.DISTRIBUTED, cluster.getCurrentReport(),
reportQueue, ProgressSplit.DISTRIBUTE_PARCEL.getProgress());
executeAndReport(action, apiParcelResource.startDistributionCommand(),
ProgressSplit.DISTRIBUTE_PARCEL.getProgress(),
cluster.getCurrentReport(), reportQueue, poller, false);