diff --git a/tools/rack/pom.xml b/tools/rack/pom.xml index fe8e3c5b..d75e872c 100644 --- a/tools/rack/pom.xml +++ b/tools/rack/pom.xml @@ -61,10 +61,10 @@ UTF-8 UTF-8 - 21.0.1 + 21.0.2 ${project.version} 3.2.5 - 4.0.4 + 4.0.5 diff --git a/tools/rack/rack.plugin/META-INF/MANIFEST.MF b/tools/rack/rack.plugin/META-INF/MANIFEST.MF index 5504e384..7353efb1 100644 --- a/tools/rack/rack.plugin/META-INF/MANIFEST.MF +++ b/tools/rack/rack.plugin/META-INF/MANIFEST.MF @@ -91,7 +91,7 @@ Bundle-ClassPath: ., lib/opencsv.jar, lib/sparqlGraphLibrary.jar, lib/viz.js-graphviz-java.jar -Bundle-RequiredExecutionEnvironment: JavaSE-11 +Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy Bundle-Activator: com.ge.research.rack.Activator Automatic-Module-Name: rack.plugin diff --git a/tools/rack/rack.plugin/RITE-128.ICO b/tools/rack/rack.plugin/RITE-128.ICO new file mode 100644 index 00000000..cf8c6636 Binary files /dev/null and b/tools/rack/rack.plugin/RITE-128.ICO differ diff --git a/tools/rack/rack.plugin/RITE-128.bmp b/tools/rack/rack.plugin/RITE-128.bmp new file mode 100644 index 00000000..37e108b1 Binary files /dev/null and b/tools/rack/rack.plugin/RITE-128.bmp differ diff --git a/tools/rack/rack.plugin/RITE-16.bmp b/tools/rack/rack.plugin/RITE-16.bmp new file mode 100644 index 00000000..ff074a2d Binary files /dev/null and b/tools/rack/rack.plugin/RITE-16.bmp differ diff --git a/tools/rack/rack.plugin/RITE-256.bmp b/tools/rack/rack.plugin/RITE-256.bmp new file mode 100644 index 00000000..ce0f107b Binary files /dev/null and b/tools/rack/rack.plugin/RITE-256.bmp differ diff --git a/tools/rack/rack.plugin/RITE-32.bmp b/tools/rack/rack.plugin/RITE-32.bmp new file mode 100644 index 00000000..7b5342ab Binary files /dev/null and b/tools/rack/rack.plugin/RITE-32.bmp differ diff --git a/tools/rack/rack.plugin/build.properties b/tools/rack/rack.plugin/build.properties index b081e412..2e809bc7 100644 --- a/tools/rack/rack.plugin/build.properties +++ b/tools/rack/rack.plugin/build.properties @@ -51,8 +51,12 @@ bin.includes = .,\ lib/sparqlGraphLibrary.jar,\ lib/viz.js-graphviz-java.jar,\ plugin.xml,\ - splash.bmp + splash.bmp,\ + RITE-16.bmp,\ + RITE-32.bmp src.includes = icons/,\ resources/,\ - src/,\ - splash.bmp + splash.bmp,\ + RITE-16.bmp,\ + RITE-32.bmp,\ + rack.plugin/icons/ diff --git a/tools/rack/rack.plugin/icons/RITE-128.ICO b/tools/rack/rack.plugin/icons/RITE-128.ICO new file mode 100644 index 00000000..cf8c6636 Binary files /dev/null and b/tools/rack/rack.plugin/icons/RITE-128.ICO differ diff --git a/tools/rack/rack.plugin/plugin.xml b/tools/rack/rack.plugin/plugin.xml index 0f27b21b..3a4086af 100644 --- a/tools/rack/rack.plugin/plugin.xml +++ b/tools/rack/rack.plugin/plugin.xml @@ -497,5 +497,15 @@ type="java.lang.Object"> + + + + + + + diff --git a/tools/rack/rack.plugin/src/com/ge/research/rack/BuildIngestionNodegroupsHandler.java b/tools/rack/rack.plugin/src/com/ge/research/rack/BuildIngestionNodegroupsHandler.java index 03842151..0d9fd055 100644 --- a/tools/rack/rack.plugin/src/com/ge/research/rack/BuildIngestionNodegroupsHandler.java +++ b/tools/rack/rack.plugin/src/com/ge/research/rack/BuildIngestionNodegroupsHandler.java @@ -89,9 +89,6 @@ public static IStatus buildNodegroups(IProgressMonitor monitor) { return Status.CANCEL_STATUS; } - String path = /* ProjectUtils.getOverlayProjectPath(); */ - RackPreferencePage.getInstanceDataFolder(); - String ingestionNodegroupPath = RackPreferencePage.getInstanceDataFolder(); ProjectUtils.createNodegroupFolder(ingestionNodegroupPath); diff --git a/tools/rack/rack.plugin/src/com/ge/research/rack/ClearAllHandler.java b/tools/rack/rack.plugin/src/com/ge/research/rack/ClearAllHandler.java index c2d27478..6937b351 100644 --- a/tools/rack/rack.plugin/src/com/ge/research/rack/ClearAllHandler.java +++ b/tools/rack/rack.plugin/src/com/ge/research/rack/ClearAllHandler.java @@ -43,7 +43,6 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.core.runtime.jobs.*; import org.eclipse.swt.widgets.Display; public class ClearAllHandler extends AbstractHandler { @@ -108,7 +107,10 @@ public Object execute(ExecutionEvent event) throws ExecutionException { return null; - /* try { + /* A computational thread is used, the RackConsole.getConsole().error calls + * have to be changed to ErrorMessageUtil.showError calls. + * + * try { String consoleViewId = IConsoleConstants.ID_CONSOLE_VIEW; IConsoleView consoleView = diff --git a/tools/rack/rack.plugin/src/com/ge/research/rack/IngestInstanceDataHandler.java b/tools/rack/rack.plugin/src/com/ge/research/rack/IngestInstanceDataHandler.java index 7c85bbcf..e0f66508 100644 --- a/tools/rack/rack.plugin/src/com/ge/research/rack/IngestInstanceDataHandler.java +++ b/tools/rack/rack.plugin/src/com/ge/research/rack/IngestInstanceDataHandler.java @@ -32,8 +32,8 @@ package com.ge.research.rack; import com.ge.research.rack.utils.ConnectionUtil; +import com.ge.research.rack.utils.ErrorMessageUtil; import com.ge.research.rack.utils.ProjectUtils; -import com.ge.research.rack.utils.RackConsole; import com.ge.research.rack.views.RackPreferencePage; import com.ge.research.rack.views.ViewUtils; import com.ge.research.semtk.api.nodeGroupExecution.client.NodeGroupExecutionClient; @@ -76,7 +76,6 @@ public class IngestInstanceDataHandler extends AbstractHandler { private static List dGraphs = new ArrayList<>(); private static List mGraphs = new ArrayList<>(); private static List dedupSteps = new ArrayList<>(); - private static IngestionStatus status = null; private static enum IngestionStatus { FAILED, @@ -92,7 +91,7 @@ private IngestionStatus uploadModelFromYAML(String yamlPath, IProgressMonitor mo } if (dedupSteps.contains(yamlPath)) { - RackConsole.getConsole().warning("Skipping previously executed step at: " + yamlPath); + ErrorMessageUtil.warning("Skipping previously executed step at: " + yamlPath); return IngestionStatus.DONE; } @@ -108,25 +107,24 @@ private IngestionStatus uploadModelFromYAML(String yamlPath, IProgressMonitor mo try { oYaml = ProjectUtils.readYaml(yamlPath); } catch (Exception e) { - RackConsole.getConsole().error("Unable to read " + dir + "/import.yaml"); + ErrorMessageUtil.error("Unable to read " + dir + "/import.yaml"); } if (oYaml == null || !(oYaml instanceof Map)) { - RackConsole.getConsole().error("Ill formed " + dir + "/import.yaml, please check"); + ErrorMessageUtil.error("Ill formed " + dir + "/import.yaml, please check"); return IngestionStatus.FAILED; } - HashMap yamlMap = (HashMap) oYaml; + HashMap yamlMap = (HashMap) oYaml; if (!yamlMap.containsKey("files")) { - RackConsole.getConsole() - .warning(dir + "/import.yaml contains no owl files to upload, done"); + ErrorMessageUtil.warning(dir + "/import.yaml contains no owl files to upload, done"); return IngestionStatus.FAILED; } Object oList = yamlMap.get("files"); if (!(oList instanceof List)) { - RackConsole.getConsole() - .error("owl files in" + dir + "/import.yaml is ill formed, please check"); + ErrorMessageUtil.error( + "owl files in" + dir + "/import.yaml is ill formed, please check"); return IngestionStatus.FAILED; } @@ -136,9 +134,8 @@ private IngestionStatus uploadModelFromYAML(String yamlPath, IProgressMonitor mo Object oDataGraph = yamlMap.get("model-graphs"); if (oDataGraph instanceof List) { if (((List) oDataGraph).size() > 1) { - RackConsole.getConsole() - .warning( - "We currently support ingesting only using a single model-graph"); + ErrorMessageUtil.warning( + "We currently support ingesting only using a single model-graph"); // return IngestionStatus.FAILED; } modelGraph = ((List) oDataGraph).get(0); @@ -147,12 +144,9 @@ private IngestionStatus uploadModelFromYAML(String yamlPath, IProgressMonitor mo } // validate target graph against footprint if (!mGraphs.contains(modelGraph)) { - RackConsole.getConsole() - .error( - "Specified target graph " - + modelGraph - + " not declared in footprint"); - RackConsole.getConsole().error("YAML file: " + yamlPath); + ErrorMessageUtil.error( + "Specified target graph " + modelGraph + " not declared in footprint"); + ErrorMessageUtil.error("YAML file: " + yamlPath); return IngestionStatus.FAILED; } } @@ -165,30 +159,27 @@ private IngestionStatus uploadModelFromYAML(String yamlPath, IProgressMonitor mo String owlPath = Paths.get(dir + "/" + owl).normalize().toString(); File owlFile = new File(owlPath); if (!owlFile.exists()) { - RackConsole.getConsole().error("Cannot find owl file: " + owlPath); + ErrorMessageUtil.error("Cannot find owl file: " + owlPath); return IngestionStatus.FAILED; } try { - RackConsole.getConsole() - .print( - "Uploading owl file " - + owlFile.getAbsolutePath() - + " to " - + modelGraph - + " ... "); + ErrorMessageUtil.print( + "Uploading owl file " + + owlFile.getAbsolutePath() + + " to " + + modelGraph + + " ... "); SparqlQueryClient qAuthClient = ConnectionUtil.getOntologyUploadClient(modelGraph); qAuthClient.uploadOwl(owlFile); - RackConsole.getConsole().printOK(); + ErrorMessageUtil.printOK(); } catch (Exception e) { - RackConsole.getConsole().printFAIL(); - RackConsole.getConsole().error(e.getLocalizedMessage()); - RackConsole.getConsole() - .error( - "Ontology processing/upload failed, make sure you are connected to RACK or RACK-BOX instance"); - RackConsole.getConsole() - .error("Upload of owl failed, OWL: " + owlFile.getAbsolutePath()); + ErrorMessageUtil.printFAIL(); + ErrorMessageUtil.error(e.getLocalizedMessage()); + ErrorMessageUtil.error( + "Ontology processing/upload failed, make sure you are connected to RACK or RACK-BOX instance"); + ErrorMessageUtil.error("Upload of owl failed, OWL: " + owlFile.getAbsolutePath()); return IngestionStatus.FAILED; } } @@ -203,7 +194,7 @@ private IngestionStatus uploadDataFromYAML(String yamlPath, IProgressMonitor mon } if (dedupSteps.contains(yamlPath)) { - RackConsole.getConsole().warning("Skipping previously executed step at: " + yamlPath); + ErrorMessageUtil.warning("Skipping previously executed step at: " + yamlPath); return IngestionStatus.DONE; } @@ -218,25 +209,25 @@ private IngestionStatus uploadDataFromYAML(String yamlPath, IProgressMonitor mon try { oYaml = ProjectUtils.readYaml(yamlPath); } catch (Exception e) { - RackConsole.getConsole().error("Unable to read " + dir + "/import.yaml"); + ErrorMessageUtil.error("Unable to read " + dir + "/import.yaml"); return IngestionStatus.FAILED; } if (oYaml == null || !(oYaml instanceof Map)) { - RackConsole.getConsole().error("Ill formed " + dir + "/import.yaml, please check"); + ErrorMessageUtil.error("Ill formed " + dir + "/import.yaml, please check"); return IngestionStatus.FAILED; } - HashMap yamlMap = (HashMap) oYaml; + HashMap yamlMap = (HashMap) oYaml; if (!yamlMap.containsKey("ingestion-steps")) { - RackConsole.getConsole().warning(dir + "/import.yaml contains no ingestion step, done"); + ErrorMessageUtil.warning(dir + "/import.yaml contains no ingestion step, done"); return IngestionStatus.FAILED; } Object oList = yamlMap.get("ingestion-steps"); if (!(oList instanceof List)) { - RackConsole.getConsole() - .error("ingestion-steps in" + dir + "/import.yaml is ill formed, please check"); + ErrorMessageUtil.error( + "ingestion-steps in" + dir + "/import.yaml is ill formed, please check"); return IngestionStatus.FAILED; } @@ -249,12 +240,9 @@ private IngestionStatus uploadDataFromYAML(String yamlPath, IProgressMonitor mon dataGraph = (String) oDataGraph; // validate target graph against footprint if (!dGraphs.contains(dataGraph)) { - RackConsole.getConsole() - .error( - "Specified target graph " - + dataGraph - + " not declared in footprint"); - RackConsole.getConsole().error("YAML file: " + yamlPath); + ErrorMessageUtil.error( + "Specified target graph " + dataGraph + " not declared in footprint"); + ErrorMessageUtil.error("YAML file: " + yamlPath); return IngestionStatus.FAILED; } } @@ -264,9 +252,8 @@ private IngestionStatus uploadDataFromYAML(String yamlPath, IProgressMonitor mon Object oDataGraph = yamlMap.get("model-graphs"); if (oDataGraph instanceof List) { if (((List) oDataGraph).size() > 1) { - RackConsole.getConsole() - .warning( - "We currently support ingesting only using a single model-graph"); + ErrorMessageUtil.warning( + "We currently support ingesting only using a single model-graph"); // return IngestionStatus.FAILED; } modelGraph = ((List) oDataGraph).get(0); @@ -275,12 +262,9 @@ private IngestionStatus uploadDataFromYAML(String yamlPath, IProgressMonitor mon } // validate target graph against footprint if (!mGraphs.contains(modelGraph)) { - RackConsole.getConsole() - .error( - "Specified target graph " - + modelGraph - + " not declared in footprint"); - RackConsole.getConsole().error("YAML file: " + yamlPath); + ErrorMessageUtil.error( + "Specified target graph " + modelGraph + " not declared in footprint"); + ErrorMessageUtil.error("YAML file: " + yamlPath); return IngestionStatus.FAILED; } } @@ -316,11 +300,10 @@ private IngestionStatus uploadDataFromYAML(String yamlPath, IProgressMonitor mon } File csvFile = new File(dir + "/" + csvFileName); if (!csvFile.exists()) { - RackConsole.getConsole() - .error( - "Cannot ingest data for nodegroup: " - + ingestionId - + ", csv file missing"); + ErrorMessageUtil.error( + "Cannot ingest data for nodegroup: " + + ingestionId + + ", csv file missing"); return IngestionStatus.FAILED; // continue; @@ -330,10 +313,8 @@ private IngestionStatus uploadDataFromYAML(String yamlPath, IProgressMonitor mon ArrayList> tabData = new ArrayList<>(); if (dedupSteps.contains(csvFile.getAbsolutePath())) { - RackConsole.getConsole() - .warning( - "Skipping already processed file: " - + csvFile.getAbsolutePath()); + ErrorMessageUtil.warning( + "Skipping already processed file: " + csvFile.getAbsolutePath()); continue; } else { dedupSteps.add(csvFile.getAbsolutePath()); @@ -364,7 +345,7 @@ private IngestionStatus uploadDataFromYAML(String yamlPath, IProgressMonitor mon } catch (Exception e) { String message = "Problem occured when reading lines for :" + dir + "/" + csvFileName; - RackConsole.getConsole().error(message); + ErrorMessageUtil.error(message); return IngestionStatus.FAILED; } @@ -395,41 +376,39 @@ private IngestionStatus uploadDataFromYAML(String yamlPath, IProgressMonitor mon String owlPath = dir + "/" + owlFile; File owl = new File(owlPath); if (!owl.exists()) { - RackConsole.getConsole().error("Cannot find owl file: " + owlPath); + ErrorMessageUtil.error("Cannot find owl file: " + owlPath); continue; } final String dGraph = dataGraph; if (dedupSteps.contains(owl.getAbsolutePath())) { - RackConsole.getConsole() - .warning("Skipping already processed file: " + owl.getAbsolutePath()); + ErrorMessageUtil.warning( + "Skipping already processed file: " + owl.getAbsolutePath()); continue; } else { dedupSteps.add(owl.getAbsolutePath()); } try { - RackConsole.getConsole() - .print( - "Uploading owl file " - + owl.getAbsolutePath() - + " to " - + dGraph - + " ... "); + ErrorMessageUtil.print( + "Uploading owl file " + + owl.getAbsolutePath() + + " to " + + dGraph + + " ... "); SparqlQueryClient qAuthClient = ConnectionUtil.getOntologyUploadClient(dGraph); qAuthClient.uploadOwl(owl); - RackConsole.getConsole().printOK(); + ErrorMessageUtil.printOK(); } catch (Exception e) { - RackConsole.getConsole().printFAIL(); - RackConsole.getConsole() - .error("Upload of owl filed, OWL: " + owl.getAbsolutePath()); + ErrorMessageUtil.printFAIL(); + ErrorMessageUtil.error("Upload of owl filed, OWL: " + owl.getAbsolutePath()); return IngestionStatus.FAILED; } } } if (monitor.isCanceled()) { - RackConsole.getConsole().print(MANIFEST_CANCELED); + ErrorMessageUtil.print(MANIFEST_CANCELED); } return IngestionStatus.DONE; } @@ -441,7 +420,7 @@ private IngestionStatus uploadNodegroupsFromYAML(String ngPath, IProgressMonitor } if (dedupSteps.contains(ngPath)) { - RackConsole.getConsole().warning("Skipping previously executed step at: " + ngPath); + ErrorMessageUtil.warning("Skipping previously executed step at: " + ngPath); return IngestionStatus.DONE; } @@ -453,11 +432,10 @@ private IngestionStatus uploadNodegroupsFromYAML(String ngPath, IProgressMonitor } File csvNgStore = new File(ngPath + "/store_data.csv"); if (!csvNgStore.exists()) { - RackConsole.getConsole() - .error( - "Nodegroup csv store is missing, cannot ingest nodegroups specified in folder:" - + ngPath); - RackConsole.getConsole().error("Store data CSV: " + csvNgStore.getAbsolutePath()); + ErrorMessageUtil.error( + "Nodegroup csv store is missing, cannot ingest nodegroups specified in folder:" + + ngPath); + ErrorMessageUtil.error("Store data CSV: " + csvNgStore.getAbsolutePath()); } ArrayList colsList = new ArrayList<>(); ArrayList> tabData = new ArrayList<>(); @@ -486,7 +464,7 @@ private IngestionStatus uploadNodegroupsFromYAML(String ngPath, IProgressMonitor } catch (Exception e) { String message = "Problem occured when reading lines for :" + dir + "/" + csvNgStore.getName(); - RackConsole.getConsole().error(message); + ErrorMessageUtil.error(message); return IngestionStatus.FAILED; } @@ -510,8 +488,8 @@ private IngestionStatus uploadNodegroupsFromCSV( final String jsonFile = entry.get(3); File ngJson = new File(ngPath + "/" + jsonFile); if (!ngJson.exists()) { - RackConsole.getConsole() - .error("json file for " + jsonFile + "missing in folder: " + ngPath); + ErrorMessageUtil.error( + "json file for " + jsonFile + "missing in folder: " + ngPath); continue; } final String jsonstr = FileUtils.readFileToString(ngJson, Charset.defaultCharset()); @@ -522,21 +500,19 @@ private IngestionStatus uploadNodegroupsFromCSV( final SparqlGraphJson json2 = json; try { - RackConsole.getConsole() - .print("Uploading nodegroup: " + nodegroupId + ".json ... "); + ErrorMessageUtil.print("Uploading nodegroup: " + nodegroupId + ".json ... "); ngClient.executeStoreNodeGroup( nodegroupId, entry.get(1), entry.get(2), json2.getJson()); - RackConsole.getConsole().printOK(); + ErrorMessageUtil.printOK(); } catch (Exception e) { - RackConsole.getConsole().printFAIL(); - RackConsole.getConsole().error(e.getLocalizedMessage()); - RackConsole.getConsole() - .error( - "Upload of nodegroup" - + nodegroupId - + " failed, JSON:" - + ngJson.getAbsolutePath()); + ErrorMessageUtil.printFAIL(); + ErrorMessageUtil.error(e.getLocalizedMessage()); + ErrorMessageUtil.error( + "Upload of nodegroup" + + nodegroupId + + " failed, JSON:" + + ngJson.getAbsolutePath()); return IngestionStatus.FAILED; } } @@ -547,7 +523,7 @@ private IngestionStatus uploadDataFromManifestYAML(String yamlPath, IProgressMon throws Exception { if (dedupSteps.contains(yamlPath)) { - RackConsole.getConsole().warning("Skipping previously executed step at: " + yamlPath); + ErrorMessageUtil.warning("Skipping previously executed step at: " + yamlPath); return IngestionStatus.DONE; } @@ -561,43 +537,31 @@ private IngestionStatus uploadDataFromManifestYAML(String yamlPath, IProgressMon return IngestionStatus.FAILED; } String dir = file.getParent(); - Object oYaml = null; + HashMap yamlMap = null; try { - oYaml = ProjectUtils.readYaml(yamlPath); + yamlMap = ProjectUtils.readYaml(yamlPath); } catch (Exception e) { - RackConsole.getConsole().error("Unable to read " + dir + "/" + file.getName()); + ErrorMessageUtil.error("Unable to read " + dir + "/" + file.getName()); } - if (oYaml == null || !(oYaml instanceof Map)) { - RackConsole.getConsole() - .error( - "Ill formed manifest at " - + dir - + "/" - + file.getName() - + ", please check"); - RackConsole.getConsole().error("Check YAML: " + file.getAbsolutePath()); + if (yamlMap == null) { + ErrorMessageUtil.error( + "Ill formed manifest at " + dir + "/" + file.getName() + ", please check"); + ErrorMessageUtil.error("Check YAML: " + file.getAbsolutePath()); return IngestionStatus.FAILED; } - HashMap yamlMap = (HashMap) oYaml; - if (!yamlMap.containsKey("steps")) { - RackConsole.getConsole() - .error(dir + "/" + file.getName() + " contains no ingestion step, done"); - RackConsole.getConsole().error("Check YAML: " + file.getAbsolutePath()); + ErrorMessageUtil.error( + dir + "/" + file.getName() + " contains no ingestion step, done"); + ErrorMessageUtil.error("Check YAML: " + file.getAbsolutePath()); return IngestionStatus.FAILED; } Object oList = yamlMap.get("steps"); if (!(oList instanceof List)) { - RackConsole.getConsole() - .error( - "steps in" - + dir - + "/" - + file.getName() - + " is ill formed, please check"); - RackConsole.getConsole().error("Check YAML: " + file.getAbsolutePath()); + ErrorMessageUtil.error( + "steps in" + dir + "/" + file.getName() + " is ill formed, please check"); + ErrorMessageUtil.error("Check YAML: " + file.getAbsolutePath()); return IngestionStatus.FAILED; } ArrayList> steps = (ArrayList>) oList; @@ -689,32 +653,30 @@ private IStatus ingestInstanceData(IProgressMonitor monitor) { File ingestionYaml = new File(manifestPath); if (!ingestionYaml.exists()) { - RackConsole.getConsole().warning("No manifest.yaml found, nothing to ingest"); + ErrorMessageUtil.warning("No manifest.yaml found, nothing to ingest"); return Status.CANCEL_STATUS; } String dir = ingestionYaml.getParent(); - Object oYaml = null; + HashMap yamlMap = null; try { - oYaml = ProjectUtils.readYaml(ingestionYaml.getAbsolutePath()); + yamlMap = ProjectUtils.readYaml(ingestionYaml.getAbsolutePath()); } catch (Exception e) { - RackConsole.getConsole().error("Unable to read " + dir + "/" + ingestionYaml.getName()); + ErrorMessageUtil.error("Unable to read " + dir + "/" + ingestionYaml.getName()); return Status.CANCEL_STATUS; } - if (oYaml == null || !(oYaml instanceof Map)) { - RackConsole.getConsole() - .error( - "Ill formed manifest at " - + dir - + "/" - + ingestionYaml.getName() - + ", please check"); - RackConsole.getConsole().error("Check YAML: " + ingestionYaml.getAbsolutePath()); + if (yamlMap == null) { + ErrorMessageUtil.error( + "Ill formed manifest at " + + dir + + "/" + + ingestionYaml.getName() + + ", please check"); + ErrorMessageUtil.error("Check YAML: " + ingestionYaml.getAbsolutePath()); return Status.CANCEL_STATUS; } // read footprint - HashMap yamlMap = (HashMap) oYaml; if (yamlMap.containsKey("footprint")) { Object oFootprint = yamlMap.get("footprint"); @@ -744,18 +706,18 @@ private IStatus ingestInstanceData(IProgressMonitor monitor) { monitor.worked(100); switch (value) { case DONE: - RackConsole.getConsole().print(MANIFEST_SUCCESS); + ErrorMessageUtil.print(MANIFEST_SUCCESS); break; case FAILED: - RackConsole.getConsole().error(MANIFEST_FAILED); + ErrorMessageUtil.error(MANIFEST_FAILED); break; case CANCELED: - RackConsole.getConsole().print(MANIFEST_CANCELED); + ErrorMessageUtil.print(MANIFEST_CANCELED); } } catch (Exception e) { - RackConsole.getConsole() - .error("Ingestion failed, check YAML: " + ingestionYaml.getAbsolutePath()); + ErrorMessageUtil.error( + "Ingestion failed, check YAML: " + ingestionYaml.getAbsolutePath()); } finally { setRunning(false); } @@ -792,8 +754,8 @@ private IngestionStatus uploadInstanceDataCSV( } } String sCSV = tab.toCSVString(); - RackConsole.getConsole() - .print("Uploading CSV at " + path + " as class " + ingestionId + "... "); + ErrorMessageUtil.print( + "Uploading CSV at " + path + " as class " + ingestionId + "... "); if (bUriIngestion == false) { client.dispatchIngestFromCsvStringsByIdSync( ingestionId, @@ -815,20 +777,19 @@ private IngestionStatus uploadInstanceDataCSV( sCSV, ConnectionUtil.getSparqlConnection(mGraphs, dataGraph, dataGraphs)); } - RackConsole.getConsole().printOK(); + ErrorMessageUtil.printOK(); List warnings = client.getWarnings(); if (warnings != null) { for (String warning : warnings) { - RackConsole.getConsole().warning(warning); + ErrorMessageUtil.warning(warning); } } } catch (Exception e) { - RackConsole.getConsole().printFAIL(); - RackConsole.getConsole().error(e.getLocalizedMessage()); - RackConsole.getConsole() - .error("Upload of " + ingestionId + " failed, " + "CSV: " + path); + ErrorMessageUtil.printFAIL(); + ErrorMessageUtil.error(e.getLocalizedMessage()); + ErrorMessageUtil.error("Upload of " + ingestionId + " failed, " + "CSV: " + path); return IngestionStatus.FAILED; } @@ -854,7 +815,7 @@ protected IStatus run(IProgressMonitor monitor) { ViewUtils.showProgressView(); if (isRunning()) { - RackConsole.getConsole().error(MANIFEST_IN_PROGRESS); + ErrorMessageUtil.error(MANIFEST_IN_PROGRESS); return Status.CANCEL_STATUS; } diff --git a/tools/rack/rack.plugin/src/com/ge/research/rack/IngestTemplatesHandler.java b/tools/rack/rack.plugin/src/com/ge/research/rack/IngestTemplatesHandler.java index b2d2984a..165cb160 100644 --- a/tools/rack/rack.plugin/src/com/ge/research/rack/IngestTemplatesHandler.java +++ b/tools/rack/rack.plugin/src/com/ge/research/rack/IngestTemplatesHandler.java @@ -51,11 +51,9 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent; import org.eclipse.core.runtime.jobs.IJobChangeListener; import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.console.IConsoleConstants; import org.eclipse.ui.console.IConsoleView; -import org.eclipse.ui.handlers.HandlerUtil; public class IngestTemplatesHandler extends AbstractHandler { @@ -187,7 +185,6 @@ public static void uploadNodegroup(String ingestId, boolean isCore) throws Excep @Override public Object execute(ExecutionEvent event) throws ExecutionException { - IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); try { diff --git a/tools/rack/rack.plugin/src/com/ge/research/rack/LoadAssuranceCaseHandler.java b/tools/rack/rack.plugin/src/com/ge/research/rack/LoadAssuranceCaseHandler.java index 2d47ebfb..88b7bfa0 100644 --- a/tools/rack/rack.plugin/src/com/ge/research/rack/LoadAssuranceCaseHandler.java +++ b/tools/rack/rack.plugin/src/com/ge/research/rack/LoadAssuranceCaseHandler.java @@ -52,7 +52,6 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.jobs.*; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.TreePath; import org.eclipse.jface.viewers.TreeSelection; diff --git a/tools/rack/rack.plugin/src/com/ge/research/rack/ManifestSelectedPropertyTester.java b/tools/rack/rack.plugin/src/com/ge/research/rack/ManifestSelectedPropertyTester.java index addb153f..626a69ef 100644 --- a/tools/rack/rack.plugin/src/com/ge/research/rack/ManifestSelectedPropertyTester.java +++ b/tools/rack/rack.plugin/src/com/ge/research/rack/ManifestSelectedPropertyTester.java @@ -40,7 +40,7 @@ public class ManifestSelectedPropertyTester extends PropertyTester { public static final String MY_PROPERTY = "isManifestSelected"; public static IEvaluationService getEvalService(BundleContext ctxt) { - final ServiceReference reference = + final ServiceReference reference = ctxt.getServiceReference(IEvaluationService.class.getName()); return (IEvaluationService) ctxt.getService(reference); } diff --git a/tools/rack/rack.plugin/src/com/ge/research/rack/UploadIngestionPackageHandler.java b/tools/rack/rack.plugin/src/com/ge/research/rack/UploadIngestionPackageHandler.java index 0b2ce424..8dda14f6 100644 --- a/tools/rack/rack.plugin/src/com/ge/research/rack/UploadIngestionPackageHandler.java +++ b/tools/rack/rack.plugin/src/com/ge/research/rack/UploadIngestionPackageHandler.java @@ -32,6 +32,7 @@ package com.ge.research.rack; import com.ge.research.rack.utils.ConnectionUtil; +import com.ge.research.rack.utils.ErrorMessageUtil; import com.ge.research.rack.utils.RackConsole; import com.ge.research.rack.utils.RackManifestIngestionBuilderUtil; import com.ge.research.rack.utils.RackManifestIngestionBuilderUtil.IngestionBuilderException; @@ -62,6 +63,7 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.TreePath; import org.eclipse.jface.viewers.TreeSelection; import org.eclipse.swt.SWT; @@ -133,6 +135,7 @@ public Object execute(ExecutionEvent event, boolean shouldUpload, boolean keepZi if (eventResourcePaths.length != 1) { RackConsole.getConsole().error(NO_SELECTED_PROJECT); + MessageDialog.openError(null, "Ingestion failed", NO_SELECTED_PROJECT); RackConsole.getConsole().activate(); return null; } @@ -145,6 +148,7 @@ public Object execute(ExecutionEvent event, boolean shouldUpload, boolean keepZi if (selectedProject.isEmpty()) { RackConsole.getConsole().error(NO_SELECTED_PROJECT); + MessageDialog.openError(null, "Ingestion failed", NO_SELECTED_PROJECT); RackConsole.getConsole().activate(); } @@ -152,6 +156,7 @@ public Object execute(ExecutionEvent event, boolean shouldUpload, boolean keepZi if (shouldUpload && !startRun()) { RackConsole.getConsole().error(UPLOAD_DEBOUNCED); + MessageDialog.openError(null, "Ingestion failed", UPLOAD_DEBOUNCED); RackConsole.getConsole().activate(); return null; } @@ -266,22 +271,20 @@ private void addChangeListeners(final Runnable asyncCallback) { @Override public void done(IJobChangeEvent event) { if (event.getResult() != Status.OK_STATUS) { - RackConsole.getConsole() - .error( - String.format( - upload ? UPLOAD_FAILED : CREATION_FAILED, - ingestionPackageZipFilepath)); + ErrorMessageUtil.error( + String.format( + upload ? UPLOAD_FAILED : CREATION_FAILED, + ingestionPackageZipFilepath)); } asyncCallback.run(); } @Override public void scheduled(IJobChangeEvent event) { - RackConsole.getConsole() - .print( - String.format( - upload ? UPLOAD_QUEUED : CREATION_QUEUED, - ingestionPackageZipFilepath)); + ErrorMessageUtil.print( + String.format( + upload ? UPLOAD_QUEUED : CREATION_QUEUED, + ingestionPackageZipFilepath)); } }; @@ -309,7 +312,7 @@ protected IStatus run(IProgressMonitor monitor) { } } catch (final Exception e) { - RackConsole.getConsole().error(e.getMessage()); + ErrorMessageUtil.error(e.getMessage()); return Status.CANCEL_STATUS; } return Status.OK_STATUS; @@ -325,8 +328,7 @@ private static Path zipIt(Path folder, Path zipFilepath) try (FileOutputStream fos = new FileOutputStream(zipFilepath.toFile()); ZipOutputStream zipStream = new ZipOutputStream(fos)) { - RackConsole.getConsole() - .print(String.format(GENERATING_PROJECT, zipFilepath.toString())); + ErrorMessageUtil.error(String.format(GENERATING_PROJECT, zipFilepath.toString())); new RackManifestIngestionBuilderUtil().zipManifestResources(folder, zipStream); } @@ -365,9 +367,9 @@ private static void uploadIngestionZip(Path zipFilepath, IProgressMonitor monito return; } if (semTkOutputLine.contains(ERROR_LINE)) { - RackConsole.getConsole().errorEcho(semTkOutputLine); + ErrorMessageUtil.errorEcho(semTkOutputLine); } else { - RackConsole.getConsole().printEcho(semTkOutputLine); + ErrorMessageUtil.printEcho(semTkOutputLine); } } } diff --git a/tools/rack/rack.plugin/src/com/ge/research/rack/UploadNodegroupsHandler.java b/tools/rack/rack.plugin/src/com/ge/research/rack/UploadNodegroupsHandler.java index 5fe82a68..ce34df2d 100644 --- a/tools/rack/rack.plugin/src/com/ge/research/rack/UploadNodegroupsHandler.java +++ b/tools/rack/rack.plugin/src/com/ge/research/rack/UploadNodegroupsHandler.java @@ -32,6 +32,7 @@ package com.ge.research.rack; import com.ge.research.rack.report.utils.RackQueryUtils; +import com.ge.research.rack.utils.ErrorMessageUtil; import com.ge.research.rack.utils.RackConsole; import java.io.File; import java.util.List; @@ -202,16 +203,16 @@ public NodegroupsUploadJob( @Override public void done(IJobChangeEvent event) { if (event.getResult() != Status.OK_STATUS) { - RackConsole.getConsole() - .error(String.format(UPLOAD_FAILED, nodegroupFilepaths)); + ErrorMessageUtil.error( + String.format(UPLOAD_FAILED, nodegroupFilepaths)); } asyncCallback.run(); } @Override public void scheduled(IJobChangeEvent event) { - RackConsole.getConsole() - .println(String.format(UPLOAD_QUEUED, nodegroupFilepaths)); + ErrorMessageUtil.println( + String.format(UPLOAD_QUEUED, nodegroupFilepaths)); } }); } diff --git a/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/structures/MultiClassPackets.java b/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/structures/MultiClassPackets.java index 0c68b562..f957db7b 100644 --- a/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/structures/MultiClassPackets.java +++ b/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/structures/MultiClassPackets.java @@ -198,12 +198,12 @@ public void setDependencyList(List dependencyList) { * * @author Saswata Paul */ - public class TreeItemAndBoolean { + public class TreeItemAndBoolean { - TreeItem treeItem; + TreeItem treeItem; Boolean expandFlag; - public TreeItemAndBoolean(TreeItem treeItem, Boolean expandFlag) { + public TreeItemAndBoolean(TreeItem treeItem, Boolean expandFlag) { this.treeItem = treeItem; this.expandFlag = expandFlag; } @@ -211,14 +211,14 @@ public TreeItemAndBoolean(TreeItem treeItem, Boolean expandFlag) { /** * @return the treeItem */ - public TreeItem getTreeItem() { + public TreeItem getTreeItem() { return treeItem; } /** * @param treeItem the treeItem to set */ - public void setTreeItem(TreeItem treeItem) { + public void setTreeItem(TreeItem treeItem) { this.treeItem = treeItem; } diff --git a/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/utils/CustomStringUtils.java b/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/utils/CustomStringUtils.java index 4a60215c..a5ff5693 100644 --- a/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/utils/CustomStringUtils.java +++ b/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/utils/CustomStringUtils.java @@ -59,7 +59,7 @@ public class CustomStringUtils { * @return */ public static String getGsnOutDir(String instanceFilePath) { - String dirPath = ""; + // String dirPath = ""; // get the instance folder path String instDir = CustomFileUtils.getFileDirectory(instanceFilePath); diff --git a/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/utils/OntologyJsonObjUtils.java b/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/utils/OntologyJsonObjUtils.java index 6ad7e106..05b793ca 100644 --- a/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/utils/OntologyJsonObjUtils.java +++ b/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/utils/OntologyJsonObjUtils.java @@ -32,7 +32,6 @@ package com.ge.research.rack.autoGsn.utils; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -69,12 +68,12 @@ public static String getUriPrefix(JSONObject ontInfo, String key) { public static List getPropertyRangeURIs( JSONObject ontInfo, String classId, String propId) { // Create a list of strings to store values - List rangeUris = new ArrayList(); + List rangeUris = new ArrayList(); System.out.println("Finding range of " + classId + " | " + propId); JSONArray classPropertyRangeList = (JSONArray) ontInfo.get("classPropertyRangeList"); - Iterator classPropertyRangeListIter = classPropertyRangeList.iterator(); + var classPropertyRangeListIter = classPropertyRangeList.iterator(); // Flag to check if propertyUri has been added as first element Boolean addedPropUriFlag = false; @@ -87,8 +86,8 @@ public static List getPropertyRangeURIs( String rowRangeInfo = classPropertyRange.get(2).toString(); String rowClassId = rowClassInfo.split("\\:")[1]; - String rowClassUri = - getUriPrefix(ontInfo, rowClassInfo.split("\\:")[0]) + "#" + rowClassId; + // String rowClassUri = + // getUriPrefix(ontInfo, rowClassInfo.split("\\:")[0]) + "#" + rowClassId; String rowPropId = rowPropInfo.split("\\:")[1]; String rowPropUri = getUriPrefix(ontInfo, rowPropInfo.split("\\:")[0]) + "#" + rowPropId; @@ -146,7 +145,7 @@ public static String getClassURI(JSONObject ontInfo, String classId) { System.out.println("Finding URI of class " + classId); JSONArray subClassSuperClassList = (JSONArray) ontInfo.get("subClassSuperClassList"); - Iterator subClassSuperClassListIter = subClassSuperClassList.iterator(); + var subClassSuperClassListIter = subClassSuperClassList.iterator(); while (subClassSuperClassListIter.hasNext()) { JSONArray subSuperPair = (JSONArray) subClassSuperClassListIter.next(); @@ -183,7 +182,7 @@ public static String getSuperClassId(JSONObject ontInfo, String classId) { System.out.println("Finding Superclass of class " + classId); JSONArray subClassSuperClassList = (JSONArray) ontInfo.get("subClassSuperClassList"); - Iterator subClassSuperClassListIter = subClassSuperClassList.iterator(); + var subClassSuperClassListIter = subClassSuperClassList.iterator(); while (subClassSuperClassListIter.hasNext()) { JSONArray subSuperPair = (JSONArray) subClassSuperClassListIter.next(); @@ -219,7 +218,7 @@ public static Boolean isForwardProperty( JSONObject ontInfo, String classAId, String propId, String classBId) { JSONArray classPropertyRangeList = (JSONArray) ontInfo.get("classPropertyRangeList"); - Iterator classPropertyRangeListIter = classPropertyRangeList.iterator(); + var classPropertyRangeListIter = classPropertyRangeList.iterator(); /** * Note: Since class can be from overlays, the JSON ontology information can have the Class diff --git a/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/utils/QueryGenerationUtils.java b/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/utils/QueryGenerationUtils.java index 4f63251d..d5039ed7 100644 --- a/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/utils/QueryGenerationUtils.java +++ b/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/utils/QueryGenerationUtils.java @@ -91,7 +91,7 @@ public static String binaryConnectionQuery( String targetClassUri = OntologyJsonObjUtils.getClassURI(ontInfo, targetClassId); String sourceClassUri = OntologyJsonObjUtils.getClassURI(ontInfo, sourceClassId); - List propertyInfo = + List propertyInfo = OntologyJsonObjUtils.getPropertyRangeURIs(ontInfo, sourceClassId, propertyId); String propertyUri = @@ -187,7 +187,7 @@ public static String binaryConnectionQueryWithDesc( String targetClassUri = OntologyJsonObjUtils.getClassURI(ontInfo, targetClassId); String sourceClassUri = OntologyJsonObjUtils.getClassURI(ontInfo, sourceClassId); - List propertyInfo = + List propertyInfo = OntologyJsonObjUtils.getPropertyRangeURIs(ontInfo, sourceClassId, propertyId); String propertyUri = diff --git a/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/viewHandlers/AutoGsnUnifiedDrillGoalViewHandler.java b/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/viewHandlers/AutoGsnUnifiedDrillGoalViewHandler.java index 71a997bc..06729bff 100644 --- a/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/viewHandlers/AutoGsnUnifiedDrillGoalViewHandler.java +++ b/tools/rack/rack.plugin/src/com/ge/research/rack/autoGsn/viewHandlers/AutoGsnUnifiedDrillGoalViewHandler.java @@ -74,7 +74,7 @@ public class AutoGsnUnifiedDrillGoalViewHandler { // -------- Local variables to store data // All relevant GSN for this traverse instance - private List allRelevantGsn; + // private List allRelevantGsn; // Current level private int currentGoalLevel = 0; @@ -108,14 +108,14 @@ public class AutoGsnUnifiedDrillGoalViewHandler { @FXML private Label labelGoalStatus; @FXML private Label labelSubElementsHeading; - @FXML private BarChart chartGoalStatus; + @FXML private BarChart chartGoalStatus; @FXML private NumberAxis chartGoalStatusNumberAxis; @FXML private ListView