- caching on submitQuery requests added
- bug fixed in servlet in submitQuery method when a user clicks the cancel button and the map from statistical is already recovered - private variable output renamed in class SubmitQueryResultWithFileFromServlet git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@100324 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
67dc075dcc
commit
8ffb77cfee
|
@ -9,29 +9,32 @@ public class SubmitQueryResultWithFileFromServlet extends BaseModelData
|
||||||
implements Serializable {
|
implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private List<String> output;
|
private List<String> attributes;
|
||||||
private String convertedQuery;
|
private String convertedQuery;
|
||||||
private String fileName;
|
private String fileName;
|
||||||
|
|
||||||
|
|
||||||
public SubmitQueryResultWithFileFromServlet() {
|
public SubmitQueryResultWithFileFromServlet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubmitQueryResultWithFileFromServlet(List<String> result, String query, String fileName) {
|
public SubmitQueryResultWithFileFromServlet(List<String> attributes,
|
||||||
set("output", result);
|
String query, String fileName) {
|
||||||
|
set("attributes", attributes);
|
||||||
set("convertedQuery", query);
|
set("convertedQuery", query);
|
||||||
set("fileName", fileName);
|
set("fileName", fileName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getListOutput() {
|
public List<String> getListOutput() {
|
||||||
return get("output");
|
return get("attributes");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFileName() {
|
public String getFileName() {
|
||||||
return get("fileName");
|
return get("fileName");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getConvertedQuery() {
|
public String getConvertedQuery() {
|
||||||
return get("convertedQuery");
|
return get("convertedQuery");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,9 +406,10 @@ 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 LoadTables");
|
"FAILURE RPC LoadTables");
|
||||||
|
|
||||||
if(caught instanceof SessionExpiredException){
|
if (caught instanceof SessionExpiredException) {
|
||||||
rootLogger.log(Level.INFO, "Session expired");
|
rootLogger.log(Level.INFO,
|
||||||
|
"Session expired");
|
||||||
CheckSession.showLogoutDialog();
|
CheckSession.showLogoutDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -445,18 +446,18 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// enable toolbar in the dialog
|
// enable toolbar in the dialog
|
||||||
toolBarTop.enable();
|
toolBarTop.enable();
|
||||||
|
|
||||||
// if (result != null) {
|
// if (result != null) {
|
||||||
//
|
//
|
||||||
// List<Result> data = result.getData();
|
// List<Result> data = result.getData();
|
||||||
// if (data.size() == 0) {
|
// if (data.size() == 0) {
|
||||||
// MessageBox
|
// MessageBox
|
||||||
// .alert("Warning ",
|
// .alert("Warning ",
|
||||||
// "<br/>Message:"
|
// "<br/>Message:"
|
||||||
// + "no tables availables",
|
// + "no tables availables",
|
||||||
// null);
|
// null);
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -848,12 +849,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
rootLogger
|
rootLogger
|
||||||
.log(Level.SEVERE, "FAILURE RPC submitQuery ");
|
.log(Level.SEVERE, "FAILURE RPC submitQuery ");
|
||||||
|
|
||||||
if(caught instanceof SessionExpiredException){
|
if (caught instanceof SessionExpiredException) {
|
||||||
rootLogger.log(Level.INFO, "Session expired");
|
rootLogger.log(Level.INFO, "Session expired");
|
||||||
CheckSession.showLogoutDialog();
|
CheckSession.showLogoutDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listener<MessageBoxEvent> l = new
|
// Listener<MessageBoxEvent> l = new
|
||||||
// Listener<MessageBoxEvent>() {
|
// Listener<MessageBoxEvent>() {
|
||||||
// public void handleEvent(MessageBoxEvent ce) {
|
// public void handleEvent(MessageBoxEvent ce) {
|
||||||
|
@ -909,6 +910,9 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
form.getButtonById(Dialog.OK).enable();
|
form.getButtonById(Dialog.OK).enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if listAttributes is null the computation has
|
||||||
|
// been removed from the statisticalManager.In this
|
||||||
|
// case no message is displayed.
|
||||||
if (listAttributes == null) {
|
if (listAttributes == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -922,14 +926,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
+ "The query returned 0 values", null);
|
+ "The query returned 0 values", null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String query = "";
|
String query = "";
|
||||||
|
|
||||||
if (dataQuery.getSmartCorrection()==false){
|
if (dataQuery.getSmartCorrection() == false) {
|
||||||
query = dataQuery.getQuery();
|
query = dataQuery.getQuery();
|
||||||
}else{
|
} else {
|
||||||
query = obj.getConvertedQuery();
|
query = obj.getConvertedQuery();
|
||||||
}
|
}
|
||||||
// if ((listAttributes == null)
|
// if ((listAttributes == null)
|
||||||
// || (listAttributes.size() == 0)) {
|
// || (listAttributes.size() == 0)) {
|
||||||
//
|
//
|
||||||
|
@ -989,7 +993,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
|
|
||||||
// start the parsing of the submit result in order to obtain a table
|
// start the parsing of the submit result in order to obtain a table
|
||||||
private void parseSubmitQueryResult(Dialog dialog, final int dialogID,
|
private void parseSubmitQueryResult(Dialog dialog, final int dialogID,
|
||||||
final List<String> listAttributes, String query, String fileName, final String UID) {
|
final List<String> listAttributes, String query, String fileName,
|
||||||
|
final String UID) {
|
||||||
|
|
||||||
final Dialog form = dialog;
|
final Dialog form = dialog;
|
||||||
// define the proxy and create the grid to display in the dialog
|
// define the proxy and create the grid to display in the dialog
|
||||||
|
@ -1009,12 +1014,13 @@ 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");
|
||||||
|
|
||||||
if(caught instanceof SessionExpiredException){
|
if (caught instanceof SessionExpiredException) {
|
||||||
rootLogger.log(Level.INFO, "Session expired");
|
rootLogger.log(Level.INFO,
|
||||||
|
"Session expired");
|
||||||
CheckSession.showLogoutDialog();
|
CheckSession.showLogoutDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
|
Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
|
||||||
public void handleEvent(MessageBoxEvent ce) {
|
public void handleEvent(MessageBoxEvent ce) {
|
||||||
|
@ -1151,7 +1157,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// submitResult.setLayout(new FitLayout());
|
// submitResult.setLayout(new FitLayout());
|
||||||
submitResult.setHeading("Result Query " + dialogID);
|
submitResult.setHeading("Result Query " + dialogID);
|
||||||
submitResult.setResizable(false);
|
submitResult.setResizable(false);
|
||||||
submitResult.setSize(600, 400);
|
submitResult.setSize(600, 400);
|
||||||
|
@ -1159,23 +1165,24 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
submitResult.setHideOnButtonClick(true);
|
submitResult.setHideOnButtonClick(true);
|
||||||
submitResult.setMaximizable(true);
|
submitResult.setMaximizable(true);
|
||||||
submitResult.setMinimizable(true);
|
submitResult.setMinimizable(true);
|
||||||
// submitResult.setBottomComponent(toolBar);
|
// submitResult.setBottomComponent(toolBar);
|
||||||
|
|
||||||
submitResult.setLayout(new RowLayout(Style.Orientation.VERTICAL));
|
submitResult.setLayout(new RowLayout(Style.Orientation.VERTICAL));
|
||||||
//to add the panel of the converted query and the panel that display the query's result
|
// to add the panel of the converted query and the panel that display
|
||||||
ContentPanel q= new ContentPanel();
|
// the query's result
|
||||||
|
ContentPanel q = new ContentPanel();
|
||||||
q.setLayout(new FitLayout());
|
q.setLayout(new FitLayout());
|
||||||
q.setHeaderVisible(false);
|
q.setHeaderVisible(false);
|
||||||
q.addText(query);
|
q.addText(query);
|
||||||
submitResult.add(q, new RowData(1, 0.3));
|
submitResult.add(q, new RowData(1, 0.3));
|
||||||
|
|
||||||
ContentPanel g = new ContentPanel();
|
ContentPanel g = new ContentPanel();
|
||||||
g.setLayout(new FitLayout());
|
g.setLayout(new FitLayout());
|
||||||
g.setHeaderVisible(false);
|
g.setHeaderVisible(false);
|
||||||
g.setBottomComponent(toolBar);
|
g.setBottomComponent(toolBar);
|
||||||
g.add(grid);
|
g.add(grid);
|
||||||
g.layout(true);
|
g.layout(true);
|
||||||
|
|
||||||
// mimimize event handled
|
// mimimize event handled
|
||||||
submitResult.addListener(Events.Minimize, new Listener<WindowEvent>() {
|
submitResult.addListener(Events.Minimize, new Listener<WindowEvent>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1204,12 +1211,12 @@ 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 refreshDataOnServer");
|
"FAILURE RPC refreshDataOnServer");
|
||||||
|
|
||||||
if(caught instanceof SessionExpiredException){
|
if (caught instanceof SessionExpiredException) {
|
||||||
rootLogger.log(Level.INFO, "Session expired");
|
rootLogger.log(Level.INFO, "Session expired");
|
||||||
CheckSession.showLogoutDialog();
|
CheckSession.showLogoutDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1233,8 +1240,8 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
submitResult.addButton(download);
|
submitResult.addButton(download);
|
||||||
// submitResult.add(grid);
|
// submitResult.add(grid);
|
||||||
submitResult.add(g,new RowData(1, 0.7));
|
submitResult.add(g, new RowData(1, 0.7));
|
||||||
submitResult.show();
|
submitResult.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1256,7 +1263,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
FileModel resource;
|
FileModel resource;
|
||||||
|
|
||||||
String elementType;
|
String elementType;
|
||||||
|
|
||||||
if (selectedItem.isDatabase()) {
|
if (selectedItem.isDatabase()) {
|
||||||
// the table has not a schema because the selected item is a
|
// the table has not a schema because the selected item is a
|
||||||
// database
|
// database
|
||||||
|
@ -1272,7 +1279,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||||
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
||||||
|
|
||||||
elementType = ConstantsPortlet.DATABASE;
|
elementType = ConstantsPortlet.DATABASE;
|
||||||
} else {
|
} else {
|
||||||
// the table has a schema because the selected item is a schema
|
// the table has a schema because the selected item is a schema
|
||||||
|
@ -1289,7 +1296,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||||
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
||||||
|
|
||||||
elementType = ConstantsPortlet.SCHEMA;
|
elementType = ConstantsPortlet.SCHEMA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1303,13 +1310,13 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
// Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
rootLogger.log(Level.SEVERE, "FAILURE RPC sample");
|
rootLogger.log(Level.SEVERE, "FAILURE RPC sample");
|
||||||
|
|
||||||
if(caught instanceof SessionExpiredException){
|
if (caught instanceof SessionExpiredException) {
|
||||||
rootLogger.log(Level.INFO, "Session expired");
|
rootLogger.log(Level.INFO, "Session expired");
|
||||||
CheckSession.showLogoutDialog();
|
CheckSession.showLogoutDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (caught.getMessage()
|
if (caught.getMessage()
|
||||||
.contains("Result not available")) {
|
.contains("Result not available")) {
|
||||||
MessageBox.alert("Warning ", "<br/>Message:"
|
MessageBox.alert("Warning ", "<br/>Message:"
|
||||||
|
@ -1324,12 +1331,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(SamplingResultWithFileFromServlet samplingResult) {
|
public void onSuccess(
|
||||||
|
SamplingResultWithFileFromServlet samplingResult) {
|
||||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC sample");
|
rootLogger.log(Level.SEVERE, "SUCCESS RPC sample");
|
||||||
|
|
||||||
if (samplingResult != null) {
|
if (samplingResult != null) {
|
||||||
// get data
|
// get data
|
||||||
List<Result> result = samplingResult.getListOutput();
|
List<Result> result = samplingResult
|
||||||
|
.getListOutput();
|
||||||
// get the attributes list for the result
|
// get the attributes list for the result
|
||||||
// table
|
// table
|
||||||
List<String> listAttributes = new ArrayList<String>();
|
List<String> listAttributes = new ArrayList<String>();
|
||||||
|
@ -1347,14 +1356,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// table
|
// table
|
||||||
parseResult(result, listAttributes, fileName);
|
parseResult(result, listAttributes, fileName);
|
||||||
|
|
||||||
} else{
|
} else {
|
||||||
MessageBox.alert("Error ",
|
MessageBox.alert("Error ", "<br/>Message: "
|
||||||
"<br/>Message: " + "no data available", null);
|
+ "no data available", null);
|
||||||
|
|
||||||
if (obj.isMasked()) {
|
if (obj.isMasked()) {
|
||||||
obj.unmask();
|
obj.unmask();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1411,9 +1420,9 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
FileModel schema;
|
FileModel schema;
|
||||||
FileModel database;
|
FileModel database;
|
||||||
FileModel resource;
|
FileModel resource;
|
||||||
|
|
||||||
String elementType;
|
String elementType;
|
||||||
|
|
||||||
if (selectedItem.isDatabase()) {
|
if (selectedItem.isDatabase()) {
|
||||||
// the table has not a schema
|
// the table has not a schema
|
||||||
database = selectedItem;
|
database = selectedItem;
|
||||||
|
@ -1428,7 +1437,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
rootLogger.log(Level.INFO, "SchemaName: " + "");
|
||||||
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
||||||
elementType=ConstantsPortlet.DATABASE;
|
elementType = ConstantsPortlet.DATABASE;
|
||||||
} else {
|
} else {
|
||||||
// the table has a schema
|
// the table has a schema
|
||||||
schema = selectedItem;
|
schema = selectedItem;
|
||||||
|
@ -1444,7 +1453,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
|
||||||
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
|
||||||
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
|
||||||
elementType=ConstantsPortlet.SCHEMA;
|
elementType = ConstantsPortlet.SCHEMA;
|
||||||
}
|
}
|
||||||
// to mask the entire content panel
|
// to mask the entire content panel
|
||||||
obj.mask("Sampling the table", "x-mask-loading");
|
obj.mask("Sampling the table", "x-mask-loading");
|
||||||
|
@ -1456,12 +1465,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
// Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
rootLogger.log(Level.SEVERE, "FAILURE RPC smartSample");
|
rootLogger.log(Level.SEVERE, "FAILURE RPC smartSample");
|
||||||
|
|
||||||
if(caught instanceof SessionExpiredException){
|
if (caught instanceof SessionExpiredException) {
|
||||||
rootLogger.log(Level.INFO, "Session expired");
|
rootLogger.log(Level.INFO, "Session expired");
|
||||||
CheckSession.showLogoutDialog();
|
CheckSession.showLogoutDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (caught.getMessage()
|
if (caught.getMessage()
|
||||||
.contains("The table has 0 rows")) {
|
.contains("The table has 0 rows")) {
|
||||||
MessageBox.alert("Warning ", "<br/>Message:"
|
MessageBox.alert("Warning ", "<br/>Message:"
|
||||||
|
@ -1476,12 +1485,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(SamplingResultWithFileFromServlet samplingResult) {
|
public void onSuccess(
|
||||||
|
SamplingResultWithFileFromServlet samplingResult) {
|
||||||
rootLogger.log(Level.SEVERE, "SUCCESS RPC smartSample");
|
rootLogger.log(Level.SEVERE, "SUCCESS RPC smartSample");
|
||||||
|
|
||||||
if (samplingResult != null) {
|
if (samplingResult != null) {
|
||||||
// get data
|
// get data
|
||||||
List<Result> result = samplingResult.getListOutput();
|
List<Result> result = samplingResult
|
||||||
|
.getListOutput();
|
||||||
// get the attributes list for the result
|
// get the attributes list for the result
|
||||||
// table
|
// table
|
||||||
List<String> listAttributes = new ArrayList<String>();
|
List<String> listAttributes = new ArrayList<String>();
|
||||||
|
@ -1497,14 +1508,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// parse the result in order to obtain a
|
// parse the result in order to obtain a
|
||||||
// table
|
// table
|
||||||
parseResult(result, listAttributes, fileName);
|
parseResult(result, listAttributes, fileName);
|
||||||
}else{
|
} else {
|
||||||
MessageBox.alert("Error ",
|
MessageBox.alert("Error ", "<br/>Message: "
|
||||||
"<br/>Message: " + "no data available", null);
|
+ "no data available", null);
|
||||||
|
|
||||||
if (obj.isMasked()) {
|
if (obj.isMasked()) {
|
||||||
obj.unmask();
|
obj.unmask();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1528,7 +1539,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
FileModel resource;
|
FileModel resource;
|
||||||
|
|
||||||
String elementType;
|
String elementType;
|
||||||
|
|
||||||
if (selectedItem.isDatabase()) {
|
if (selectedItem.isDatabase()) {
|
||||||
// the table has not a schema
|
// the table has not a schema
|
||||||
database = selectedItem;
|
database = selectedItem;
|
||||||
|
@ -1573,13 +1584,13 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
rootLogger
|
rootLogger
|
||||||
.log(Level.SEVERE, "FAILURE RPC randomSample");
|
.log(Level.SEVERE, "FAILURE RPC randomSample");
|
||||||
|
|
||||||
if(caught instanceof SessionExpiredException){
|
if (caught instanceof SessionExpiredException) {
|
||||||
rootLogger.log(Level.INFO, "Session expired");
|
rootLogger.log(Level.INFO, "Session expired");
|
||||||
CheckSession.showLogoutDialog();
|
CheckSession.showLogoutDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (caught.getMessage()
|
if (caught.getMessage()
|
||||||
.contains("Result not available")) {
|
.contains("Result not available")) {
|
||||||
MessageBox.alert("Warning ", "<br/>Message:"
|
MessageBox.alert("Warning ", "<br/>Message:"
|
||||||
|
@ -1594,13 +1605,15 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(SamplingResultWithFileFromServlet samplingResult) {
|
public void onSuccess(
|
||||||
|
SamplingResultWithFileFromServlet samplingResult) {
|
||||||
rootLogger
|
rootLogger
|
||||||
.log(Level.SEVERE, "SUCCESS RPC randomSample");
|
.log(Level.SEVERE, "SUCCESS RPC randomSample");
|
||||||
|
|
||||||
if (samplingResult != null) {
|
if (samplingResult != null) {
|
||||||
// get data
|
// get data
|
||||||
List<Result> result = samplingResult.getListOutput();
|
List<Result> result = samplingResult
|
||||||
|
.getListOutput();
|
||||||
// get the attributes list for the result
|
// get the attributes list for the result
|
||||||
// table
|
// table
|
||||||
List<String> listAttributes = new ArrayList<String>();
|
List<String> listAttributes = new ArrayList<String>();
|
||||||
|
@ -1616,14 +1629,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
// parse the result in order to obtain a
|
// parse the result in order to obtain a
|
||||||
// table
|
// table
|
||||||
parseResult(result, listAttributes, fileName);
|
parseResult(result, listAttributes, fileName);
|
||||||
} else{
|
} else {
|
||||||
MessageBox.alert("Error ",
|
MessageBox.alert("Error ", "<br/>Message: "
|
||||||
"<br/>Message: " + "no data available", null);
|
+ "no data available", null);
|
||||||
|
|
||||||
if (obj.isMasked()) {
|
if (obj.isMasked()) {
|
||||||
obj.unmask();
|
obj.unmask();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1642,13 +1655,13 @@ public class GxtBorderLayoutPanel extends ContentPanel {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
// Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
rootLogger.log(Level.SEVERE, "FAILURE RPC parseResult");
|
rootLogger.log(Level.SEVERE, "FAILURE RPC parseResult");
|
||||||
|
|
||||||
if(caught instanceof SessionExpiredException){
|
if (caught instanceof SessionExpiredException) {
|
||||||
rootLogger.log(Level.INFO, "Session expired");
|
rootLogger.log(Level.INFO, "Session expired");
|
||||||
CheckSession.showLogoutDialog();
|
CheckSession.showLogoutDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox.alert("Error ",
|
MessageBox.alert("Error ",
|
||||||
"<br/>Message:" + caught.getMessage(), null);
|
"<br/>Message:" + caught.getMessage(), null);
|
||||||
|
|
||||||
|
@ -1999,13 +2012,13 @@ 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 getTableDetails");
|
"FAILURE RPC getTableDetails");
|
||||||
|
|
||||||
if(caught instanceof SessionExpiredException){
|
if (caught instanceof SessionExpiredException) {
|
||||||
rootLogger.log(Level.INFO, "Session expired");
|
rootLogger.log(Level.INFO, "Session expired");
|
||||||
CheckSession.showLogoutDialog();
|
CheckSession.showLogoutDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox.alert("Error ",
|
MessageBox.alert("Error ",
|
||||||
"<br/>Message:" + caught.getMessage(), null);
|
"<br/>Message:" + caught.getMessage(), null);
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ public class GxtToolbarFunctionality {
|
||||||
FileModel tableInfo = selectedTableEvent.getTableInfo();
|
FileModel tableInfo = selectedTableEvent.getTableInfo();
|
||||||
setInfoOnSelectedTable(tableName, tableInfo);
|
setInfoOnSelectedTable(tableName, tableInfo);
|
||||||
isTableSelected = true;
|
isTableSelected = true;
|
||||||
// rootLogger.info("table clicked: " + isTableSelected);
|
// rootLogger.info("table clicked: " + isTableSelected);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ public class GxtToolbarFunctionality {
|
||||||
SelectedItemEvent selectedItemEvent) {
|
SelectedItemEvent selectedItemEvent) {
|
||||||
|
|
||||||
isTableSelected = false;
|
isTableSelected = false;
|
||||||
// rootLogger.info("item clicked: " + isTableSelected);
|
// rootLogger.info("item clicked: " + isTableSelected);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,6 +334,10 @@ public class GxtToolbarFunctionality {
|
||||||
"computation removed with uid: "
|
"computation removed with uid: "
|
||||||
+ uidSubmitQueryList
|
+ uidSubmitQueryList
|
||||||
.get(dialogID));
|
.get(dialogID));
|
||||||
|
} else {
|
||||||
|
rootLogger
|
||||||
|
.log(Level.INFO,
|
||||||
|
"computation can not be removed because it is already finished");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,13 +347,16 @@ public class GxtToolbarFunctionality {
|
||||||
rootLogger
|
rootLogger
|
||||||
.log(Level.SEVERE,
|
.log(Level.SEVERE,
|
||||||
"FAILURE RPC removeComputation");
|
"FAILURE RPC removeComputation");
|
||||||
|
|
||||||
if(caught instanceof SessionExpiredException){
|
if (caught instanceof SessionExpiredException) {
|
||||||
rootLogger.log(Level.INFO, "Session expired");
|
rootLogger
|
||||||
CheckSession.showLogoutDialog();
|
.log(Level.INFO,
|
||||||
|
"Session expired");
|
||||||
|
CheckSession
|
||||||
|
.showLogoutDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -535,13 +542,12 @@ public class GxtToolbarFunctionality {
|
||||||
// data = form.getSubmitQueryData();
|
// data = form.getSubmitQueryData();
|
||||||
|
|
||||||
String query = data.getQuery();
|
String query = data.getQuery();
|
||||||
|
|
||||||
Listener<MessageBoxEvent> l = new
|
Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() {
|
||||||
Listener<MessageBoxEvent>() {
|
public void handleEvent(MessageBoxEvent ce) {
|
||||||
public void handleEvent(MessageBoxEvent ce) {
|
SubmtQueryDialog.getButtonById(Dialog.OK).enable();
|
||||||
SubmtQueryDialog.getButtonById(Dialog.OK).enable();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((query == null) || (query.equals(""))) {
|
if ((query == null) || (query.equals(""))) {
|
||||||
MessageBox.alert("Warning", "Query field null", l);
|
MessageBox.alert("Warning", "Query field null", l);
|
||||||
|
@ -601,7 +607,7 @@ public class GxtToolbarFunctionality {
|
||||||
// query = String.format(queryForSubmitOperation, tableName);
|
// query = String.format(queryForSubmitOperation, tableName);
|
||||||
query = "select * from " + tableName + " limit 10";
|
query = "select * from " + tableName + " limit 10";
|
||||||
|
|
||||||
// System.out.println("query mysql: " + query);
|
// System.out.println("query mysql: " + query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tableInfo.isSchema()) { // database postgres
|
if (tableInfo.isSchema()) { // database postgres
|
||||||
|
@ -610,7 +616,7 @@ public class GxtToolbarFunctionality {
|
||||||
String tableName = schemaName + "." + "\"" + selectedTable + "\"";
|
String tableName = schemaName + "." + "\"" + selectedTable + "\"";
|
||||||
// query = String.format(queryForSubmitOperation, tableName);
|
// query = String.format(queryForSubmitOperation, tableName);
|
||||||
query = "select * from " + tableName + " limit 10";
|
query = "select * from " + tableName + " limit 10";
|
||||||
// System.out.println("query postgres: " + query);
|
// System.out.println("query postgres: " + query);
|
||||||
}
|
}
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
|
|
|
@ -5,13 +5,10 @@ import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.net.URLStreamHandler;
|
import java.net.URLStreamHandler;
|
||||||
|
@ -21,11 +18,8 @@ import java.io.FileOutputStream;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import net.didion.jwnl.data.Exc;
|
|
||||||
import net.sf.ehcache.Cache;
|
import net.sf.ehcache.Cache;
|
||||||
import net.sf.ehcache.CacheManager;
|
import net.sf.ehcache.CacheManager;
|
||||||
import net.sf.ehcache.Ehcache;
|
|
||||||
import net.sf.ehcache.config.CacheConfiguration;
|
import net.sf.ehcache.config.CacheConfiguration;
|
||||||
import net.sf.ehcache.config.MemoryUnit;
|
import net.sf.ehcache.config.MemoryUnit;
|
||||||
import net.sf.ehcache.store.MemoryStoreEvictionPolicy;
|
import net.sf.ehcache.store.MemoryStoreEvictionPolicy;
|
||||||
|
@ -70,7 +64,6 @@ import org.gcube.portlets.user.databasesmanager.client.utils.ConstantsPortlet;
|
||||||
import org.gcube.portlets.user.databasesmanager.server.util.SessionUtil;
|
import org.gcube.portlets.user.databasesmanager.server.util.SessionUtil;
|
||||||
import org.gcube.portlets.user.databasesmanager.shared.SessionExpiredException;
|
import org.gcube.portlets.user.databasesmanager.shared.SessionExpiredException;
|
||||||
import org.gcube.portlets.user.databasesmanager.shared.StatisticalManagerException;
|
import org.gcube.portlets.user.databasesmanager.shared.StatisticalManagerException;
|
||||||
|
|
||||||
import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
|
import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
|
||||||
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
|
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
|
||||||
import com.extjs.gxt.ui.client.data.PagingLoadResult;
|
import com.extjs.gxt.ui.client.data.PagingLoadResult;
|
||||||
|
@ -244,14 +237,17 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// List<Result> result = new ArrayList<Result>();
|
// List<Result> result = new ArrayList<Result>();
|
||||||
// session.setAttribute("TablesResult", result);
|
// session.setAttribute("TablesResult", result);
|
||||||
|
|
||||||
// map that contains the submit query result and the related uid
|
// // map that contains the submit query result and the related uid
|
||||||
HashMap<String, List<Result>> submitQueryResult = new HashMap<String, List<Result>>();
|
// HashMap<String, List<Result>> submitQueryResult = new HashMap<String,
|
||||||
session.setAttribute("submitQueryResult", submitQueryResult);
|
// List<Result>>();
|
||||||
|
// session.setAttribute("submitQueryResult", submitQueryResult);
|
||||||
|
|
||||||
// map that contains the submit query result parsed and the related
|
// // map that contains the submit query result parsed and the related
|
||||||
// uid
|
// // uid
|
||||||
HashMap<String, List<Row>> submitQueryResultParsed = new HashMap<String, List<Row>>();
|
// HashMap<String, List<Row>> submitQueryResultParsed = new
|
||||||
session.setAttribute("submitQueryResultParsed", submitQueryResultParsed);
|
// HashMap<String, List<Row>>();
|
||||||
|
// session.setAttribute("submitQueryResultParsed",
|
||||||
|
// submitQueryResultParsed);
|
||||||
|
|
||||||
// information about a database
|
// information about a database
|
||||||
// String currentDB = "";
|
// String currentDB = "";
|
||||||
|
@ -272,6 +268,27 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// Hashmap that contains the job status with a uid key
|
// Hashmap that contains the job status with a uid key
|
||||||
HashMap<String, String> JobStatusMap = new HashMap<String, String>();
|
HashMap<String, String> JobStatusMap = new HashMap<String, String>();
|
||||||
session.setAttribute("JobStatusList", JobStatusMap);
|
session.setAttribute("JobStatusList", JobStatusMap);
|
||||||
|
|
||||||
|
// map that keeps track if a uid submitQuery request uses cached data
|
||||||
|
// and it does not start a computation
|
||||||
|
HashMap<String, Boolean> listSubmitQueryUIDCachedData = new HashMap<String, Boolean>();
|
||||||
|
session.setAttribute("listSubmitQueryUIDCachedData",
|
||||||
|
listSubmitQueryUIDCachedData);
|
||||||
|
|
||||||
|
// maps that contain key to retrieve data from cache for each uid
|
||||||
|
// submitQuery request
|
||||||
|
// map that stores information to send result of the rpc loadsubmitQuery
|
||||||
|
// to the client
|
||||||
|
HashMap<String, String> listKeySubmitQueryResult = new HashMap<String, String>();
|
||||||
|
session.setAttribute("listKeySubmitQueryResult",
|
||||||
|
listKeySubmitQueryResult);
|
||||||
|
|
||||||
|
// TODO DA CANCELLARE
|
||||||
|
// // map that stores information to send result of the rpc submitQuery
|
||||||
|
// to
|
||||||
|
// // the client
|
||||||
|
// HashMap<String, String> listKeyData = new HashMap<String, String>();
|
||||||
|
// session.setAttribute("listKeyData", listKeyData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// to get resources from IS
|
// to get resources from IS
|
||||||
|
@ -907,7 +924,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// data output
|
// data output
|
||||||
// List<Result> output = new ArrayList<Result>();
|
// List<Result> output = new ArrayList<Result>();
|
||||||
List<Result> output = null;
|
List<Result> output = null;
|
||||||
|
SubmitQueryResultWithFileFromServlet result = null;
|
||||||
|
|
||||||
// list that contains table attributes
|
// list that contains table attributes
|
||||||
List<String> listAttributes = null;
|
List<String> listAttributes = null;
|
||||||
|
@ -964,78 +981,172 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
inputParameters.get(4).setValue(language);
|
inputParameters.get(4).setValue(language);
|
||||||
inputParameters.get(5).setValue(query);
|
inputParameters.get(5).setValue(query);
|
||||||
|
|
||||||
|
// get data from cache
|
||||||
// create data structure
|
// check if data exist considering as key the input parameters
|
||||||
ComputationOutput outputData = new ComputationOutput();
|
|
||||||
|
|
||||||
// computation id
|
// parse the query in order to remove spaces
|
||||||
String computationId = startComputation(algorithmId,
|
String queryParsed = parseQuery(inputParameters.get(5).getValue());
|
||||||
inputParameters, outputData, UID);
|
// get data sent to client calling the submitQuery
|
||||||
|
String keyData = inputParameters.get(0).getValue()
|
||||||
|
+ inputParameters.get(1).getValue()
|
||||||
|
+ inputParameters.get(2).getValue()
|
||||||
|
+ inputParameters.get(3).getValue()
|
||||||
|
+ inputParameters.get(4).getValue() + queryParsed;
|
||||||
|
|
||||||
// get JobID
|
// System.out.println("KEY:" + keyData);
|
||||||
if (checkJob(UID)) {
|
// System.out.println("UID:" + UID);
|
||||||
// computationIDMap.put(id, computationId);
|
// store key
|
||||||
|
// updateListKeyData(UID, keyData);
|
||||||
|
net.sf.ehcache.Element dataFromCache = getDataFromCache(keyData);
|
||||||
|
|
||||||
// print check on retrieving data
|
// key to get query result sent to client calling loadSubmitResult
|
||||||
// logger.info("output data retrieved");
|
String keySubmitQueryResult = keyData + "_SubmitQueryResult";
|
||||||
|
updateListKeySubmitQueryResult(UID, keySubmitQueryResult);
|
||||||
|
net.sf.ehcache.Element submitQueryResultFromCache = getDataFromCache(keySubmitQueryResult);
|
||||||
|
|
||||||
// data output values
|
Object data = null;
|
||||||
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
|
Object submitQueryResult = null;
|
||||||
// data output keys
|
|
||||||
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
|
|
||||||
|
|
||||||
mapValues = outputData.getMapValues();
|
if ((dataFromCache != null) && (submitQueryResultFromCache != null)) {
|
||||||
mapKeys = outputData.getmapKeys();
|
data = dataFromCache.getObjectValue();
|
||||||
|
submitQueryResult = submitQueryResultFromCache.getObjectValue();
|
||||||
|
// System.out.println("***GETTING DATA FROM CACHE");
|
||||||
|
}
|
||||||
|
if ((data != null) && (submitQueryResult != null)) {
|
||||||
|
result = (SubmitQueryResultWithFileFromServlet) data;
|
||||||
|
|
||||||
if (mapValues.size() != 0) {
|
// set variable to true value if cached data are used and a
|
||||||
output = new ArrayList<Result>();
|
// computation is not started
|
||||||
|
Boolean val = new Boolean(true);
|
||||||
|
updateListSubmitQueryUIDCachedData(UID, val);
|
||||||
|
|
||||||
// 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 converted query
|
|
||||||
|
|
||||||
if (smartCorrectionQuery == true) {
|
|
||||||
convertedQuery = output.get(0).getValue();
|
|
||||||
output.remove(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
listAttributes = null;
|
|
||||||
|
// set variable to false value if cached data are not used and a
|
||||||
|
// computation is started
|
||||||
|
Boolean val = new Boolean(false);
|
||||||
|
updateListSubmitQueryUIDCachedData(UID, val);
|
||||||
|
|
||||||
|
// create data structure
|
||||||
|
ComputationOutput outputData = new ComputationOutput();
|
||||||
|
|
||||||
|
// computation id
|
||||||
|
String computationId = startComputation(algorithmId,
|
||||||
|
inputParameters, outputData, UID);
|
||||||
|
|
||||||
|
// get JobID
|
||||||
|
if (checkJob(UID)) { // if the computation has not been removed
|
||||||
|
// the job uid is present
|
||||||
|
// computationIDMap.put(id, computationId);
|
||||||
|
|
||||||
|
// print check on retrieving data
|
||||||
|
logger.info("output data retrieved");
|
||||||
|
|
||||||
|
// data output values
|
||||||
|
LinkedHashMap<String, String> mapValues = new LinkedHashMap<String, String>();
|
||||||
|
// data output keys
|
||||||
|
LinkedHashMap<String, String> mapKeys = new LinkedHashMap<String, String>();
|
||||||
|
|
||||||
|
mapValues = outputData.getMapValues();
|
||||||
|
mapKeys = outputData.getmapKeys();
|
||||||
|
|
||||||
|
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 converted query
|
||||||
|
|
||||||
|
if (smartCorrectionQuery == true) {
|
||||||
|
convertedQuery = output.get(0).getValue();
|
||||||
|
output.remove(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the attributes list for the result table
|
||||||
|
listAttributes = new ArrayList<String>();
|
||||||
|
listAttributes = getListAttributes(output.get(0)
|
||||||
|
.getValue());
|
||||||
|
|
||||||
|
if (listAttributes == null) {
|
||||||
|
logger.error("dbmanager-> Error in server while loading data. variable listAttributes null");
|
||||||
|
throw new Exception(
|
||||||
|
"Error in server while loading data.");
|
||||||
|
}
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
// generate the file csv output
|
||||||
|
String name = "SubmitQuery";
|
||||||
|
String fileName = storeResultIntoCSVFile(output, name);
|
||||||
|
// get the web application path
|
||||||
|
HttpServletRequest request = this
|
||||||
|
.getThreadLocalRequest();
|
||||||
|
String applicationPath = request.getContextPath();
|
||||||
|
// logger.info("dbmanager-> Application Path: " +
|
||||||
|
// applicationPath);
|
||||||
|
String partialPathFile = applicationPath
|
||||||
|
+ "/computationResult/" + fileName;
|
||||||
|
|
||||||
|
result = new SubmitQueryResultWithFileFromServlet(
|
||||||
|
listAttributes, convertedQuery, partialPathFile);
|
||||||
|
|
||||||
|
// put the two data in cache
|
||||||
|
net.sf.ehcache.Element dataToCache = new net.sf.ehcache.Element(
|
||||||
|
keyData, result);
|
||||||
|
insertDataIntoCache(dataToCache);
|
||||||
|
|
||||||
|
net.sf.ehcache.Element submitQueryResultToCache = new net.sf.ehcache.Element(
|
||||||
|
keySubmitQueryResult, output);
|
||||||
|
insertDataIntoCache(submitQueryResultToCache);
|
||||||
|
|
||||||
|
}
|
||||||
|
} else { // if the computation has been removed the job uid is
|
||||||
|
// not present and listAttributes is null.
|
||||||
|
listAttributes = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// // generate the file csv output
|
||||||
|
// String name = "SubmitQuery";
|
||||||
|
// String fileName = storeResultIntoCSVFile(output, name);
|
||||||
|
// // get the web application path
|
||||||
|
// HttpServletRequest request = this.getThreadLocalRequest();
|
||||||
|
// String applicationPath = request.getContextPath();
|
||||||
|
// // logger.info("dbmanager-> Application Path: " +
|
||||||
|
// // applicationPath);
|
||||||
|
// String partialPathFile = applicationPath
|
||||||
|
// + "/computationResult/" + fileName;
|
||||||
|
//
|
||||||
|
// result = new SubmitQueryResultWithFileFromServlet(
|
||||||
|
// listAttributes, convertedQuery, partialPathFile);
|
||||||
|
//
|
||||||
|
// // put teh two data in cache
|
||||||
|
// net.sf.ehcache.Element dataToCache = new
|
||||||
|
// net.sf.ehcache.Element(
|
||||||
|
// keyData, result);
|
||||||
|
// insertDataIntoCache(dataToCache);
|
||||||
|
//
|
||||||
|
// net.sf.ehcache.Element submitQueryResultToCache = new
|
||||||
|
// net.sf.ehcache.Element(
|
||||||
|
// keySubmitQueryResult, output);
|
||||||
|
// insertDataIntoCache(submitQueryResultToCache);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate the file csv output
|
|
||||||
String name = "SubmitQuery";
|
|
||||||
String fileName = storeResultIntoCSVFile(output, name);
|
|
||||||
// get the web application path
|
|
||||||
HttpServletRequest request = this.getThreadLocalRequest();
|
|
||||||
String applicationPath = request.getContextPath();
|
|
||||||
// logger.info("dbmanager-> Application Path: " + applicationPath);
|
|
||||||
String partialPathFile = applicationPath + "/computationResult/"
|
|
||||||
+ fileName;
|
|
||||||
|
|
||||||
SubmitQueryResultWithFileFromServlet result = new SubmitQueryResultWithFileFromServlet(
|
|
||||||
listAttributes, convertedQuery, partialPathFile);
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1056,6 +1167,14 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
|
} finally {
|
||||||
|
// remove the element related to the uid submitQuery request if
|
||||||
|
// present
|
||||||
|
removeSubmitQueryUIDCachedData(UID);
|
||||||
|
// remove jobStatus
|
||||||
|
removeJobStatus(UID);
|
||||||
|
// remove job
|
||||||
|
removeJob(UID);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1566,44 +1685,97 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
throw new SessionExpiredException();
|
throw new SessionExpiredException();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 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
|
|
||||||
data = getSubmitQueryResultParsed(UID);
|
|
||||||
|
|
||||||
if ((data == null)) {
|
|
||||||
// parse the submit query result
|
|
||||||
result = getSubmitQueryResult(UID);
|
|
||||||
|
|
||||||
if ((result != null) && (result.size() != 0)) {
|
|
||||||
data = parseCVSString(result, listAttributes);
|
|
||||||
updateSubmitQueryResultParsed(UID, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a sublist and add data to list according
|
// Create a sublist and add data to list according
|
||||||
// to the limit and offset value of the config
|
// to the limit and offset value of the config
|
||||||
List<Row> sublist = new ArrayList<Row>();
|
List<Row> sublist = new ArrayList<Row>();
|
||||||
BasePagingLoadResult loadResult = null;
|
BasePagingLoadResult loadResult = null;
|
||||||
|
|
||||||
int start = config.getOffset();
|
// data parsed
|
||||||
int limit = data.size();
|
List<Row> data = new ArrayList<Row>();
|
||||||
|
// submit query result
|
||||||
|
List<Result> result = new ArrayList<Result>();
|
||||||
|
// get the key to retrieve the submitQuery result
|
||||||
|
String key = getKeySubmitQueryResult(UID);
|
||||||
|
|
||||||
if (config.getLimit() > 0) {
|
if ((key != null) && (!key.equals(""))) {
|
||||||
limit = Math.min(start + config.getLimit(), limit);
|
// load data
|
||||||
|
|
||||||
|
// get data from cache
|
||||||
|
net.sf.ehcache.Element dataFromCache = getDataFromCache(key);
|
||||||
|
Object value = null;
|
||||||
|
if (dataFromCache != null) {
|
||||||
|
value = dataFromCache.getObjectValue();
|
||||||
|
}
|
||||||
|
if (value != null) {
|
||||||
|
result = (List<Result>) value;
|
||||||
|
|
||||||
|
data = parseCVSString(result, listAttributes);
|
||||||
|
|
||||||
|
int start = config.getOffset();
|
||||||
|
int limit = data.size();
|
||||||
|
|
||||||
|
if (config.getLimit() > 0) {
|
||||||
|
limit = Math.min(start + config.getLimit(), limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
int totalNumber = data.size();
|
||||||
|
sublist = new ArrayList<Row>(data.subList(start, limit));
|
||||||
|
loadResult = new BasePagingLoadResult<Row>(sublist,
|
||||||
|
config.getOffset(), totalNumber);
|
||||||
|
|
||||||
|
// System.out.println("start: " + start);
|
||||||
|
// System.out.println("limit: " + limit);
|
||||||
|
// System.out.println("sublist size: " + sublist.size());
|
||||||
|
} else {
|
||||||
|
|
||||||
|
logger.error("dbmanager-> Error in server while loading data. variable value null");
|
||||||
|
throw new Exception("Error in server while loading data.");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
logger.error("dbmanager-> Error in server while loading data. key null");
|
||||||
|
throw new Exception("Error in server while loading data.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int totalNumber = data.size();
|
// // System.out.println("Server - loadSubmitResultMethod");
|
||||||
sublist = new ArrayList<Row>(data.subList(start, limit));
|
// // data parsed
|
||||||
loadResult = new BasePagingLoadResult<Row>(sublist,
|
// List<Row> data = new ArrayList<Row>();
|
||||||
config.getOffset(), totalNumber);
|
// // submit query result
|
||||||
|
// List<Result> result = new ArrayList<Result>();
|
||||||
|
// // get parsed data
|
||||||
|
// data = getSubmitQueryResultParsed(UID);
|
||||||
|
//
|
||||||
|
// if ((data == null)) {
|
||||||
|
// // parse the submit query result
|
||||||
|
// result = getSubmitQueryResult(UID);
|
||||||
|
//
|
||||||
|
// if ((result != null) && (result.size() != 0)) {
|
||||||
|
// data = parseCVSString(result, listAttributes);
|
||||||
|
// updateSubmitQueryResultParsed(UID, data);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// System.out.println("start: " + start);
|
// // Create a sublist and add data to list according
|
||||||
// System.out.println("limit: " + limit);
|
// // to the limit and offset value of the config
|
||||||
// System.out.println("sublist size: " + sublist.size());
|
// List<Row> sublist = new ArrayList<Row>();
|
||||||
|
// BasePagingLoadResult loadResult = null;
|
||||||
|
//
|
||||||
|
// int start = config.getOffset();
|
||||||
|
// int limit = data.size();
|
||||||
|
//
|
||||||
|
// if (config.getLimit() > 0) {
|
||||||
|
// limit = Math.min(start + config.getLimit(), limit);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// int totalNumber = data.size();
|
||||||
|
// sublist = new ArrayList<Row>(data.subList(start, limit));
|
||||||
|
// loadResult = new BasePagingLoadResult<Row>(sublist,
|
||||||
|
// config.getOffset(), totalNumber);
|
||||||
|
//
|
||||||
|
// // System.out.println("start: " + start);
|
||||||
|
// // System.out.println("limit: " + limit);
|
||||||
|
// // System.out.println("sublist size: " + sublist.size());
|
||||||
|
|
||||||
return loadResult;
|
return loadResult;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1766,85 +1938,93 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// return params;
|
// return params;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private synchronized List<Result> getSubmitQueryResult(String submitQueryUID) {
|
// private synchronized List<Result> getSubmitQueryResult(String
|
||||||
ASLSession session = SessionUtil.getAslSession(this
|
// submitQueryUID) {
|
||||||
.getThreadLocalRequest().getSession());
|
// ASLSession session = SessionUtil.getAslSession(this
|
||||||
HashMap<String, List<Result>> submitQueryResult = (HashMap<String, List<Result>>) session
|
// .getThreadLocalRequest().getSession());
|
||||||
.getAttribute("submitQueryResult");
|
// HashMap<String, List<Result>> submitQueryResult = (HashMap<String,
|
||||||
if (submitQueryResult.containsKey(submitQueryUID)) {
|
// List<Result>>) session
|
||||||
return submitQueryResult.get(submitQueryUID);
|
// .getAttribute("submitQueryResult");
|
||||||
} else {
|
// if (submitQueryResult.containsKey(submitQueryUID)) {
|
||||||
return null;
|
// return submitQueryResult.get(submitQueryUID);
|
||||||
}
|
// } else {
|
||||||
}
|
// return null;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
private synchronized List<Row> getSubmitQueryResultParsed(
|
// private synchronized List<Row> getSubmitQueryResultParsed(
|
||||||
String submitQueryUID) {
|
// String submitQueryUID) {
|
||||||
ASLSession session = SessionUtil.getAslSession(this
|
// ASLSession session = SessionUtil.getAslSession(this
|
||||||
.getThreadLocalRequest().getSession());
|
// .getThreadLocalRequest().getSession());
|
||||||
HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String, List<Row>>) session
|
// HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String,
|
||||||
.getAttribute("submitQueryResultParsed");
|
// List<Row>>) session
|
||||||
|
// .getAttribute("submitQueryResultParsed");
|
||||||
|
//
|
||||||
|
// if (submitQueryResultParsed.containsKey(submitQueryUID)) {
|
||||||
|
// // System.out.println("ResultParsed: UID contained");
|
||||||
|
// return submitQueryResultParsed.get(submitQueryUID);
|
||||||
|
// } else {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
if (submitQueryResultParsed.containsKey(submitQueryUID)) {
|
// private synchronized void updateSubmitQueryResultParsed(
|
||||||
// System.out.println("ResultParsed: UID contained");
|
// String submitQueryUID, List<Row> data) {
|
||||||
return submitQueryResultParsed.get(submitQueryUID);
|
// ASLSession session = SessionUtil.getAslSession(this
|
||||||
} else {
|
// .getThreadLocalRequest().getSession());
|
||||||
return null;
|
// HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String,
|
||||||
}
|
// List<Row>>) session
|
||||||
}
|
// .getAttribute("submitQueryResultParsed");
|
||||||
|
// // add data
|
||||||
|
// if (data.size() != 0) {
|
||||||
|
// submitQueryResultParsed.put(submitQueryUID, data);
|
||||||
|
// session.setAttribute("submitQueryResultParsed",
|
||||||
|
// submitQueryResultParsed);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
private synchronized void updateSubmitQueryResultParsed(
|
// private synchronized void removeResultParsed(String submitQueryUID) {
|
||||||
String submitQueryUID, List<Row> data) {
|
// ASLSession session = SessionUtil.getAslSession(this
|
||||||
ASLSession session = SessionUtil.getAslSession(this
|
// .getThreadLocalRequest().getSession());
|
||||||
.getThreadLocalRequest().getSession());
|
// HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String,
|
||||||
HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String, List<Row>>) session
|
// List<Row>>) session
|
||||||
.getAttribute("submitQueryResultParsed");
|
// .getAttribute("submitQueryResultParsed");
|
||||||
// add data
|
// if (submitQueryResultParsed.containsKey(submitQueryUID)) {
|
||||||
if (data.size() != 0) {
|
// // remove data parsed
|
||||||
submitQueryResultParsed.put(submitQueryUID, data);
|
// submitQueryResultParsed.remove(submitQueryUID);
|
||||||
session.setAttribute("submitQueryResultParsed",
|
// // update
|
||||||
submitQueryResultParsed);
|
// session.setAttribute("submitQueryResultParsed",
|
||||||
}
|
// submitQueryResultParsed);
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
private synchronized void removeResultParsed(String submitQueryUID) {
|
// private synchronized void updateSubmitQueryResultMap(String
|
||||||
ASLSession session = SessionUtil.getAslSession(this
|
// submitQueryUID,
|
||||||
.getThreadLocalRequest().getSession());
|
// List<Result> result) {
|
||||||
HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String, List<Row>>) session
|
// if (submitQueryUID != null) {
|
||||||
.getAttribute("submitQueryResultParsed");
|
// ASLSession session = SessionUtil.getAslSession(this
|
||||||
if (submitQueryResultParsed.containsKey(submitQueryUID)) {
|
// .getThreadLocalRequest().getSession());
|
||||||
// remove data parsed
|
// HashMap<String, List<Result>> submitQueryResult = (HashMap<String,
|
||||||
submitQueryResultParsed.remove(submitQueryUID);
|
// List<Result>>) session
|
||||||
// update
|
// .getAttribute("submitQueryResult");
|
||||||
session.setAttribute("submitQueryResultParsed",
|
// submitQueryResult.put(submitQueryUID, result);
|
||||||
submitQueryResultParsed);
|
// session.setAttribute("submitQueryResult", submitQueryResult);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
private synchronized void updateSubmitQueryResultMap(String submitQueryUID,
|
// private synchronized void removeResult(String submitQueryUID) {
|
||||||
List<Result> result) {
|
// ASLSession session = SessionUtil.getAslSession(this
|
||||||
if (submitQueryUID != null) {
|
// .getThreadLocalRequest().getSession());
|
||||||
ASLSession session = SessionUtil.getAslSession(this
|
// HashMap<String, List<Result>> submitQueryResult = (HashMap<String,
|
||||||
.getThreadLocalRequest().getSession());
|
// List<Result>>) session
|
||||||
HashMap<String, List<Result>> submitQueryResult = (HashMap<String, List<Result>>) session
|
// .getAttribute("submitQueryResult");
|
||||||
.getAttribute("submitQueryResult");
|
// if (submitQueryResult.containsKey(submitQueryUID)) {
|
||||||
submitQueryResult.put(submitQueryUID, result);
|
// // remove data parsed
|
||||||
session.setAttribute("submitQueryResult", submitQueryResult);
|
// submitQueryResult.remove(submitQueryUID);
|
||||||
}
|
// // update
|
||||||
}
|
// session.setAttribute("submitQueryResult", submitQueryResult);
|
||||||
|
// }
|
||||||
private synchronized void removeResult(String submitQueryUID) {
|
// }
|
||||||
ASLSession session = SessionUtil.getAslSession(this
|
|
||||||
.getThreadLocalRequest().getSession());
|
|
||||||
HashMap<String, List<Result>> submitQueryResult = (HashMap<String, List<Result>>) session
|
|
||||||
.getAttribute("submitQueryResult");
|
|
||||||
if (submitQueryResult.containsKey(submitQueryUID)) {
|
|
||||||
// remove data parsed
|
|
||||||
submitQueryResult.remove(submitQueryUID);
|
|
||||||
// update
|
|
||||||
session.setAttribute("submitQueryResult", submitQueryResult);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// update job with the related status
|
// update job with the related status
|
||||||
private synchronized void updateJobStatus(String jobID, String status) {
|
private synchronized void updateJobStatus(String jobID, String status) {
|
||||||
|
@ -1931,6 +2111,90 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
return isContained;
|
return isContained;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private synchronized void updateListSubmitQueryUIDCachedData(String UID,
|
||||||
|
Boolean value) {
|
||||||
|
ASLSession session = SessionUtil.getAslSession(this
|
||||||
|
.getThreadLocalRequest().getSession());
|
||||||
|
|
||||||
|
HashMap<String, Boolean> listSubmitQueryUIDCachedData = (HashMap<String, Boolean>) session
|
||||||
|
.getAttribute("listSubmitQueryUIDCachedData");
|
||||||
|
listSubmitQueryUIDCachedData.put(UID, value);
|
||||||
|
session.setAttribute("listSubmitQueryUIDCachedData",
|
||||||
|
listSubmitQueryUIDCachedData);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized Boolean checkSubmitQueryUIDCachedData(String UID) {
|
||||||
|
ASLSession session = SessionUtil.getAslSession(this
|
||||||
|
.getThreadLocalRequest().getSession());
|
||||||
|
|
||||||
|
HashMap<String, Boolean> listSubmitQueryUIDCachedData = (HashMap<String, Boolean>) session
|
||||||
|
.getAttribute("listSubmitQueryUIDCachedData");
|
||||||
|
return listSubmitQueryUIDCachedData.get(UID);
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void removeSubmitQueryUIDCachedData(String UID) {
|
||||||
|
ASLSession session = SessionUtil.getAslSession(this
|
||||||
|
.getThreadLocalRequest().getSession());
|
||||||
|
|
||||||
|
HashMap<String, Boolean> listSubmitQueryUIDCachedData = (HashMap<String, Boolean>) session
|
||||||
|
.getAttribute("listSubmitQueryUIDCachedData");
|
||||||
|
|
||||||
|
if (listSubmitQueryUIDCachedData.containsKey(UID)) {
|
||||||
|
listSubmitQueryUIDCachedData.remove(UID);
|
||||||
|
session.setAttribute("listSubmitQueryUIDCachedData",
|
||||||
|
listSubmitQueryUIDCachedData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void removeKeySubmitQueryResult(String UID) {
|
||||||
|
ASLSession session = SessionUtil.getAslSession(this
|
||||||
|
.getThreadLocalRequest().getSession());
|
||||||
|
|
||||||
|
HashMap<String, String> listKeySubmitQueryResult = (HashMap<String, String>) session
|
||||||
|
.getAttribute("listKeySubmitQueryResult");
|
||||||
|
|
||||||
|
if (listKeySubmitQueryResult.containsKey(UID)) {
|
||||||
|
listKeySubmitQueryResult.remove(UID);
|
||||||
|
session.setAttribute("listKeySubmitQueryResult",
|
||||||
|
listKeySubmitQueryResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO CANCELLARE METDODO
|
||||||
|
// private synchronized void updateListKeyData(String UID, String value) {
|
||||||
|
// ASLSession session = SessionUtil.getAslSession(this
|
||||||
|
// .getThreadLocalRequest().getSession());
|
||||||
|
//
|
||||||
|
// HashMap<String, String> listKeyData = (HashMap<String, String>) session
|
||||||
|
// .getAttribute("listKeyData");
|
||||||
|
// listKeyData.put(UID, value);
|
||||||
|
// session.setAttribute("listKeyData", listKeyData);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
private synchronized void updateListKeySubmitQueryResult(String UID,
|
||||||
|
String value) {
|
||||||
|
ASLSession session = SessionUtil.getAslSession(this
|
||||||
|
.getThreadLocalRequest().getSession());
|
||||||
|
|
||||||
|
HashMap<String, String> listKeySubmitQueryResult = (HashMap<String, String>) session
|
||||||
|
.getAttribute("listKeySubmitQueryResult");
|
||||||
|
listKeySubmitQueryResult.put(UID, value);
|
||||||
|
session.setAttribute("listKeySubmitQueryResult",
|
||||||
|
listKeySubmitQueryResult);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized String getKeySubmitQueryResult(String UID) {
|
||||||
|
ASLSession session = SessionUtil.getAslSession(this
|
||||||
|
.getThreadLocalRequest().getSession());
|
||||||
|
|
||||||
|
HashMap<String, String> listKeySubmitQueryResult = (HashMap<String, String>) session
|
||||||
|
.getAttribute("listKeySubmitQueryResult");
|
||||||
|
return listKeySubmitQueryResult.get(UID);
|
||||||
|
}
|
||||||
|
|
||||||
private String startComputation(String algorithmName,
|
private String startComputation(String algorithmName,
|
||||||
List<Parameter> parameters, ComputationOutput outputData)
|
List<Parameter> parameters, ComputationOutput outputData)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
@ -2155,51 +2419,71 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
throw new SessionExpiredException();
|
throw new SessionExpiredException();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String computationId = null;
|
|
||||||
|
|
||||||
if ((uidSubmitQuery != null) && (!(uidSubmitQuery.equals("")))) {
|
Boolean isComputationRemoved = false;
|
||||||
// get job status
|
// verify if this uid submitQuery request uses data in cache
|
||||||
// ASLSession session = WsUtil.getAslSession(this
|
Boolean value = checkSubmitQueryUIDCachedData(uidSubmitQuery);
|
||||||
// .getThreadLocalRequest().getSession());
|
|
||||||
// HashMap<String, String> JobStatusMap = (HashMap<String,
|
|
||||||
// String>)
|
|
||||||
// session
|
|
||||||
// .getAttribute("JobStatusList");
|
|
||||||
// String status = JobStatusMap.get(uidSubmitQuery);
|
|
||||||
String status = getJobStatus(uidSubmitQuery);
|
|
||||||
|
|
||||||
if (status == null) {
|
if (value != null) {
|
||||||
// the computation has not started
|
// System.out.println("For uid " + uidSubmitQuery
|
||||||
while (computationId == null) {
|
// + " data are cached? " + value.booleanValue());
|
||||||
computationId = removeJob(uidSubmitQuery);
|
if (!value.booleanValue()) {
|
||||||
|
// remove computation
|
||||||
|
String computationId = null;
|
||||||
|
|
||||||
|
if ((uidSubmitQuery != null)
|
||||||
|
&& (!(uidSubmitQuery.equals("")))) {
|
||||||
|
// get job status
|
||||||
|
// ASLSession session = WsUtil.getAslSession(this
|
||||||
|
// .getThreadLocalRequest().getSession());
|
||||||
|
// HashMap<String, String> JobStatusMap =
|
||||||
|
// (HashMap<String,
|
||||||
|
// String>)
|
||||||
|
// session
|
||||||
|
// .getAttribute("JobStatusList");
|
||||||
|
// String status = JobStatusMap.get(uidSubmitQuery);
|
||||||
|
String status = getJobStatus(uidSubmitQuery);
|
||||||
|
|
||||||
|
if (status == null) {
|
||||||
|
// the computation has not started
|
||||||
|
while (computationId == null) {
|
||||||
|
computationId = removeJob(uidSubmitQuery);
|
||||||
|
}
|
||||||
|
} else if (status.equals("computation started")) {
|
||||||
|
// System.out.println("check status: computation started");
|
||||||
|
// the computation has started
|
||||||
|
computationId = removeJob(uidSubmitQuery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (status.equals("computation started")) {
|
|
||||||
// System.out.println("check status: computation started");
|
if (computationId != null) {
|
||||||
// the computation has started
|
StatisticalManagerFactory factory = getFactory();
|
||||||
computationId = removeJob(uidSubmitQuery);
|
try {
|
||||||
|
factory.removeComputation(computationId);
|
||||||
|
// remove submit query result
|
||||||
|
refreshDataOnServer(uidSubmitQuery);
|
||||||
|
// System.out.println("computation removed");
|
||||||
|
isComputationRemoved = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
logger.info("dbmanager-> Could not remove the computation ID "
|
||||||
|
+ computationId
|
||||||
|
+ " corresponding to jobID "
|
||||||
|
+ uidSubmitQuery);
|
||||||
|
logger.error("dbmanager-> ", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// // remove job status
|
||||||
|
// removeJobStatus(uidSubmitQuery);
|
||||||
|
// //remove the element related to the uid submitQuery
|
||||||
|
// request
|
||||||
|
// removeSubmitQueryUIDCachedData(uidSubmitQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (computationId != null) {
|
return isComputationRemoved;
|
||||||
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("dbmanager-> Could not remove the computation ID "
|
|
||||||
+ computationId
|
|
||||||
+ " corresponding to jobID "
|
|
||||||
+ uidSubmitQuery);
|
|
||||||
logger.error("dbmanager-> ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// remove job status
|
|
||||||
removeJobStatus(uidSubmitQuery);
|
|
||||||
return (new Boolean(true));
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("dbmanager-> ", e);
|
logger.error("dbmanager-> ", e);
|
||||||
|
@ -2207,6 +2491,14 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
"Error in server while loading data. Exception: " + e);
|
"Error in server while loading data. Exception: " + e);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// finally {
|
||||||
|
// // remove the element related to the uid submitQuery request
|
||||||
|
// removeSubmitQueryUIDCachedData(uidSubmitQuery);
|
||||||
|
// // remove job status
|
||||||
|
// System.out.println("remove job status");
|
||||||
|
// removeJobStatus(uidSubmitQuery);
|
||||||
|
// removeJob(uidSubmitQuery);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshDataOnServer(String submitQueryUID) throws Exception {
|
public void refreshDataOnServer(String submitQueryUID) throws Exception {
|
||||||
|
@ -2216,8 +2508,11 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
throw new SessionExpiredException();
|
throw new SessionExpiredException();
|
||||||
|
|
||||||
if ((submitQueryUID != null) && (!submitQueryUID.equals(""))) {
|
if ((submitQueryUID != null) && (!submitQueryUID.equals(""))) {
|
||||||
removeResultParsed(submitQueryUID);
|
// removeResultParsed(submitQueryUID);
|
||||||
removeResult(submitQueryUID);
|
// removeResult(submitQueryUID);
|
||||||
|
// removeSubmitQueryUIDCachedData(submitQueryUID);
|
||||||
|
removeKeySubmitQueryResult(submitQueryUID);
|
||||||
|
// System.out.println("data refreshed on server");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2367,6 +2662,11 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
private String storeResultIntoCSVFile(List<Result> result, String n)
|
private String storeResultIntoCSVFile(List<Result> result, String n)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
|
if (result == null) {
|
||||||
|
logger.info("Error in server while loading data. object result null");
|
||||||
|
throw new Exception("Error in server while loading data");
|
||||||
|
}
|
||||||
|
|
||||||
// file that will contain result
|
// file that will contain result
|
||||||
BufferedWriter out = null;
|
BufferedWriter out = null;
|
||||||
|
|
||||||
|
@ -2413,5 +2713,12 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
.getSession());
|
.getSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String parseQuery(String query) {
|
||||||
|
String queryParsed;
|
||||||
|
|
||||||
|
queryParsed = query.trim();
|
||||||
|
queryParsed = queryParsed.replaceAll(" +", " ");
|
||||||
|
return queryParsed;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue