private static String getBuild(UniverseSpec spec, Producer<?> producer, Channel channel, String freq) { FeaturePackLocation loc = new FeaturePackLocation(spec, producer.getName(), channel.getName(), freq, null); String build = null; try { build = channel.getLatestBuild(loc); } catch (ProvisioningException ex) { // OK, no build. } return build; }
default FeaturePackUpdatePlan getUpdatePlan(FeaturePackUpdatePlan.Request updateRequest) throws ProvisioningException { final FeaturePackLocation fpl = updateRequest.getInstalledLocation(); String latestBuild = null; try { latestBuild = getLatestBuild(fpl); } catch(LatestVersionNotAvailableException e) { // that also means no update } if (latestBuild != null && !(latestBuild.equals(fpl.getBuild()))) { updateRequest.setNewLocation(fpl.replaceBuild(latestBuild)); } return updateRequest.buildPlan(); }
/** * Resolves latest available feature-pack ID * * @param fpl feature-pack location * @return latest available feature-pack id * @throws ProvisioningException in case of any error */ public FeaturePackLocation resolveLatestBuild(FeaturePackLocation fpl) throws ProvisioningException { Channel channel = getUniverse(fpl.getUniverse()) .getProducer(fpl.getProducerName()) .getChannel(fpl.getChannelName()); final String latestBuild = channel.getLatestBuild(fpl); FeaturePackLocation latestLocation = new FeaturePackLocation(fpl.getUniverse(), fpl.getProducerName(), fpl.getChannelName(), fpl.getFrequency(), latestBuild); channel.resolve(latestLocation); return latestLocation; }
parsedLocation.getChannel(), null, null).getFPID(); latestBuild = pmSession.getUniverse().getUniverse(spec). getProducer(parsedLocation.getProducer()).getChannel(parsedLocation.getChannel()).getLatestBuild(id); } else { FeaturePackLocation loc = new FeaturePackLocation(spec, parsedLocation.getProducer(), parsedLocation.getChannel(), parsedLocation.getFrequency(), null); latestBuild = pmSession.getUniverse().getUniverse(spec). getProducer(parsedLocation.getProducer()).getChannel(parsedLocation.getChannel()).getLatestBuild(loc);