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
...
...
155
155
156
156
157
    /*
157
    /*
158
     * // PROPERTIES & ARGUMENTS //////////////
158
     * // PROPERTIES & ARGUMENTS //////////////
159
     */
159
     */
160
    private static String archimateOutputPath;
160
    private static Path archimateOutputPath;
161
    private static String inputFileName;
161
    private static Path inputFileName;
162
    private static String dotLocation;
162
    private static Path dotLocation;
163
    private static Path tavernaHome;
163
    private static Path tavernaHome;
164
    private static Path tavernaHomeLib;
164
    private static Path tavernaHomeLib;
165
    private static Path tavernaHomeRepo;
165
    private static Path tavernaHomeRepo;
166
166
167
    private List<IArchimateElement> nodeElements;
167
    private List<IArchimateElement> nodeElements;
...
...
188
    }
188
    }
189
189
190
    /*
190
    /*
191
     * // GETTER & SETTER ///////////////
191
     * // GETTER & SETTER ///////////////
192
     */
192
     */
193
    public static void setDotLocation(String dotLocation) {
193
    public static void setDotLocation(Path dotLocation) {
194
        TavernaExtractor.dotLocation = dotLocation;
194
        TavernaExtractor.dotLocation = dotLocation;
195
    }
195
    }
196
196
197
    public static String getDotLocation() {
197
    public static Path getDotLocation() {
198
        return dotLocation;
198
        return dotLocation;
199
    }
199
    }
200
200
201
    public static String getArchimateOutputPath() {
201
    public static Path getArchimateOutputPath() {
202
        return archimateOutputPath;
202
        return archimateOutputPath;
203
    }
203
    }
204
204
205
    public static void setArchimateOutputPath(String archimateOutputPath) {
205
    public static void setArchimateOutputPath(Path archimateOutputPath) {
206
        TavernaExtractor.archimateOutputPath = archimateOutputPath;
206
        TavernaExtractor.archimateOutputPath = archimateOutputPath;
207
    }
207
    }
208
208
209
    public static String getInputFileName() {
209
    public static Path getInputFileName() {
210
        return inputFileName;
210
        return inputFileName;
211
    }
211
    }
212
212
213
    public static void setInputFileName(String inputFileName) {
213
    public static void setInputFileName(Path inputFileName) {
214
        TavernaExtractor.inputFileName = inputFileName;
214
        TavernaExtractor.inputFileName = inputFileName;
215
    }
215
    }
