void commandEnd() { if (seen.isEmpty()) { return; } try { Properties props = config.getLayoutCacheContent(); long time = System.currentTimeMillis(); for (FPID id : seen) { props.setProperty(id.toString(), "" + time); } config.storeLayoutCacheContent(props); } catch (IOException ex) { CliLogging.exception(ex); } }
void install(FeaturePackLocation.FPID fpid, Path fpContentDir) throws ProvisioningException { Universe<?> universe = null; UniverseFeaturePackInstaller ufpInstaller = null; if (universeResolution) { universe = universeResolver.getUniverse(fpid.getLocation().getUniverse()); ufpInstaller = ufpInstallers.get(universe.getFactoryId()); if (ufpInstaller == null) { throw new ProvisioningException(Errors.featurePackInstallerNotFound(universe.getFactoryId(), ufpInstallers.keySet())); } } final Path fpZip = getBuildDir().resolve(LayoutUtils.ensureValidFileName(fpid.toString())); try { ZipUtils.zip(fpContentDir, fpZip); } catch (IOException e) { throw new ProvisioningException("Failed to create feature-pack archive", e); } if (ufpInstaller != null) { ufpInstaller.install(universe, fpid, fpZip); } }
@Override protected String getId(PmSession session) throws CommandExecutionException { String filePath = (String) getValue(FILE_OPTION_NAME); if (filePath == null) { filePath = getOptionValue(FILE_OPTION_NAME); if (filePath == null) { return super.getId(session); } } Path path; try { path = Util.resolvePath(session.getAeshContext(), filePath); } catch (IOException ex) { throw new CommandExecutionException(ex.getMessage()); } if (!Files.exists(path)) { return null; } try { return FeaturePackDescriber.readSpec(path).getFPID().toString(); } catch (ProvisioningException ex) { throw new CommandExecutionException(session, CliErrors.retrieveFeaturePackID(), ex); } }
for(FPID patchId : featurePack.getPatches()) { final ElementNode patch = addElement(patches, Element.PATCH.getLocalName(), ns); addAttribute(patch, Attribute.ID, patchId.toString());
private void writeFeaturePack(ElementNode fp, FeaturePack<?> featurePack) { addAttribute(fp, Attribute.LOCATION, featurePack.getFPID().toString()); if (featurePack.hasPackages()) { final ElementNode packages = addElement(fp, Element.PACKAGES); for (FeaturePackPackage pkg : featurePack.getPackages()) { final ElementNode pkgElement = addElement(packages, Element.PACKAGE); addAttribute(pkgElement, Attribute.NAME, pkg.getName()); } } } }
@Override public void nextFeaturePack(FPID fpid) { fpElement = addElement(parent, Element.FEATURE_PACK.getLocalName(), parent.getNamespace()); addAttribute(fpElement, Attribute.LOCATION, fpid.toString()); }