Search in sources :

Example 16 with DirectoryId

use of org.eclipse.winery.repository.datatypes.ids.elements.DirectoryId in project winery by eclipse.

the class ToscaExportUtil method prepareForExport.

/**
 * Determines the referenced definition children Ids and also updates the references in the Artifact Template
 *
 * @return a collection of referenced definition child Ids
 */
protected void prepareForExport(IRepository repository, ArtifactTemplateId id) throws IOException {
    // Export files
    // This method is called BEFORE the concrete definitions element is written.
    // Therefore, we adapt the content of the attached files to the really existing files
    BackendUtils.synchronizeReferences(repository, id);
    DirectoryId fileDir = new ArtifactTemplateFilesDirectoryId(id);
    SortedSet<RepositoryFileReference> files = repository.getContainedFiles(fileDir);
    for (RepositoryFileReference ref : files) {
        // Even if writing a TOSCA only (!this.writingCSAR),
        // we put the virtual path in the TOSCA
        // Reason: Winery is mostly used as a service and local storage
        // reference to not make sense
        // The old implementation had absolutePath.toUri().toString();
        // there, but this does not work when using a cloud blob store.
        putRefAsReferencedItemInCsar(repository, ref);
    }
}
Also used : ArtifactTemplateFilesDirectoryId(org.eclipse.winery.repository.datatypes.ids.elements.ArtifactTemplateFilesDirectoryId) ArtifactTemplateFilesDirectoryId(org.eclipse.winery.repository.datatypes.ids.elements.ArtifactTemplateFilesDirectoryId) DirectoryId(org.eclipse.winery.repository.datatypes.ids.elements.DirectoryId) RepositoryFileReference(org.eclipse.winery.repository.common.RepositoryFileReference)

Aggregations

DirectoryId (org.eclipse.winery.repository.datatypes.ids.elements.DirectoryId)16 ArtifactTemplateFilesDirectoryId (org.eclipse.winery.repository.datatypes.ids.elements.ArtifactTemplateFilesDirectoryId)7 RepositoryFileReference (org.eclipse.winery.common.RepositoryFileReference)4 RepositoryFileReference (org.eclipse.winery.repository.common.RepositoryFileReference)4 ArtifactTemplateSourceDirectoryId (org.eclipse.winery.repository.datatypes.ids.elements.ArtifactTemplateSourceDirectoryId)4 GenericDirectoryId (org.eclipse.winery.repository.datatypes.ids.elements.GenericDirectoryId)4 IOException (java.io.IOException)3 Path (java.nio.file.Path)3 Map (java.util.Map)3 DefinitionsChildId (org.eclipse.winery.model.ids.definitions.DefinitionsChildId)3 TArtifactReference (org.eclipse.winery.model.tosca.TArtifactReference)3 TArtifactTemplate (org.eclipse.winery.model.tosca.TArtifactTemplate)3 URI (java.net.URI)2 HashMap (java.util.HashMap)2 List (java.util.List)2 ZipOutputStream (java.util.zip.ZipOutputStream)2 ArtifactTemplateId (org.eclipse.winery.common.ids.definitions.ArtifactTemplateId)2 ServiceTemplateId (org.eclipse.winery.model.ids.definitions.ServiceTemplateId)2 TExtensibleElements (org.eclipse.winery.model.tosca.TExtensibleElements)2 BackendUtils (org.eclipse.winery.repository.backend.BackendUtils)2