216
216
217
    public static Path getTavernaHome() {
217
    public static Path getTavernaHome() {
218
        return tavernaHome;
218
        return tavernaHome;
...
...
309
309
310
            URL workflowURL = null;
310
            URL workflowURL = null;
311
            File file = null;
311
            File file = null;
312
            try {
312
            try {
313
                Session session = sshManager.createSession(15000);
313
                Session session = sshManager.createSession(15000);
314
                file = sshManager.readFile(session, inputFileName);
314
                file = sshManager.readFile(session, inputFileName.toString());
315
            }
315
            }
316
            catch(SSHManagerException e){
316
            catch(SSHManagerException e){
317
                e.printStackTrace();
317
                e.printStackTrace();
318
            }
318
            }
319
319
...
...
390
        workflowFile = (IArtifact) ArchiUtils.initElement(factory.createArtifact(), "Worfklow File",
390
        workflowFile = (IArtifact) ArchiUtils.initElement(factory.createArtifact(), "Worfklow File",
391
                infrastructureFolder, nodeElements);
391
                infrastructureFolder, nodeElements);
392
        ArchiUtils.initRelation(factory.createAssociationRelationship(), workflowFile, taverna, relationsFolder,
392
        ArchiUtils.initRelation(factory.createAssociationRelationship(), workflowFile, taverna, relationsFolder,
393
                relations);
393
                relations);
394
394
395
        workflowFile.getProperties().add(createDepProperties(new File(TavernaExtractor.getInputFileName()).getAbsolutePath()));
395
        workflowFile.getProperties().add(createDepProperties(TavernaExtractor.getInputFileName().toString()));
396
396
397
        // Orchestration Service
397
        // Orchestration Service
398
        parentProcessWorkflow = ArchiUtils.initElement(factory.createBusinessProcess(), dataflow.getLocalName()
398
        parentProcessWorkflow = ArchiUtils.initElement(factory.createBusinessProcess(), dataflow.getLocalName()
399
                + " Process", businessFolder, businessProcesses);
399
                + " Process", businessFolder, businessProcesses);
400
        workflowApplicationComponent = ArchiUtils.initElement(factory.createApplicationComponent(),
400
        workflowApplicationComponent = ArchiUtils.initElement(factory.createApplicationComponent(),
...
...
575
        IDiagramModelArchimateObject processDiagramObject = elementModelObjectMap.get(parentProcessWorkflow.getId());
575
        IDiagramModelArchimateObject processDiagramObject = elementModelObjectMap.get(parentProcessWorkflow.getId());
576
        processDiagramObject.setBounds(padding, padding, outerBounds.getWidth() - padding * 2, outerBounds.getHeight()
576
        processDiagramObject.setBounds(padding, padding, outerBounds.getWidth() - padding * 2, outerBounds.getHeight()
577
                - padding * 2);
577
                - padding * 2);
578
578
579
        // Set new file
579
        // Set new file
580
        File outFile = new File(TavernaExtractor.getArchimateOutputPath());
580
        File outFile = TavernaExtractor.getArchimateOutputPath().toFile();
581
        model.setFile(outFile);
581
        model.setFile(outFile);
582
582
583
        // Set model version
583
        // Set model version
584
        model.setVersion(ModelVersion.VERSION);
584
        model.setVersion(ModelVersion.VERSION);
585
585
...
...
1749
            fw.close();
1749
            fw.close();
1750
1750
1751
            // Dot to SVG
1751
            // Dot to SVG
1752
            File svgTmp = new File(tmpDirPath + File.separator + "tavernaExtractorToArchimate.dot.svg");
1752
            File svgTmp = new File(tmpDirPath + File.separator + "tavernaExtractorToArchimate.dot.svg");
1753
1753
1754
            String[] COMMAND = { TavernaExtractor.getDotLocation(), "-Tsvg", dotTmp.getAbsolutePath(), "-o", svgTmp.getAbsolutePath() };
1754
            String[] COMMAND = { TavernaExtractor.getDotLocation().toString(), "-Tsvg", dotTmp.getAbsolutePath(), "-o", svgTmp.getAbsolutePath() };
1755
1755
1756
            LOGGER.debug("Running command '" + StringUtils.join(COMMAND, " ") + "'.");
1756
            LOGGER.debug("Running command '" + StringUtils.join(COMMAND, " ") + "'.");
1757
1757
1758
            ProcessBuilder proc = new ProcessBuilder(COMMAND);
1758
            ProcessBuilder proc = new ProcessBuilder(COMMAND);
1759
            Process process = proc.start();
1759
            Process process = proc.start();
...
...
1846
        return inputsNumber;
1846
        return inputsNumber;
1847
    }
1847
    }
1848
1848
1849
    private boolean isDotAvailable() {
1849
    private boolean isDotAvailable() {
1850
1850
1851
        if (dotLocation != null && !dotLocation.isEmpty()) {
1851
        boolean dot = false;
1852
        if (dotLocation != null) {
1852
1853
1853
            try {
1854
            try {
1854
                Paths.get(dotLocation);
1855
               dot = dotLocation.toFile().exists() ? true : false;
1855
            }catch(InvalidPathException ipe){
1856
            }catch(InvalidPathException ipe){
1856
                return false;
1857
                return false;
1857
            }
1858
            }
1858
            return true;
1859
        }
1859
        }
1860
        return false;
1860
        return dot;
1861
    }
1861
    }
1862
1862
1863
    private void detailProcessorsOnLayers(List<? extends Processor> processors) throws IOException {
1863
    private void detailProcessorsOnLayers(List<? extends Processor> processors) throws IOException {
1864
        for (Processor processor : processors) {
1864
        for (Processor processor : processors) {
1865
1865