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:
parent
7ce0d5ec45
commit
d77cb38a8e
|
@ -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() {
|
||||
|
|
|
@ -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 + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -119,7 +119,6 @@ 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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
@ -108,15 +107,17 @@ public class InformationSystemUtils {
|
|||
|
||||
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) {
|
||||
|
@ -139,7 +140,7 @@ 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) {
|
||||
|
@ -158,7 +159,6 @@ public class InformationSystemUtils {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
logger.debug("DataMiner PoolManager URI: " + poolManagerURI);
|
||||
return poolManagerURI;
|
||||
|
||||
|
@ -172,7 +172,6 @@ public class InformationSystemUtils {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static String retrieveSocialNetworkingService(String scope) throws StatAlgoImporterServiceException {
|
||||
try {
|
||||
logger.debug("Retrieve SocialNetworkingService");
|
||||
|
@ -192,7 +191,7 @@ public class InformationSystemUtils {
|
|||
List<GCoreEndpoint> socialNetworkingResources = client.submit(query);
|
||||
logger.debug("Resources: " + socialNetworkingResources);
|
||||
|
||||
String socialNetworkingURI=null;
|
||||
String socialNetworkingURI = null;
|
||||
|
||||
for (GCoreEndpoint gCoreEndpoint : socialNetworkingResources) {
|
||||
if (gCoreEndpoint.scopes() != null) {
|
||||
|
@ -208,14 +207,13 @@ 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) {
|
||||
|
@ -234,7 +232,6 @@ public class InformationSystemUtils {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
logger.debug("SocialNetworking URI: " + socialNetworkingURI);
|
||||
return socialNetworkingURI;
|
||||
|
||||
|
|
Loading…
Reference in New Issue