/** * Generates the meta data for all of the artifacts found during discovery. * @param discoveredArtifacts */ private void generateMetaData(DiscoveredArtifacts discoveredArtifacts) { for (DiscoveredArtifact artifact : discoveredArtifacts) { BaseArtifactType metaData = this.metaDataFactory.createMetaData(artifact); for (MetaDataProvider metaDataProvider : this.metaDataProviders) { metaDataProvider.provideMetaData(metaData); } artifact.setMetaData(metaData); } }
/** * Creates an S-RAMP archive from this JAR. * @return an S-RAMP archive * @throws ZipToSrampArchiveException */ public SrampArchive createSrampArchive() throws ZipToSrampArchiveException { this.artifactFilter.setContext(this.context); this.metaDataFactory.setContext(this.context); DiscoveredArtifacts discoveredArtifacts = discoverArtifacts(); discoveredArtifacts.index(jarWorkDir); generateMetaData(discoveredArtifacts); try { SrampArchive archive = new SrampArchive(); for (DiscoveredArtifact artifact : discoveredArtifacts) { String path = artifact.getArchivePath(); archive.addEntry(path, artifact.getMetaData(), artifact.getContent()); } return archive; } catch (Exception e) { throw new ZipToSrampArchiveException(e); } }