@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; }
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; }
void setBatch(boolean batch) throws ProvisioningException { if(!list.isEmpty()) { throw new ProvisioningException("Can't start batch in the middle of a branch"); } this.batch = batch; }
Path getWorkDir() throws ProvisioningException { if(workDir == null) { try { workDir = Files.createTempDirectory(GLN_FP_INSTALLER); } catch (IOException e) { throw new ProvisioningException("Failed to create a tmp dir"); } } return workDir; }
private RepositoryArtifactResolver getArtifactResolver(String repositoryId) throws ProvisioningException { final RepositoryArtifactResolver artifactResolver = artifactResolvers.get(repositoryId); if(artifactResolver == null) { throw new ProvisioningException("Repository artifact resolver " + repositoryId + " has not been configured"); } return artifactResolver; }
private static void mkdirs(final Path stagedHistoryDir) throws ProvisioningException { try { Files.createDirectories(stagedHistoryDir); } catch (IOException e) { throw new ProvisioningException(Errors.mkdirs(stagedHistoryDir), e); } }
private String toStringElem(Object elem) throws ProvisioningException { if(elem == null) { throw new ProvisioningException(Errors.illegalCapabilityElement(capSpec, null, capBuf.toString())); } final String str = elem.toString().trim(); if(str.isEmpty()) { throw new ProvisioningException(Errors.illegalCapabilityElement(capSpec, str, capBuf.toString())); } return str; } }
void setBranch(ConfigFeatureBranch branch) throws ProvisioningException { if(this.branch != null) { throw new ProvisioningException("The branch has already been set for " + spec.id); } this.branch = branch; branch.setSpecBranch(); }
public static String toMavenCoords(FeaturePackLocation fpl) throws ProvisioningException { final String producer = fpl.getProducerName(); final int colon = producer.indexOf(':'); if(colon <= 0) { throw new ProvisioningException("Failed to determine group and artifact IDs for " + fpl); } final StringBuilder buf = new StringBuilder(); buf.append(producer.substring(0, colon)).append(':').append(producer.substring(colon + 1)).append(':').append(ZIP); buf.append(':').append(fpl.getBuild()); return buf.toString(); }
private static void deleteHistoryFiles(Path installedHistoryDir) throws ProvisioningException { try (DirectoryStream<Path> stream = Files.newDirectoryStream(installedHistoryDir)) { for (Path entry : stream) { if (Files.isDirectory(entry)) { IoUtils.recursiveDelete(entry); } } } catch (IOException ex) { throw new ProvisioningException(Errors.readDirectory(installedHistoryDir), ex); } } }
public static ConfigModel parse(Path p) throws ProvisioningException { try(BufferedReader reader = Files.newBufferedReader(p)) { return INSTANCE.parse(reader); } catch (Exception e) { throw new ProvisioningException(Errors.parseXml(p), e); } }
public static ConfigLayerSpec parseConfigLayerSpec(Path p, String model) throws ProvisioningException { try(BufferedReader reader = Files.newBufferedReader(p)) { return parseConfigLayerSpec(reader, model); } catch (Exception e) { throw new ProvisioningException(Errors.parseXml(p), e); } }
public FeaturePackSpec getSpec() throws ProvisioningException { if(spec == null) { try(BufferedReader reader = Files.newBufferedReader(dir.resolve(Constants.FEATURE_PACK_XML))) { spec = FeaturePackXmlParser.getInstance().parse(reader); } catch (Exception e) { throw new ProvisioningException(Errors.readFile(dir.resolve(Constants.FEATURE_PACK_XML))); } } return spec; }
private ProvisioningManager getProvisioningManager(Path installation) throws ProvisioningException { if (installation == null) { throw new ProvisioningException(CliErrors.noDirectoryProvided()); } if (!Files.exists(PathsUtils.getProvisioningXml(installation))) { throw new ProvisioningException(CliErrors.notValidInstallation(installation)); } ProvisioningManager mgr = pmSession.newProvisioningManager(installation, false); return mgr; }
public byte[] getHash() throws ProvisioningException { if(hash == null) { try { hash = HashUtils.hashPath(p); } catch (IOException e) { throw new ProvisioningException(Errors.hashCalculation(p)); } } return hash; }
public static ProvisionedConfig parse(Path p) throws ProvisioningException { try(BufferedReader reader = Files.newBufferedReader(p)) { return getInstance().parse(reader); } catch (IOException | XMLStreamException e) { throw new ProvisioningException(Errors.parseXml(p), e); } }
private void persistDirHashes(Path hashes, FsEntry entry, List<FsEntry> dirs) throws ProvisioningException { final Path target = hashes.resolve(entry.getRelativePath()); try { Files.createDirectory(target); } catch (IOException e) { throw new ProvisioningException(Errors.hashesNotPersisted(), e); } if (entry.hasChildren()) { persistChildHashes(hashes, entry, dirs, target); } }
public FsEntry forPath(Path p) throws ProvisioningException { final FsEntry entry = new FsEntry(null, p); if(entry.dir) { try { initChildren(entry); } catch (IOException e) { throw new ProvisioningException(Errors.fsEntryInit(p), e); } } return entry; }
public List<ResolvedFeature> orderFeatures(ConfigModelStack stack) throws ProvisioningException { this.specFeatures = stack.specFeatures; this.features = stack.features; try { doOrder(stack.rt); } catch (ProvisioningException e) { throw new ProvisioningException(Errors.failedToBuildConfigSpec(stack.id.getModel(), stack.id.getName()), e); } return orderedFeatures; }
private void processConfigLayer(ConfigModelStack configStack, FeatureGroupSupport layer) throws ProvisioningException { this.configStack = configStack; try { if(layer.hasPackageDeps()) { processPackageDeps(layer, null); } processConfigItemContainer(layer); this.configStack = null; } catch (ProvisioningException e) { throw new ProvisioningException(Errors.failedToResolveConfigLayer(configStack.id.getModel(), layer.getName()), e); } }