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