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
This commit is contained in:
Giancarlo Panichi 2017-07-25 17:37:47 +00:00
parent 7ce0d5ec45
commit d77cb38a8e
6 changed files with 93 additions and 82 deletions

View File

@ -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() {

View File

@ -20,6 +20,7 @@ public class InputReadyEvent extends GwtEvent<InputReadyEvent.InputReadyEventHan
public static Type<InputReadyEventHandler> TYPE = new Type<InputReadyEventHandler>();
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<InputReadyEvent.InputReadyEventHan
public HandlerRegistration addInputReadyEventHandler(InputReadyEventHandler handler);
}
public InputReadyEvent(InputData inputData, boolean validData) {
public InputReadyEvent(InputData inputData) {
this.inputData = inputData;
this.validData = validData;
this.validData = true;
this.error=null;
}
public InputReadyEvent(InputData inputData, String error) {
this.inputData = inputData;
this.validData = false;
this.error=error;
}
@Override
@ -60,9 +68,15 @@ public class InputReadyEvent extends GwtEvent<InputReadyEvent.InputReadyEventHan
return validData;
}
@Override
public String toString() {
return "InputReadyEvent [inputData=" + inputData + ", validData=" + validData + "]";
public String getError() {
return error;
}
@Override
public String toString() {
return "InputReadyEvent [inputData=" + inputData + ", validData=" + validData + ", error=" + error + "]";
}
}

View File

@ -1,8 +1,8 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputReadyEvent;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils.UtilsGXT3;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.ProjectInfo;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
@ -117,10 +117,9 @@ public class InputVariableTabPanel extends TabPanel {
}
public void requestInput() {
InputData inputData = new InputData();
boolean valid=true;
if (globalVariablesPanel != null) {
inputData.setListGlobalVariables(globalVariablesPanel.getGlobalVariables());
}
@ -133,19 +132,22 @@ public class InputVariableTabPanel extends TabPanel {
inputData.setInterpreterInfo(interpreterInfoPanel.getInterpreterInfo());
}
InputReadyEvent inputReadyEvent;
try {
if (projectInfoPanel != null) {
inputData.setProjectInfo(projectInfoPanel.getProjectInfo());
ProjectInfo projectInfo = projectInfoPanel.getProjectInfo();
inputData.setProjectInfo(projectInfo);
inputReadyEvent = new InputReadyEvent(inputData);
} else {
inputReadyEvent = new InputReadyEvent(inputData, "Error loading ProjectInfoPanel!");
}
} catch (Exception e) {
Log.error("Attention invalid project info: " + e.getLocalizedMessage());
UtilsGXT3.alert("Attention", e.getLocalizedMessage());
valid=false;
inputReadyEvent = new InputReadyEvent(inputData, e.getLocalizedMessage());
}
InputReadyEvent inputReadyEvent = new InputReadyEvent(inputData,valid);
eventBus.fireEvent(inputReadyEvent);
Log.debug("Fired InputReadyEvent");
eventBus.fireEvent(inputReadyEvent);
}

View File

