Search in sources :

Example 6 with ToscaTypeAlreadyDefinedInOtherCSAR

use of alien4cloud.component.repository.exception.ToscaTypeAlreadyDefinedInOtherCSAR in project alien4cloud by alien4cloud.

the class PluginArchiveIndexer method indexArchive.

private void indexArchive(PluginArchive pluginArchive, Orchestrator orchestrator, Location location) {
    ArchiveRoot archive = pluginArchive.getArchive();
    // inject a specific tag to allow components catalog filtering search
    injectWorkSpace(archive.getNodeTypes().values(), orchestrator, location);
    injectWorkSpace(archive.getArtifactTypes().values(), orchestrator, location);
    injectWorkSpace(archive.getCapabilityTypes().values(), orchestrator, location);
    injectWorkSpace(archive.getRelationshipTypes().values(), orchestrator, location);
    List<ParsingError> parsingErrors = Lists.newArrayList();
    // index the archive in alien catalog
    try {
        archiveIndexer.importArchive(archive, CSARSource.ORCHESTRATOR, pluginArchive.getArchiveFilePath(), parsingErrors);
    } catch (AlreadyExistException e) {
        log.debug("Skipping location archive import as the released version already exists in the repository.");
    } catch (CSARUsedInActiveDeployment e) {
        log.debug("Skipping orchestrator archive import as it is used in an active deployment. " + e.getMessage());
    } catch (ToscaTypeAlreadyDefinedInOtherCSAR e) {
        log.debug("Skipping orchestrator archive import, it's archive contain's a tosca type already defined in an other archive." + e.getMessage());
    }
    // Publish event to allow plugins to post-process elements (portability plugin for example).
    publishLocationTypeIndexedEvent(archive.getNodeTypes().values(), orchestrator, location);
}
Also used : ArchiveRoot(alien4cloud.tosca.model.ArchiveRoot) ParsingError(alien4cloud.tosca.parser.ParsingError) CSARUsedInActiveDeployment(alien4cloud.component.repository.exception.CSARUsedInActiveDeployment) ToscaTypeAlreadyDefinedInOtherCSAR(alien4cloud.component.repository.exception.ToscaTypeAlreadyDefinedInOtherCSAR) AlreadyExistException(alien4cloud.exception.AlreadyExistException)

Aggregations

CSARUsedInActiveDeployment (alien4cloud.component.repository.exception.CSARUsedInActiveDeployment)6 ToscaTypeAlreadyDefinedInOtherCSAR (alien4cloud.component.repository.exception.ToscaTypeAlreadyDefinedInOtherCSAR)6 AlreadyExistException (alien4cloud.exception.AlreadyExistException)6 ParsingException (alien4cloud.tosca.parser.ParsingException)3 Path (java.nio.file.Path)3 ParsingError (alien4cloud.tosca.parser.ParsingError)2 IOException (java.io.IOException)2 Csar (org.alien4cloud.tosca.model.Csar)2 Audit (alien4cloud.audit.annotation.Audit)1 PluginArchive (alien4cloud.orchestrators.plugin.model.PluginArchive)1 RestError (alien4cloud.rest.model.RestError)1 ArchiveRoot (alien4cloud.tosca.model.ArchiveRoot)1 ParsingContext (alien4cloud.tosca.parser.ParsingContext)1 ParsingResult (alien4cloud.tosca.parser.ParsingResult)1 ApiOperation (io.swagger.annotations.ApiOperation)1 CSARDependency (org.alien4cloud.tosca.model.CSARDependency)1 CsarDependenciesBean (org.alien4cloud.tosca.model.CsarDependenciesBean)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1 UsernamePasswordAuthenticationToken (org.springframework.security.authentication.UsernamePasswordAuthenticationToken)1 SimpleGrantedAuthority (org.springframework.security.core.authority.SimpleGrantedAuthority)1