|
19 | 19 |
|
20 | 20 | package org.commonwl.view.researchobject;
|
21 | 21 |
|
| 22 | +import static org.apache.commons.io.FileUtils.readFileToString; |
| 23 | + |
| 24 | +import java.io.File; |
| 25 | +import java.io.IOException; |
| 26 | +import java.net.URI; |
| 27 | +import java.net.URISyntaxException; |
| 28 | +import java.nio.file.Files; |
| 29 | +import java.nio.file.Path; |
| 30 | +import java.nio.file.Paths; |
| 31 | +import java.util.ArrayList; |
| 32 | +import java.util.HashSet; |
| 33 | +import java.util.List; |
| 34 | +import java.util.Set; |
| 35 | +import java.util.regex.Matcher; |
| 36 | +import java.util.regex.Pattern; |
| 37 | + |
22 | 38 | import org.apache.commons.io.FileUtils;
|
23 | 39 | import org.apache.commons.io.FilenameUtils;
|
24 | 40 | import org.apache.jena.query.QuerySolution;
|
25 | 41 | import org.apache.jena.query.ResultSet;
|
26 | 42 | import org.apache.taverna.robundle.Bundle;
|
27 | 43 | import org.apache.taverna.robundle.Bundles;
|
28 |
| -import org.apache.taverna.robundle.manifest.*; |
| 44 | +import org.apache.taverna.robundle.manifest.Agent; |
| 45 | +import org.apache.taverna.robundle.manifest.Manifest; |
| 46 | +import org.apache.taverna.robundle.manifest.PathAnnotation; |
| 47 | +import org.apache.taverna.robundle.manifest.PathMetadata; |
| 48 | +import org.apache.taverna.robundle.manifest.Proxy; |
29 | 49 | import org.commonwl.view.cwl.CWLTool;
|
30 | 50 | import org.commonwl.view.cwl.CWLValidationException;
|
31 | 51 | import org.commonwl.view.cwl.RDFService;
|
|
42 | 62 | import org.springframework.beans.factory.annotation.Value;
|
43 | 63 | import org.springframework.stereotype.Service;
|
44 | 64 |
|
45 |
| -import java.io.File; |
46 |
| -import java.io.IOException; |
47 |
| -import java.net.URI; |
48 |
| -import java.net.URISyntaxException; |
49 |
| -import java.nio.file.Files; |
50 |
| -import java.nio.file.Path; |
51 |
| -import java.nio.file.Paths; |
52 |
| -import java.util.ArrayList; |
53 |
| -import java.util.HashSet; |
54 |
| -import java.util.List; |
55 |
| -import java.util.Set; |
56 |
| -import java.util.regex.Matcher; |
57 |
| -import java.util.regex.Pattern; |
58 |
| - |
59 |
| -import static org.apache.commons.io.FileUtils.readFileToString; |
60 |
| - |
61 | 65 | /**
|
62 | 66 | * Service handling Research Object Bundles
|
63 | 67 | */
|
@@ -197,8 +201,11 @@ public Bundle createBundle(Workflow workflow, GitDetails gitInfo) throws IOExcep
|
197 | 201 |
|
198 | 202 | // Git2prov history
|
199 | 203 | List<Path> history = new ArrayList<>();
|
200 |
| - history.add(Paths.get("http://git2prov.org/git2prov?giturl=" + |
201 |
| - gitInfo.getRepoUrl() + "&serialization=PROV-JSON")); |
| 204 | + // FIXME: Below is a a hack to pretend the URI is a Path |
| 205 | + String git2prov = "http://git2prov.org/git2prov?giturl=" + gitInfo.getRepoUrl() |
| 206 | + + "&serialization=PROV-JSON"; |
| 207 | + Path git2ProvPath = bundle.getRoot().relativize(bundle.getRoot().resolve(git2prov)); |
| 208 | + history.add(git2ProvPath); |
202 | 209 | bundle.getManifest().setHistory(history);
|
203 | 210 |
|
204 | 211 | } catch (URISyntaxException ex) {
|
@@ -246,8 +253,9 @@ private void addFilesToBundle(GitDetails gitDetails, Bundle bundle, Path bundleP
|
246 | 253 | try {
|
247 | 254 | // Where to store the new file
|
248 | 255 | Path bundleFilePath = bundlePath.resolve(file.getName());
|
249 |
| - Path gitPath = Paths.get(gitDetails.getPath()).resolve(file.getName()); |
250 |
| - |
| 256 | + Path gitFolder = Paths.get(gitDetails.getPath()); |
| 257 | + Path gitPath = bundlePath.getRoot().resolve(gitFolder.resolve(file.getName())); |
| 258 | + |
251 | 259 | // Get direct URL permalink
|
252 | 260 | URI rawURI = new URI("https://w3id.org/cwl/view/git/" + workflow.getLastCommit() +
|
253 | 261 | "/" + gitPath + "?format=raw");
|
|
0 commit comments