private static void failedToReadDirectory(Path p, IOException e) throws ProvisioningDescriptionException { throw new ProvisioningDescriptionException(Errors.readDirectory(p), e); } }
protected ProvisioningOption(String name) { this.name = name; required = false; persistent = true; defaultValue = null; valueSet = getBooleanValueSet(); }
@SuppressWarnings("unchecked") public T setUniverseFactoryLoader(UniverseFactoryLoader ufl) throws ProvisioningException { if(this.ufl != null) { throw new ProvisioningException("Universe factory loader has already been initialized"); } this.ufl = ufl; return (T) this; }
/** * (Re-)provisions the current installation to the desired specification. * * @param provisioningConfig the desired installation specification * @param options feature-pack plug-ins options * @throws ProvisioningException in case provisioning fails */ public void provision(ProvisioningConfig provisioningConfig, Map<String, String> options) throws ProvisioningException { try(ProvisioningLayout<FeaturePackRuntimeBuilder> layout = newConfigLayout(provisioningConfig, options)) { doProvision(layout, getFsDiff(), false); } }
/** * Installs a feature-pack provided as a local archive. * This method calls install(featurePack, true). * * @param featurePack path to feature-pack archive * @throws ProvisioningException in case installation fails */ public void install(Path featurePack) throws ProvisioningException { install(featurePack, true); }
public byte[] getHash() throws ProvisioningException { if(hash == null) { try { hash = HashUtils.hashPath(p); } catch (IOException e) { throw new ProvisioningException(Errors.hashCalculation(p)); } } return hash; }
private static void mkdirs(final Path stagedHistoryDir) throws ProvisioningException { try { Files.createDirectories(stagedHistoryDir); } catch (IOException e) { throw new ProvisioningException(Errors.mkdirs(stagedHistoryDir), e); } }
/** * Set the default universe spec for the installation * * @param universeSpec universe spec * @throws ProvisioningException in case of an error */ public void setDefaultUniverse(UniverseSpec universeSpec) throws ProvisioningException { addUniverse(null, universeSpec); }
public FeatureReferenceSpec getFeatureRef(String name) throws ProvisioningDescriptionException { final FeatureReferenceSpec ref = featureRefs.get(name); if(ref == null) { throw new ProvisioningDescriptionException(Errors.featureRefNotInSpec(name, this.name)); } return ref; }
public FeatureParameterSpec getParam(String name) throws ProvisioningDescriptionException { final FeatureParameterSpec paramSpec = params.get(name); if(paramSpec == null) { throw new ProvisioningDescriptionException(Errors.unknownFeatureParameter(this.name, name)); } return paramSpec; }
private static void assertDirectory(Path dir) throws ProvisioningDescriptionException { if(!Files.isDirectory(dir)) { throw new ProvisioningDescriptionException(Errors.notADir(dir)); } }
/** * @param fpl feature-pack location * @param cause the actual cause */ public LatestVersionNotAvailableException(FeaturePackLocation fpl, Throwable cause) { super(Errors.noVersionAvailable(fpl), cause); this.fpl = fpl; }
private FeatureParameterSpec(Builder builder) throws ProvisioningDescriptionException { if (builder.featureId && builder.nillable) { throw new ProvisioningDescriptionException("ID parameter " + builder.name + " cannot be nillable."); } this.name = builder.name; this.featureId = builder.featureId; this.nillable = builder.nillable; this.defaultValue = builder.defaultValue; this.type = builder.type; }
/** * Creates an exception representing an unsatisfied package dependency error. * * @param fpid the feature-pack that is expected to contain the package * @param packageName the name of the package dependency on which couldn't be resolved * @param cause original cause */ public UnsatisfiedPackageDependencyException(FPID fpid, String packageName, UnsatisfiedPackageDependencyException cause) { super(Errors.unsatisfiedPackageDependency(fpid, packageName), cause); } }
/** * Prints a message if {@link #isVerboseEnabled()} is {@code true}. * * @param message the message to print, may be {@code null} */ default void verbose(CharSequence message) { verbose(null, message); }
/** * Prints an informational message. * * @param message the message to print, may be {@code null} */ default void print(CharSequence message) { print(null, message); }
public Builder setUniverseResolver(UniverseResolver resolver) throws ProvisioningException { if(ufl != null) { throw new ProvisioningException("Universe factory loader has already been initialized which conflicts with the initialization of universe resolver"); } if(layoutFactory != null) { throw new ProvisioningException("Provisioning layout factory has already been initialized which conflicts with the initialization of universe resolver"); } this.resolver = resolver; return this; }
/** * @param fpl feature-pack location */ public LatestVersionNotAvailableException(FeaturePackLocation fpl) { super(Errors.noVersionAvailable(fpl)); this.fpl = fpl; }
private FeatureParameterSpec(String name, boolean featureId, boolean nillable, String defaultValue) throws ProvisioningDescriptionException { if (featureId && nillable) { throw new ProvisioningDescriptionException("ID parameter " + name + " cannot be nillable."); } this.name = name; this.featureId = featureId; this.nillable = nillable; this.defaultValue = defaultValue; this.type = Constants.BUILT_IN_TYPE_STRING; }
public Builder setLayoutFactory(ProvisioningLayoutFactory layoutFactory) throws ProvisioningException { if(ufl != null) { throw new ProvisioningException("Universe factory loader has already been initialized which conflicts with the initialization of provisioning layout factory"); } if(resolver != null) { throw new ProvisioningException("Universe resolver has already been initialized which conflicts with the initialization of provisioning layout factory"); } this.layoutFactory = layoutFactory; return this; }