Search in sources :

Example 11 with ParsingException

use of alien4cloud.tosca.parser.ParsingException in project alien4cloud by alien4cloud.

the class MockAmazonLocationConfigurer method getMatchingConfigurations.

@Override
public Map<String, MatchingConfiguration> getMatchingConfigurations() {
    Path matchingConfigPath = selfContext.getPluginPath().resolve("aws/mock-resources-matching-config.yml");
    MatchingConfigurations matchingConfigurations = null;
    try {
        matchingConfigurations = matchingConfigurationsParser.parseFile(matchingConfigPath).getResult();
    } catch (ParsingException e) {
        return Maps.newHashMap();
    }
    return matchingConfigurations.getMatchingConfigurations();
}
Also used : Path(java.nio.file.Path) MatchingConfigurations(alien4cloud.deployment.matching.services.nodes.MatchingConfigurations) ParsingException(alien4cloud.tosca.parser.ParsingException)

Example 12 with ParsingException

use of alien4cloud.tosca.parser.ParsingException in project yorc-a4c-plugin by ystia.

the class PluginArchiveService method parsePluginArchives.

public PluginArchive parsePluginArchives(String archiveRelativePath) {
    // Parse the archives
    ParsingResult<ArchiveRoot> result;
    Path archivePath = selfContext.getPluginPath().resolve(archiveRelativePath);
    try {
        result = this.archiveParser.parseDir(archivePath, AlienConstants.GLOBAL_WORKSPACE_ID);
    } catch (ParsingException e) {
        log.error("Failed to parse archive, plugin won't work", e);
        throw new RuntimeException("Failed to parse archive, plugin won't work", e);
    }
    if (result.getContext().getParsingErrors() != null && !result.getContext().getParsingErrors().isEmpty()) {
        log.error("Parsing errors for " + archiveRelativePath);
        for (ParsingError parsingError : result.getContext().getParsingErrors()) {
            log.error(parsingError.toString());
        }
        throw new RuntimeException("Plugin archive is invalid, plugin won't work");
    }
    return new PluginArchive(result.getResult(), archivePath);
}
Also used : Path(java.nio.file.Path) ArchiveRoot(alien4cloud.tosca.model.ArchiveRoot) ParsingError(alien4cloud.tosca.parser.ParsingError) PluginArchive(alien4cloud.orchestrators.plugin.model.PluginArchive) ParsingException(alien4cloud.tosca.parser.ParsingException)

Aggregations

ParsingException (alien4cloud.tosca.parser.ParsingException)12 Path (java.nio.file.Path)9 ArchiveRoot (alien4cloud.tosca.model.ArchiveRoot)5 CSARUsedInActiveDeployment (alien4cloud.component.repository.exception.CSARUsedInActiveDeployment)3 ToscaTypeAlreadyDefinedInOtherCSAR (alien4cloud.component.repository.exception.ToscaTypeAlreadyDefinedInOtherCSAR)3 MatchingConfigurations (alien4cloud.deployment.matching.services.nodes.MatchingConfigurations)3 AlreadyExistException (alien4cloud.exception.AlreadyExistException)3 PluginArchive (alien4cloud.orchestrators.plugin.model.PluginArchive)2 ToscaContextual (alien4cloud.tosca.context.ToscaContextual)2 ParsingContext (alien4cloud.tosca.parser.ParsingContext)2 ParsingError (alien4cloud.tosca.parser.ParsingError)2 ParsingResult (alien4cloud.tosca.parser.ParsingResult)2 IOException (java.io.IOException)2 EditorToscaYamlParsingException (org.alien4cloud.tosca.editor.exception.EditorToscaYamlParsingException)2 CSARDependency (org.alien4cloud.tosca.model.CSARDependency)2 Csar (org.alien4cloud.tosca.model.Csar)2 CsarDependenciesBean (org.alien4cloud.tosca.model.CsarDependenciesBean)2 Audit (alien4cloud.audit.annotation.Audit)1 MatchingConfiguration (alien4cloud.model.deployment.matching.MatchingConfiguration)1 PluginArchiveException (alien4cloud.plugin.exception.PluginArchiveException)1