From d77cb38a8eb583a13a0ea22a2f99084a097ed2cf Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 25 Jul 2017 17:37:47 +0000 Subject: [PATCH] ref 8819: Extend The Algorithms Importer to Manage Many Processes as Black Boxes https://support.d4science.org/issues/8819 Updated the support Pre-Installed software git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@151291 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/StatAlgoImporterController.java | 42 ++++++++++-------- .../client/event/InputReadyEvent.java | 24 ++++++++--- .../tools/input/InputVariableTabPanel.java | 20 +++++---- .../client/tools/input/ProjectInfoPanel.java | 42 ++++++++---------- .../server/is/InformationSystemUtils.java | 43 +++++++++---------- .../statalgoimporter.gwt.xml | 4 +- 6 files changed, 93 insertions(+), 82 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/StatAlgoImporterController.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/StatAlgoImporterController.java index 1020c87..956d53d 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/StatAlgoImporterController.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/StatAlgoImporterController.java @@ -320,26 +320,31 @@ public class StatAlgoImporterController { if (!event.isValidData()) { if (monitor != null) { monitor.hide(); + } + UtilsGXT3.alert("Attention", event.getError()); + return; + } else { + if(inputRequestType==null){ return; } - } - - switch (inputRequestType) { - case Save: - pm.saveProject(event.getInputData(), monitor); - break; - case SoftwareCreate: - pm.softwareCreate(event.getInputData(), monitor); - break; - case MainCodeSet: - pm.setMainCode(event.getInputData(), mainCodeItemDescription); - break; - case BinaryCodeSet: - pm.setBinaryCode(event.getInputData(), binaryCodeItemDescription); - break; - default: - break; + + switch (inputRequestType) { + case Save: + pm.saveProject(event.getInputData(), monitor); + break; + case SoftwareCreate: + pm.softwareCreate(event.getInputData(), monitor); + break; + case MainCodeSet: + pm.setMainCode(event.getInputData(), mainCodeItemDescription); + break; + case BinaryCodeSet: + pm.setBinaryCode(event.getInputData(), binaryCodeItemDescription); + break; + default: + break; + } } } @@ -348,8 +353,9 @@ public class StatAlgoImporterController { monitor = new StatAlgoImporterMonitor(); inputRequestType = InputRequestType.Save; InputRequestEvent inputRequestEvent = new InputRequestEvent(); + Log.debug("Fired InputRequestEvent: " + inputRequestEvent); eventBus.fireEvent(inputRequestEvent); - Log.debug("ProjectSaveRequest: " + inputRequestEvent); + } private void softwareCreateRequest() { diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/InputReadyEvent.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/InputReadyEvent.java index 6848a4c..1794e65 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/InputReadyEvent.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/event/InputReadyEvent.java @@ -20,6 +20,7 @@ public class InputReadyEvent extends GwtEvent TYPE = new Type(); private InputData inputData; private boolean validData; + private String error; public interface InputReadyEventHandler extends EventHandler { void onInputReady(InputReadyEvent event); @@ -29,9 +30,16 @@ public class InputReadyEvent extends GwtEvent client = ICFactory.clientFor(GCoreEndpoint.class); List dataMinerPoolManagerResources = client.submit(query); logger.debug("Resources: " + dataMinerPoolManagerResources); - - String poolManagerURI=null; - + + String poolManagerURI = null; + for (GCoreEndpoint gCoreEndpoint : dataMinerPoolManagerResources) { if (gCoreEndpoint.scopes() != null) { ScopeGroup scopes = gCoreEndpoint.scopes(); @@ -139,9 +140,9 @@ public class InformationSystemUtils { logger.debug("DataMiner PoolManager Endpoint: " + dataMinerEndpoint); if (dataMinerEndpoint != null && dataMinerEndpoint.uri() != null) { - poolManagerURI=dataMinerEndpoint.uri().toString(); + poolManagerURI = dataMinerEndpoint.uri().toString(); } - + } catch (Throwable e) { String error = "Error in discovery DataMiner PoolManager gCubeEndpoint resource on IS in scope: " + scope; @@ -157,8 +158,7 @@ public class InformationSystemUtils { } } - - + logger.debug("DataMiner PoolManager URI: " + poolManagerURI); return poolManagerURI; @@ -171,8 +171,7 @@ public class InformationSystemUtils { throw new StatAlgoImporterServiceException(error, e); } } - - + public static String retrieveSocialNetworkingService(String scope) throws StatAlgoImporterServiceException { try { logger.debug("Retrieve SocialNetworkingService"); @@ -183,7 +182,7 @@ public class InformationSystemUtils { logger.debug("SocialNetworkingService resource in scope: " + scope); SimpleQuery query = ICFactory.queryFor(GCoreEndpoint.class); - + query.addCondition("$resource/Profile/ServiceClass/text() eq '" + Constants.SOCIAL_NETWORKING_CLASS + "'") .addCondition("$resource/Profile/ServiceName/text() eq '" + Constants.SOCIAL_NETWORKING_NAME + "'") .setResult("$resource"); @@ -191,9 +190,9 @@ public class InformationSystemUtils { DiscoveryClient client = ICFactory.clientFor(GCoreEndpoint.class); List socialNetworkingResources = client.submit(query); logger.debug("Resources: " + socialNetworkingResources); - - String socialNetworkingURI=null; - + + String socialNetworkingURI = null; + for (GCoreEndpoint gCoreEndpoint : socialNetworkingResources) { if (gCoreEndpoint.scopes() != null) { ScopeGroup scopes = gCoreEndpoint.scopes(); @@ -208,16 +207,15 @@ public class InformationSystemUtils { } if (found) { try { - logger.debug( - "SocialNetworking Endpoints map: " + gCoreEndpoint.profile().endpointMap()); + logger.debug("SocialNetworking Endpoints map: " + gCoreEndpoint.profile().endpointMap()); Map endpointMap = gCoreEndpoint.profile().endpointMap(); Endpoint dataMinerEndpoint = endpointMap.get("jersey-servlet"); logger.debug("SocialNetworking Endpoint: " + dataMinerEndpoint); if (dataMinerEndpoint != null && dataMinerEndpoint.uri() != null) { - socialNetworkingURI=dataMinerEndpoint.uri().toString(); + socialNetworkingURI = dataMinerEndpoint.uri().toString(); } - + } catch (Throwable e) { String error = "Error in discovery SocialNetworking gCubeEndpoint resource on IS in scope: " + scope; @@ -233,8 +231,7 @@ public class InformationSystemUtils { } } - - + logger.debug("SocialNetworking URI: " + socialNetworkingURI); return socialNetworkingURI; diff --git a/src/main/resources/org/gcube/portlets/user/statisticalalgorithmsimporter/statalgoimporter.gwt.xml b/src/main/resources/org/gcube/portlets/user/statisticalalgorithmsimporter/statalgoimporter.gwt.xml index d94f2ea..59cb0ba 100644 --- a/src/main/resources/org/gcube/portlets/user/statisticalalgorithmsimporter/statalgoimporter.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/statisticalalgorithmsimporter/statalgoimporter.gwt.xml @@ -60,7 +60,7 @@ --> + /> --> @@ -68,7 +68,7 @@ - +