@Override public F newFeaturePack(FeaturePackLocation fpl, FeaturePackSpec spec, Path dir, int type) throws ProvisioningException { return transformer.transform(fpFactory.newFeaturePack(fpl, spec, dir, type)); } }, transformer);
public ProvisioningLayout<FeaturePackLayout> newConfigLayout(ProvisioningConfig config) throws ProvisioningException { return newConfigLayout(config, new FeaturePackLayoutFactory<FeaturePackLayout>() { @Override public FeaturePackLayout newFeaturePack(FeaturePackLocation fpl, FeaturePackSpec fpSpec, Path dir, int type) { return new FeaturePackLayout(fpl.getFPID(), dir, type) { @Override public FeaturePackSpec getSpec() { return fpSpec; } }; }}, false); }
private static void addCustomUpdates(ProvisioningPlan plan, List<FeaturePackLocation> custom, ProvisioningManager mgr) throws ProvisioningException { try (ProvisioningLayout<?> layout = mgr.getLayoutFactory().newConfigLayout(mgr.getProvisioningConfig())) { for (FeaturePackLocation loc : custom) { FeaturePackLayout fpl = layout.getFeaturePack(loc.getProducer()); FeaturePackLocation current = fpl.getFPID().getLocation(); FeaturePackUpdatePlan fpPlan = FeaturePackUpdatePlan.request(current, fpl.isTransitiveDep()).setNewLocation(loc).buildPlan(); if (fpPlan.hasNewLocation()) { plan.update(fpPlan); } } } }
@Override public F transform(O other) throws ProvisioningException { return fpFactory.newFeaturePack(other.getFPID().getLocation(), other.getSpec(), other.getDir(), other.getType()); } });
private static void processPackages(FeaturePackDescription.Builder fpBuilder, Path packagesDir, String encoding) throws ProvisioningDescriptionException { assertDirectory(packagesDir); try (DirectoryStream<Path> stream = Files.newDirectoryStream(packagesDir)) { for(Path path : stream) { fpBuilder.addPackage(processPackage(path, encoding)); } } catch (IOException e) { failedToReadDirectory(packagesDir, e); } }
@Override public void close() { if(closeLayoutFactory) { layoutFactory.close(); } }
/** * Provisioning layout factory * * @return provisioning layout factory */ public ProvisioningLayoutFactory getLayoutFactory() { if(layoutFactory == null) { closeLayoutFactory = true; layoutFactory = ProvisioningLayoutFactory.getInstance(universeResolver); } return layoutFactory; }
private ProgressTracker<FPID> getBuildTracker(boolean trackProgress) { if(!trackProgress) { return ProvisioningLayoutFactory.getNoOpProgressTracker(); } return buildTracker == null ? buildTracker = layoutFactory.getProgressTracker(ProvisioningLayoutFactory.TRACK_LAYOUT_BUILD) : buildTracker; }
@Override public Collection<FeaturePackRuntime> getFeaturePacks() { return layout.getOrderedFeaturePacks(); }
/** * Returns repository artifact resolver for specific repository type. * * @param repositoryId repository id * @return artifact resolver * @throws ProvisioningException in case artifact resolver was not configured for the repository type */ public RepositoryArtifactResolver getArtifactResolver(String repositoryId) throws ProvisioningException { return layout.getFactory().getUniverseResolver().getArtifactResolver(repositoryId); }
@Override public void close() { if(refs == 0 || --refs > 0) { return; } reset(); if(workDir != null) { IoUtils.recursiveDelete(workDir); } layoutFactory.handleClosed(); } }
/** * Returns a resource path for the provisioning setup. * * @param path path to the resource relative to the global resources directory * @return file-system path for the resource * @throws ProvisioningException in case the layout does not include any resources */ public Path getResource(String... path) throws ProvisioningException { return handle.getResource(path); }
/** * Returns a path for a temporary file-system resource. * * @param path path relative to the global tmp directory * @return temporary file-system path */ public Path getTmpPath(String... path) { return layout.getTmpPath(path); }
/** * Returns a path for a temporary file-system resource. * * @param path path relative to the global tmp directory * @return temporary file-system path */ public Path getTmpPath(String... path) { return handle.getTmpPath(path); }
/** * Returns a resource path for the provisioning setup. * * @param path path to the resource relative to the global resources directory * @return file-system path for the resource * @throws ProvisioningException in case of a failure */ public Path getResource(String... path) throws ProvisioningException { return layout.getResource(path); }
private ProgressTracker<ProducerSpec> getUpdatesTracker() { return updatesTracker == null ? updatesTracker = layoutFactory.getProgressTracker(ProvisioningLayoutFactory.TRACK_UPDATES) : updatesTracker; }
@Override public void close() { handle.close(); } }
public FeaturePackDescription build() throws ProvisioningDescriptionException { return new FeaturePackDescription(this); } }
public ProvisioningRuntimeBuilder initLayout(ProvisioningLayoutFactory layoutFactory, ProvisioningConfig config) throws ProvisioningException { layout = layoutFactory.newConfigLayout(config, FP_RT_FACTORY, false); return this; }