@ -4,8 +4,6 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.Projec
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.shared.EventBus;
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
import com.sencha.gxt.core.client.util.Margins;
@ -61,21 +59,12 @@ public class ProjectInfoPanel extends ContentPanel {
algorithmName.setAllowBlank(false);
algorithmName.addValidator(
new RegExValidator("^[a-zA-Z0-9_]*$", "Attention only characters a-z,A-Z,0-9 are allowed"));
algorithmName.addValidator(
new RegExValidator("^((?!(TEST|test|Test)).)*$", "Attention the words that contain TEST are invalid names"));
algorithmName.addValidator(new RegExValidator("^((?!(TEST|test|Test)).)*$",
"Attention the words that contain TEST are invalid names"));
algorithmName.addValidator(new MaxLengthValidator(100));
algorithmName.setEmptyText("Enter name...");
algorithmName.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
algorithmName.validate();
}
});
FieldLabel nameLabel = new FieldLabel(algorithmName, "Name");
nameLabel.setLabelWidth(LABAEL_WIDTH);
@ -86,7 +75,7 @@ public class ProjectInfoPanel extends ContentPanel {
algorithmDescription.setEmptyText("Enter description...");
algorithmDescription.addValidator(new RegExValidator("^[^\"]*$", "Attention character \" is not allowed"));
algorithmDescription.addValidator(new RegExValidator("^[^|]*$", "Attention character | is not allowed"));
FieldLabel descriptionLabel = new FieldLabel(algorithmDescription, "Description");
descriptionLabel.setLabelWidth(LABAEL_WIDTH);
@ -96,8 +85,8 @@ public class ProjectInfoPanel extends ContentPanel {
algorithmCategory.setEmptyText("Enter description...");
algorithmCategory.addValidator(
new RegExValidator("^[a-zA-Z0-9_]*$", "Attention only characters a-z,A-Z,0-9 are allowed"));
algorithmCategory.addValidator(
new RegExValidator("^((?!(TEST|test|Test)).)*$", "Attention the words that contain TEST are invalid names"));
algorithmCategory.addValidator(new RegExValidator("^((?!(TEST|test|Test)).)*$",
"Attention the words that contain TEST are invalid names"));
algorithmCategory.addValidator(new MaxLengthValidator(32));
FieldLabel categoryLabel = new FieldLabel(algorithmCategory, "Category");
categoryLabel.setLabelWidth(LABAEL_WIDTH);
@ -158,19 +147,22 @@ public class ProjectInfoPanel extends ContentPanel {
}
public ProjectInfo getProjectInfo() throws Exception {
if(!algorithmName.validate()){
if (!algorithmName.isValid()) {
Log.debug("AlgorithmName " + algorithmName.getCurrentValue());
throw new Exception("Invalid algorithm name");
}
if(!algorithmDescription.validate()){
if (!algorithmDescription.isValid()) {
Log.debug("AlgorithmDescription " + algorithmDescription.getCurrentValue());
throw new Exception("Invalid algorithm description");
}
if(!algorithmCategory.validate()){
if (!algorithmCategory.isValid()) {
Log.debug("AlgorithmCategory " + algorithmCategory.getCurrentValue());
throw new Exception("Invalid algorithm category");
}
String name = algorithmName.getCurrentValue();
String description = algorithmDescription.getCurrentValue();
String category = algorithmCategory.getCurrentValue();

View File

@ -8,7 +8,6 @@ import org.gcube.common.resources.gcore.GCoreEndpoint;
import org.gcube.common.resources.gcore.GCoreEndpoint.Profile.Endpoint;
import org.gcube.common.resources.gcore.GenericResource;
import org.gcube.common.resources.gcore.ScopeGroup;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
@ -107,17 +106,19 @@ public class InformationSystemUtils {
logger.debug("Retrieve DataMiner Pool Manager resource in scope: " + scope);
SimpleQuery query = ICFactory.queryFor(GCoreEndpoint.class);
query.addCondition("$resource/Profile/ServiceClass/text() eq '" + Constants.POOL_MANAGER_SERVICE_CLASS + "'")
.addCondition("$resource/Profile/ServiceName/text() eq '" + Constants.POOL_MANAGER_SERVICE_NAME + "'")
query.addCondition(
"$resource/Profile/ServiceClass/text() eq '" + Constants.POOL_MANAGER_SERVICE_CLASS + "'")
.addCondition(
"$resource/Profile/ServiceName/text() eq '" + Constants.POOL_MANAGER_SERVICE_NAME + "'")
.setResult("$resource");
DiscoveryClient<GCoreEndpoint> client = ICFactory.clientFor(GCoreEndpoint.class);
List<GCoreEndpoint> dataMinerPoolManagerResources = client.submit(query);
logger.debug("Resources: " + dataMinerPoolManagerResources);
String poolManagerURI=null;
String poolManagerURI = null;
for (GCoreEndpoint gCoreEndpoint : dataMinerPoolManagerResources) {
if (gCoreEndpoint.scopes() != null) {
ScopeGroup<String> 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<GCoreEndpoint> client = ICFactory.clientFor(GCoreEndpoint.class);
List<GCoreEndpoint> socialNetworkingResources = client.submit(query);
logger.debug("Resources: " + socialNetworkingResources);
String socialNetworkingURI=null;
String socialNetworkingURI = null;
for (GCoreEndpoint gCoreEndpoint : socialNetworkingResources) {
if (gCoreEndpoint.scopes() != null) {
ScopeGroup<String> 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<String, Endpoint> 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;

View File

@ -60,7 +60,7 @@
<set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
/> -->
/> -->
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="ENABLED"
/> -->
@ -68,7 +68,7 @@
<set-property name="log_ConsoleLogger" value="DISABLED" />
<set-property name="log_DivLogger" value="DISABLED" />
<set-property name="log_GWTLogger" value="DISABLED" />
<set-property name="log_SystemLogger" value="DISABLED" />
<set-property name="log_SystemLogger" value="DISABLED" />
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="DISABLED"
/> -->