public ProvisioningRuntimeBuilder initLayout(ProvisioningLayout<?> configLayout) throws ProvisioningException { layout = configLayout.transform(FP_RT_FACTORY); return this; }
public ProvisioningRuntime getRuntime(ProvisioningLayout<?> provisioningLayout) throws ProvisioningException { return getRuntimeInternal(provisioningLayout.transform(ProvisioningRuntimeBuilder.FP_RT_FACTORY), null); }
/** * (Re-)provisions the current installation to the desired specification. * * @param provisioningLayout pre-built provisioning layout * @throws ProvisioningException in case provisioning fails */ public void provision(ProvisioningLayout<?> provisioningLayout) throws ProvisioningException { try(ProvisioningLayout<FeaturePackRuntimeBuilder> layout = provisioningLayout.transform(ProvisioningRuntimeBuilder.FP_RT_FACTORY)) { doProvision(layout, getFsDiff(), false); } }
ProvisioningRuntime(final ProvisioningRuntimeBuilder builder, final MessageWriter messageWriter) throws ProvisioningException { this.startTime = builder.startTime; this.config = builder.config; this.layout = builder.layout.transform(new FeaturePackLayoutTransformer<FeaturePackRuntime, FeaturePackRuntimeBuilder>() { @Override public FeaturePackRuntime transform(FeaturePackRuntimeBuilder other) throws ProvisioningException { return other.build(builder); } }); this.fsDiff = builder.fsDiff; try { this.configs = builder.getResolvedConfigs(); this.stagedDir = layout.newStagedDir(); } catch (ProvisioningException | RuntimeException | Error e) { layout.close(); throw e; } this.messageWriter = messageWriter; }
private boolean displayConfigs(PmCommandInvocation commandInvocation, ProvisioningLayout<FeaturePackLayout> pLayout) throws ProvisioningException, IOException { Map<String, List<ConfigInfo>> configs = new HashMap<>(); try (ProvisioningRuntime rt = ProvisioningRuntimeBuilder. newInstance(commandInvocation.getPmSession().getMessageWriter(false)) .initRtLayout(pLayout.transform(ProvisioningRuntimeBuilder.FP_RT_FACTORY)) .setEncoding(ProvisioningManager.Builder.ENCODING) .build()) { for (ProvisionedConfig m : rt.getConfigs()) { String model = m.getModel(); List<ConfigInfo> names = configs.get(model); if (names == null) { names = new ArrayList<>(); configs.put(model, names); } if (m.getName() != null) { names.add(new ConfigInfo(model, m.getName(), m.getLayers())); } } String str = StateInfoUtil.buildConfigs(configs, pLayout); if (str != null) { commandInvocation.print(str); } return str != null; } }