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

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

Added shows results for computations that are successful

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@128532 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-05-09 16:57:18 +00:00
parent d7682b795c
commit 6b3f4ebff1
20 changed files with 957 additions and 224 deletions

View File

@ -2,22 +2,28 @@ package org.gcube.portlets.user.dataminermanager.client;
import java.util.List;
import org.gcube.portlets.user.dataminermanager.client.bean.ComputationItem;
import org.gcube.portlets.user.dataminermanager.client.bean.OperatorsClassification;
import org.gcube.portlets.user.dataminermanager.client.bean.output.Resource;
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminermanager.client.events.CancelComputationExecutionRequestEvent;
import org.gcube.portlets.user.dataminermanager.client.events.DataMinerWorkAreaEvent;
import org.gcube.portlets.user.dataminermanager.client.events.DataMinerWorkAreaRequestEvent;
import org.gcube.portlets.user.dataminermanager.client.events.DeleteItemRequestEvent;
import org.gcube.portlets.user.dataminermanager.client.events.MenuEvent;
import org.gcube.portlets.user.dataminermanager.client.events.MenuSwitchEvent;
import org.gcube.portlets.user.dataminermanager.client.events.OperatorsClassificationEvent;
import org.gcube.portlets.user.dataminermanager.client.events.OperatorsClassificationRequestEvent;
import org.gcube.portlets.user.dataminermanager.client.events.OutputResourceEvent;
import org.gcube.portlets.user.dataminermanager.client.events.OutputResourceRequestEvent;
import org.gcube.portlets.user.dataminermanager.client.events.OutputShowEvent;
import org.gcube.portlets.user.dataminermanager.client.events.OutputShowRequestEvent;
import org.gcube.portlets.user.dataminermanager.client.events.RefreshDataMinerWorkAreaEvent;
import org.gcube.portlets.user.dataminermanager.client.events.ResubmitComputationExecutionEvent;
import org.gcube.portlets.user.dataminermanager.client.events.ResubmitComputationExecutionRequestEvent;
import org.gcube.portlets.user.dataminermanager.client.events.SessionExpiredEvent;
import org.gcube.portlets.user.dataminermanager.client.events.StartComputationExecutionEvent;
import org.gcube.portlets.user.dataminermanager.client.events.StartComputationExecutionRequestEvent;
import org.gcube.portlets.user.dataminermanager.client.monitor.StatusMonitor;
import org.gcube.portlets.user.dataminermanager.client.rpc.DataMinerPortletServiceAsync;
import org.gcube.portlets.user.dataminermanager.client.type.DataMinerWorkAreaElementType;
import org.gcube.portlets.user.dataminermanager.client.type.DataMinerWorkAreaEventType;
@ -44,6 +50,7 @@ public class DataMinerManagerController {
private DataMinerWorkArea dataMinerWorkArea;
private List<OperatorsClassification> operatorsClassifications;
private MenuType currentVisualization;
private StatusMonitor monitor;
public DataMinerManagerController() {
init();
@ -73,18 +80,15 @@ public class DataMinerManagerController {
}
/*
private void sessionExpiredShowDelayed() {
Timer timeoutTimer = new Timer() {
public void run() {
sessionExpiredShow();
}
};
int TIMEOUT = 3; // 3 second timeout
timeoutTimer.schedule(TIMEOUT * 1000); // timeout is in milliseconds
}*/
* private void sessionExpiredShowDelayed() { Timer timeoutTimer = new
* Timer() { public void run() { sessionExpiredShow();
*
* } }; int TIMEOUT = 3; // 3 second timeout
*
* timeoutTimer.schedule(TIMEOUT * 1000); // timeout is in milliseconds
*
* }
*/
private void bind() {
@ -156,6 +160,39 @@ public class DataMinerManagerController {
});
EventBusProvider.INSTANCE
.addHandler(
OutputResourceRequestEvent.TYPE,
new OutputResourceRequestEvent.OutputResourceRequestEventHandler() {
@Override
public void onOutputRequest(
OutputResourceRequestEvent event) {
Log.debug("Catch OutputResourceRequestEvent: "
+ event);
manageOutputResourceRequestEvent(event);
}
});
EventBusProvider.INSTANCE
.addHandler(
OutputShowRequestEvent.TYPE,
new OutputShowRequestEvent.OutputShowRequestEventHandler() {
@Override
public void onOutputShowRequest(OutputShowRequestEvent event) {
Log.debug("Catch OutputShowRequestEvent: "
+ event);
manageOutputShowRequestEvent(event);
}
});
EventBusProvider.INSTANCE
.addHandler(
OperatorsClassificationRequestEvent.TYPE,
@ -184,9 +221,26 @@ public class DataMinerManagerController {
});
EventBusProvider.INSTANCE
.addHandler(
DataMinerWorkAreaRequestEvent.TYPE,
new DataMinerWorkAreaRequestEvent.DataMinerWorkAreaRequestEventHandler() {
@Override
public void onRequest(
DataMinerWorkAreaRequestEvent event) {
Log.debug("Catch DataMinerWorkAreaRequestEvent: "
+ event);
retrieveDataMinerWorkArea();
}
});
}
private void callHello() {
DataMinerPortletServiceAsync.INSTANCE
.hello(new AsyncCallback<UserInfo>() {
@ -233,36 +287,39 @@ public class DataMinerManagerController {
private void startComputationRequest(
final StartComputationExecutionRequestEvent event) {
monitor = new StatusMonitor();
DataMinerPortletServiceAsync.INSTANCE.startComputation(event.getOp(),
new AsyncCallback<ComputationId>() {
@Override
public void onSuccess(ComputationId computationId) {
if (computationId == null)
UtilsGXT3.alert("Error",
"Failed to start computation "
+ event.getOp().getName()
+ ", the computation id is null!");
else {
startComputation(computationId,
event.getComputationStatusPanelIndex());
}
}
@Override
public void onFailure(Throwable caught) {
monitor.hide();
if (caught instanceof ExpiredSessionServiceException) {
UtilsGXT3.alert("Error", "Expired Session!");
EventBusProvider.INSTANCE
.fireEvent(new SessionExpiredEvent());
} else {
UtilsGXT3.alert("Error",
"Failed to start computation "
"Failed start computation "
+ event.getOp().getName() + "! "
+ caught.getLocalizedMessage());
caught.printStackTrace();
}
}
@Override
public void onSuccess(ComputationId computationId) {
monitor.hide();
if (computationId == null)
UtilsGXT3.alert("Error",
"Failed start computation "
+ event.getOp().getName()
+ ", the computation id is null!");
else {
startComputation(computationId,
event.getComputationStatusPanelIndex());
}
}
});
}
@ -277,12 +334,13 @@ public class DataMinerManagerController {
private void cancelComputationRequest(
CancelComputationExecutionRequestEvent event) {
final ComputationId computationId = event.getComputationId();
monitor = new StatusMonitor();
DataMinerPortletServiceAsync.INSTANCE.cancelComputation(computationId,
new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
monitor.hide();
if (caught instanceof ExpiredSessionServiceException) {
UtilsGXT3.alert("Error", "Expired Session!");
EventBusProvider.INSTANCE
@ -298,6 +356,7 @@ public class DataMinerManagerController {
@Override
public void onSuccess(String result) {
monitor.hide();
Log.debug("Computation Deleted!");
}
@ -306,11 +365,13 @@ public class DataMinerManagerController {
private void resubmitComputationRequest(
final ResubmitComputationExecutionRequestEvent event) {
monitor = new StatusMonitor();
DataMinerPortletServiceAsync.INSTANCE.resubmit(
event.getItemDescription(), new AsyncCallback<ComputationId>() {
@Override
public void onFailure(Throwable caught) {
monitor.hide();
if (caught instanceof ExpiredSessionServiceException) {
UtilsGXT3.alert("Error", "Expired Session!");
EventBusProvider.INSTANCE
@ -325,6 +386,7 @@ public class DataMinerManagerController {
@Override
public void onSuccess(ComputationId result) {
monitor.hide();
if (result == null)
UtilsGXT3
.alert("Error",
@ -338,10 +400,8 @@ public class DataMinerManagerController {
}
private void resubmitComputation(ComputationId computationId) {
ComputationItem computationItem = new ComputationItem(computationId,
null);
ResubmitComputationExecutionEvent event = new ResubmitComputationExecutionEvent(
computationItem);
computationId);
EventBusProvider.INSTANCE.fireEvent(event);
}
@ -436,11 +496,13 @@ public class DataMinerManagerController {
}
private void retrieveDataMinerWorkArea() {
monitor = new StatusMonitor();
DataMinerPortletServiceAsync.INSTANCE
.getDataMinerWorkArea(new AsyncCallback<DataMinerWorkArea>() {
@Override
public void onFailure(Throwable caught) {
monitor.hide();
if (caught instanceof ExpiredSessionServiceException) {
UtilsGXT3.alert("Error", "Expired Session");
EventBusProvider.INSTANCE
@ -454,6 +516,7 @@ public class DataMinerManagerController {
@Override
public void onSuccess(DataMinerWorkArea result) {
monitor.hide();
Log.debug("DataMinerWorkArea: " + result);
fireDataMinerWorkAreaEventRetrieved(result);
@ -471,11 +534,13 @@ public class DataMinerManagerController {
}
private void deleteItemRequest(final DeleteItemRequestEvent event) {
monitor = new StatusMonitor();
DataMinerPortletServiceAsync.INSTANCE.deleteItem(
event.getItemDescription(), new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
monitor.hide();
if (caught instanceof ExpiredSessionServiceException) {
UtilsGXT3.alert("Error", "Expired Session");
EventBusProvider.INSTANCE
@ -489,6 +554,7 @@ public class DataMinerManagerController {
@Override
public void onSuccess(Void result) {
monitor.hide();
Log.debug("Deleted Item!");
fireRefreshDataMinerWorkAreaEvent(event
.getDataMinerWorkAreaElementType());
@ -507,4 +573,93 @@ public class DataMinerManagerController {
}
}
private void manageOutputResourceRequestEvent(
OutputResourceRequestEvent event) {
if (event == null) {
UtilsGXT3.alert("Error", "Invalid output request!");
} else {
if (event.getComputationId() == null
|| event.getComputationId().getId() == null
|| event.getComputationId().getId().isEmpty()) {
UtilsGXT3.alert(
"Error",
"Invalid output request, computation id: "
+ event.getComputationId());
} else {
monitor = new StatusMonitor();
DataMinerPortletServiceAsync.INSTANCE
.getResourceByComputationId(event.getComputationId(),
new AsyncCallback<Resource>() {
@Override
public void onSuccess(Resource resource) {
monitor.hide();
fireOutputResourceEvent(resource);
}
@Override
public void onFailure(Throwable caught) {
monitor.hide();
Log.error("Error in getResourceByComputationId: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error",
"Impossible to retrieve output info. "
+ caught.getLocalizedMessage());
}
});
}
}
}
private void fireOutputResourceEvent(Resource resource) {
OutputResourceEvent event = new OutputResourceEvent(resource);
EventBusProvider.INSTANCE.fireEvent(event);
}
private void manageOutputShowRequestEvent(OutputShowRequestEvent event) {
if (event == null) {
UtilsGXT3.alert("Error", "Invalid show output request!");
} else {
if (event.getItemDescription() == null
|| event.getItemDescription().getId() == null
|| event.getItemDescription().getId().isEmpty()) {
UtilsGXT3.alert(
"Error",
"Invalid show output request, item description: "
+ event.getItemDescription());
} else {
monitor = new StatusMonitor();
DataMinerPortletServiceAsync.INSTANCE
.getResourceByComputationItem(
event.getItemDescription(),
new AsyncCallback<Resource>() {
@Override
public void onSuccess(Resource resource) {
monitor.hide();
fireOutputShowEvent(resource);
}
@Override
public void onFailure(Throwable caught) {
monitor.hide();
Log.error("Error in getResourceByComputationItem: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error",
"Impossible to retrieve output info. "
+ caught.getLocalizedMessage());
}
});
}
}
}
protected void fireOutputShowEvent(Resource resource) {
OutputShowEvent event = new OutputShowEvent(resource);
EventBusProvider.INSTANCE.fireEvent(event);
}
}

View File

@ -0,0 +1,70 @@
package org.gcube.portlets.user.dataminermanager.client.events;
import org.gcube.portlets.user.dataminermanager.client.type.DataMinerWorkAreaRequestEventType;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Data Miner Work Area Request Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class DataMinerWorkAreaRequestEvent
extends
GwtEvent<DataMinerWorkAreaRequestEvent.DataMinerWorkAreaRequestEventHandler> {
public static Type<DataMinerWorkAreaRequestEventHandler> TYPE = new Type<DataMinerWorkAreaRequestEventHandler>();
private DataMinerWorkAreaRequestEventType dataMinerWorkAreaRequestEventType;
public interface DataMinerWorkAreaRequestEventHandler extends EventHandler {
void onRequest(DataMinerWorkAreaRequestEvent event);
}
public interface HasDataMinerWorkAreaRequestEventHandler extends
HasHandlers {
public HandlerRegistration addDataMinerWorkAreaRequestEventHandler(
DataMinerWorkAreaRequestEventHandler handler);
}
public DataMinerWorkAreaRequestEvent(
DataMinerWorkAreaRequestEventType dataMinerWorkAreaRequestEventType) {
this.dataMinerWorkAreaRequestEventType = dataMinerWorkAreaRequestEventType;
}
@Override
protected void dispatch(DataMinerWorkAreaRequestEventHandler handler) {
handler.onRequest(this);
}
@Override
public Type<DataMinerWorkAreaRequestEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<DataMinerWorkAreaRequestEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source,
DataMinerWorkAreaRequestEvent event) {
source.fireEvent(event);
}
public DataMinerWorkAreaRequestEventType getDataMinerWorkAreaRequestEventType() {
return dataMinerWorkAreaRequestEventType;
}
@Override
public String toString() {
return "DataMinerWorkAreaRequestEvent [dataMinerWorkAreaRequestEventType="
+ dataMinerWorkAreaRequestEventType + "]";
}
}

View File

@ -0,0 +1,63 @@
package org.gcube.portlets.user.dataminermanager.client.events;
import org.gcube.portlets.user.dataminermanager.client.bean.output.Resource;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Output Resource Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class OutputResourceEvent extends
GwtEvent<OutputResourceEvent.OutputResourceEventHandler> {
public static Type<OutputResourceEventHandler> TYPE = new Type<OutputResourceEventHandler>();
private Resource resource;
public interface OutputResourceEventHandler extends EventHandler {
void onOutput(OutputResourceEvent event);
}
public interface HasOutputResourceEventHandler extends HasHandlers {
public HandlerRegistration addOutputResourceEventHandler(
OutputResourceEventHandler handler);
}
public OutputResourceEvent(Resource resource) {
this.resource = resource;
}
@Override
protected void dispatch(OutputResourceEventHandler handler) {
handler.onOutput(this);
}
@Override
public Type<OutputResourceEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<OutputResourceEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, OutputResourceEvent event) {
source.fireEvent(event);
}
public Resource getResource() {
return resource;
}
@Override
public String toString() {
return "OutputResourceEvent [resource=" + resource + "]";
}
}

View File

@ -0,0 +1,65 @@
package org.gcube.portlets.user.dataminermanager.client.events;
import org.gcube.portlets.user.dataminermanager.shared.data.ComputationId;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Output Resource Request Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class OutputResourceRequestEvent extends
GwtEvent<OutputResourceRequestEvent.OutputResourceRequestEventHandler> {
public static Type<OutputResourceRequestEventHandler> TYPE = new Type<OutputResourceRequestEventHandler>();
private ComputationId computationId;
public interface OutputResourceRequestEventHandler extends EventHandler {
void onOutputRequest(OutputResourceRequestEvent event);
}
public interface HasOutputResourceRequestEventHandler extends HasHandlers {
public HandlerRegistration addOutputResourceRequestEventHandler(
OutputResourceRequestEventHandler handler);
}
public OutputResourceRequestEvent(ComputationId computationId) {
this.computationId = computationId;
}
@Override
protected void dispatch(OutputResourceRequestEventHandler handler) {
handler.onOutputRequest(this);
}
@Override
public Type<OutputResourceRequestEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<OutputResourceRequestEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, OutputResourceRequestEvent event) {
source.fireEvent(event);
}
public ComputationId getComputationId() {
return computationId;
}
@Override
public String toString() {
return "OutputResourceRequestEvent [computationId=" + computationId
+ "]";
}
}

View File

@ -0,0 +1,64 @@
package org.gcube.portlets.user.dataminermanager.client.events;
import org.gcube.portlets.user.dataminermanager.client.bean.output.Resource;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Output Show Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class OutputShowEvent extends
GwtEvent<OutputShowEvent.OutputShowEventHandler> {
public static Type<OutputShowEventHandler> TYPE = new Type<OutputShowEventHandler>();
private Resource resource;
public interface OutputShowEventHandler extends EventHandler {
void onOutputShow(OutputShowEvent event);
}
public interface HasOutputShowResourceEventHandler extends HasHandlers {
public HandlerRegistration addOutputShowResourceEventHandler(
OutputShowEventHandler handler);
}
public OutputShowEvent(Resource resource) {
this.resource = resource;
}
@Override
protected void dispatch(OutputShowEventHandler handler) {
handler.onOutputShow(this);
}
@Override
public Type<OutputShowEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<OutputShowEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, OutputShowEvent event) {
source.fireEvent(event);
}
public Resource getResource() {
return resource;
}
@Override
public String toString() {
return "OutputShowEvent [resource=" + resource + "]";
}
}

View File

@ -0,0 +1,65 @@
package org.gcube.portlets.user.dataminermanager.client.events;
import org.gcube.portlets.user.dataminermanager.shared.workspace.ItemDescription;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Output Show Request Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class OutputShowRequestEvent extends
GwtEvent<OutputShowRequestEvent.OutputShowRequestEventHandler> {
public static Type<OutputShowRequestEventHandler> TYPE = new Type<OutputShowRequestEventHandler>();
private ItemDescription itemDescription;
public interface OutputShowRequestEventHandler extends EventHandler {
void onOutputShowRequest(OutputShowRequestEvent event);
}
public interface HasOutputShowResourceRequestEventHandler extends HasHandlers {
public HandlerRegistration addOutputShowResourceRequestEventHandler(
OutputShowRequestEventHandler handler);
}
public OutputShowRequestEvent(ItemDescription itemDescription) {
this.itemDescription = itemDescription;
}
@Override
protected void dispatch(OutputShowRequestEventHandler handler) {
handler.onOutputShowRequest(this);
}
@Override
public Type<OutputShowRequestEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<OutputShowRequestEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, OutputShowRequestEvent event) {
source.fireEvent(event);
}
public ItemDescription getItemDescription() {
return itemDescription;
}
@Override
public String toString() {
return "OutputShowRequestEvent [itemDescription=" + itemDescription
+ "]";
}
}

View File

@ -1,6 +1,6 @@
package org.gcube.portlets.user.dataminermanager.client.events;
import org.gcube.portlets.user.dataminermanager.client.bean.ComputationItem;
import org.gcube.portlets.user.dataminermanager.shared.data.ComputationId;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
@ -20,7 +20,7 @@ public class ResubmitComputationExecutionEvent
GwtEvent<ResubmitComputationExecutionEvent.ResubmitComputationExecutionEventHandler> {
public static Type<ResubmitComputationExecutionEventHandler> TYPE = new Type<ResubmitComputationExecutionEventHandler>();
private ComputationItem computationItem;
private ComputationId computationId;
public interface ResubmitComputationExecutionEventHandler extends
EventHandler {
@ -33,8 +33,8 @@ public class ResubmitComputationExecutionEvent
ResubmitComputationExecutionEventHandler handler);
}
public ResubmitComputationExecutionEvent(ComputationItem computationItem) {
this.computationItem = computationItem;
public ResubmitComputationExecutionEvent(ComputationId computationId) {
this.computationId = computationId;
}
@Override
@ -56,14 +56,16 @@ public class ResubmitComputationExecutionEvent
source.fireEvent(event);
}
public ComputationItem getComputationItem() {
return computationItem;
public ComputationId getComputationId() {
return computationId;
}
@Override
public String toString() {
return "ResubmitComputationExecutionEvent [computationItem="
+ computationItem + "]";
return "ResubmitComputationExecutionEvent [computationId="
+ computationId + "]";
}
}

View File

@ -6,6 +6,8 @@ import java.util.List;
import org.gcube.portlets.user.dataminermanager.client.DataMinerManager;
import org.gcube.portlets.user.dataminermanager.client.bean.Operator;
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminermanager.client.events.OutputResourceEvent;
import org.gcube.portlets.user.dataminermanager.client.events.OutputShowEvent;
import org.gcube.portlets.user.dataminermanager.client.events.ResubmitComputationExecutionEvent;
import org.gcube.portlets.user.dataminermanager.client.events.StartComputationExecutionEvent;
import org.gcube.portlets.user.dataminermanager.client.events.StartComputationExecutionRequestEvent;
@ -96,12 +98,30 @@ public class ComputationExecutionPanel extends FramedPanel {
}
});
EventBusProvider.INSTANCE
.addHandler(
OutputShowEvent.getType(),
new OutputShowEvent.OutputShowEventHandler() {
@Override
public void onOutputShow(OutputShowEvent event) {
showOutput(event);
}
});
}
public void startNewComputation(final Operator operator) {
Log.debug("Computation Panel: start new computation ");
ComputationStatusPanel statusPanel = new ComputationStatusPanel(
operator);
operator.getName());
computationStatusPanels.add(statusPanel);
int index = computationStatusPanels.indexOf(statusPanel);
statusPanel.setItemId("ComputationStatusPanel" + String.valueOf(index));
@ -141,9 +161,9 @@ public class ComputationExecutionPanel extends FramedPanel {
}
}
public void resubmitComputation(ResubmitComputationExecutionEvent event) {
private void resubmitComputation(ResubmitComputationExecutionEvent event) {
final ComputationStatusPanel statusPanel = new ComputationStatusPanel(
event.getComputationItem().getOperator());
event.getComputationId().getOperatorName());
computationStatusPanels.add(statusPanel);
if (v.getWidgetCount() == 0) {
v.add(statusPanel, new VerticalLayoutData(1, -1, new Margins(20)));
@ -153,13 +173,32 @@ public class ComputationExecutionPanel extends FramedPanel {
}
removeAllButton.setEnabled(true);
statusPanel.computationStarted(event.getComputationItem()
.getComputationId());
statusPanel.computationStarted(event.getComputationId());
forceLayout();
}
private void showOutput(OutputShowEvent event) {
/*
final ComputationStatusPanel statusPanel = new ComputationStatusPanel(
event.getComputationId().getOperatorName());
computationStatusPanels.add(statusPanel);
if (v.getWidgetCount() == 0) {
v.add(statusPanel, new VerticalLayoutData(1, -1, new Margins(20)));
} else {
v.insert(statusPanel, 0, new VerticalLayoutData(1, -1, new Margins(
20)));
}
removeAllButton.setEnabled(true);
statusPanel.computationStarted(event.getComputationId());
forceLayout();
*/
}
/**
*
*/

View File

@ -14,8 +14,9 @@ import org.gcube.portlets.user.dataminermanager.client.bean.output.ObjectResourc
import org.gcube.portlets.user.dataminermanager.client.bean.output.Resource;
import org.gcube.portlets.user.dataminermanager.client.bean.output.Resource.ResourceType;
import org.gcube.portlets.user.dataminermanager.client.bean.output.TableResource;
import org.gcube.portlets.user.dataminermanager.client.rpc.DataMinerPortletServiceAsync;
import org.gcube.portlets.user.dataminermanager.client.util.UtilsGXT3;
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminermanager.client.events.OutputResourceEvent;
import org.gcube.portlets.user.dataminermanager.client.events.OutputResourceRequestEvent;
import org.gcube.portlets.user.dataminermanager.client.widgets.ImagesViewer;
import org.gcube.portlets.user.dataminermanager.client.widgets.ResourceViewer;
import org.gcube.portlets.user.dataminermanager.shared.data.ComputationId;
@ -24,7 +25,6 @@ import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.core.client.XTemplates;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.button.TextButton;
@ -49,40 +49,44 @@ public class ComputationOutputPanel extends SimpleContainer {
super();
this.computationId = computationId;
Log.debug("ComputationOutputPanel");
bind();
init();
}
private void init() {
v = new VerticalLayoutContainer();
add(v);
// request resource by ComputationId
DataMinerPortletServiceAsync.INSTANCE.getResourceByComputationId(computationId,
new AsyncCallback<Resource>() {
@Override
public void onSuccess(Resource result) {
showOutputInfo(result);
}
@Override
public void onFailure(Throwable caught) {
Log.error("Error in getResourceByComputationId: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert(
"Error",
"Impossible to retrieve output info. "
+ caught.getLocalizedMessage());
}
});
OutputResourceRequestEvent event=new OutputResourceRequestEvent(computationId);
EventBusProvider.INSTANCE.fireEvent(event);
}
private void bind(){
EventBusProvider.INSTANCE.addHandler(
OutputResourceEvent.TYPE,
new OutputResourceEvent.OutputResourceEventHandler() {
@Override
public void onOutput(
OutputResourceEvent event) {
Log.debug("Catch OutputResourceEvent: "
+ event);
showOutputInfo(event);
}
});
}
/**
*
* @param resource
*/
private void showOutputInfo(Resource resource) {
private void showOutputInfo(OutputResourceEvent event) {
try {
Resource resource=event.getResource();
Log.info("Show Output Info on: " + resource);
if (resource == null)
return;

View File

@ -7,12 +7,13 @@ import java.util.Date;
import org.gcube.portlets.user.dataminermanager.client.bean.ComputationStatus;
import org.gcube.portlets.user.dataminermanager.client.bean.ComputationStatus.Status;
import org.gcube.portlets.user.dataminermanager.client.bean.Operator;
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminermanager.client.custom.progress.GreenProgressBar;
import org.gcube.portlets.user.dataminermanager.client.custom.progress.RedProgressBar;
import org.gcube.portlets.user.dataminermanager.client.events.CancelComputationExecutionRequestEvent;
import org.gcube.portlets.user.dataminermanager.client.events.DataMinerWorkAreaRequestEvent;
import org.gcube.portlets.user.dataminermanager.client.rpc.DataMinerPortletServiceAsync;
import org.gcube.portlets.user.dataminermanager.client.type.DataMinerWorkAreaRequestEventType;
import org.gcube.portlets.user.dataminermanager.client.util.UtilsGXT3;
import org.gcube.portlets.user.dataminermanager.shared.Constants;
import org.gcube.portlets.user.dataminermanager.shared.data.ComputationId;
@ -35,193 +36,231 @@ import com.sencha.gxt.widget.core.client.info.Info;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ComputationStatusPanel extends SimpleContainer {
private ProgressBar progressBar;
private ComputationId computationId;
private Operator operator;
private boolean terminated=false;
private ComputationTimer timer = new ComputationTimer();
private String operatorName;
private boolean terminated = false;
private ComputationTimer timer = new ComputationTimer();
private TextButton cancelComputationBtn;
private VerticalLayoutContainer vert;
/**
*
*/
public ComputationStatusPanel(Operator operator) {
public ComputationStatusPanel(String operatorName) {
super();
this.operator=operator;
this.operatorName = operatorName;
init();
create();
}
private void init(){
private void init() {
setStylePrimaryName("computationStatusPanel");
}
private void create(){
vert=new VerticalLayoutContainer();
HtmlLayoutContainer title = new HtmlLayoutContainer("<div class='computationStatusTitle'><p>Computation of <b>" + operator.getName() + "</b></p></div>");
HtmlLayoutContainer date = new HtmlLayoutContainer("<div class='computationStatusDate'><p>" + new Date().toString() + "</p></div>");
private void create() {
vert = new VerticalLayoutContainer();
HtmlLayoutContainer title = new HtmlLayoutContainer(
"<div class='computationStatusTitle'><p>Computation of <b>"
+ operatorName + "</b></p></div>");
HtmlLayoutContainer date = new HtmlLayoutContainer(
"<div class='computationStatusDate'><p>"
+ new Date().toString() + "</p></div>");
vert.add(title, new VerticalLayoutData(-1, -1, new Margins(0)));
vert.add(date,new VerticalLayoutData(-1, -1, new Margins(0)));
vert.add(date, new VerticalLayoutData(-1, -1, new Margins(0)));
add(vert);
forceLayout();
}
/**
* @param computationId the computationId to set
* @param computationId
* the computationId to set
*/
public void computationStarted(ComputationId computationId) {
this.computationId = computationId;
vert.add(new HtmlLayoutContainer("<p>Created, the id is "+computationId.getId()+" [<a href='"+computationId.getUrlId()+"' >link</a>]</p>"));
vert.add(new HtmlLayoutContainer("<p>Created, the id is "
+ computationId.getId() + " [<a href='"
+ computationId.getUrlId() + "' >link</a>]</p>"));
progressBar = new ProgressBar();
progressBar.updateProgress(0, "Starting...");
vert.add(progressBar,new VerticalLayoutData(1, -1, new Margins(20)));
progressBar.updateProgress(0, "Starting...");
vert.add(progressBar, new VerticalLayoutData(1, -1, new Margins(20)));
cancelComputationBtn = new TextButton("Cancel");
cancelComputationBtn.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
cancelComputationBtn.disable();
cancelComputation();
}
});
cancelComputationBtn.getElement().getStyle().setMarginBottom(36, Unit.PX);
vert.add(cancelComputationBtn,new VerticalLayoutData(-1, -1, new Margins(0)));
cancelComputationBtn.getElement().getStyle()
.setMarginBottom(36, Unit.PX);
vert.add(cancelComputationBtn, new VerticalLayoutData(-1, -1,
new Margins(0)));
forceLayout();
timer.scheduleRepeating(Constants.TIME_UPDATE_COMPUTATION_STATUS_PANEL);
}
private void cancelComputation(){
CancelComputationExecutionRequestEvent event=new CancelComputationExecutionRequestEvent(computationId);
private void cancelComputation() {
CancelComputationExecutionRequestEvent event = new CancelComputationExecutionRequestEvent(
computationId);
EventBusProvider.INSTANCE.fireEvent(event);
}
/**
* @param computationId
* @param operator
* @param computationId
* @param operator
*
*/
protected void computationTerminated(ComputationId computationId, Operator operator, ComputationStatus computationStatus) {
protected void computationTerminated(ComputationId computationId,
ComputationStatus computationStatus) {
Log.debug("Computation Terminated");
Log.debug("Computation Status:"+computationStatus);
Log.debug("Computation Status:" + computationStatus);
if (terminated == false) {
terminated = true;
cancelComputationBtn.setVisible(false);
if (computationStatus.isComplete()) {
Log.debug("Computation is Complete");
Info.display("Terminated", "The computation "+computationId.getId()+" of "+operator.getName()+" is terminated correctly.");
int index=vert.getWidgetIndex(progressBar);
Info.display("Terminated",
"The computation " + computationId.getId() + " of "
+ computationId.getOperatorName()
+ " is terminated correctly.");
int index = vert.getWidgetIndex(progressBar);
vert.remove(index);
//TODO
progressBar =new GreenProgressBar();
// TODO
progressBar = new GreenProgressBar();
progressBar.updateProgress(1, "Computation Complete");
vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20)));
vert.insert(progressBar, index, new VerticalLayoutData(1, -1,
new Margins(20)));
showOutput();
fireDataMinerWorkAreareRequestUpdate();
} else if (computationStatus.isFailed()) {
Log.debug("Computation is Failed");
String errorMessage;
if(computationStatus.getErrResource()==null||computationStatus.getErrResource().getDescription()==null ){
errorMessage=new String("Computation Failed!");
if (computationStatus.getErrResource() == null
|| computationStatus.getErrResource().getDescription() == null) {
errorMessage = new String("Computation Failed!");
} else {
errorMessage=computationStatus.getErrResource().getDescription();
errorMessage = computationStatus.getErrResource()
.getDescription();
}
UtilsGXT3.alert("Failed", "The computation "+computationId.getId()+" of "+operator.getName()+" has failed.</br>"
+"Message: "+errorMessage);
int index=vert.getWidgetIndex(progressBar);
Info.display("Failed",
"The computation " + computationId.getId() + " of "
+ computationId.getOperatorName()
+ " is failed.");
UtilsGXT3.alert("Failed",
"The computation " + computationId.getId() + " of "
+ computationId.getOperatorName()
+ " has failed.</br>"
+ errorMessage);
int index = vert.getWidgetIndex(progressBar);
vert.remove(index);
//TODO
progressBar =new RedProgressBar();
// TODO
progressBar = new RedProgressBar();
progressBar.updateProgress(1, "Computation Fail");
progressBar.getElement().getStyle().setMarginBottom(36, Unit.PX);
vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20)));
progressBar.getElement().getStyle()
.setMarginBottom(36, Unit.PX);
vert.insert(progressBar, index, new VerticalLayoutData(1, -1,
new Margins(20)));
fireDataMinerWorkAreareRequestUpdate();
}
}
forceLayout();
}
private void fireDataMinerWorkAreareRequestUpdate() {
DataMinerWorkAreaRequestEvent event = new DataMinerWorkAreaRequestEvent(
DataMinerWorkAreaRequestEventType.UPDATE);
EventBusProvider.INSTANCE.fireEvent(event);
}
/**
*
*/
private void showOutput() {
HtmlLayoutContainer computationEndMessage=new HtmlLayoutContainer("<p>The computation <b>"+operator.getName()+"</b> finished.</p>");
vert.add(computationEndMessage, new VerticalLayoutData(-1, -1, new Margins(0)));
ComputationOutputPanel computationOutputPanel = new ComputationOutputPanel(computationId);
computationOutputPanel.getElement().getStyle().setMarginBottom(36, Unit.PX);
vert.add(computationOutputPanel, new VerticalLayoutData(1, -1, new Margins(0)));
HtmlLayoutContainer computationEndMessage = new HtmlLayoutContainer(
"<p>The computation <b>" + computationId.getOperatorName()
+ "</b> finished.</p>");
vert.add(computationEndMessage, new VerticalLayoutData(-1, -1,
new Margins(0)));
ComputationOutputPanel computationOutputPanel = new ComputationOutputPanel(
computationId);
computationOutputPanel.getElement().getStyle()
.setMarginBottom(36, Unit.PX);
vert.add(computationOutputPanel, new VerticalLayoutData(1, -1,
new Margins(0)));
}
/**
* @param computationStatus
*/
protected void updateStatus(ComputationStatus computationStatus) {
Log.debug("Conputation Status Panel ::Update Status ");
Log.debug("Conputation Status Panel ::Update Status ");
if (computationStatus.getStatus() == Status.PENDING)
progressBar.updateText("Pending...");
else {
double percentage = computationStatus.getPercentage();
progressBar.updateProgress(percentage/100,
"Running, " + NumberFormat.getFormat("0.00").format(percentage) + "% Complete");
progressBar.updateProgress(percentage / 100, "Running, "
+ NumberFormat.getFormat("0.00").format(percentage)
+ "% Complete");
}
}
private class ComputationTimer extends Timer {
@Override
public void run() {
Log.debug("Timer run .....");
DataMinerPortletServiceAsync.INSTANCE.getComputationStatus(computationId, new AsyncCallback<ComputationStatus>() {
Log.debug("Timer run .....");
DataMinerPortletServiceAsync.INSTANCE.getComputationStatus(
computationId, new AsyncCallback<ComputationStatus>() {
@Override
public void onFailure(Throwable caught) {
int index=vert.getWidgetIndex(progressBar);
vert.remove(index);
//TODO
progressBar =new RedProgressBar();
progressBar.updateProgress(1, "Failed to get the status");
progressBar.getElement().getStyle().setMarginBottom(36, Unit.PX);
vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20)));
}
@Override
public void onFailure(Throwable caught) {
int index = vert.getWidgetIndex(progressBar);
vert.remove(index);
// TODO
progressBar = new RedProgressBar();
progressBar.updateProgress(1,
"Failed to get the status");
progressBar.getElement().getStyle()
.setMarginBottom(36, Unit.PX);
vert.insert(progressBar, index,
new VerticalLayoutData(1, -1, new Margins(
20)));
@Override
public void onSuccess(ComputationStatus computationStatus) {
if (computationStatus.isTerminated()) {
ComputationTimer.this.cancel();
computationTerminated(computationId, operator, computationStatus);
} else
updateStatus(computationStatus);
}
});
}
@Override
public void onSuccess(
ComputationStatus computationStatus) {
if (computationStatus.isTerminated()) {
ComputationTimer.this.cancel();
computationTerminated(computationId,
computationStatus);
} else
updateStatus(computationStatus);
}
});
}
}
}
/**
*
@ -229,9 +268,9 @@ public class ComputationStatusPanel extends SimpleContainer {
public void stopTimer() {
try {
timer.cancel();
} catch (Exception e) {
} catch (Exception e) {
}
vert.clear();
}
}

View File

@ -0,0 +1,63 @@
package org.gcube.portlets.user.dataminermanager.client.monitor;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class StatusMonitor extends AutoProgressMessageBox {
public StatusMonitor() {
super("Waiting", "Please wait...");
create();
}
/**
*
* @param headingHtml
* @param messageHtml
*/
public StatusMonitor(SafeHtml headingHtml, SafeHtml messageHtml) {
super(headingHtml, messageHtml);
create();
}
/**
*
* @param headingHtml
*/
public StatusMonitor(SafeHtml headingHtml) {
super(headingHtml);
create();
}
/**
*
* @param headingHtml
* @param messageHtml
*/
public StatusMonitor(String headingHtml, String messageHtml) {
super(headingHtml, messageHtml);
create();
}
/**
*
* @param headingHtml
*/
public StatusMonitor(String headingHtml) {
super(headingHtml);
create();
}
private void create() {
setProgressText("In progress...");
auto();
show();
}
}

View File

@ -36,7 +36,6 @@ public interface DataMinerPortletService extends RemoteService {
public ComputationStatus getComputationStatus(ComputationId computationId)
throws ServiceException;
public ComputationId resubmit(ItemDescription itemDescription) throws ServiceException;
@ -55,4 +54,6 @@ public interface DataMinerPortletService extends RemoteService {
public Resource getResourceByComputationId(ComputationId computationId) throws ServiceException;
public Resource getResourceByComputationItem(ItemDescription itemDescription) throws ServiceException;
}

View File

@ -61,5 +61,8 @@ public interface DataMinerPortletServiceAsync {
void getResourceByComputationId(ComputationId computationId,
AsyncCallback<Resource> callback);
void getResourceByComputationItem(ItemDescription itemDescription,
AsyncCallback<Resource> callback);
}

View File

@ -0,0 +1,11 @@
package org.gcube.portlets.user.dataminermanager.client.type;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public enum DataMinerWorkAreaRequestEventType {
OPEN,UPDATE;
}

View File

@ -0,0 +1,11 @@
package org.gcube.portlets.user.dataminermanager.client.type;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public enum OutputResourceRequestEventType {
ComputationId, ItemDescription;
}

View File

@ -155,7 +155,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
logger.debug("Resubmit(): " + itemDescription);
Map<String, String> properties = StorageUtil.getProperties(
aslSession.getUsername(), itemDescription.getId());
logger.debug(properties.toString());
logger.debug("Properties: " + properties);
SClient smClient = SessionUtil.getSClient(session, aslSession);
return smClient.resubmitComputation(properties);
} catch (ServiceException e) {
@ -190,30 +190,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
}
}
@Override
public Resource getResourceByComputationId(ComputationId computationId)
throws ServiceException {
try {
Log.debug("getResourceByComputationId: " + computationId);
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session);
SClient smClient = SessionUtil.getSClient(session, aslSession);
Resource resource = smClient
.getResourceByComputationId(computationId);
Log.debug("Resoure: " + resource);
return resource;
} catch (ServiceException e) {
logger.error(e.getLocalizedMessage());
throw e;
} catch (Throwable e) {
logger.error("Error in getResourceByComputationId: "
+ e.getLocalizedMessage());
e.printStackTrace();
throw new ServiceException(e.getLocalizedMessage(), e);
}
}
@Override
public void deleteItem(ItemDescription itemDescription)
@ -317,4 +294,53 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
}
}
@Override
public Resource getResourceByComputationId(ComputationId computationId)
throws ServiceException {
try {
Log.debug("getResourceByComputationId: " + computationId);
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session);
SClient smClient = SessionUtil.getSClient(session, aslSession);
Resource resource = smClient
.getResourceByComputationId(computationId);
Log.debug("Resoure: " + resource);
return resource;
} catch (ServiceException e) {
logger.error(e.getLocalizedMessage());
throw e;
} catch (Throwable e) {
logger.error("Error in getResourceByComputationId: "
+ e.getLocalizedMessage());
e.printStackTrace();
throw new ServiceException(e.getLocalizedMessage(), e);
}
}
@Override
public Resource getResourceByComputationItem(ItemDescription itemDescription)
throws ServiceException {
try {
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session);
logger.debug("ResourceByComputationItemt(): " + itemDescription);
Map<String, String> properties = StorageUtil.getProperties(
aslSession.getUsername(), itemDescription.getId());
logger.debug("Properties: " + properties);
SClient smClient = SessionUtil.getSClient(session, aslSession);
return smClient.getResourceByComputationProperties(properties);
} catch (ServiceException e) {
logger.error(e.getLocalizedMessage());
throw e;
} catch (Throwable e) {
logger.error("Error retrieving resource by computation item: "
+ e.getLocalizedMessage());
e.printStackTrace();
throw new ServiceException(e.getLocalizedMessage());
}
}
}

View File

@ -39,6 +39,9 @@ public abstract class SClient {
public abstract Resource getResourceByComputationId(
ComputationId computationId) throws Exception;
public abstract Resource getResourceByComputationProperties(
Map<String, String> computationProperties) throws Exception;
public abstract String cancelComputation(ComputationId computationId)
throws Exception;

View File

@ -278,7 +278,8 @@ public class SClient4WPS extends SClient {
processDescription = wpsClient.getProcessDescription(
wpsProcessingServlet, processId);
} catch (Throwable e) {
logger.error("Error getProcessDescription for process "+processId+" with WPS URL: "
logger.error("Error getProcessDescription for process "
+ processId + " with WPS URL: "
+ wpsProcessingServlet);
if (k == 3)
throw e;
@ -294,7 +295,7 @@ public class SClient4WPS extends SClient {
processDescription.set(XmlString.Factory
.parse(processDescriptionURL));
logger.debug("ProcessDescription: "+processDescription);
logger.debug("ProcessDescription: " + processDescription);
InputDescriptionType[] inputList = processDescription
.getDataInputs().getInputArray();
@ -704,7 +705,8 @@ public class SClient4WPS extends SClient {
logger.error("Invalid processLocation: " + processUrl);
throw new Exception("Invalid processLocation: " + processUrl);
}
ComputationId computationId = new ComputationId(id, processUrl);
ComputationId computationId = new ComputationId(id, processUrl,
operator.getId(), operator.getName());
logger.debug("ComputationId: " + computationId);
runningProcess.put(computationId, processInformations);
@ -1143,11 +1145,16 @@ public class SClient4WPS extends SClient {
}
@Override
public ComputationId resubmitComputation(Map<String,String> computationProperties)
throws Exception {
public ComputationId resubmitComputation(
Map<String, String> computationProperties) throws Exception {
ProcessInformations processInformations;
if (computationProperties == null || computationProperties.isEmpty()) {
throw new Exception("Invalid computation properties: "
+ computationProperties);
}
try {
processInformations = describeProcess(computationProperties.get("operator_name"));
processInformations = describeProcess(computationProperties
.get("operator_id"));
} catch (Throwable e) {
logger.error("GetParameters: " + e.getLocalizedMessage());
e.printStackTrace();
@ -1163,19 +1170,30 @@ public class SClient4WPS extends SClient {
inputParameters.put(inputParameter.getName(), inputParameter);
}
Map<String, String> userInputs = new LinkedHashMap<>();
for(Map.Entry<String, String> entry:computationProperties.entrySet()){
if(entry.getKey().startsWith("input")){
int inputSeparatorIndex=entry.getKey().indexOf("_");
String inputKey=entry.getKey().substring(inputSeparatorIndex+1);
userInputs.put(inputKey, entry.getValue());
logger.debug("UserInputs[key=" + inputKey + ", value="
+ entry.getValue() + "]");
for (Map.Entry<String, String> entry : computationProperties.entrySet()) {
if (entry.getKey().startsWith("input")) {
int inputSeparatorIndex = entry.getKey().indexOf("_");
String inputKey = entry.getKey().substring(
inputSeparatorIndex + 1);
if (inputKey.compareToIgnoreCase("user.name") != 0
&& inputKey.compareToIgnoreCase("scope") != 0) {
userInputs.put(inputKey, entry.getValue());
logger.debug("UserInputs[key=" + inputKey + ", value="
+ entry.getValue() + "]");
}
}
}
if (userInputs.isEmpty()) {
logger.error("Attention no imputs parameters retrieved for this computation: "
+ computationProperties);
throw new Exception(
"Attention no imputs parameters retrieved for this computation: "
+ computationProperties);
}
String processUrl = compute(processInformations, userInputs,
inputParameters);
logger.debug("Stated Computation ProcessLocation:" + processUrl);
@ -1188,7 +1206,9 @@ public class SClient4WPS extends SClient {
logger.error("Invalid processLocation: " + processUrl);
throw new Exception("Invalid processLocation: " + processUrl);
}
ComputationId computationId = new ComputationId(id, processUrl);
ComputationId computationId = new ComputationId(id, processUrl,
computationProperties.get("operator_id"),
computationProperties.get("operator_name"));
logger.debug("ComputationId: " + computationId);
runningProcess.put(computationId, processInformations);
@ -1196,4 +1216,11 @@ public class SClient4WPS extends SClient {
return computationId;
}
@Override
public Resource getResourceByComputationProperties(
Map<String, String> computationProperties) throws Exception {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -338,10 +338,10 @@ public class StatWPSClientSession {
url = req.getRequest(url);
try {
String authString = user + ":" + password;
System.out.println("auth string: " + authString);
logger.debug("auth string: " + authString);
byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
String encoded = new String(authEncBytes);
System.out.println("Base64 encoded auth string: " + encoded);
logger.debug("Base64 encoded auth string: " + encoded);
URL urlObj = new URL(url);
HttpURLConnection connection = (HttpURLConnection) urlObj
@ -370,17 +370,17 @@ public class StatWPSClientSession {
private ProcessDescriptionsDocument retrieveDescriptionViaGET(
String[] processIDs, String url) throws WPSClientException {
try {
System.out.println("RetrieveDescriptio: " + processIDs + " url:"
logger.debug("RetrieveDescription GET: " + processIDs + " url:"
+ url);
StatClientDescribeProcessRequest req = new StatClientDescribeProcessRequest();
req.setIdentifier(processIDs);
String requestURL = req.getRequest(url);
String authString = user + ":" + password;
System.out.println("auth string: " + authString);
logger.debug("auth string: " + authString);
byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
String encoded = new String(authEncBytes);
System.out.println("Base64 encoded auth string: " + encoded);
logger.debug("Base64 encoded auth string: " + encoded);
URL urlObj = new URL(requestURL);
HttpURLConnection connection = (HttpURLConnection) urlObj
@ -419,10 +419,10 @@ public class StatWPSClientSession {
try {
logger.debug("RetrieveDataViaPost(): " + urlString);
String authString = user + ":" + password;
System.out.println("auth string: " + authString);
logger.debug("auth string: " + authString);
byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
String encoded = new String(authEncBytes);
System.out.println("Base64 encoded auth string: " + encoded);
logger.debug("Base64 encoded auth string: " + encoded);
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
@ -609,10 +609,10 @@ public class StatWPSClientSession {
try {
String authString = user + ":" + password;
System.out.println("auth string: " + authString);
logger.debug("auth string: " + authString);
byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
String encoded = new String(authEncBytes);
System.out.println("Base64 encoded auth string: " + encoded);
logger.debug("Base64 encoded auth string: " + encoded);
url+="?id="+computationId;
URL urlObj = new URL(url);

View File

@ -13,15 +13,20 @@ public class ComputationId implements Serializable {
private static final long serialVersionUID = 7898676192287822723L;
private String id;
private String urlId;
private String operatorId;
private String operatorName;
public ComputationId() {
super();
}
public ComputationId(String id, String urlId) {
public ComputationId(String id, String urlId, String operatorId,
String operatorName) {
super();
this.id = id;
this.urlId = urlId;
this.operatorId = operatorId;
this.operatorName = operatorName;
}
public String getId() {
@ -40,9 +45,26 @@ public class ComputationId implements Serializable {
this.urlId = urlId;
}
public String getOperatorId() {
return operatorId;
}
public void setOperatorId(String operatorId) {
this.operatorId = operatorId;
}
public String getOperatorName() {
return operatorName;
}
public void setOperatorName(String operatorName) {
this.operatorName = operatorName;
}
@Override
public String toString() {
return "ComputationId [id=" + id + ", urlId=" + urlId + "]";
return "ComputationId [id=" + id + ", urlId=" + urlId + ", operatorId="
+ operatorId + ", operatorName=" + operatorName + "]";
}
}