refs 2521: Explore the possibility to port the StatMan interface onto Dataminer
https://support.d4science.org/issues/2521 Added Cancel computations git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@128783 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6193c8c1c8
commit
4855c842ab
|
@ -5,6 +5,9 @@ import java.util.List;
|
|||
import org.gcube.portlets.user.dataminermanager.client.bean.OperatorsClassification;
|
||||
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.CancelExecutionFromComputationsRequestEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.ComputationDataEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.ComputationDataRequestEvent;
|
||||
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;
|
||||
|
@ -14,8 +17,6 @@ import org.gcube.portlets.user.dataminermanager.client.events.OperatorsClassific
|
|||
import org.gcube.portlets.user.dataminermanager.client.events.OperatorsClassificationRequestEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.OutputDataEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.OutputDataRequestEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.ComputationDataEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.ComputationDataRequestEvent;
|
||||
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;
|
||||
|
@ -27,6 +28,7 @@ import org.gcube.portlets.user.dataminermanager.client.rpc.DataMinerPortletServi
|
|||
import org.gcube.portlets.user.dataminermanager.client.type.DataMinerWorkAreaElementType;
|
||||
import org.gcube.portlets.user.dataminermanager.client.type.DataMinerWorkAreaEventType;
|
||||
import org.gcube.portlets.user.dataminermanager.client.type.MenuType;
|
||||
import org.gcube.portlets.user.dataminermanager.client.util.InfoMessageBox;
|
||||
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.OutputData;
|
||||
|
@ -35,10 +37,13 @@ import org.gcube.portlets.user.dataminermanager.shared.data.computations.Computa
|
|||
import org.gcube.portlets.user.dataminermanager.shared.exception.ExpiredSessionServiceException;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.session.UserInfo;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.workspace.DataMinerWorkArea;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.workspace.ItemDescription;
|
||||
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -51,7 +56,7 @@ public class DataMinerManagerController {
|
|||
private DataMinerWorkArea dataMinerWorkArea;
|
||||
private List<OperatorsClassification> operatorsClassifications;
|
||||
private MenuType currentVisualization;
|
||||
|
||||
|
||||
public DataMinerManagerController() {
|
||||
init();
|
||||
}
|
||||
|
@ -65,6 +70,7 @@ public class DataMinerManagerController {
|
|||
}
|
||||
|
||||
private void init() {
|
||||
currentVisualization = MenuType.HOME;
|
||||
bind();
|
||||
callHello();
|
||||
checkSession();
|
||||
|
@ -108,7 +114,7 @@ public class DataMinerManagerController {
|
|||
|
||||
@Override
|
||||
public void onSelect(MenuEvent event) {
|
||||
Log.debug("Catch MenuEvent:");
|
||||
Log.debug("Catch MenuEvent:" + event);
|
||||
manageMenuEvent(event);
|
||||
|
||||
}
|
||||
|
@ -144,6 +150,22 @@ public class DataMinerManagerController {
|
|||
}
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE
|
||||
.addHandler(
|
||||
CancelExecutionFromComputationsRequestEvent.TYPE,
|
||||
new CancelExecutionFromComputationsRequestEvent.CancelExecutionFromComputationsRequestEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onCancel(
|
||||
CancelExecutionFromComputationsRequestEvent event) {
|
||||
Log.debug("Catch CancelExecutionFromComputationsRequestEvent: "
|
||||
+ event);
|
||||
cancelExecutionFromComputationsRequest(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE
|
||||
.addHandler(
|
||||
ResubmitComputationExecutionRequestEvent.TYPE,
|
||||
|
@ -160,38 +182,33 @@ public class DataMinerManagerController {
|
|||
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE.addHandler(OutputDataRequestEvent.TYPE,
|
||||
new OutputDataRequestEvent.OutputDataRequestEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onOutputRequest(OutputDataRequestEvent event) {
|
||||
Log.debug("Catch OutputDataRequestEvent: " + event);
|
||||
manageOutputDataRequestEvent(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE
|
||||
.addHandler(
|
||||
OutputDataRequestEvent.TYPE,
|
||||
new OutputDataRequestEvent.OutputDataRequestEventHandler() {
|
||||
ComputationDataRequestEvent.TYPE,
|
||||
new ComputationDataRequestEvent.ComputationDataRequestEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onOutputRequest(
|
||||
OutputDataRequestEvent event) {
|
||||
Log.debug("Catch OutputDataRequestEvent: "
|
||||
public void onComputationDataRequest(
|
||||
ComputationDataRequestEvent event) {
|
||||
Log.debug("Catch ComputationDataRequestEvent: "
|
||||
+ event);
|
||||
manageOutputDataRequestEvent(event);
|
||||
manageComputationDataRequestEvent(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE
|
||||
.addHandler(
|
||||
ComputationDataRequestEvent.TYPE,
|
||||
new ComputationDataRequestEvent.ComputationDataRequestEventHandler() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onComputationDataRequest(ComputationDataRequestEvent event) {
|
||||
Log.debug("Catch ComputationDataRequestEvent: "
|
||||
+ event);
|
||||
manageComputationDataRequestEvent(event);
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE
|
||||
.addHandler(
|
||||
|
@ -269,6 +286,7 @@ public class DataMinerManagerController {
|
|||
}
|
||||
|
||||
private void manageMenuEvent(MenuEvent event) {
|
||||
Log.debug("CurrentVisualization=" + currentVisualization);
|
||||
if (event == null
|
||||
|| event.getMenuType() == null
|
||||
|| (currentVisualization == null && event.getMenuType()
|
||||
|
@ -327,6 +345,47 @@ public class DataMinerManagerController {
|
|||
EventBusProvider.INSTANCE.fireEvent(event);
|
||||
}
|
||||
|
||||
private void cancelExecutionFromComputationsRequest(
|
||||
CancelExecutionFromComputationsRequestEvent event) {
|
||||
final ItemDescription itemDescription = event.getItemDescription();
|
||||
DataMinerPortletServiceAsync.INSTANCE.cancelComputation(
|
||||
itemDescription, new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof ExpiredSessionServiceException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session!");
|
||||
EventBusProvider.INSTANCE
|
||||
.fireEvent(new SessionExpiredEvent());
|
||||
} else {
|
||||
Log.error("Error in cancenExecutionFromComputations:"
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
"Error in cancel computation "
|
||||
+ itemDescription.getName() + ": "
|
||||
+ caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
Log.debug("Computation Cancelled!");
|
||||
final InfoMessageBox d = new InfoMessageBox("Info",
|
||||
"Computation cancellation request has been accepted!");
|
||||
d.addHideHandler(new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
fireRefreshDataMinerWorkAreaEvent(DataMinerWorkAreaElementType.Computations);
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void cancelComputationRequest(
|
||||
CancelComputationExecutionRequestEvent event) {
|
||||
final ComputationId computationId = event.getComputationId();
|
||||
|
@ -350,7 +409,7 @@ public class DataMinerManagerController {
|
|||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
Log.debug("Computation Deleted!");
|
||||
Log.debug("Computation Cancelled!");
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -358,9 +417,11 @@ public class DataMinerManagerController {
|
|||
|
||||
private void resubmitComputationRequest(
|
||||
final ResubmitComputationExecutionRequestEvent event) {
|
||||
MenuSwitchEvent menuSwitchEvent=new MenuSwitchEvent(MenuType.EXPERIMENT);
|
||||
currentVisualization = MenuType.EXPERIMENT;
|
||||
MenuSwitchEvent menuSwitchEvent = new MenuSwitchEvent(
|
||||
MenuType.EXPERIMENT);
|
||||
EventBusProvider.INSTANCE.fireEvent(menuSwitchEvent);
|
||||
|
||||
|
||||
DataMinerPortletServiceAsync.INSTANCE.resubmit(
|
||||
event.getItemDescription(), new AsyncCallback<ComputationId>() {
|
||||
|
||||
|
@ -488,7 +549,8 @@ public class DataMinerManagerController {
|
|||
EventBusProvider.INSTANCE.fireEvent(ocEvent);
|
||||
}
|
||||
|
||||
private void retrieveDataMinerWorkArea(final DataMinerWorkAreaRequestEvent event) {
|
||||
private void retrieveDataMinerWorkArea(
|
||||
final DataMinerWorkAreaRequestEvent event) {
|
||||
final StatusMonitor monitor = new StatusMonitor();
|
||||
DataMinerPortletServiceAsync.INSTANCE
|
||||
.getDataMinerWorkArea(new AsyncCallback<DataMinerWorkArea>() {
|
||||
|
@ -519,10 +581,12 @@ public class DataMinerManagerController {
|
|||
|
||||
}
|
||||
|
||||
private void fireDataMinerWorkAreaEventRetrieved(DataMinerWorkAreaRequestEvent event, DataMinerWorkArea result) {
|
||||
private void fireDataMinerWorkAreaEventRetrieved(
|
||||
DataMinerWorkAreaRequestEvent event, DataMinerWorkArea result) {
|
||||
dataMinerWorkArea = result;
|
||||
DataMinerWorkAreaEvent dataMinerWorkAreaEvent = new DataMinerWorkAreaEvent(
|
||||
DataMinerWorkAreaEventType.OPEN, event.getDataMinerWorkAreaRegionType(), result);
|
||||
DataMinerWorkAreaEventType.OPEN,
|
||||
event.getDataMinerWorkAreaRegionType(), result);
|
||||
EventBusProvider.INSTANCE.fireEvent(dataMinerWorkAreaEvent);
|
||||
}
|
||||
|
||||
|
@ -566,8 +630,7 @@ public class DataMinerManagerController {
|
|||
|
||||
}
|
||||
|
||||
private void manageOutputDataRequestEvent(
|
||||
OutputDataRequestEvent event) {
|
||||
private void manageOutputDataRequestEvent(OutputDataRequestEvent event) {
|
||||
if (event == null) {
|
||||
UtilsGXT3.alert("Error", "Invalid output request!");
|
||||
} else {
|
||||
|
@ -578,8 +641,8 @@ public class DataMinerManagerController {
|
|||
"Error",
|
||||
"Invalid output request, computation id: "
|
||||
+ event.getComputationId());
|
||||
} else {
|
||||
final StatusMonitor monitor = new StatusMonitor();
|
||||
} else {
|
||||
final StatusMonitor monitor = new StatusMonitor();
|
||||
DataMinerPortletServiceAsync.INSTANCE
|
||||
.getOutputDataByComputationId(event.getComputationId(),
|
||||
new AsyncCallback<OutputData>() {
|
||||
|
@ -611,41 +674,41 @@ public class DataMinerManagerController {
|
|||
|
||||
}
|
||||
|
||||
private void manageComputationDataRequestEvent(ComputationDataRequestEvent event) {
|
||||
private void manageComputationDataRequestEvent(
|
||||
ComputationDataRequestEvent event) {
|
||||
if (event == null) {
|
||||
UtilsGXT3.alert("Error", "Invalid computation info request!");
|
||||
} else {
|
||||
if (event.getItemDescription() == null
|
||||
|| event.getItemDescription().getId() == null
|
||||
|| event.getItemDescription().getId().isEmpty()) {
|
||||
UtilsGXT3.alert(
|
||||
"Error",
|
||||
UtilsGXT3.alert("Error",
|
||||
"Invalid computation info request, item description: "
|
||||
+ event.getItemDescription());
|
||||
} else {
|
||||
final StatusMonitor monitor = new StatusMonitor();
|
||||
DataMinerPortletServiceAsync.INSTANCE.getComputationData(
|
||||
event.getItemDescription(),
|
||||
new AsyncCallback<ComputationData>() {
|
||||
@Override
|
||||
public void onSuccess(ComputationData computationData) {
|
||||
monitor.hide();
|
||||
fireComputationDataEvent(computationData);
|
||||
}
|
||||
event.getItemDescription(),
|
||||
new AsyncCallback<ComputationData>() {
|
||||
@Override
|
||||
public void onSuccess(
|
||||
ComputationData computationData) {
|
||||
monitor.hide();
|
||||
fireComputationDataEvent(computationData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
Log.error("Error in getComputationData: "
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
Log.error("Error in getComputationData: "
|
||||
+ caught.getLocalizedMessage());
|
||||
caught.printStackTrace();
|
||||
UtilsGXT3.alert("Error",
|
||||
"Impossible to retrieve computation info. "
|
||||
+ caught.getLocalizedMessage());
|
||||
caught.printStackTrace();
|
||||
UtilsGXT3
|
||||
.alert("Error",
|
||||
"Impossible to retrieve computation info. "
|
||||
+ caught.getLocalizedMessage());
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -655,4 +718,5 @@ public class DataMinerManagerController {
|
|||
EventBusProvider.INSTANCE.fireEvent(event);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -68,6 +68,7 @@ public class Header extends HorizontalPanel {
|
|||
menuDataSpace.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Log.debug("Click Menu Data Space");
|
||||
MenuEvent menuEvent = new MenuEvent(MenuType.DATA_SPACE);
|
||||
EventBusProvider.INSTANCE.fireEvent(menuEvent);
|
||||
}
|
||||
|
@ -79,6 +80,7 @@ public class Header extends HorizontalPanel {
|
|||
menuExperiment.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Log.debug("Click Menu Experiment");
|
||||
MenuEvent menuEvent = new MenuEvent(MenuType.EXPERIMENT);
|
||||
EventBusProvider.INSTANCE.fireEvent(menuEvent);
|
||||
}
|
||||
|
@ -91,6 +93,7 @@ public class Header extends HorizontalPanel {
|
|||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Log.debug("Click Menu Computations");
|
||||
MenuEvent menuEvent = new MenuEvent(MenuType.COMPUTATIONS);
|
||||
EventBusProvider.INSTANCE.fireEvent(menuEvent);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutD
|
|||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||
import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer.HorizontalLayoutData;
|
||||
//import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer.HorizontalLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
|
@ -122,10 +122,10 @@ public class HomePanel extends SimpleContainer {
|
|||
HTML text = new HTML("<b>" + title + "</b><br>" + description);
|
||||
text.addStyleName("smMenuItemText");
|
||||
text.setWidth("400px");
|
||||
HorizontalLayoutData textLayoutData = new HorizontalLayoutData(400,
|
||||
/*HorizontalLayoutData textLayoutData = new HorizontalLayoutData(400,
|
||||
140, new Margins(10, 5, 10, 10));
|
||||
HorizontalLayoutData imgLayoutData = new HorizontalLayoutData(140, 140,
|
||||
new Margins(10, 10, 10, 5));
|
||||
new Margins(10, 10, 10, 5));*/
|
||||
|
||||
//horiz.add(text, textLayoutData);
|
||||
//horiz.add(img, imgLayoutData);
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.CancelExecutionFromComputationsRequestEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.ComputationDataRequestEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.DataMinerWorkAreaEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.DeleteItemRequestEvent;
|
||||
|
@ -523,8 +524,18 @@ public class ComputationsExecutedPanel extends FramedPanel {
|
|||
}
|
||||
|
||||
private void cancelComputation() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
if (selectedItem != null) {
|
||||
ItemDescription itemDescription = new ItemDescription(
|
||||
selectedItem.getId(), selectedItem.getName(),
|
||||
selectedItem.getOwner(), selectedItem.getPath(),
|
||||
selectedItem.getType().name());
|
||||
CancelExecutionFromComputationsRequestEvent cancelComputationEvent = new CancelExecutionFromComputationsRequestEvent(
|
||||
itemDescription);
|
||||
EventBusProvider.INSTANCE.fireEvent(cancelComputationEvent);
|
||||
Log.debug("Fired: " + cancelComputationEvent);
|
||||
} else {
|
||||
UtilsGXT3.info("Attention", "Select a computation!");
|
||||
}
|
||||
}
|
||||
|
||||
private void resubmitComputation() {
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* Cancel Execution From Computations Request Event
|
||||
*
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class CancelExecutionFromComputationsRequestEvent
|
||||
extends
|
||||
GwtEvent<CancelExecutionFromComputationsRequestEvent.CancelExecutionFromComputationsRequestEventHandler> {
|
||||
|
||||
public static Type<CancelExecutionFromComputationsRequestEventHandler> TYPE = new Type<CancelExecutionFromComputationsRequestEventHandler>();
|
||||
private ItemDescription itemDescription;
|
||||
|
||||
public interface CancelExecutionFromComputationsRequestEventHandler extends
|
||||
EventHandler {
|
||||
void onCancel(CancelExecutionFromComputationsRequestEvent event);
|
||||
}
|
||||
|
||||
public interface HasCancelExecutionFromComputationsRequestEventHandler
|
||||
extends HasHandlers {
|
||||
public HandlerRegistration addCancelExecutionFromComputationsRequestEventHandler(
|
||||
CancelExecutionFromComputationsRequestEventHandler handler);
|
||||
}
|
||||
|
||||
public CancelExecutionFromComputationsRequestEvent(
|
||||
ItemDescription itemDescription) {
|
||||
this.itemDescription = itemDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatch(
|
||||
CancelExecutionFromComputationsRequestEventHandler handler) {
|
||||
handler.onCancel(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type<CancelExecutionFromComputationsRequestEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static Type<CancelExecutionFromComputationsRequestEventHandler> getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static void fire(HasHandlers source,
|
||||
CancelExecutionFromComputationsRequestEvent event) {
|
||||
source.fireEvent(event);
|
||||
}
|
||||
|
||||
public ItemDescription getItemDescription() {
|
||||
return itemDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CancelExecutionFromComputationsRequestEvent [itemDescription="
|
||||
+ itemDescription + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -59,9 +59,10 @@ public class MenuEvent extends
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MenuEvent []";
|
||||
return "MenuEvent [menuType=" + menuType + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.google.gwt.event.shared.HandlerRegistration;
|
|||
import com.google.gwt.event.shared.HasHandlers;
|
||||
|
||||
/**
|
||||
* Delete Item Event
|
||||
* Refresh DataMiner Work Area Event
|
||||
*
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
|
|
|
@ -224,14 +224,18 @@ public class ComputationStatusPanel extends SimpleContainer {
|
|||
* @param computationStatus
|
||||
*/
|
||||
private void updateStatus(ComputationStatus computationStatus) {
|
||||
Log.debug("Conputation Status Panel ::Update Status ");
|
||||
Log.debug("Conputation Status Panel ::Update Status "+computationStatus);
|
||||
if (computationStatus.getStatus().compareTo(Status.ACCEPTED)==0)
|
||||
progressBar.updateText("Accepted...");
|
||||
else {
|
||||
double percentage = computationStatus.getPercentage();
|
||||
progressBar.updateProgress(percentage/100, "Running, "
|
||||
if(percentage==0){
|
||||
progressBar.updateText("Running, 0% Complete");
|
||||
} else {
|
||||
progressBar.updateProgress(percentage/100, "Running, "
|
||||
+ percentage
|
||||
+ "% Complete");
|
||||
}
|
||||
}
|
||||
forceLayout();
|
||||
}
|
||||
|
|
|
@ -56,5 +56,7 @@ public interface DataMinerPortletService extends RemoteService {
|
|||
public OutputData getOutputDataByComputationId(ComputationId computationId) throws ServiceException;
|
||||
|
||||
public ComputationData getComputationData(ItemDescription itemDescription) throws ServiceException;
|
||||
|
||||
public String cancelComputation(ItemDescription itemDescription) throws ServiceException;
|
||||
|
||||
}
|
||||
|
|
|
@ -58,12 +58,15 @@ public interface DataMinerPortletServiceAsync {
|
|||
AsyncCallback<String> asyncCallback);
|
||||
|
||||
void deleteItem(ItemDescription itemDescription,
|
||||
AsyncCallback<Void> callback);
|
||||
AsyncCallback<Void> callback);
|
||||
|
||||
void getOutputDataByComputationId(ComputationId computationId,
|
||||
AsyncCallback<OutputData> callback);
|
||||
|
||||
|
||||
void getComputationData(ItemDescription itemDescription,
|
||||
AsyncCallback<ComputationData> callback);
|
||||
|
||||
void cancelComputation(ItemDescription itemDescription,
|
||||
AsyncCallback<String> asyncCallback);
|
||||
|
||||
}
|
||||
|
|
|
@ -361,4 +361,40 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String cancelComputation(ItemDescription itemDescription)
|
||||
throws ServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||
logger.debug("CancelComputation(): " + itemDescription);
|
||||
Map<String, String> properties = StorageUtil.getProperties(
|
||||
aslSession.getUsername(), itemDescription.getId());
|
||||
logger.debug("Properties: " + properties);
|
||||
String compId = properties.get("computation_id");
|
||||
if(compId==null){
|
||||
throw new ServiceException("Computation Id not found!");
|
||||
} else {
|
||||
int lastIndexUnd=compId.lastIndexOf("_");
|
||||
if(lastIndexUnd==-1){
|
||||
throw new ServiceException("Invalid Computation Id: "+compId);
|
||||
} else {
|
||||
compId=compId.substring(lastIndexUnd+1);
|
||||
}
|
||||
}
|
||||
ComputationId computationId=new ComputationId();
|
||||
computationId.setId(compId);
|
||||
SClient smClient = SessionUtil.getSClient(aslSession);
|
||||
String result = smClient.cancelComputation(computationId);
|
||||
return result;
|
||||
} catch (ServiceException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
logger.error(e.getLocalizedMessage(), e);
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -111,9 +111,10 @@ public class SessionUtil {
|
|||
logger.error("ASLSession is null!");
|
||||
throw new ExpiredSessionServiceException("Session Expired!");
|
||||
}
|
||||
|
||||
SClient sClient = (SClient) aslSession.getAttribute(Constants.SClient);
|
||||
if (sClient == null) {
|
||||
SClient sClient;
|
||||
|
||||
Object obj=aslSession.getAttribute(Constants.SClient);
|
||||
if(obj==null){
|
||||
logger.info("Created new SClient");
|
||||
ServiceCredential serviceCredential=new ServiceCredential(aslSession.getUsername(), aslSession.getScope(),
|
||||
SessionUtil.getToken(aslSession));
|
||||
|
@ -125,7 +126,13 @@ public class SessionUtil {
|
|||
sClient = director.getSClient();
|
||||
aslSession.setAttribute(Constants.SClient, sClient);
|
||||
} else {
|
||||
logger.info("Use SClient in session");
|
||||
if (obj instanceof SClient) {
|
||||
logger.info("Use SClient in session");
|
||||
sClient=(SClient) obj;
|
||||
} else {
|
||||
logger.error("Portlet is Changed!");
|
||||
throw new ServiceException("Sign Out, portlet is changed, a new session is required!");
|
||||
}
|
||||
}
|
||||
|
||||
return sClient;
|
||||
|
|
|
@ -74,7 +74,6 @@ import org.w3c.dom.NodeList;
|
|||
*/
|
||||
public class SClient4WPS extends SClient {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1909871837115147159L;
|
||||
private static Logger logger = LoggerFactory.getLogger(SClient4WPS.class);
|
||||
// private static final int OPERATOR_BRIEF_DESCRIPTION_MAX_LENGHT = 170;
|
||||
|
@ -94,7 +93,6 @@ public class SClient4WPS extends SClient {
|
|||
|
||||
private StatWPSClientSession wpsClient;
|
||||
|
||||
|
||||
public SClient4WPS(ServiceCredential serviceCredential) throws Exception {
|
||||
super();
|
||||
process = new HashMap<>();
|
||||
|
@ -166,9 +164,6 @@ public class SClient4WPS extends SClient {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<OperatorsClassification> getOperatorsClassifications()
|
||||
throws Exception {
|
||||
|
@ -940,7 +935,9 @@ public class SClient4WPS extends SClient {
|
|||
Status.RUNNING,
|
||||
statusd);
|
||||
} else {
|
||||
|
||||
logger.debug("WPS STATUS: Not Started, "
|
||||
+ statusType
|
||||
.getProcessStarted());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class Constants {
|
|||
|
||||
public static final String TD_DATASOURCE_FACTORY_ID = "DataMinerManager";
|
||||
|
||||
public static final int TIME_UPDATE_COMPUTATION_STATUS_PANEL = 10 * 1000;// 7*1000;
|
||||
public static final int TIME_UPDATE_COMPUTATION_STATUS_PANEL = 5 * 1000;// 7*1000;
|
||||
|
||||
public static final String[] ClassificationNames = { "User Perspective" };
|
||||
// "Computation Perspective"};
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="ENABLED"
|
||||
/> -->
|
||||
|
||||
|
||||
|
||||
<set-property name="log_ConsoleLogger" value="DISABLED" />
|
||||
<set-property name="log_DivLogger" value="DISABLED" />
|
||||
<set-property name="log_GWTLogger" value="DISABLED" />
|
||||
|
|
Loading…
Reference in New Issue