Search in sources :

Example 81 with RepositoryFileReference

use of org.eclipse.winery.repository.common.RepositoryFileReference in project container by OpenTOSCA.

the class BpelPlanEnginePlugin method planLocationOnDisk.

@Nullable
private Path planLocationOnDisk(CsarId csarId, QName planId, PlanModelReference planRef) {
    Csar csar = storage.findById(csarId);
    IRepository repository = RepositoryFactory.getRepository(csar.getSaveLocation());
    PlanId plan = new PlanId(new PlansId(new ServiceTemplateId(csar.entryServiceTemplate().getTargetNamespace(), csar.entryServiceTemplate().getId(), false)), new XmlId(planId.toString(), false));
    Collection<RepositoryFileReference> fileRefs = repository.getContainedFiles(plan);
    Path planPath = null;
    for (RepositoryFileReference ref : fileRefs) {
        if (ref.getFileName().endsWith(".zip")) {
            planPath = repository.ref2AbsolutePath(ref);
        }
    }
    return planPath;
}
Also used : Path(java.nio.file.Path) Csar(org.opentosca.container.core.model.csar.Csar) RepositoryFileReference(org.eclipse.winery.repository.common.RepositoryFileReference) PlanId(org.eclipse.winery.model.ids.elements.PlanId) XmlId(org.eclipse.winery.model.ids.XmlId) IRepository(org.eclipse.winery.repository.backend.IRepository) ServiceTemplateId(org.eclipse.winery.model.ids.definitions.ServiceTemplateId) PlansId(org.eclipse.winery.model.ids.elements.PlansId) Nullable(org.eclipse.jdt.annotation.Nullable)

Aggregations

RepositoryFileReference (org.eclipse.winery.repository.common.RepositoryFileReference)81 IOException (java.io.IOException)33 Path (java.nio.file.Path)26 TDefinitions (org.eclipse.winery.model.tosca.TDefinitions)17 QName (javax.xml.namespace.QName)14 ArtifactTemplateFilesDirectoryId (org.eclipse.winery.repository.datatypes.ids.elements.ArtifactTemplateFilesDirectoryId)14 InputStream (java.io.InputStream)13 ArrayList (java.util.ArrayList)12 ArtifactTemplateId (org.eclipse.winery.model.ids.definitions.ArtifactTemplateId)12 IRepository (org.eclipse.winery.repository.backend.IRepository)12 ServiceTemplateId (org.eclipse.winery.model.ids.definitions.ServiceTemplateId)11 PlanId (org.eclipse.winery.model.ids.elements.PlanId)10 PlansId (org.eclipse.winery.model.ids.elements.PlansId)10 XmlId (org.eclipse.winery.model.ids.XmlId)9 Test (org.junit.jupiter.api.Test)9 DefinitionsChildId (org.eclipse.winery.model.ids.definitions.DefinitionsChildId)8 MediaType (org.apache.tika.mime.MediaType)7 TArtifactTemplate (org.eclipse.winery.model.tosca.TArtifactTemplate)7 BufferedInputStream (java.io.BufferedInputStream)6 HashMap (java.util.HashMap)6