Search in sources :

Example 76 with ArchiveRoot

use of alien4cloud.tosca.model.ArchiveRoot 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

ArchiveRoot (alien4cloud.tosca.model.ArchiveRoot)76 Test (org.junit.Test)43 Set (java.util.Set)26 NodeType (org.alien4cloud.tosca.model.types.NodeType)26 Csar (org.alien4cloud.tosca.model.Csar)25 RelationshipType (org.alien4cloud.tosca.model.types.RelationshipType)16 CapabilityType (org.alien4cloud.tosca.model.types.CapabilityType)14 ParsingError (alien4cloud.tosca.parser.ParsingError)13 Path (java.nio.file.Path)11 PropertyDefinition (org.alien4cloud.tosca.model.definitions.PropertyDefinition)9 NodeTemplate (org.alien4cloud.tosca.model.templates.NodeTemplate)8 Node (org.yaml.snakeyaml.nodes.Node)8 PluginArchive (alien4cloud.orchestrators.plugin.model.PluginArchive)6 CSARDependency (org.alien4cloud.tosca.model.CSARDependency)6 AbstractPropertyValue (org.alien4cloud.tosca.model.definitions.AbstractPropertyValue)6 ParsingException (alien4cloud.tosca.parser.ParsingException)5 Map (java.util.Map)5 Topology (org.alien4cloud.tosca.model.templates.Topology)5 ComplexPropertyValue (org.alien4cloud.tosca.model.definitions.ComplexPropertyValue)4 ScalarPropertyValue (org.alien4cloud.tosca.model.definitions.ScalarPropertyValue)4