/** * Builds a layout for the configuration including the feature-pack contained in the local archive. * Optionally, installs the feature-pack archive to the universe repository. * * @param featurePack feature-pack archive * @param installInUniverse whether to install the feature-pack into the universe repository * @return layout * @throws ProvisioningException in case of a failure */ public ProvisioningLayout<FeaturePackLayout> newConfigLayout(Path featurePack, boolean installInUniverse) throws ProvisioningException { return newConfigLayout(ProvisioningConfig.builder().addFeaturePackDep(addLocal(featurePack, installInUniverse)).build()); }
public void close() { try { if (state != null) { state.close(); } } finally { try { universe.close(); } finally { if (interactive) { layoutFactory.checkOpenLayouts(); } else { 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; }
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); }
/** * Installs a feature-pack provided as a local archive. * * @param featurePack path to feature-pack archive * @param installInUniverse whether to install the feature-pack artifact into the universe repository * @throws ProvisioningException in case installation fails */ public void install(Path featurePack, boolean installInUniverse) throws ProvisioningException { install(getLayoutFactory().addLocal(featurePack, installInUniverse)); }
@Override public void close() { if(closeLayoutFactory) { layoutFactory.close(); } }
@Override public void close() { cacheManager.close(); checkOpenLayouts(); }
public static ProvisioningLayoutFactory getInstance(UniverseResolver universeResolver, FeaturePackCacheManager cacheManager) { return new ProvisioningLayoutFactory(universeResolver, cacheManager); }
ProvisioningLayout(ProvisioningLayoutFactory layoutFactory, ProvisioningConfig config, FeaturePackLayoutFactory<F> fpFactory, boolean initPluginOptions) throws ProvisioningException { this.layoutFactory = layoutFactory; this.fpFactory = fpFactory; this.config = config; this.handle = layoutFactory.createHandle(); if(config.hasFeaturePackDeps()) { try { build(false, true); if (initPluginOptions) { initPluginOptions(Collections.emptyMap(), false); } } catch(Throwable t) { handle.close(); throw t; } } }
private ProgressTracker<ProducerSpec> getUpdatesTracker() { return updatesTracker == null ? updatesTracker = layoutFactory.getProgressTracker(ProvisioningLayoutFactory.TRACK_UPDATES) : updatesTracker; }
@SuppressWarnings("unchecked") public <T> ProgressTracker<T> getProgressTracker(String id) { final ProgressTracker<?> callback = progressTrackers.get(id); return callback == null ? getNoOpProgressTracker() : (ProgressTracker<T>) callback; }
public ProvisioningRuntimeBuilder initLayout(ProvisioningLayoutFactory layoutFactory, ProvisioningConfig config) throws ProvisioningException { layout = layoutFactory.newConfigLayout(config, FP_RT_FACTORY, false); return this; }
@Override protected void runCommand(PmCommandInvocation commandInvocation) throws CommandExecutionException { try { FeaturePackLocation fpl = commandInvocation.getPmSession().getLayoutFactory().addLocal(path.toPath(), install == null ? true : install); commandInvocation.println(fpl + " imported."); } catch (ProvisioningException ex) { throw new CommandExecutionException(commandInvocation.getPmSession(), CliErrors.importFeaturePackFailed(), ex); } } }
public static ProvisioningLayoutFactory getInstance(UniverseResolver universeResolver) { return new ProvisioningLayoutFactory(universeResolver); }
ProvisioningLayout(ProvisioningLayoutFactory layoutFactory, ProvisioningConfig config, FeaturePackLayoutFactory<F> fpFactory, Map<String, String> extraOptions) throws ProvisioningException { this.layoutFactory = layoutFactory; this.fpFactory = fpFactory; this.config = config; this.handle = layoutFactory.createHandle(); if(config.hasFeaturePackDeps()) { try { build(false, true); initPluginOptions(extraOptions, false); } catch(Throwable t) { handle.close(); throw t; } } }
private ProvisioningLayout<FeaturePackRuntimeBuilder> newConfigLayout(ProvisioningConfig provisioningConfig, Map<String, String> pluginOptions) throws ProvisioningException { return getLayoutFactory().newConfigLayout(provisioningConfig, ProvisioningRuntimeBuilder.FP_RT_FACTORY, pluginOptions); }
fpl = manager.getLayoutFactory().addLocal(localPath, false);
public static ProvisioningLayoutFactory getInstance(Path home, UniverseResolver universeResolver) { return getInstance(universeResolver, new FeaturePackCacheManager(home)); }
@Override public ResolvedPlugins resolve() throws ResolutionException { boolean closeLayout = layout == null; ProvisioningLayout<FeaturePackLayout> pLayout = layout; // Silent resolution. session.unregisterTrackers(); try { try { if (pLayout == null) { if (config != null) { pLayout = session.getLayoutFactory().newConfigLayout(config); } else { // No registration in universe during completion pLayout = session.getLayoutFactory().newConfigLayout(file, false); } } return resolvePlugins(pLayout); } catch (Exception ex) { throw new ResolutionException(ex.getLocalizedMessage(), ex); } finally { if (closeLayout && pLayout != null) { pLayout.close(); } } } finally { session.registerTrackers(); } }