Switch to unified view

a/src/main/java/net/timbusproject/extractors/modules/tavernaextractor/TavernaExtractor.java b/src/main/java/net/timbusproject/extractors/modules/tavernaextractor/TavernaExtractor.java
...
...
151
    private IFolder infrastructureFolder;
151
    private IFolder infrastructureFolder;
152
    private IFolder motivationFolder;
152
    private IFolder motivationFolder;
153
    private IFolder applicationFolder;
153
    private IFolder applicationFolder;
154
    private IFolder relationsFolder;
154
    private IFolder relationsFolder;
155
155
156
157
    /*
156
    /*
158
     * // PROPERTIES & ARGUMENTS //////////////
157
     * // PROPERTIES & ARGUMENTS //////////////
159
     */
158
     */
160
    private static Path archimateOutputPath;
159
    private static Path archimateOutputPath;
161
    private static Path inputFileName;
160
    private static Path inputFileName;
...
...
293
292
294
        nodeElements = new ArrayList<IArchimateElement>();
293
        nodeElements = new ArrayList<IArchimateElement>();
295
        elementModelObjectMap = new HashMap<String, IDiagramModelArchimateObject>();
294
        elementModelObjectMap = new HashMap<String, IDiagramModelArchimateObject>();
296
        relations = new ArrayList<IRelationship>();
295
        relations = new ArrayList<IRelationship>();
297
296
297
        File tavernaFile = null;
298
        try {
298
        try {
299
            // try to load from classpath
300
//            URL workflowURL = getClass().getResource(inputFileName);
301
//
302
//            if (workflowURL == null) { // if not successful, try opening file
303
//
304
//                File f = new File(inputFileName);
305
//                if (f.exists()) {
306
//                    workflowURL = f.toURI().toURL();
307
//                }
308
//            }
309
299
310
            URL workflowURL = null;
300
            URL workflowURL = null;
311
            File file = null;
312
            try {
301
            try {
313
                Session session = sshManager.createSession(15000);
302
                Session session = sshManager.createSession(15000);
314
                file = sshManager.readFile(session, inputFileName.toString());
303
                tavernaFile = sshManager.readFile(session, inputFileName.toString());
315
            }
304
            }
316
            catch(SSHManagerException e){
305
            catch(SSHManagerException e){
317
                e.printStackTrace();
306
                e.printStackTrace();
318
            }
307
            }
319
308
320
321
322
            if (file.exists()) {
309
            if (tavernaFile.exists()) {
323
                    workflowURL = file.toURI().toURL();
310
                    workflowURL = tavernaFile.toURI().toURL();
324
            }
311
            }
325
312
326
            LOGGER.info( "Reading workflow from " + workflowURL);
313
            LOGGER.info( "Reading workflow from " + workflowURL);
327
            System.out.println("Reading workflow from " + workflowURL);
314
            System.out.println("Reading workflow from " + workflowURL);
328
            dataflow = openDataflow(workflowURL);
315
            dataflow = openDataflow(workflowURL);
...
...
582
        model.setFile(outFile);
569
        model.setFile(outFile);
583
570
584
        // Set model version
571
        // Set model version
585
        model.setVersion(ModelVersion.VERSION);
572
        model.setVersion(ModelVersion.VERSION);
586
573
587
588
        //create tmp file
574
        //create tmp file
589
        Path outputTmp = Files.createTempFile("taverna-extractor","output");
575
        Path outputTmp = Files.createTempFile("tavernaExtractor-",".output");
590
576
591
        // Adapted from {@link ArchiveManager#saveModelToXMLFile}
577
        // Adapted from {@link ArchiveManager#saveModelToXMLFile}
592
        ResourceSet resourceSet = ArchimateResourceFactory.createResourceSet();
578
        ResourceSet resourceSet = ArchimateResourceFactory.createResourceSet();
593
        Resource resource = resourceSet.createResource(URI.createFileURI(outputTmp.toAbsolutePath().toString()));
579
        Resource resource = resourceSet.createResource(URI.createFileURI(outputTmp.toAbsolutePath().toString()));
594
580
595
        resource.getContents().add(model);
581
        resource.getContents().add(model);
596
        resource.save(null);
582
        resource.save(null);
597
583
598
        LOGGER.info( "Wrote model successfully to " + outFile.getAbsolutePath());
584
        LOGGER.info( "Wrote model successfully to " + outFile.getAbsolutePath());
585
586
        // copy temp file to remote host
587
        try {
588
            Session session = sshManager.createSession(15000);
589
            sshManager.sendFile(session, outputTmp.toString(), archimateOutputPath.toString());
590
        }
591
        catch(SSHManagerException e){
592
            e.printStackTrace();
593
        }
594
595
        // remove both temp files.
596
        Files.deleteIfExists(outputTmp);
597
        Files.deleteIfExists(tavernaFile.toPath());
599
    }
598
    }
600
599
601
    public void processWebServiceActivity(IFolder businessFolder, IFolder infrastructureFolder,
600
    public void processWebServiceActivity(IFolder businessFolder, IFolder infrastructureFolder,
602
                                          IFolder applicationFolder, IFolder relationsFolder, IApplicationComponent workflowApplicationComponent,
601
                                          IFolder applicationFolder, IFolder relationsFolder, IApplicationComponent workflowApplicationComponent,
603
                                          HashMap<Processor, IBusinessProcess> processorProcessMap,
602
                                          HashMap<Processor, IBusinessProcess> processorProcessMap,