2020package org .commonwl .view .researchobject ;
2121
2222import org .apache .commons .io .FilenameUtils ;
23- import org .commonwl . view . github . GitHubService ;
23+ import org .apache . taverna . robundle . Bundle ;
2424import org .commonwl .view .github .GithubDetails ;
2525import org .commonwl .view .workflow .Workflow ;
2626import org .commonwl .view .workflow .WorkflowRepository ;
2727import org .slf4j .Logger ;
2828import org .slf4j .LoggerFactory ;
2929import org .springframework .beans .factory .annotation .Autowired ;
30- import org .springframework .beans .factory .annotation .Value ;
3130import org .springframework .scheduling .annotation .Async ;
3231import org .springframework .scheduling .annotation .EnableAsync ;
3332import org .springframework .stereotype .Component ;
@@ -47,34 +46,24 @@ public class ROBundleFactory {
4746
4847 private final Logger logger = LoggerFactory .getLogger (this .getClass ());
4948
50- private final String applicationName ;
51- private final String applicationURL ;
52- private final int singleFileSizeLimit ;
53- private final Path storageLocation ;
5449 private final WorkflowRepository workflowRepository ;
50+ private final ROBundleService roBundleService ;
5551
5652 @ Autowired
57- public ROBundleFactory (@ Value ("${applicationName}" ) String applicationName ,
58- @ Value ("${applicationURL}" ) String applicationURL ,
59- @ Value ("${graphvizStorage}" ) Path graphvizStorage ,
60- @ Value ("${singleFileSizeLimit}" ) int singleFileSizeLimit ,
53+ public ROBundleFactory (ROBundleService roBundleService ,
6154 WorkflowRepository workflowRepository ) {
62- this .applicationName = applicationName ;
63- this .applicationURL = applicationURL ;
64- this .storageLocation = graphvizStorage ;
6555 this .workflowRepository = workflowRepository ;
66- this .singleFileSizeLimit = singleFileSizeLimit ;
56+ this .roBundleService = roBundleService ;
6757 }
6858
6959 /**
7060 * Creates a new Workflow Research Object Bundle from a Github URL
7161 * and saves it to a file
72- * @param githubService The service for Github API functionality
7362 * @param githubInfo Details of the Github repository
7463 * @throws IOException Any API errors which may have occurred
7564 */
7665 @ Async
77- public void workflowROFromGithub (GitHubService githubService , GithubDetails githubInfo )
66+ public void workflowROFromGithub (GithubDetails githubInfo )
7867 throws IOException , InterruptedException {
7968 logger .info ("Creating Research Object Bundle" );
8069
@@ -83,16 +72,15 @@ public void workflowROFromGithub(GitHubService githubService, GithubDetails gith
8372 githubInfo .getBranch (), FilenameUtils .getPath (githubInfo .getPath ()));
8473
8574 // Create a new Research Object Bundle with Github contents
86- ROBundle bundle = new ROBundle (githubService , roDetails ,
87- applicationName , applicationURL , singleFileSizeLimit );
75+ Bundle bundle = roBundleService .newBundleFromGithub (roDetails );
8876
8977 // Save the bundle to the storage location in properties
90- Path bundleLocation = bundle .saveToFile (storageLocation );
78+ Path bundleLocation = roBundleService .saveToFile (bundle );
9179
9280 // Add the path to the bundle to the bundle
9381 Workflow workflow = workflowRepository .findByRetrievedFrom (githubInfo );
9482
95- // Chance that this thread could be created before workflow model is saved
83+ // Chance that this thread could be done before workflow model is saved
9684 int attempts = 5 ;
9785 while (attempts > 0 && workflow == null ) {
9886 // Delay this thread by 0.5s and try again until success or too many attempts
0 commit comments