refs 2521: Explore the possibility to port the StatMan interface onto Dataminer

https://support.d4science.org/issues/2521

Added Equivalent GET Request

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@128614 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-05-16 13:23:40 +00:00
parent 741c061e79
commit 06c05f0dd3
27 changed files with 202 additions and 543 deletions

View File

@ -358,6 +358,8 @@ public class DataMinerManagerController {
private void resubmitComputationRequest(
final ResubmitComputationExecutionRequestEvent event) {
MenuSwitchEvent menuSwitchEvent=new MenuSwitchEvent(MenuType.EXPERIMENT);
EventBusProvider.INSTANCE.fireEvent(menuSwitchEvent);
DataMinerPortletServiceAsync.INSTANCE.resubmit(
event.getItemDescription(), new AsyncCallback<ComputationId>() {

View File

@ -45,6 +45,7 @@ public class ComputationStatus implements Serializable {
super();
this.percentage = 100f;
this.status = Status.FAILED;
this.error=error;
}
public boolean isComplete() {

View File

@ -8,7 +8,9 @@ import java.util.Map;
/**
* @author ceras
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TemplateDescriptor {

View File

@ -27,6 +27,7 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.form.FieldLabel;
import com.sencha.gxt.widget.core.client.info.Info;
/**
@ -85,6 +86,24 @@ public class ComputationStatusPanel extends SimpleContainer {
vert.add(new HtmlLayoutContainer("<p>Created, the id is "
+ computationId.getId() + " [<a href='"
+ computationId.getUrlId() + "' >link</a>]</p>"));
TextButton equivalentRequestBtn=new TextButton();
equivalentRequestBtn.setText("Show");
equivalentRequestBtn.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
showEquivalentRequestDialog();
}
});
FieldLabel equivalentRequestLabel=new FieldLabel(equivalentRequestBtn,"Equivalent Get Request");
equivalentRequestLabel.setLabelWidth(140);
vert.add(equivalentRequestLabel, new VerticalLayoutData(-1, -1, new Margins(0)));
progressBar = new ProgressBar();
progressBar.updateProgress(0, "Starting...");
vert.add(progressBar, new VerticalLayoutData(1, -1, new Margins(20)));
@ -110,7 +129,10 @@ public class ComputationStatusPanel extends SimpleContainer {
timer.scheduleRepeating(Constants.TIME_UPDATE_COMPUTATION_STATUS_PANEL);
}
private void showEquivalentRequestDialog() {
EquivalentRequestDialog equivalentRequestDialog=new EquivalentRequestDialog(computationId);
equivalentRequestDialog.show();
}
private void cancelComputation() {
CancelComputationExecutionRequestEvent event = new CancelComputationExecutionRequestEvent(

View File

@ -0,0 +1,46 @@
package org.gcube.portlets.user.dataminermanager.client.experiments;
import org.gcube.portlets.user.dataminermanager.shared.data.computations.ComputationId;
import com.allen_sauer.gwt.log.client.Log;
import com.sencha.gxt.widget.core.client.Dialog;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.form.TextArea;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class EquivalentRequestDialog extends Dialog {
private ComputationId computationId;
public EquivalentRequestDialog(ComputationId computationId) {
super();
Log.debug("EquivalentRequestDialog: " + computationId);
this.computationId = computationId;
init();
create();
}
private void init() {
setModal(true);
setClosable(true);
setHeadingText("Equivalent Get Request");
setBodyBorder(true);
setHideOnButtonClick(true);
setPredefinedButtons(PredefinedButton.CLOSE);
getButtonBar().setPack(BoxLayoutPack.CENTER);
}
private void create() {
TextArea equivalentRequestArea = new TextArea();
equivalentRequestArea.setHeight(200);
equivalentRequestArea.setWidth(640);
equivalentRequestArea.setValue(computationId.getEquivalentRequest());
equivalentRequestArea.setReadOnly(true);
add(equivalentRequestArea);
}
}

View File

@ -1,6 +1,3 @@
/**
*
*/
package org.gcube.portlets.user.dataminermanager.client.experiments;
import org.gcube.portlets.user.dataminermanager.client.bean.Operator;
@ -17,6 +14,12 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.tips.ToolTipConfig;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class OperatorPanel extends SimpleContainer {
private static final int TOOLTIP_WIDTH = 500;
@ -27,8 +30,9 @@ public class OperatorPanel extends SimpleContainer {
private HTML titleHtml;
/**
*
* @param operator
* @param handler
* @param op
*/
public OperatorPanel(Operator operator, OperatorsPanelHandler handler) {
super();
@ -71,7 +75,8 @@ public class OperatorPanel extends SimpleContainer {
}
/**
* @return the operator
*
* @return
*/
public Operator getOperator() {
return operator;

View File

@ -6,7 +6,9 @@ package org.gcube.portlets.user.dataminermanager.client.experiments;
import org.gcube.portlets.user.dataminermanager.client.bean.Operator;
/**
* @author ceras
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface OperatorsPanelHandler {

View File

@ -1,101 +0,0 @@
package org.gcube.portlets.user.dataminermanager.client.resources;
import org.gcube.portlets.user.dataminermanager.client.DataMinerManager;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
public class Images {
public static AbstractImagePrototype logo() {
return AbstractImagePrototype.create(DataMinerManager.resources.logo());
}
public static AbstractImagePrototype logoLittle() {
return AbstractImagePrototype.create(DataMinerManager.resources.logoLittle());
}
public static AbstractImagePrototype computationIcon() {
return AbstractImagePrototype.create(DataMinerManager.resources.executionIcon());
}
public static AbstractImagePrototype inputSpaceIcon() {
return AbstractImagePrototype.create(DataMinerManager.resources.inputSpaceIcon());
}
public static AbstractImagePrototype addOperator() {
return AbstractImagePrototype.create(DataMinerManager.resources.addOperator());
}
public static AbstractImagePrototype startComputation() {
return AbstractImagePrototype.create(DataMinerManager.resources.startComputation());
}
public static AbstractImagePrototype removeAll() {
return AbstractImagePrototype.create(DataMinerManager.resources.removeAll());
}
public static AbstractImagePrototype showAllOperators() {
return AbstractImagePrototype.create(DataMinerManager.resources.sortAscending());
}
public static AbstractImagePrototype showCategories() {
return AbstractImagePrototype.create(DataMinerManager.resources.tree());
}
public static AbstractImagePrototype folderExplore() {
return AbstractImagePrototype.create(DataMinerManager.resources.folderExplore());
}
public static AbstractImagePrototype cancel() {
return AbstractImagePrototype.create(DataMinerManager.resources.cancel());
}
public static AbstractImagePrototype addl() {
return AbstractImagePrototype.create(DataMinerManager.resources.add());
}
public static AbstractImagePrototype table() {
return AbstractImagePrototype.create(DataMinerManager.resources.table());
}
public static AbstractImagePrototype refresh() {
return AbstractImagePrototype.create(DataMinerManager.resources.refresh());
}
public static AbstractImagePrototype fileDownload() {
return AbstractImagePrototype.create(DataMinerManager.resources.fileDownload());
}
public static AbstractImagePrototype loader() {
return AbstractImagePrototype.create(DataMinerManager.resources.loader());
}
public static AbstractImagePrototype save() {
return AbstractImagePrototype.create(DataMinerManager.resources.save());
}
public static AbstractImagePrototype expand() {
return AbstractImagePrototype.create(DataMinerManager.resources.expand());
}
public static AbstractImagePrototype collapse() {
return AbstractImagePrototype.create(DataMinerManager.resources.collapse());
}
public static AbstractImagePrototype groupBy() {
return AbstractImagePrototype.create(DataMinerManager.resources.groupBy());
}
public static AbstractImagePrototype map() {
return AbstractImagePrototype.create(DataMinerManager.resources.map());
}
public static AbstractImagePrototype userPerspective() {
return AbstractImagePrototype.create(DataMinerManager.resources.userPerspective());
}
public static AbstractImagePrototype computationPerspective() {
return AbstractImagePrototype.create(DataMinerManager.resources.computationPerspective());
}
}

View File

@ -4,6 +4,12 @@ package org.gcube.portlets.user.dataminermanager.client.resources;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface Resources extends ClientBundle {
@Source("logo.png")

View File

@ -15,6 +15,12 @@ import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class DataMinerManager extends GenericPortlet {
private final Logger logger= LoggerFactory.getLogger(GenericPortlet.class);

View File

@ -35,7 +35,10 @@ import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
/**
* The server side implementation of the RPC service.
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
@SuppressWarnings("serial")
public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements

View File

@ -6,6 +6,12 @@ import java.util.List;
import org.gcube.portlets.user.dataminermanager.client.bean.Operator;
import org.gcube.portlets.user.dataminermanager.client.bean.OperatorCategory;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class DescriptionRepository {
static List<OperatorCategory> categories;

View File

@ -16,7 +16,9 @@ import org.apache.commons.io.IOUtils;
import org.gcube.portlets.user.dataminermanager.server.storage.StorageUtil;
/**
* @author Federico De Faveri defaveri@isti.cnr.it
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class DownloadServlet extends HttpServlet{

View File

@ -1,169 +0,0 @@
/**
*
*/
package org.gcube.portlets.user.dataminermanager.server.news;
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import org.apache.log4j.Logger;
import org.gcube.common.resources.gcore.GCoreEndpoint;
import org.gcube.common.resources.gcore.ServiceEndpoint;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class FeedScheduler {
protected Timer scheduler;
protected Map<String, OperatorsNewsProducer> scheduledScopes;
protected Logger logger = Logger.getLogger(FeedScheduler.class);
public FeedScheduler(long refreshTime) {
scheduledScopes = new HashMap<String, OperatorsNewsProducer>();
scheduler = new Timer(true);
scheduler.schedule(new TimerTask() {
@Override
public void run() {
checkScopes();
}
}, 0, refreshTime);
}
public void schedule() throws Exception {
List<String> scopes = getAvailableScopes();
for (String scope : scopes) {
logger.trace("checking scope: " + scope);
if (isServicePresentInScope(scope)) {
logger.trace("service present");
schedule(scope);
} else
logger.trace("service not present");
}
checkScopes();
}
protected void schedule(String scope) {
if (!scheduledScopes.containsKey(scope)) {
System.out.println("inside create new operator newProduce");
OperatorsNewsProducer feeder = new OperatorsNewsProducer(scope);
scheduledScopes.put(scope, feeder);
}
else
{
System.out.println("non created operator");
}
}
protected void checkScopes() {
System.out.println("inside checkScope");
for (OperatorsNewsProducer feeder : scheduledScopes.values()) {
try {
feeder.checkOperatorsForFeed();
} catch (Exception e) {
}
}
}
protected boolean isServicePresentInScope(String scope) throws Exception {
SimpleQuery query = queryFor(GCoreEndpoint.class);
query.addCondition("$resource/Profile/ServiceName/text() eq 'data-miner-manager-gcubews'");
query.addCondition("$resource/Profile/ServiceClass/text() eq 'DataAnalysis'");
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
//
System.out.println("scope"+ScopeProvider.instance.get());
List<ServiceEndpoint> resources = client.submit(query);
System.out.println("number of find service :"+resources.size());
return resources.size()> 0;
}
protected static List<String> getAvailableScopes() throws Exception {
List<String> scopes = new ArrayList<String>();
String []scopeNames= ScopeProvider.instance.get().split("/");
int i=0;
String toltaPathScope="";
while(i<scopeNames.length || i <2)
{
if(i==0)
toltaPathScope=toltaPathScope+scopeNames[i];
else
toltaPathScope=toltaPathScope+"/"+scopeNames[i];
System.out.println("scope add:"+toltaPathScope);
scopes.add(toltaPathScope);
i++;
}
return scopes;
}
// protected static List<String> findAvailableScopes(String infrastructure)
// throws Exception {
//
// List<String> scopes = new ArrayList<String>();
//
// // ************* PORTAL MODE, Checking organizations
// scopes.add(infrastructure);
//
// // /************* GET ROOT ORGANIZATION
// List<Organization> organizations = OrganizationLocalServiceUtil
// .getOrganizations(0,
// OrganizationLocalServiceUtil.getOrganizationsCount());
// Organization rootOrganization = null;
// for (Organization organization : organizations) {
// if (organization.getName().equals(infrastructure.getName())) {
// rootOrganization = organization;
// break;
// }
// }
// if (rootOrganization == null)
// throw new Exception("Unable to find infrastructure scope "
// + infrastructure.getName() + " among organizations");
// // ************** GET VO
// for (Organization vOrg : rootOrganization.getSuborganizations()) {
// String VOScopeString = "/" + vOrg.getParentOrganization().getName()
// + "/" + vOrg.getName();
// try {
// scopes.add(GCUBEScope.getScope(VOScopeString));
// for (Organization vre : vOrg.getSuborganizations()) {
// String VREScopeString = VOScopeString + "/" + vre.getName();
// try {
// scopes.add(GCUBEScope.getScope(VREScopeString));
// } catch (Exception e) {
// }
// }
// } catch (Exception e) {
// }
// // ************* GET VRE
// }
//
// return scopes;
// }
public static void main(String[] args) throws Exception {
ScopeProvider.instance.set("/gcube/devNext");
FeedScheduler scheduler = new FeedScheduler(1000);
scheduler.schedule();
}
}

View File

@ -1,239 +0,0 @@
/**
*
*/
package org.gcube.portlets.user.dataminermanager.server.news;
import static org.gcube.resources.discovery.icclient.ICFactory.client;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.log4j.Logger;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.applicationsupportlayer.social.ApplicationNewsManager;
import org.gcube.applicationsupportlayer.social.NewsManager;
import org.gcube.common.resources.gcore.GenericResource;
import org.gcube.common.resources.gcore.Resources;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.informationsystem.publisher.RegistryPublisherFactory;
import org.gcube.informationsystem.publisher.ScopedPublisher;
import org.gcube.portlets.user.dataminermanager.client.bean.Operator;
import org.gcube.portlets.user.dataminermanager.client.bean.OperatorCategory;
import org.gcube.portlets.user.dataminermanager.server.DescriptionRepository;
import org.gcube.portlets.user.dataminermanager.server.SessionUtil;
import org.gcube.portlets.user.dataminermanager.shared.Constants;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.Query;
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
import org.w3c.dom.CharacterData;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class OperatorsNewsProducer {
private static final String GR_SECONDARY_TYPE = "DataMinerManager";
private static final String GR_NAME = "Operators";
protected Logger logger = Logger.getLogger(OperatorsNewsProducer.class);
protected String scope;
/**
* @param scope
*/
public OperatorsNewsProducer(String scope) {
this.scope = scope;
}
public void checkOperatorsForFeed() throws Exception
{
logger.trace("checkOperatorsForFeed scope: "+scope);
Map<String, Operator> currentOperators = getCurrentOperators();
List<String> previousNotifiedOperators = getGenericResource();
List<Operator> newOperators = calculateNewOperators(previousNotifiedOperators, currentOperators);
logger.trace("curentOperators.size "+currentOperators.size()+" previousNotifiedOperators: "+previousNotifiedOperators.size()+" newOperators: "+newOperators.size());
boolean feedNews = newOperators.size()!=0;
if (feedNews) {
//TODO NEWS!
logger.trace("Operators:");
for (Operator operator:newOperators) logger.trace(operator.getName());
ASLSession fakeSession = SessionManager.getInstance().getASLSession("1", "fake.session");
fakeSession.setScope(scope.toString());
NewsManager anm = new ApplicationNewsManager(fakeSession, Constants.APPLICATION_ID);
for (Operator operator:newOperators) {
String news = getNewsText(operator);
anm.shareApplicationUpdate(news);
}
saveNotifiedOperators(currentOperators);
}
}
protected String getNewsText(Operator operator)
{
StringBuilder text = new StringBuilder("The operator ");
text.append(operator.getName());
text.append(" has been added: ");
text.append(operator.getDescription());
return text.toString();
}
protected List<Operator> calculateNewOperators(List<String> previousNotifiedOperators, Map<String, Operator> currentOperators)
{
List<Operator> newOperators = new ArrayList<Operator>();
for (Operator op: currentOperators.values()) if (!previousNotifiedOperators.contains(op.getName())) newOperators.add(op);
return newOperators;
}
protected List<String> getGenericResource() throws Exception
{
String queryString = "for $resource in collection('/db/Profiles/GenericResource')"
+ "//Resource where ($resource/Profile/SecondaryType eq '"
+ GR_SECONDARY_TYPE
+ "')"
+ " and ($resource/Scopes/Scope eq '"
+ ScopeProvider.instance.get()
+ "') "
+ " and ( $resource/Profile/Name eq '"
+ GR_NAME
+ "')" +
" return $resource/Profile/Body/operators/text()";
logger.debug(queryString);
Query q = new QueryBox(queryString);
DiscoveryClient<String> client = client();
List<String> operators = new ArrayList<String>();
operators.addAll(client.submit(q));
List<String> result= new ArrayList<String>();
for(String s : operators)
{
result.addAll(extractOperatorsFromXml(s));
}
return result;
}
/**
* @param xml
* @return
* @throws IOException
* @throws SAXException
* @throws ParserConfigurationException
*/
protected List<String> extractOperatorsFromXml(String xml) throws SAXException, IOException, ParserConfigurationException {
List<String> operators = new ArrayList<String>();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(xml));
Document doc = db.parse(is);
NodeList nodes = doc.getElementsByTagName("operator");
// iterate the employees
for (int i = 0; i < nodes.getLength(); i++) {
Element operator = (Element) nodes.item(i);
String operatorId = getCharacterDataFromElement(operator);
operators.add(operatorId);
}
return operators;
}
protected String getCharacterDataFromElement(Element e) {
Node child = e.getFirstChild();
if (child instanceof CharacterData) {
CharacterData cd = (CharacterData) child;
return cd.getData();
}
return "?";
}
public Map<String, Operator> getCurrentOperators() {
Map<String, Operator> operators = new HashMap<String, Operator>();
return operators;
}
public void saveNotifiedOperators(Map<String, Operator> operators) throws Exception
{
StringBuilder xml = new StringBuilder();
xml.append("<Resource version=\"0.4.x\">");
xml.append("<Type>GenericResource</Type>");
xml.append("<Profile>");
xml.append("<SecondaryType>");
xml.append(GR_SECONDARY_TYPE);
xml.append("</SecondaryType>");
xml.append("<Name>");
xml.append(GR_NAME);
xml.append("</Name>");
xml.append("<Body>");
xml.append("<operators>");
for (Operator operator: operators.values()) xml.append("<operator>"+operator.getName()+"</operator>");
xml.append("</operators>");
xml.append("</Body>");
xml.append("</Profile>");
xml.append("</Resource>");
StringReader reader = new StringReader(xml.toString());
GenericResource resource = (GenericResource) Resources.unmarshal(
GenericResource.class, reader);
ScopedPublisher sp = RegistryPublisherFactory
.scopedPublisher();
List<String>scopes= new ArrayList<String>();
scopes.add(scope);
sp.create(resource, scopes);
}
public static void main(String[] args) throws Exception
{
/*GHNContext ctx = GHNContext.getContext();
String rootScope = (String) ctx.getProperty(GHNContext.INFRASTRUCTURE_NAME, true);*/
OperatorsNewsProducer feeder = new OperatorsNewsProducer("/gcube/devNext/NextNext");
feeder.checkOperatorsForFeed();
}
}

View File

@ -705,8 +705,9 @@ public class SClient4WPS extends SClient {
+ parm.getValue() + "]");
}
LinkedHashMap<String, String> equivalentRequestMap = new LinkedHashMap<>();
String processUrl = compute(processInformations, userInputs,
inputParameters);
inputParameters, equivalentRequestMap);
logger.debug("Stated Computation ProcessLocation:" + processUrl);
int idIndex = processUrl.lastIndexOf("?id=");
@ -717,8 +718,19 @@ public class SClient4WPS extends SClient {
logger.error("Invalid processLocation: " + processUrl);
throw new Exception("Invalid processLocation: " + processUrl);
}
String equivalentRequest = wpsProcessingServlet + "?"
+ "request=Execute&service=WPS&Version=1.0.0&gcube-token="
+ wpsToken + "&lang=en-US&Identifier=" + operator.getId()
+ "&DataInputs=";
for (String key : equivalentRequestMap.keySet()) {
equivalentRequest = equivalentRequest + key + "="
+ equivalentRequestMap.get(key) + ";";
}
ComputationId computationId = new ComputationId(id, processUrl,
operator.getId(), operator.getName());
operator.getId(), operator.getName(), equivalentRequest);
logger.debug("ComputationId: " + computationId);
runningProcess.put(computationId, processInformations);
@ -728,7 +740,9 @@ public class SClient4WPS extends SClient {
private String compute(ProcessInformations processInformations,
Map<String, String> userInputs,
Map<String, Parameter> inputParameters) throws Exception {
Map<String, Parameter> inputParameters,
LinkedHashMap<String, String> equivalentRequestMap)
throws Exception {
try {
// setup the inputs
org.n52.wps.client.ExecuteRequestBuilder executeBuilder = new org.n52.wps.client.ExecuteRequestBuilder(
@ -741,7 +755,8 @@ public class SClient4WPS extends SClient {
logger.debug("Configuring Literal: "
+ input.getIdentifier().getStringValue()
+ " to: " + value);
equivalentRequestMap.put(input.getIdentifier()
.getStringValue(), value);
executeBuilder.addLiteralData(input.getIdentifier()
.getStringValue(), value);
@ -749,7 +764,8 @@ public class SClient4WPS extends SClient {
logger.debug("Configuring Bounding Box: "
+ input.getIdentifier().getStringValue()
+ " to: " + value);
equivalentRequestMap.put(input.getIdentifier()
.getStringValue(), value);
addBoundingBoxInput(executeBuilder, input
.getIdentifier().getStringValue(), value);
@ -774,6 +790,8 @@ public class SClient4WPS extends SClient {
} else {
publicLink = value;
}
equivalentRequestMap.put(input.getIdentifier()
.getStringValue(), value);
executeBuilder.addComplexDataReference(input
.getIdentifier().getStringValue(),
publicLink, complex.getDefault()
@ -828,21 +846,23 @@ public class SClient4WPS extends SClient {
responseObject = wpsClient.executeViaGET(
computationId.getUrlId(), "");
logger.debug("ComputationStatus ResponseObject:"
logger.debug("ComputationStatus ResponseObject: "
+ responseObject);
if (responseObject instanceof ExecuteResponseDocumentImpl) {
if (((ExecuteResponseDocumentImpl) responseObject)
.getExecuteResponse() == null) {
logger.debug("WPS FAILURE OR PAUSED: ExecuteResponse is null");
logger.debug("WPS FAILURE: ExecuteResponse is null");
computationStatus = new ComputationStatus(
Status.FAILED, 100f);
} else {
StatusType statusType = ((ExecuteResponseDocumentImpl) responseObject)
.getExecuteResponse().getStatus();
if (statusType == null) {
logger.debug("WPS FAILURE OR PAUSED: Status Type is null");
logger.debug("WPS FAILURE: Status Type is null");
computationStatus = new ComputationStatus(
Status.FAILED, 100f);
} else {
@ -923,7 +943,7 @@ public class SClient4WPS extends SClient {
} else {
logger.error("Error in ResponceObject: "
+ responseObject);
logger.error("WPS FAILURE");
logger.error("WPS FAILURE: ");
computationStatus = new ComputationStatus(
Status.FAILED, 100f);
return computationStatus;
@ -1213,8 +1233,9 @@ public class SClient4WPS extends SClient {
+ computationProperties);
}
LinkedHashMap<String, String> equivalentRequestMap = new LinkedHashMap<>();
String processUrl = compute(processInformations, userInputs,
inputParameters);
inputParameters, equivalentRequestMap);
logger.debug("Stated Computation ProcessLocation:" + processUrl);
int idIndex = processUrl.lastIndexOf("?id=");
@ -1225,9 +1246,20 @@ public class SClient4WPS extends SClient {
logger.error("Invalid processLocation: " + processUrl);
throw new Exception("Invalid processLocation: " + processUrl);
}
String equivalentRequest = wpsProcessingServlet + "?"
+ "request=Execute&service=WPS&Version=1.0.0&gcube-token="
+ wpsToken + "&lang=en-US&Identifier="
+ computationProperties.get("operator_id") + "&DataInputs=";
for (String key : equivalentRequestMap.keySet()) {
equivalentRequest = equivalentRequest + key + "="
+ equivalentRequestMap.get(key) + ";";
}
ComputationId computationId = new ComputationId(id, processUrl,
computationProperties.get("operator_id"),
computationProperties.get("operator_name"));
computationProperties.get("operator_name"), equivalentRequest);
logger.debug("ComputationId: " + computationId);
runningProcess.put(computationId, processInformations);

View File

@ -402,7 +402,7 @@ public class WPS2SM {
String defaultValue) {
String description = title;
/*
String innerDescription = "";
if (maxMegabytes != null && maxMegabytes.trim().length() > 0) {
@ -425,7 +425,7 @@ public class WPS2SM {
description += " ["
+ innerDescription.substring(0,
innerDescription.lastIndexOf(";")).trim() + "]";
*/
return description;
}

View File

@ -1,7 +1,13 @@
package org.gcube.portlets.user.dataminermanager.shared;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class Constants {
public static final boolean DEBUG_MODE = true;
public static final boolean DEBUG_MODE = false;
public static final boolean TEST_ENABLE = false;
public static final String APPLICATION_ID = "org.gcube.portlets.user.dataminermanager.portlet.DataMinerManager";

View File

@ -4,7 +4,9 @@
package org.gcube.portlets.user.dataminermanager.shared;
/**
* @author ceras
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class StringUtil {

View File

@ -15,18 +15,20 @@ public class ComputationId implements Serializable {
private String urlId;
private String operatorId;
private String operatorName;
private String equivalentRequest;
public ComputationId() {
super();
}
public ComputationId(String id, String urlId, String operatorId,
String operatorName) {
String operatorName, String equivalentRequest) {
super();
this.id = id;
this.urlId = urlId;
this.operatorId = operatorId;
this.operatorName = operatorName;
this.equivalentRequest = equivalentRequest;
}
public String getId() {
@ -61,10 +63,19 @@ public class ComputationId implements Serializable {
this.operatorName = operatorName;
}
public String getEquivalentRequest() {
return equivalentRequest;
}
public void setEquivalentRequest(String equivalentRequest) {
this.equivalentRequest = equivalentRequest;
}
@Override
public String toString() {
return "ComputationId [id=" + id + ", urlId=" + urlId + ", operatorId="
+ operatorId + ", operatorName=" + operatorName + "]";
+ operatorId + ", operatorName=" + operatorName
+ ", equivalentRequest=" + equivalentRequest + "]";
}
}

View File

@ -9,7 +9,9 @@ import java.util.List;
/**
* @author ceras
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ColumnListParameter extends Parameter implements Serializable {

View File

@ -7,7 +7,9 @@ import java.io.Serializable;
/**
* @author ceras
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ColumnParameter extends Parameter implements Serializable {

View File

@ -9,7 +9,9 @@ import java.util.List;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* @author ceras
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class EnumParameter extends Parameter implements IsSerializable {

View File

@ -8,7 +8,9 @@ import java.util.ArrayList;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* @author ceras
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class FileParameter extends Parameter implements IsSerializable {

View File

@ -7,7 +7,9 @@ import com.google.gwt.user.client.rpc.IsSerializable;
/**
* @author ceras
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ListParameter extends Parameter implements IsSerializable {

View File

@ -4,7 +4,9 @@ package org.gcube.portlets.user.dataminermanager.shared.parameters;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* @author ceras
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ObjectParameter extends Parameter implements IsSerializable {

View File

@ -7,7 +7,9 @@ import java.io.Serializable;
import java.util.ArrayList;
/**
* @author ceras
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TabularListParameter extends Parameter implements Serializable {