bugs fixed for the submitQuery functionality:
- If a user clicks "cancel" after a computation is finished, the result will not be shown.(corrections in "removecomputtaion" and "submitquery" methods in servlet class and in the in the callback success related to the submitquery rpc in class GxtBorderLayout) - the ok button disabled in the dialog related to the submitQuery operation in order to avoid to submit the same query.The ok button will be enabled when a dialog will show the result.(corrections in rpc submitQuery and parseSubmitQueryResult in GxtBorderLayout class) git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@99516 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1ebffe746f
commit
e955f2bc42
|
@ -427,6 +427,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
startSearchTable = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(
|
||||
PagingLoadResult<Result> result) {
|
||||
|
@ -842,53 +843,87 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// Window.alert(caught.getMessage());
|
||||
rootLogger.log(Level.SEVERE, "FAILURE RPC submitQuery ");
|
||||
|
||||
Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
|
||||
public void handleEvent(MessageBoxEvent ce) {
|
||||
// Button btn = ce.getButtonClicked();
|
||||
// Info.display("MessageBox",
|
||||
// "The '{0}' button was pressed",
|
||||
// btn.getHtml());
|
||||
// Button btn = ce.getButtonClicked();
|
||||
rootLogger
|
||||
.log(Level.SEVERE, "FAILURE RPC submitQuery ");
|
||||
|
||||
if (form.getBody().isMasked())
|
||||
form.getBody().unmask();
|
||||
}
|
||||
};
|
||||
// Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
|
||||
// public void handleEvent(MessageBoxEvent ce) {
|
||||
// // Button btn = ce.getButtonClicked();
|
||||
// // Info.display("MessageBox",
|
||||
// // "The '{0}' button was pressed",
|
||||
// // btn.getHtml());
|
||||
// // Button btn = ce.getButtonClicked();
|
||||
//
|
||||
// if (form.getBody().isMasked())
|
||||
// form.getBody().unmask();
|
||||
//
|
||||
// }
|
||||
// };
|
||||
|
||||
if (!(caught.getMessage().equals("ServerException"))) {
|
||||
|
||||
if (!(caught.getMessage().equals("ServerException"))){
|
||||
|
||||
MessageBox.alert("Error ",
|
||||
"<br/>Message:" + caught.getMessage(), l);
|
||||
"<br/>Message:" + caught.getMessage(), null);
|
||||
}
|
||||
|
||||
// if (!(caught instanceof
|
||||
// javax.xml.ws.soap.SOAPFaultException)){
|
||||
// MessageBox.alert("Error ",
|
||||
// "<br/>Message:" + caught.getMessage(), l);
|
||||
// }
|
||||
|
||||
// if (!(caught instanceof javax.xml.ws.soap.SOAPFaultException)){
|
||||
// MessageBox.alert("Error ",
|
||||
// "<br/>Message:" + caught.getMessage(), l);
|
||||
// }
|
||||
if (form.getBody().isMasked())
|
||||
form.getBody().unmask();
|
||||
|
||||
if (form.getButtonById(Dialog.OK).isEnabled() == false){
|
||||
form.getButtonById(Dialog.OK).enable();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<String> listAttributes) {
|
||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC submitQuery");
|
||||
|
||||
if (form.getBody().isMasked())
|
||||
form.getBody().unmask();
|
||||
|
||||
if ((listAttributes == null)
|
||||
|| (listAttributes.size() == 0)) {
|
||||
|
||||
if (form.getButtonById(Dialog.OK).isEnabled() == false){
|
||||
form.getButtonById(Dialog.OK).enable();
|
||||
}
|
||||
|
||||
|
||||
if (listAttributes==null){
|
||||
return;
|
||||
}
|
||||
|
||||
if (listAttributes.size() == 0) {
|
||||
|
||||
// if (form.getBody().isMasked())
|
||||
// form.getBody().unmask();
|
||||
|
||||
rootLogger.log(Level.SEVERE,
|
||||
"No results have been returned");
|
||||
|
||||
MessageBox.alert("Error ", "<br/>Message:"+ "Result not available", null);
|
||||
|
||||
MessageBox.alert("Error ", "<br/>Message:"
|
||||
+ "Result not available", null);
|
||||
return;
|
||||
}
|
||||
|
||||
// if ((listAttributes == null)
|
||||
// || (listAttributes.size() == 0)) {
|
||||
//
|
||||
// // if (form.getBody().isMasked())
|
||||
// // form.getBody().unmask();
|
||||
//
|
||||
// rootLogger.log(Level.SEVERE,
|
||||
// "No results have been returned");
|
||||
//
|
||||
// MessageBox.alert("Error ", "<br/>Message:"
|
||||
// + "Result not available", null);
|
||||
// return;
|
||||
// }
|
||||
|
||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC submitQuery");
|
||||
rootLogger.log(Level.SEVERE, "output size: "
|
||||
+ listAttributes.size());
|
||||
|
@ -951,24 +986,46 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
public void onFailure(Throwable caught) {
|
||||
rootLogger.log(Level.SEVERE,
|
||||
"FAILURE RPC loadSubmitQueryResult");
|
||||
|
||||
Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
|
||||
public void handleEvent(MessageBoxEvent ce) {
|
||||
if (form.getBody().isMasked())
|
||||
form.getBody().unmask();
|
||||
|
||||
if (form.getButtonById(Dialog.OK).isEnabled() == false){
|
||||
form.getButtonById(Dialog.OK).enable();
|
||||
}
|
||||
}
|
||||
};
|
||||
MessageBox.alert("Error ", "<br/>Message:"
|
||||
+ caught.getMessage(), null);
|
||||
+ caught.getMessage(), l);
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(PagingLoadResult<Row> result) {
|
||||
rootLogger.log(Level.SEVERE,
|
||||
"SUCCESS RPC loadSubmitQueryResult");
|
||||
callback.onSuccess(result);
|
||||
List<Row> rows = result.getData();
|
||||
if (form.getBody().isMasked())
|
||||
form.getBody().unmask();
|
||||
|
||||
if ((rows == null) || (rows.size() == 0)) {
|
||||
rootLogger.log(Level.SEVERE,
|
||||
"No results have been returned");
|
||||
return;
|
||||
if (result != null) {
|
||||
callback.onSuccess(result);
|
||||
List<Row> rows = result.getData();
|
||||
|
||||
if (form.getBody().isMasked())
|
||||
form.getBody().unmask();
|
||||
|
||||
if (form.getButtonById(Dialog.OK).isEnabled() == false){
|
||||
form.getButtonById(Dialog.OK).enable();
|
||||
}
|
||||
|
||||
if ((rows == null) || (rows.size() == 0)) {
|
||||
rootLogger
|
||||
.log(Level.SEVERE,
|
||||
"No results have been returned");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// if (result != null) {
|
||||
// rootLogger.log(Level.SEVERE,
|
||||
// "rows not null");
|
||||
|
@ -1098,6 +1155,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
rootLogger.log(Level.SEVERE,
|
||||
"FAILURE RPC refreshDataOnServer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
rootLogger.log(Level.SEVERE,
|
||||
|
@ -1346,6 +1404,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
obj.unmask();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<Result> result) {
|
||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC randomSample");
|
||||
|
@ -1398,6 +1457,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
|||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<Row> rows) {
|
||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC parseResult");
|
||||
|
|
|
@ -242,6 +242,8 @@ public class GxtToolbarFunctionality {
|
|||
new SelectionListener<ButtonEvent>() {
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
//deactivate the button
|
||||
dialog.getButtonById(Dialog.OK).disable();
|
||||
// recover info from dialog
|
||||
setInfoOnSubmitQuery(form, dialog,
|
||||
dialogID);
|
||||
|
|
|
@ -170,7 +170,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
if (inputParameters.size() != 0) {
|
||||
// print check
|
||||
logger.info("algorithm input parameters retrieved");
|
||||
logger.info("dbmanager-> algorithm input parameters retrieved");
|
||||
}
|
||||
|
||||
// // print check input parameters
|
||||
|
@ -231,7 +231,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
if (inputParameters.size() != 0) {
|
||||
// print check
|
||||
logger.info("algorithm input parameters retrieved");
|
||||
logger.info("dbmanager-> algorithm input parameters retrieved");
|
||||
}
|
||||
|
||||
inputParameters.get(0).setValue(resourceName);
|
||||
|
@ -299,7 +299,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
if (inputParameters.size() != 0) {
|
||||
// print check
|
||||
logger.info("algorithm input parameters retrieved");
|
||||
logger.info("dbmanager-> algorithm input parameters retrieved");
|
||||
}
|
||||
|
||||
// print check algorithm input parameters
|
||||
|
@ -311,8 +311,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
|
||||
|
||||
// print check
|
||||
logger.info("ResourceName: " + dataInput.get("ResourceName"));
|
||||
logger.info("DatabaseName: " + dataInput.get("DatabaseName"));
|
||||
logger.info("dbmanager-> ResourceName: " + dataInput.get("ResourceName"));
|
||||
logger.info("dbmanager-> DatabaseName: " + dataInput.get("DatabaseName"));
|
||||
|
||||
// create data structure
|
||||
ComputationOutput outputData = new ComputationOutput();
|
||||
|
@ -322,7 +322,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
// print check
|
||||
// retrieve data
|
||||
logger.info("output data retrieved");
|
||||
logger.info("dbmanager-> output data retrieved");
|
||||
|
||||
// data output values
|
||||
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
|
||||
|
@ -370,7 +370,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
if (inputParameters.size() != 0) {
|
||||
// print check
|
||||
logger.info("algorithm input parameters retrieved");
|
||||
logger.info("dbmanager-> algorithm input parameters retrieved");
|
||||
}
|
||||
|
||||
// print check algorithm input parameters
|
||||
|
@ -383,9 +383,9 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
inputParameters.get(2).setValue(dataInput.get("SchemaName"));
|
||||
|
||||
// print check
|
||||
logger.info("ResourceName: " + dataInput.get("ResourceName"));
|
||||
logger.info("DatabaseName: " + dataInput.get("DatabaseName"));
|
||||
logger.info("SchemaName: " + dataInput.get("SchemaName"));
|
||||
logger.info("dbmanager-> ResourceName: " + dataInput.get("ResourceName"));
|
||||
logger.info("dbmanager-> DatabaseName: " + dataInput.get("DatabaseName"));
|
||||
logger.info("dbmanager-> SchemaName: " + dataInput.get("SchemaName"));
|
||||
|
||||
// create data structure
|
||||
ComputationOutput outputData = new ComputationOutput();
|
||||
|
@ -520,7 +520,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
boolean smartCorrectionQuery, String language, String UID)
|
||||
throws Exception {
|
||||
|
||||
logger.info("Dialect used for smart correction: " + language);
|
||||
logger.info("dbmanager-> Dialect used for smart correction: " + language);
|
||||
|
||||
// data input
|
||||
List<Parameter> inputParameters = new ArrayList<Parameter>();
|
||||
|
@ -552,7 +552,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
if (inputParameters.size() != 0) {
|
||||
// print check
|
||||
logger.info("algorithm input parameters retrieved");
|
||||
logger.info("dbmanager-> algorithm input parameters retrieved");
|
||||
}
|
||||
|
||||
// print check
|
||||
|
@ -561,10 +561,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
// }
|
||||
|
||||
// print check
|
||||
logger.info("ResourceName: " + dataDB.get("ResourceName"));
|
||||
logger.info("DatabaseName: " + dataDB.get("DatabaseName"));
|
||||
logger.info("Query: " + query);
|
||||
logger.info("SmartCorrections check: " + smartCorrectionQuery);
|
||||
logger.info("dbmanager-> ResourceName: " + dataDB.get("ResourceName"));
|
||||
logger.info("dbmanager-> DatabaseName: " + dataDB.get("DatabaseName"));
|
||||
logger.info("dbmanager-> Query: " + query);
|
||||
logger.info("dbmanager-> SmartCorrections check: " + smartCorrectionQuery);
|
||||
|
||||
inputParameters.get(0).setValue(dataDB.get("ResourceName"));
|
||||
inputParameters.get(1).setValue(dataDB.get("DatabaseName"));
|
||||
|
@ -582,42 +582,59 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
String computationId = startComputation(algorithmId,
|
||||
inputParameters, outputData, UID);
|
||||
|
||||
// computationIDMap.put(id, computationId);
|
||||
// get JobID
|
||||
if (checkJob(UID)) {
|
||||
|
||||
// print check on retrieving data
|
||||
// logger.info("output data retrieved");
|
||||
// computationIDMap.put(id, computationId);
|
||||
|
||||
// data output values
|
||||
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
|
||||
// data output keys
|
||||
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
|
||||
// print check on retrieving data
|
||||
// logger.info("output data retrieved");
|
||||
|
||||
mapValues = outputData.getMapValues();
|
||||
mapKeys = outputData.getmapKeys();
|
||||
// data output values
|
||||
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
|
||||
// data output keys
|
||||
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
|
||||
|
||||
if (mapValues.size() != 0) {
|
||||
output = new ArrayList<Result>();
|
||||
mapValues = outputData.getMapValues();
|
||||
mapKeys = outputData.getmapKeys();
|
||||
|
||||
for (int i = 0; i < mapValues.size(); i++) {
|
||||
Result row = new Result(mapKeys.get(String.valueOf(i)),
|
||||
mapValues.get(String.valueOf(i)));
|
||||
output.add(row);
|
||||
if (mapValues.size() != 0) {
|
||||
output = new ArrayList<Result>();
|
||||
|
||||
// logger.info("build the result - started");
|
||||
for (int i = 0; i < mapValues.size(); i++) {
|
||||
Result row = new Result(mapKeys.get(String.valueOf(i)),
|
||||
mapValues.get(String.valueOf(i)));
|
||||
output.add(row);
|
||||
}
|
||||
|
||||
// System.out.println("output size submit: " + output.size());
|
||||
// logger.info("build the result - finished");
|
||||
|
||||
// get the attributes list for the result table
|
||||
listAttributes = new ArrayList<String>();
|
||||
listAttributes = getListAttributes(output.get(0).getValue());
|
||||
// remove the header in order to parse only the result
|
||||
output.remove(0);
|
||||
|
||||
// store the result of the submit query operation
|
||||
updateSubmitQueryResultMap(UID, output);
|
||||
//remove job with the specified uid
|
||||
removeJob(UID);
|
||||
}
|
||||
|
||||
// get the attributes list for the result table
|
||||
listAttributes = new ArrayList<String>();
|
||||
listAttributes = getListAttributes(output.get(0).getValue());
|
||||
// remove the header in order to parse only the result
|
||||
output.remove(0);
|
||||
|
||||
// store the result of the submit query operation
|
||||
updateSubmitQueryResultMap(UID, output);
|
||||
}
|
||||
else{
|
||||
|
||||
listAttributes =null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
// e.printStackTrace();
|
||||
//TODO to remove. Exception Statistical management to remove a computation
|
||||
if (e.getMessage().contains("javax.xml.ws.soap.SOAPFaultException: java.lang.IndexOutOfBoundsException")){
|
||||
// e.printStackTrace();
|
||||
// TODO to remove. Exception Statistical management to remove a
|
||||
// computation
|
||||
if (e.getMessage()
|
||||
.contains(
|
||||
"javax.xml.ws.soap.SOAPFaultException: java.lang.IndexOutOfBoundsException")) {
|
||||
e = new Exception("ServerException");
|
||||
}
|
||||
throw e;
|
||||
|
@ -654,7 +671,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
if (inputParameters.size() != 0) {
|
||||
// print check
|
||||
logger.info("algorithm input parameters retrieved");
|
||||
logger.info("dbmanager-> algorithm input parameters retrieved");
|
||||
}
|
||||
|
||||
// print check
|
||||
|
@ -663,10 +680,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
// }
|
||||
|
||||
// print check
|
||||
logger.info("ResourceName: " + dataInput.get("ResourceName"));
|
||||
logger.info("DatabaseName: " + dataInput.get("DatabaseName"));
|
||||
logger.info("SchemaName: " + dataInput.get("SchemaName"));
|
||||
logger.info("TableName: " + dataInput.get("TableName"));
|
||||
logger.info("dbmanager-> ResourceName: " + dataInput.get("ResourceName"));
|
||||
logger.info("dbmanager-> DatabaseName: " + dataInput.get("DatabaseName"));
|
||||
logger.info("dbmanager-> SchemaName: " + dataInput.get("SchemaName"));
|
||||
logger.info("dbmanager-> TableName: " + dataInput.get("TableName"));
|
||||
|
||||
inputParameters.get(0).setValue(dataInput.get("ResourceName"));
|
||||
inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
|
||||
|
@ -727,7 +744,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
if (inputParameters.size() != 0) {
|
||||
// print check
|
||||
logger.info("algorithm input parameters retrieved");
|
||||
logger.info("dbmanager-> algorithm input parameters retrieved");
|
||||
}
|
||||
|
||||
// print check
|
||||
|
@ -736,10 +753,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
// }
|
||||
|
||||
// print check
|
||||
logger.info("ResourceName: " + dataInput.get("ResourceName"));
|
||||
logger.info("DatabaseName: " + dataInput.get("DatabaseName"));
|
||||
logger.info("SchemaName: " + dataInput.get("SchemaName"));
|
||||
logger.info("TableName: " + dataInput.get("TableName"));
|
||||
logger.info("dbmanager-> ResourceName: " + dataInput.get("ResourceName"));
|
||||
logger.info("dbmanager-> DatabaseName: " + dataInput.get("DatabaseName"));
|
||||
logger.info("dbmanager-> SchemaName: " + dataInput.get("SchemaName"));
|
||||
logger.info("dbmanager-> TableName: " + dataInput.get("TableName"));
|
||||
|
||||
inputParameters.get(0).setValue(dataInput.get("ResourceName"));
|
||||
inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
|
||||
|
@ -753,7 +770,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
outputData);
|
||||
|
||||
// print check on retrieving data
|
||||
logger.info("output data retrieved");
|
||||
logger.info("dbmanager-> output data retrieved");
|
||||
|
||||
// data output values
|
||||
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
|
||||
|
@ -800,7 +817,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
if (inputParameters.size() != 0) {
|
||||
// print check
|
||||
logger.info("algorithm input parameters retrieved");
|
||||
logger.info("dbmanager-> algorithm input parameters retrieved");
|
||||
}
|
||||
|
||||
// print check algorithm input parameters
|
||||
|
@ -809,10 +826,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
// }
|
||||
|
||||
// print check
|
||||
logger.info("ResourceName: " + dataInput.get("ResourceName"));
|
||||
logger.info("DatabaseName: " + dataInput.get("DatabaseName"));
|
||||
logger.info("SchemaName: " + dataInput.get("SchemaName"));
|
||||
logger.info("TableName: " + dataInput.get("TableName"));
|
||||
logger.info("dbmanager-> ResourceName: " + dataInput.get("ResourceName"));
|
||||
logger.info("dbmanager-> DatabaseName: " + dataInput.get("DatabaseName"));
|
||||
logger.info("dbmanager-> SchemaName: " + dataInput.get("SchemaName"));
|
||||
logger.info("dbmanager-> TableName: " + dataInput.get("TableName"));
|
||||
|
||||
inputParameters.get(0).setValue(dataInput.get("ResourceName"));
|
||||
inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
|
||||
|
@ -826,7 +843,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
outputData);
|
||||
|
||||
// print check on retrieving data
|
||||
logger.info("output data retrieved");
|
||||
logger.info("dbmanager-> output data retrieved");
|
||||
|
||||
// data output values
|
||||
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
|
||||
|
@ -872,7 +889,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
if (inputParameters.size() != 0) {
|
||||
// print check
|
||||
logger.info("algorithm input parameters retrieved");
|
||||
logger.info("dbmanager-> algorithm input parameters retrieved");
|
||||
}
|
||||
|
||||
// print check algorithm input parameters
|
||||
|
@ -881,10 +898,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
// }
|
||||
|
||||
// print check
|
||||
logger.info("ResourceName: " + dataInput.get("ResourceName"));
|
||||
logger.info("DatabaseName: " + dataInput.get("DatabaseName"));
|
||||
logger.info("SchemaName: " + dataInput.get("SchemaName"));
|
||||
logger.info("TableName: " + dataInput.get("TableName"));
|
||||
logger.info("dbmanager-> ResourceName: " + dataInput.get("ResourceName"));
|
||||
logger.info("dbmanager-> DatabaseName: " + dataInput.get("DatabaseName"));
|
||||
logger.info("dbmanager-> SchemaName: " + dataInput.get("SchemaName"));
|
||||
logger.info("dbmanager-> TableName: " + dataInput.get("TableName"));
|
||||
|
||||
inputParameters.get(0).setValue(dataInput.get("ResourceName"));
|
||||
inputParameters.get(1).setValue(dataInput.get("DatabaseName"));
|
||||
|
@ -927,11 +944,12 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
// check to verify if the submit query result has been already parsed
|
||||
// boolean checkOnDataParsed = checkOnSubmitQueryResultParsed(UID);
|
||||
|
||||
// System.out.println("Server - loadSubmitResultMethod");
|
||||
// data parsed
|
||||
List<Row> data = new ArrayList<Row>();
|
||||
// submit query result
|
||||
List<Result> result = new ArrayList<Result>();
|
||||
//get parsed data
|
||||
// get parsed data
|
||||
data = getSubmitQueryResultParsed(UID);
|
||||
|
||||
if ((data == null)) {
|
||||
|
@ -968,7 +986,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
return loadResult;
|
||||
}
|
||||
|
||||
|
||||
// get attributes list for display the result in a table
|
||||
private List<String> getListAttributes(String value) {
|
||||
|
||||
|
@ -1085,9 +1103,9 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
SMListGroupedAlgorithms groups = factory.getAlgorithms();
|
||||
|
||||
if (groups == null)
|
||||
logger.info("GROUPS OF ALGORITHMS IS NULL!");
|
||||
logger.info("dbmanager-> GROUPS OF ALGORITHMS IS NULL!");
|
||||
else
|
||||
logger.info("GROUPS OF ALGORITHMS IS NOT NULL!");
|
||||
logger.info("dbmanager-> GROUPS OF ALGORITHMS IS NOT NULL!");
|
||||
|
||||
// get list categories
|
||||
for (SMGroupedAlgorithms group : groups.thelist()) {
|
||||
|
@ -1147,6 +1165,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
.getAttribute("submitQueryResultParsed");
|
||||
|
||||
if (submitQueryResultParsed.containsKey(submitQueryUID)) {
|
||||
// System.out.println("ResultParsed: UID contained");
|
||||
return submitQueryResultParsed.get(submitQueryUID);
|
||||
} else {
|
||||
return null;
|
||||
|
@ -1274,6 +1293,23 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
return null;
|
||||
}
|
||||
|
||||
private synchronized boolean checkJob(String jobID) {
|
||||
boolean isContained = false;
|
||||
if (jobID != null) {
|
||||
ASLSession session = WsUtil.getAslSession(this
|
||||
.getThreadLocalRequest().getSession());
|
||||
HashMap<String, String> computationIDMap = (HashMap<String, String>) session
|
||||
.getAttribute("ComputationIDList");
|
||||
if (computationIDMap.containsKey(jobID)) {
|
||||
isContained = true;
|
||||
} else {
|
||||
isContained = false;
|
||||
}
|
||||
}
|
||||
// System.out.println("JobID isContained: " + isContained);
|
||||
return isContained;
|
||||
}
|
||||
|
||||
private String startComputation(String algorithmName,
|
||||
List<Parameter> parameters, ComputationOutput outputData)
|
||||
throws Exception {
|
||||
|
@ -1308,19 +1344,19 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
updateJobStatus(jobID, "computation started");
|
||||
updateJob(jobID, computationId);
|
||||
logger.info("startComputation->The computation has started!");
|
||||
logger.info("dbmanager-> startComputation: the computation has started!");
|
||||
while (percentage < 100) {
|
||||
percentage = checkComputationStatus(scope, computationId,
|
||||
username, outputData);
|
||||
Thread.sleep(3000);
|
||||
}
|
||||
logger.info("startComputation->The computation has finished!");
|
||||
logger.info("dbmanager-> startComputation: the computation has finished!");
|
||||
updateJobStatus(jobID, "computation finished");
|
||||
removeJob(jobID);
|
||||
// removeJob(jobID);
|
||||
|
||||
return computationId;
|
||||
} catch (Exception e) {
|
||||
logger.info("startComputation->The job submit has failed!");
|
||||
logger.info("dbmanager-> startComputation: the job submit has failed!");
|
||||
// e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
|
@ -1356,6 +1392,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
} else if ((status == SMOperationStatus.COMPLETED)
|
||||
|| (status == SMOperationStatus.FAILED)) {
|
||||
|
||||
// logger.info("computation COMPLETED");
|
||||
// logger.info("COMPLETED OR FAILED");
|
||||
|
||||
SMAbstractResource abstractResource = computation
|
||||
|
@ -1392,7 +1429,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
// case OBJECT:
|
||||
SMObject objRes = (SMObject) smResource;
|
||||
if (objRes.name().contentEquals(PrimitiveTypes.MAP.toString())) {
|
||||
logger.info("Output is a map");
|
||||
logger.info("dbmanager-> Output is a map");
|
||||
getMap(objRes, outputData);
|
||||
|
||||
} else if (objRes.name().contentEquals(
|
||||
|
@ -1409,7 +1446,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
Exception e = new Exception(smResource.description());
|
||||
// e.printStackTrace();
|
||||
logger.error(e);
|
||||
logger.error("dbmanager-> " +e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -1423,6 +1460,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
// output data keys
|
||||
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
|
||||
|
||||
// logger.info("getStorageInputStream - started");
|
||||
|
||||
InputStream is = getStorageClientInputStream(objRes.url());
|
||||
// object serializer
|
||||
XStream xstream = new XStream();
|
||||
|
@ -1439,11 +1478,16 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
"org.gcube_system.namespaces.data.analysis.statisticalmanager.types.SMTable",
|
||||
SMTable.class);
|
||||
|
||||
// logger.info("streaming");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, SMResource> smMap = (Map<String, SMResource>) (xstream
|
||||
.fromXML(is));
|
||||
is.close();
|
||||
|
||||
// logger.info("getStorageInputStream - finished");
|
||||
|
||||
// logger.info("build the resultMap - started");
|
||||
int i = 0;
|
||||
for (String key : smMap.keySet()) {
|
||||
// add key value
|
||||
|
@ -1469,6 +1513,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
outputData.setMapValues(mapValues);
|
||||
outputData.setmapKeys(mapKeys);
|
||||
|
||||
// logger.info("build the resultMap - finished");
|
||||
}
|
||||
|
||||
private InputStream getStorageClientInputStream(String url)
|
||||
|
@ -1521,22 +1567,27 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
computationId = removeJob(uidSubmitQuery);
|
||||
}
|
||||
} else if (status.equals("computation started")) {
|
||||
// System.out.println("check status: computation started");
|
||||
// the computation has started
|
||||
computationId = removeJob(uidSubmitQuery);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (computationId != null) {
|
||||
StatisticalManagerFactory factory = getFactory();
|
||||
try {
|
||||
factory.removeComputation(computationId);
|
||||
// remove submit query result
|
||||
refreshDataOnServer(uidSubmitQuery);
|
||||
// System.out.println("computation removed");
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logger.info("Could not remove the computation ID "
|
||||
logger.info("dbmanager-> Could not remove the computation ID "
|
||||
+ computationId + " corresponding to jobID "
|
||||
+ uidSubmitQuery);
|
||||
logger.error(e);
|
||||
logger.error("dbmanager-> " +e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue