Minor updated
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@86884 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d45cc666a4
commit
1a0db169d5
|
@ -7,7 +7,7 @@ import org.gcube.portlets.user.tdwx.client.event.CloseTableEvent;
|
||||||
import org.gcube.portlets.user.tdwx.client.event.FailureEvent;
|
import org.gcube.portlets.user.tdwx.client.event.FailureEvent;
|
||||||
import org.gcube.portlets.user.tdwx.client.event.FailureEventHandler;
|
import org.gcube.portlets.user.tdwx.client.event.FailureEventHandler;
|
||||||
import org.gcube.portlets.user.tdwx.client.event.OpenTableEvent;
|
import org.gcube.portlets.user.tdwx.client.event.OpenTableEvent;
|
||||||
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceFactory;
|
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceXFactory;
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
||||||
|
|
||||||
|
@ -17,35 +17,37 @@ import com.google.gwt.event.shared.SimpleEventBus;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TabularData {
|
public class TabularDataX {
|
||||||
|
|
||||||
protected static int seed = 0;
|
protected static int seed = 0;
|
||||||
|
|
||||||
protected int tdSessionId;
|
protected int tdSessionId;
|
||||||
protected String defaultDataSourceFactoryName;
|
protected String defaultDataSourceFactoryName;
|
||||||
protected EventBus eventBus;
|
protected EventBus eventBus;
|
||||||
protected TabularDataController controller;
|
protected TabularDataXController controller;
|
||||||
protected TabularDataGridPanel gridPanel;
|
protected TabularDataXGridPanel gridPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link TabularData object setting the default {@link DataSourceFactory} name.
|
* Creates a new {@link TabularDataX object setting the default {@link DataSourceXFactory} name.
|
||||||
* @param defaultDataSourceFactoryName the default {@link DataSourceFactory} name.
|
* @param defaultDataSourceFactoryName the default {@link DataSourceXFactory} name.
|
||||||
*/
|
*/
|
||||||
public TabularData(String defaultDataSourceFactoryName)
|
public TabularDataX(String defaultDataSourceFactoryName)
|
||||||
{
|
{
|
||||||
this.tdSessionId = seed++;
|
this.tdSessionId = seed++;
|
||||||
this.defaultDataSourceFactoryName = defaultDataSourceFactoryName;
|
this.defaultDataSourceFactoryName = defaultDataSourceFactoryName;
|
||||||
eventBus = new SimpleEventBus();
|
eventBus = new SimpleEventBus();
|
||||||
controller = new TabularDataController(tdSessionId, eventBus);
|
controller = new TabularDataXController(tdSessionId, eventBus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link TabularData} object.
|
* Creates a new {@link TabularDataX} object.
|
||||||
*/
|
*/
|
||||||
public TabularData()
|
public TabularDataX()
|
||||||
{
|
{
|
||||||
this(null);
|
this(null);
|
||||||
}
|
}
|
||||||
|
@ -64,10 +66,10 @@ public class TabularData {
|
||||||
this.defaultDataSourceFactoryName = defaultDataSourceFactoryName;
|
this.defaultDataSourceFactoryName = defaultDataSourceFactoryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TabularDataGridPanel getGridPanel()
|
public TabularDataXGridPanel getGridPanel()
|
||||||
{
|
{
|
||||||
if (gridPanel == null) {
|
if (gridPanel == null) {
|
||||||
gridPanel = new TabularDataGridPanel(tdSessionId, eventBus);
|
gridPanel = new TabularDataXGridPanel(tdSessionId, eventBus);
|
||||||
}
|
}
|
||||||
return gridPanel;
|
return gridPanel;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +94,7 @@ public class TabularData {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a new table. The default {@link DataSourceFactory} name is used.
|
* Opens a new table. The default {@link DataSourceXFactory} name is used.
|
||||||
* @param tableKey the table key.
|
* @param tableKey the table key.
|
||||||
*/
|
*/
|
||||||
public void openTable(String tableKey)
|
public void openTable(String tableKey)
|
|
@ -9,8 +9,8 @@ import org.gcube.portlets.user.tdwx.client.event.FailureEvent;
|
||||||
import org.gcube.portlets.user.tdwx.client.event.OpenTableEvent;
|
import org.gcube.portlets.user.tdwx.client.event.OpenTableEvent;
|
||||||
import org.gcube.portlets.user.tdwx.client.event.OpenTableEventHandler;
|
import org.gcube.portlets.user.tdwx.client.event.OpenTableEventHandler;
|
||||||
import org.gcube.portlets.user.tdwx.client.event.TableReadyEvent;
|
import org.gcube.portlets.user.tdwx.client.event.TableReadyEvent;
|
||||||
import org.gcube.portlets.user.tdwx.client.rpc.TabularDataService;
|
import org.gcube.portlets.user.tdwx.client.rpc.TabularDataXService;
|
||||||
import org.gcube.portlets.user.tdwx.client.rpc.TabularDataServiceAsync;
|
import org.gcube.portlets.user.tdwx.client.rpc.TabularDataXServiceAsync;
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
||||||
|
|
||||||
|
@ -23,21 +23,21 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TabularDataController {
|
public class TabularDataXController {
|
||||||
|
|
||||||
protected int tdSessionId;
|
protected int tdSessionId;
|
||||||
protected EventBus eventBus;
|
protected EventBus eventBus;
|
||||||
protected TabularDataServiceAsync service;
|
protected TabularDataXServiceAsync service;
|
||||||
|
|
||||||
protected TableDefinition currentTable;
|
protected TableDefinition currentTable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param eventBus
|
* @param eventBus
|
||||||
*/
|
*/
|
||||||
protected TabularDataController(int tdSessionId, EventBus eventBus) {
|
protected TabularDataXController(int tdSessionId, EventBus eventBus) {
|
||||||
this.tdSessionId = tdSessionId;
|
this.tdSessionId = tdSessionId;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
service = GWT.create(TabularDataService.class);
|
service = GWT.create(TabularDataXService.class);
|
||||||
bindEventBus();
|
bindEventBus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TabularDataGridPanel extends ContentPanel {
|
public class TabularDataXGridPanel extends ContentPanel {
|
||||||
|
|
||||||
protected int tdSessionId;
|
protected int tdSessionId;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public class TabularDataGridPanel extends ContentPanel {
|
||||||
/**
|
/**
|
||||||
* @param eventBus
|
* @param eventBus
|
||||||
*/
|
*/
|
||||||
protected TabularDataGridPanel(int tdSessionId, EventBus eventBus) {
|
protected TabularDataXGridPanel(int tdSessionId, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
this.tdSessionId = tdSessionId;
|
this.tdSessionId = tdSessionId;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
|
@ -10,8 +10,10 @@ import org.gcube.portlets.user.tdwx.shared.model.ColumnKey;
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.DataRow;
|
import org.gcube.portlets.user.tdwx.shared.model.DataRow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a table row.
|
*
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public class Row {
|
public class Row {
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,10 @@
|
||||||
package org.gcube.portlets.user.tdwx.client.config;
|
package org.gcube.portlets.user.tdwx.client.config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table view configuration.
|
*
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public class TableViewConfig {
|
public class TableViewConfig {
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,14 @@ import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
||||||
import com.sencha.gxt.core.client.ValueProvider;
|
import com.sencha.gxt.core.client.ValueProvider;
|
||||||
import com.sencha.gxt.widget.core.client.grid.GridViewConfig;
|
import com.sencha.gxt.widget.core.client.grid.GridViewConfig;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
* A bridge between the GridViewConfig and the TableViewConfig.
|
* A bridge between the GridViewConfig and the TableViewConfig.
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
|
||||||
*/
|
*/
|
||||||
public class TabularDataGridViewConfig implements GridViewConfig<DataRow> {
|
public class TabularDataGridViewConfig implements GridViewConfig<DataRow> {
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,9 @@ package org.gcube.portlets.user.tdwx.client.event;
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CloseTableEvent extends GwtEvent<CloseTableEventHandler> {
|
public class CloseTableEvent extends GwtEvent<CloseTableEventHandler> {
|
||||||
|
|
|
@ -6,7 +6,9 @@ package org.gcube.portlets.user.tdwx.client.event;
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface CloseTableEventHandler extends EventHandler {
|
public interface CloseTableEventHandler extends EventHandler {
|
||||||
|
|
|
@ -6,7 +6,9 @@ package org.gcube.portlets.user.tdwx.client.event;
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FailureEvent extends GwtEvent<FailureEventHandler> {
|
public class FailureEvent extends GwtEvent<FailureEventHandler> {
|
||||||
|
|
|
@ -6,7 +6,9 @@ package org.gcube.portlets.user.tdwx.client.event;
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface FailureEventHandler extends EventHandler {
|
public interface FailureEventHandler extends EventHandler {
|
||||||
|
|
|
@ -8,7 +8,9 @@ import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class OpenTableEvent extends GwtEvent<OpenTableEventHandler> {
|
public class OpenTableEvent extends GwtEvent<OpenTableEventHandler> {
|
||||||
|
|
|
@ -6,7 +6,9 @@ package org.gcube.portlets.user.tdwx.client.event;
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface OpenTableEventHandler extends EventHandler {
|
public interface OpenTableEventHandler extends EventHandler {
|
||||||
|
|
|
@ -8,7 +8,9 @@ import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TableReadyEvent extends GwtEvent<TableReadyEventHandler> {
|
public class TableReadyEvent extends GwtEvent<TableReadyEventHandler> {
|
||||||
|
|
|
@ -6,7 +6,9 @@ package org.gcube.portlets.user.tdwx.client.event;
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface TableReadyEventHandler extends EventHandler {
|
public interface TableReadyEventHandler extends EventHandler {
|
||||||
|
|
|
@ -9,8 +9,11 @@ import org.gcube.portlets.user.tdwx.shared.model.DataRow;
|
||||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
|
||||||
*
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
* @param <N>
|
||||||
*/
|
*/
|
||||||
public class DataRowColumnConfig<N> extends ColumnConfig<DataRow, N> {
|
public class DataRowColumnConfig<N> extends ColumnConfig<DataRow, N> {
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,9 @@ import org.gcube.portlets.user.tdwx.shared.model.DataRow;
|
||||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DataRowModelKeyProvider implements ModelKeyProvider<DataRow> {
|
public class DataRowModelKeyProvider implements ModelKeyProvider<DataRow> {
|
||||||
|
|
|
@ -16,7 +16,9 @@ import com.sencha.gxt.data.shared.loader.PagingLoadResult;
|
||||||
import com.sencha.gxt.data.shared.loader.PagingLoadResultBean;
|
import com.sencha.gxt.data.shared.loader.PagingLoadResultBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DataRowPagingReader implements DataReader<PagingLoadResult<DataRow>, String> {
|
public class DataRowPagingReader implements DataReader<PagingLoadResult<DataRow>, String> {
|
||||||
|
|
|
@ -16,7 +16,9 @@ import com.sencha.gxt.data.shared.loader.ListLoadResult;
|
||||||
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DataRowReader implements DataReader<ListLoadResult<DataRow>, String> {
|
public class DataRowReader implements DataReader<ListLoadResult<DataRow>, String> {
|
||||||
|
|
|
@ -9,8 +9,11 @@ import org.gcube.portlets.user.tdwx.shared.model.DataRow;
|
||||||
import com.sencha.gxt.core.client.ValueProvider;
|
import com.sencha.gxt.core.client.ValueProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
|
||||||
*
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
* @param <V>
|
||||||
*/
|
*/
|
||||||
public class DataRowValueProvider<V> implements ValueProvider<DataRow, V> {
|
public class DataRowValueProvider<V> implements ValueProvider<DataRow, V> {
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,9 @@ import org.gcube.portlets.user.tdwx.shared.model.ValueType;
|
||||||
import com.google.gwt.core.client.JsArray;
|
import com.google.gwt.core.client.JsArray;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class JSonValueConverter {
|
public class JSonValueConverter {
|
||||||
|
|
|
@ -10,7 +10,9 @@ import com.google.gwt.core.client.JavaScriptObject;
|
||||||
import com.google.gwt.core.client.JsArray;
|
import com.google.gwt.core.client.JsArray;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class JSonTable extends JavaScriptObject {
|
public final class JSonTable extends JavaScriptObject {
|
||||||
|
|
|
@ -7,8 +7,11 @@ import java.util.Date;
|
||||||
|
|
||||||
import com.google.gwt.core.client.JavaScriptObject;
|
import com.google.gwt.core.client.JavaScriptObject;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class JSonValue extends JavaScriptObject {
|
public final class JSonValue extends JavaScriptObject {
|
||||||
|
|
|
@ -18,7 +18,9 @@ import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||||
import com.sencha.gxt.widget.core.client.grid.editing.AbstractGridEditing;
|
import com.sencha.gxt.widget.core.client.grid.editing.AbstractGridEditing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ColumnConfigGenerator {
|
public class ColumnConfigGenerator {
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.tdwx.client.rpc;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class TabularDataServiceException extends Exception {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 3591608412845539801L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public TabularDataServiceException() {
|
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param message
|
|
||||||
*/
|
|
||||||
public TabularDataServiceException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,6 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.tdwx.client.rpc;
|
package org.gcube.portlets.user.tdwx.client.rpc;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.tdwx.shared.Constants;
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
||||||
|
|
||||||
|
@ -10,18 +11,20 @@ import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@RemoteServiceRelativePath("tdw")
|
@RemoteServiceRelativePath(Constants.REMOTE_SERVICE_RELATIVE_PATH)
|
||||||
public interface TabularDataService extends RemoteService {
|
public interface TabularDataXService extends RemoteService {
|
||||||
|
|
||||||
public TableDefinition openTable(int tdSessionId, TableId tableId) throws TabularDataServiceException;
|
public TableDefinition openTable(int tdSessionId, TableId tableId) throws TabularDataXServiceException;
|
||||||
|
|
||||||
public TableDefinition getCurrentTableDefinition(int tdSessionId) throws TabularDataServiceException;
|
public TableDefinition getCurrentTableDefinition(int tdSessionId) throws TabularDataXServiceException;
|
||||||
|
|
||||||
public TableDefinition getTableDefinition(TableId id) throws TabularDataServiceException;
|
public TableDefinition getTableDefinition(TableId id) throws TabularDataXServiceException;
|
||||||
|
|
||||||
public void closeTable(int tdSessionId) throws TabularDataServiceException;
|
public void closeTable(int tdSessionId) throws TabularDataXServiceException;
|
||||||
|
|
||||||
}
|
}
|
|
@ -9,10 +9,12 @@ import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface TabularDataServiceAsync {
|
public interface TabularDataXServiceAsync {
|
||||||
|
|
||||||
void getCurrentTableDefinition(int id, AsyncCallback<TableDefinition> callback);
|
void getCurrentTableDefinition(int id, AsyncCallback<TableDefinition> callback);
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.tdwx.client.rpc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class TabularDataXServiceException extends Exception {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 3591608412845539801L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public TabularDataXServiceException() {
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
public TabularDataXServiceException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,10 +7,12 @@ import java.util.Comparator;
|
||||||
|
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.ColumnDefinition;
|
import org.gcube.portlets.user.tdwx.shared.model.ColumnDefinition;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares the {@link ColumnDefinition} by position field.
|
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
|
||||||
*
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
* Compares the {@link ColumnDefinition} by position field.
|
||||||
*/
|
*/
|
||||||
public class ColumnPositionComparator implements Comparator<ColumnDefinition> {
|
public class ColumnPositionComparator implements Comparator<ColumnDefinition> {
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,11 @@ import com.sencha.gxt.data.shared.loader.PagingLoader;
|
||||||
import com.sencha.gxt.widget.core.client.grid.RowNumberer;
|
import com.sencha.gxt.widget.core.client.grid.RowNumberer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
|
||||||
*
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
* @param <M>
|
||||||
*/
|
*/
|
||||||
public class LiveRowNumberer<M> extends RowNumberer<M> {
|
public class LiveRowNumberer<M> extends RowNumberer<M> {
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,9 @@ import com.sencha.gxt.data.shared.loader.PagingLoadConfig;
|
||||||
import com.sencha.gxt.data.shared.writer.DataWriter;
|
import com.sencha.gxt.data.shared.writer.DataWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PagingLoadUrlEncoder implements DataWriter<PagingLoadConfig, String> {
|
public class PagingLoadUrlEncoder implements DataWriter<PagingLoadConfig, String> {
|
||||||
|
|
|
@ -6,7 +6,9 @@ package org.gcube.portlets.user.tdwx.client.util;
|
||||||
import com.google.gwt.http.client.URL;
|
import com.google.gwt.http.client.URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class UrlBuilder {
|
public class UrlBuilder {
|
||||||
|
|
|
@ -7,10 +7,10 @@ import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.gcube.portlets.user.tdwx.client.rpc.TabularDataService;
|
import org.gcube.portlets.user.tdwx.client.rpc.TabularDataXService;
|
||||||
import org.gcube.portlets.user.tdwx.client.rpc.TabularDataServiceException;
|
import org.gcube.portlets.user.tdwx.client.rpc.TabularDataXServiceException;
|
||||||
import org.gcube.portlets.user.tdwx.server.datasource.DataSource;
|
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceX;
|
||||||
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceException;
|
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceXException;
|
||||||
import org.gcube.portlets.user.tdwx.server.util.SessionUtil;
|
import org.gcube.portlets.user.tdwx.server.util.SessionUtil;
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
||||||
|
@ -19,16 +19,18 @@ import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TabularDataServiceImpl extends RemoteServiceServlet implements TabularDataService {
|
public class TabularDataXServiceImpl extends RemoteServiceServlet implements TabularDataXService {
|
||||||
|
|
||||||
private static final long serialVersionUID = 193560783723693864L;
|
private static final long serialVersionUID = 193560783723693864L;
|
||||||
|
|
||||||
protected static Logger logger = LoggerFactory.getLogger(TabularDataServiceImpl.class);
|
protected static Logger logger = LoggerFactory.getLogger(TabularDataXServiceImpl.class);
|
||||||
|
|
||||||
protected DataSource getDataSource(int tdSessionId)
|
protected DataSourceX getDataSource(int tdSessionId)
|
||||||
{
|
{
|
||||||
HttpSession httpSession = this.getThreadLocalRequest().getSession();
|
HttpSession httpSession = this.getThreadLocalRequest().getSession();
|
||||||
return SessionUtil.getDataSource(httpSession, tdSessionId);
|
return SessionUtil.getDataSource(httpSession, tdSessionId);
|
||||||
|
@ -38,19 +40,19 @@ public class TabularDataServiceImpl extends RemoteServiceServlet implements Tabu
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TableDefinition openTable(int tdSessionId, TableId tableId) throws TabularDataServiceException {
|
public TableDefinition openTable(int tdSessionId, TableId tableId) throws TabularDataXServiceException {
|
||||||
logger.debug("openTable tdSessionId: "+tdSessionId+" tableId: "+tableId);
|
logger.debug("openTable tdSessionId: "+tdSessionId+" tableId: "+tableId);
|
||||||
|
|
||||||
try{
|
try{
|
||||||
closeCurrentTable(tdSessionId, true);
|
closeCurrentTable(tdSessionId, true);
|
||||||
|
|
||||||
HttpSession httpSession = this.getThreadLocalRequest().getSession();
|
HttpSession httpSession = this.getThreadLocalRequest().getSession();
|
||||||
DataSource dataSource = SessionUtil.openDataSource(httpSession, tableId);
|
DataSourceX dataSource = SessionUtil.openDataSource(httpSession, tableId);
|
||||||
SessionUtil.setDataSource(httpSession, tdSessionId, dataSource);
|
SessionUtil.setDataSource(httpSession, tdSessionId, dataSource);
|
||||||
return dataSource.getTableDefinition();
|
return dataSource.getTableDefinition();
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("An error occurred opening the specified table "+tableId+" in session "+tdSessionId, e);
|
logger.error("An error occurred opening the specified table "+tableId+" in session "+tdSessionId, e);
|
||||||
throw new TabularDataServiceException("An error occurred opening the specified table: "+e.getMessage());
|
throw new TabularDataXServiceException("An error occurred opening the specified table: "+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,15 +60,15 @@ public class TabularDataServiceImpl extends RemoteServiceServlet implements Tabu
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TableDefinition getCurrentTableDefinition(int tdSessionId) throws TabularDataServiceException {
|
public TableDefinition getCurrentTableDefinition(int tdSessionId) throws TabularDataXServiceException {
|
||||||
logger.debug("getCurrentTableDefinition tdSessionId: "+tdSessionId);
|
logger.debug("getCurrentTableDefinition tdSessionId: "+tdSessionId);
|
||||||
|
|
||||||
try{
|
try{
|
||||||
DataSource dataSource = getDataSource(tdSessionId);
|
DataSourceX dataSource = getDataSource(tdSessionId);
|
||||||
return dataSource.getTableDefinition();
|
return dataSource.getTableDefinition();
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("An error occurred retrieving the table definition", e);
|
logger.error("An error occurred retrieving the table definition", e);
|
||||||
throw new TabularDataServiceException("An error occurred retrieving the table definition: "+e.getMessage());
|
throw new TabularDataXServiceException("An error occurred retrieving the table definition: "+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,16 +76,16 @@ public class TabularDataServiceImpl extends RemoteServiceServlet implements Tabu
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TableDefinition getTableDefinition(TableId id) throws TabularDataServiceException {
|
public TableDefinition getTableDefinition(TableId id) throws TabularDataXServiceException {
|
||||||
logger.debug("getTableDefinition TableId: "+id);
|
logger.debug("getTableDefinition TableId: "+id);
|
||||||
|
|
||||||
try{
|
try{
|
||||||
HttpSession httpSession = this.getThreadLocalRequest().getSession();
|
HttpSession httpSession = this.getThreadLocalRequest().getSession();
|
||||||
DataSource dataSource = SessionUtil.openDataSource(httpSession,id);
|
DataSourceX dataSource = SessionUtil.openDataSource(httpSession,id);
|
||||||
return dataSource.getTableDefinition();
|
return dataSource.getTableDefinition();
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
logger.error("An error occurred getting the table definition", e);
|
logger.error("An error occurred getting the table definition", e);
|
||||||
throw new TabularDataServiceException("An error occurred getting the table definition: "+e.getMessage());
|
throw new TabularDataXServiceException("An error occurred getting the table definition: "+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,21 +93,21 @@ public class TabularDataServiceImpl extends RemoteServiceServlet implements Tabu
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void closeTable(int tdSessionId) throws TabularDataServiceException {
|
public void closeTable(int tdSessionId) throws TabularDataXServiceException {
|
||||||
try {
|
try {
|
||||||
closeCurrentTable(tdSessionId, false);
|
closeCurrentTable(tdSessionId, false);
|
||||||
} catch (DataSourceException e) {
|
} catch (DataSourceXException e) {
|
||||||
logger.error("An error occurred closing the current table", e);
|
logger.error("An error occurred closing the current table", e);
|
||||||
throw new TabularDataServiceException("An error occurred closing the current table: "+e.getMessage());
|
throw new TabularDataXServiceException("An error occurred closing the current table: "+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void closeCurrentTable(int tdSessionId, boolean silent) throws DataSourceException {
|
protected void closeCurrentTable(int tdSessionId, boolean silent) throws DataSourceXException {
|
||||||
try {
|
try {
|
||||||
HttpSession httpSession = this.getThreadLocalRequest().getSession();
|
HttpSession httpSession = this.getThreadLocalRequest().getSession();
|
||||||
SessionUtil.closeDataSource(httpSession, tdSessionId);
|
SessionUtil.closeDataSource(httpSession, tdSessionId);
|
||||||
} catch (DataSourceException e)
|
} catch (DataSourceXException e)
|
||||||
{
|
{
|
||||||
if (!silent) throw e;
|
if (!silent) throw e;
|
||||||
}
|
}
|
|
@ -1,6 +1,3 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.tdwx.server;
|
package org.gcube.portlets.user.tdwx.server;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -10,7 +7,7 @@ import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.gcube.portlets.user.tdwx.server.datasource.DataSource;
|
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceX;
|
||||||
import org.gcube.portlets.user.tdwx.server.datasource.Direction;
|
import org.gcube.portlets.user.tdwx.server.datasource.Direction;
|
||||||
import org.gcube.portlets.user.tdwx.server.util.SessionUtil;
|
import org.gcube.portlets.user.tdwx.server.util.SessionUtil;
|
||||||
import org.gcube.portlets.user.tdwx.shared.ServletParameters;
|
import org.gcube.portlets.user.tdwx.shared.ServletParameters;
|
||||||
|
@ -18,14 +15,16 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TabularDataServlet extends HttpServlet {
|
public class TabularDataXServlet extends HttpServlet {
|
||||||
|
|
||||||
private static final long serialVersionUID = 3995054634540860599L;
|
private static final long serialVersionUID = 3995054634540860599L;
|
||||||
|
|
||||||
protected Logger log = LoggerFactory.getLogger(TabularDataServlet.class);
|
protected Logger log = LoggerFactory.getLogger(TabularDataXServlet.class);
|
||||||
|
|
||||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
@ -72,7 +71,7 @@ public class TabularDataServlet extends HttpServlet {
|
||||||
log.trace("limitParameter: " + limitParameter);
|
log.trace("limitParameter: " + limitParameter);
|
||||||
int limit = Integer.parseInt(limitParameter);
|
int limit = Integer.parseInt(limitParameter);
|
||||||
|
|
||||||
DataSource dataSource = SessionUtil.getDataSource(
|
DataSourceX dataSource = SessionUtil.getDataSource(
|
||||||
request.getSession(), tdSessionId);
|
request.getSession(), tdSessionId);
|
||||||
String json = dataSource.getDataAsJSon(start, limit, sortColumn,
|
String json = dataSource.getDataAsJSon(start, limit, sortColumn,
|
||||||
direction);
|
direction);
|
|
@ -1,37 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.tdwx.server.datasource;
|
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generator of {@link DataSource}
|
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
|
||||||
*/
|
|
||||||
public interface DataSourceFactory {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The DataSourceFactory unique id.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getId();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Open the specified datasource {@link DataSource}.
|
|
||||||
* @param id the datasource id.
|
|
||||||
* @return the retrieved datasource.
|
|
||||||
* @throws DataSourceException if an error occurs retrieving the datasource.
|
|
||||||
*/
|
|
||||||
public DataSource openDataSource(ASLSession session, TableId id) throws DataSourceException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Close the specified DataSource releasing allocated resources.
|
|
||||||
* @param session
|
|
||||||
* @param dataSource
|
|
||||||
* @throws DataSourceException
|
|
||||||
*/
|
|
||||||
public void closeDataSource(ASLSession session, DataSource dataSource) throws DataSourceException;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,83 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.tdwx.server.datasource;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.ServiceLoader;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Giancarlo Panichi"
|
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class DataSourceFactoryRegistry {
|
|
||||||
|
|
||||||
|
|
||||||
protected static DataSourceFactoryRegistry instance;
|
|
||||||
|
|
||||||
public static DataSourceFactoryRegistry getInstance()
|
|
||||||
{
|
|
||||||
if (instance == null) instance = new DataSourceFactoryRegistry();
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(DataSourceFactoryRegistry.class);
|
|
||||||
|
|
||||||
protected Map<String, DataSourceFactory> instancesRegistry = new HashMap<String, DataSourceFactory>();
|
|
||||||
|
|
||||||
protected DataSourceFactoryRegistry()
|
|
||||||
{
|
|
||||||
addInstancesInEnv();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addInstancesInEnv()
|
|
||||||
{
|
|
||||||
ServiceLoader<DataSourceFactory> loader = ServiceLoader.load(DataSourceFactory.class);
|
|
||||||
for (DataSourceFactory factory:loader) add(factory);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a new {@link DataSourceFactory} to the registry.
|
|
||||||
* @param factory the {@link DataSourceFactory} to add.
|
|
||||||
*/
|
|
||||||
public void add(DataSourceFactory factory)
|
|
||||||
{
|
|
||||||
log.trace("add factory: "+factory.getId());
|
|
||||||
DataSourceFactory old = instancesRegistry.put(factory.getId(), factory);
|
|
||||||
if (old!=null) log.warn("A DataSourceFactory instance with id "+old.getId()+" and class "+old.getClass().getCanonicalName()+" was already registered. The old one has been replaced by the new one with class "+factory.getClass().getCanonicalName()+".");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the specified {@link DataSourceFactory}.
|
|
||||||
* @param factoryId the {@link DataSourceFactory} id.
|
|
||||||
* @return the {@link DataSourceFactory} if found, <code>null</code> otherwise.
|
|
||||||
*/
|
|
||||||
public DataSourceFactory get(String factoryId)
|
|
||||||
{
|
|
||||||
return instancesRegistry.get(factoryId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean exists(String factoryId)
|
|
||||||
{
|
|
||||||
return instancesRegistry.containsKey(factoryId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the specified {@link DataSourceFactory}.
|
|
||||||
* @param factoryId the {@link DataSourceFactory} id.
|
|
||||||
*/
|
|
||||||
public void remove(String factoryId)
|
|
||||||
{
|
|
||||||
log.trace("remove factoryId: "+factoryId);
|
|
||||||
instancesRegistry.remove(factoryId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,28 +1,27 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.user.tdwx.server.datasource;
|
package org.gcube.portlets.user.tdwx.server.datasource;
|
||||||
|
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A TDW datasource.
|
*
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public interface DataSource {
|
public interface DataSourceX {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the id of the {@link DataSourceFactory} that have generated it.
|
* Returns the id of the {@link DataSourceXFactory} that have generated it.
|
||||||
* @return the {@link DataSourceFactory} id.
|
* @return the {@link DataSourceXFactory} id.
|
||||||
*/
|
*/
|
||||||
public String getDataSourceFactoryId();
|
public String getDataSourceFactoryId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the table definition.
|
* Returns the table definition.
|
||||||
* @return a table definition.
|
* @return a table definition.
|
||||||
* @throws DataSourceException if an error occurred retrieving the table definition.
|
* @throws DataSourceXException if an error occurred retrieving the table definition.
|
||||||
*/
|
*/
|
||||||
public TableDefinition getTableDefinition() throws DataSourceException;
|
public TableDefinition getTableDefinition() throws DataSourceXException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the table data as JSON object.
|
* Retrieves the table data as JSON object.
|
||||||
|
@ -31,8 +30,8 @@ public interface DataSource {
|
||||||
* @param sortingColumn the column used for sorting.
|
* @param sortingColumn the column used for sorting.
|
||||||
* @param direction the sorting direction.
|
* @param direction the sorting direction.
|
||||||
* @return the JSON object as String.
|
* @return the JSON object as String.
|
||||||
* @throws DataSourceException if an error occurred retrieving the table data.
|
* @throws DataSourceXException if an error occurred retrieving the table data.
|
||||||
*/
|
*/
|
||||||
public String getDataAsJSon(int start, int limit, String sortingColumn, Direction direction) throws DataSourceException;
|
public String getDataAsJSon(int start, int limit, String sortingColumn, Direction direction) throws DataSourceXException;
|
||||||
|
|
||||||
}
|
}
|
|
@ -4,10 +4,12 @@
|
||||||
package org.gcube.portlets.user.tdwx.server.datasource;
|
package org.gcube.portlets.user.tdwx.server.datasource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DataSourceException extends Exception {
|
public class DataSourceXException extends Exception {
|
||||||
|
|
||||||
private static final long serialVersionUID = 3478740829309767716L;
|
private static final long serialVersionUID = 3478740829309767716L;
|
||||||
|
|
||||||
|
@ -15,14 +17,14 @@ public class DataSourceException extends Exception {
|
||||||
* @param message
|
* @param message
|
||||||
* @param cause
|
* @param cause
|
||||||
*/
|
*/
|
||||||
public DataSourceException(String message, Throwable cause) {
|
public DataSourceXException(String message, Throwable cause) {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param message
|
* @param message
|
||||||
*/
|
*/
|
||||||
public DataSourceException(String message) {
|
public DataSourceXException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package org.gcube.portlets.user.tdwx.server.datasource;
|
||||||
|
|
||||||
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
|
import org.gcube.portlets.user.tdwx.shared.model.TableId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Generator of {@link DataSourceX}
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface DataSourceXFactory {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The DataSourceFactory unique id.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the specified datasource {@link DataSourceX}.
|
||||||
|
* @param id the datasource id.
|
||||||
|
* @return the retrieved datasource.
|
||||||
|
* @throws DataSourceXException if an error occurs retrieving the datasource.
|
||||||
|
*/
|
||||||
|
public DataSourceX openDataSource(ASLSession session, TableId id) throws DataSourceXException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close the specified DataSource releasing allocated resources.
|
||||||
|
* @param session
|
||||||
|
* @param dataSource
|
||||||
|
* @throws DataSourceXException
|
||||||
|
*/
|
||||||
|
public void closeDataSource(ASLSession session, DataSourceX dataSource) throws DataSourceXException;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.tdwx.server.datasource;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.ServiceLoader;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DataSourceXFactoryRegistry {
|
||||||
|
|
||||||
|
|
||||||
|
protected static DataSourceXFactoryRegistry instance;
|
||||||
|
|
||||||
|
public static DataSourceXFactoryRegistry getInstance()
|
||||||
|
{
|
||||||
|
if (instance == null) instance = new DataSourceXFactoryRegistry();
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(DataSourceXFactoryRegistry.class);
|
||||||
|
|
||||||
|
protected Map<String, DataSourceXFactory> instancesRegistry = new HashMap<String, DataSourceXFactory>();
|
||||||
|
|
||||||
|
protected DataSourceXFactoryRegistry()
|
||||||
|
{
|
||||||
|
addInstancesInEnv();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addInstancesInEnv()
|
||||||
|
{
|
||||||
|
ServiceLoader<DataSourceXFactory> loader = ServiceLoader.load(DataSourceXFactory.class);
|
||||||
|
for (DataSourceXFactory factory:loader) add(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a new {@link DataSourceXFactory} to the registry.
|
||||||
|
* @param factory the {@link DataSourceXFactory} to add.
|
||||||
|
*/
|
||||||
|
public void add(DataSourceXFactory factory)
|
||||||
|
{
|
||||||
|
log.trace("add factory: "+factory.getId());
|
||||||
|
DataSourceXFactory old = instancesRegistry.put(factory.getId(), factory);
|
||||||
|
if (old!=null) log.warn("A DataSourceFactory instance with id "+old.getId()+" and class "+old.getClass().getCanonicalName()+" was already registered. The old one has been replaced by the new one with class "+factory.getClass().getCanonicalName()+".");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the specified {@link DataSourceXFactory}.
|
||||||
|
* @param factoryId the {@link DataSourceXFactory} id.
|
||||||
|
* @return the {@link DataSourceXFactory} if found, <code>null</code> otherwise.
|
||||||
|
*/
|
||||||
|
public DataSourceXFactory get(String factoryId)
|
||||||
|
{
|
||||||
|
return instancesRegistry.get(factoryId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean exists(String factoryId)
|
||||||
|
{
|
||||||
|
return instancesRegistry.containsKey(factoryId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the specified {@link DataSourceXFactory}.
|
||||||
|
* @param factoryId the {@link DataSourceXFactory} id.
|
||||||
|
*/
|
||||||
|
public void remove(String factoryId)
|
||||||
|
{
|
||||||
|
log.trace("remove factoryId: "+factoryId);
|
||||||
|
instancesRegistry.remove(factoryId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,7 +8,9 @@ import java.sql.Date;
|
||||||
import org.gcube.portlets.user.tdwx.server.util.JSONConstants;
|
import org.gcube.portlets.user.tdwx.server.util.JSONConstants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GridJSonBuilder {
|
public class GridJSonBuilder {
|
||||||
|
|
|
@ -10,7 +10,9 @@ import java.sql.Date;
|
||||||
import org.gcube.portlets.user.tdwx.server.util.JSONConstants;
|
import org.gcube.portlets.user.tdwx.server.util.JSONConstants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GridJSonWriter {
|
public class GridJSonWriter {
|
||||||
|
|
|
@ -6,7 +6,9 @@ package org.gcube.portlets.user.tdwx.server.datasource.util;
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TableJSonBuilder extends GridJSonBuilder {
|
public class TableJSonBuilder extends GridJSonBuilder {
|
||||||
|
|
|
@ -9,7 +9,9 @@ import java.io.Writer;
|
||||||
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
import org.gcube.portlets.user.tdwx.shared.model.TableDefinition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TableJSonWriter extends GridJSonWriter {
|
public class TableJSonWriter extends GridJSonWriter {
|
||||||
|
|
|
@ -3,16 +3,18 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.tdwx.server.session;
|
package org.gcube.portlets.user.tdwx.server.session;
|
||||||
|
|
||||||
import org.gcube.portlets.user.tdwx.server.datasource.DataSource;
|
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TDSession {
|
public class TDSession {
|
||||||
|
|
||||||
protected int id;
|
protected int id;
|
||||||
protected DataSource dataSource;
|
protected DataSourceX dataSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id
|
* @param id
|
||||||
|
@ -31,7 +33,7 @@ public class TDSession {
|
||||||
/**
|
/**
|
||||||
* @return the dataSource
|
* @return the dataSource
|
||||||
*/
|
*/
|
||||||
public DataSource getDataSource() {
|
public DataSourceX getDataSource() {
|
||||||
return dataSource;
|
return dataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +47,7 @@ public class TDSession {
|
||||||
/**
|
/**
|
||||||
* @param dataSource the dataSource to set
|
* @param dataSource the dataSource to set
|
||||||
*/
|
*/
|
||||||
public void setDataSource(DataSource dataSource) {
|
public void setDataSource(DataSourceX dataSource) {
|
||||||
this.dataSource = dataSource;
|
this.dataSource = dataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,9 @@ package org.gcube.portlets.user.tdwx.server.session;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TDSessionList {
|
public class TDSessionList {
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
package org.gcube.portlets.user.tdwx.server.util;
|
package org.gcube.portlets.user.tdwx.server.util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class JSONConstants {
|
public class JSONConstants {
|
||||||
|
|
|
@ -8,10 +8,10 @@ import javax.servlet.http.HttpSession;
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
import org.gcube.application.framework.core.session.SessionManager;
|
import org.gcube.application.framework.core.session.SessionManager;
|
||||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
import org.gcube.portlets.user.tdwx.server.datasource.DataSource;
|
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceX;
|
||||||
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceException;
|
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceXException;
|
||||||
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceFactory;
|
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceXFactory;
|
||||||
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceFactoryRegistry;
|
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceXFactoryRegistry;
|
||||||
import org.gcube.portlets.user.tdwx.server.session.TDSession;
|
import org.gcube.portlets.user.tdwx.server.session.TDSession;
|
||||||
import org.gcube.portlets.user.tdwx.server.session.TDSessionList;
|
import org.gcube.portlets.user.tdwx.server.session.TDSessionList;
|
||||||
import org.gcube.portlets.user.tdwx.shared.Constants;
|
import org.gcube.portlets.user.tdwx.shared.Constants;
|
||||||
|
@ -20,7 +20,9 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SessionUtil {
|
public class SessionUtil {
|
||||||
|
@ -54,14 +56,14 @@ public class SessionUtil {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataSource getDataSource(HttpSession httpSession, int tdSessionId)
|
public static DataSourceX getDataSource(HttpSession httpSession, int tdSessionId)
|
||||||
{
|
{
|
||||||
ASLSession session = getSession(httpSession);
|
ASLSession session = getSession(httpSession);
|
||||||
TDSession tdSession = getSession(session, tdSessionId);
|
TDSession tdSession = getSession(session, tdSessionId);
|
||||||
return tdSession.getDataSource();
|
return tdSession.getDataSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDataSource(HttpSession httpSession, int tdSessionId, DataSource datasource)
|
public static void setDataSource(HttpSession httpSession, int tdSessionId, DataSourceX datasource)
|
||||||
{
|
{
|
||||||
ASLSession session = getSession(httpSession);
|
ASLSession session = getSession(httpSession);
|
||||||
TDSession tdSession = getSession(session, tdSessionId);
|
TDSession tdSession = getSession(session, tdSessionId);
|
||||||
|
@ -85,21 +87,21 @@ public class SessionUtil {
|
||||||
return sessions.get(tdSessionId);
|
return sessions.get(tdSessionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataSource openDataSource(HttpSession httpSession, TableId tableId) throws DataSourceException
|
public static DataSourceX openDataSource(HttpSession httpSession, TableId tableId) throws DataSourceXException
|
||||||
{
|
{
|
||||||
DataSourceFactoryRegistry dataSourceFactoryRegistry = DataSourceFactoryRegistry.getInstance();
|
DataSourceXFactoryRegistry dataSourceFactoryRegistry = DataSourceXFactoryRegistry.getInstance();
|
||||||
DataSourceFactory factory = dataSourceFactoryRegistry.get(tableId.getDataSourceFactoryId());
|
DataSourceXFactory factory = dataSourceFactoryRegistry.get(tableId.getDataSourceFactoryId());
|
||||||
if (factory==null) throw new DataSourceException("DataSourceFactory with id "+tableId.getDataSourceFactoryId()+" don't exists");
|
if (factory==null) throw new DataSourceXException("DataSourceFactory with id "+tableId.getDataSourceFactoryId()+" don't exists");
|
||||||
ASLSession session = getSession(httpSession);
|
ASLSession session = getSession(httpSession);
|
||||||
return factory.openDataSource(session, tableId);
|
return factory.openDataSource(session, tableId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void closeDataSource(HttpSession httpSession, int tdSessionId) throws DataSourceException
|
public static void closeDataSource(HttpSession httpSession, int tdSessionId) throws DataSourceXException
|
||||||
{
|
{
|
||||||
DataSource currentDataSource = getDataSource(httpSession, tdSessionId);
|
DataSourceX currentDataSource = getDataSource(httpSession, tdSessionId);
|
||||||
if (currentDataSource != null) {
|
if (currentDataSource != null) {
|
||||||
DataSourceFactoryRegistry dataSourceFactoryRegistry = DataSourceFactoryRegistry.getInstance();
|
DataSourceXFactoryRegistry dataSourceFactoryRegistry = DataSourceXFactoryRegistry.getInstance();
|
||||||
DataSourceFactory factory = dataSourceFactoryRegistry.get(currentDataSource.getDataSourceFactoryId());
|
DataSourceXFactory factory = dataSourceFactoryRegistry.get(currentDataSource.getDataSourceFactoryId());
|
||||||
ASLSession session = getSession(httpSession);
|
ASLSession session = getSession(httpSession);
|
||||||
factory.closeDataSource(session, currentDataSource);
|
factory.closeDataSource(session, currentDataSource);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
package org.gcube.portlets.user.tdwx.shared;
|
package org.gcube.portlets.user.tdwx.shared;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
|
@ -15,6 +16,7 @@ public class Constants {
|
||||||
public final static String VERSION = "1.0.0";
|
public final static String VERSION = "1.0.0";
|
||||||
public final static String DEFAULT_USER = "giancarlo.panichi";
|
public final static String DEFAULT_USER = "giancarlo.panichi";
|
||||||
public final static String DEFAULT_SCOPE = "/gcube/devsec";
|
public final static String DEFAULT_SCOPE = "/gcube/devsec";
|
||||||
|
public final static String REMOTE_SERVICE_RELATIVE_PATH= "tdwx";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
package org.gcube.portlets.user.tdwx.shared;
|
package org.gcube.portlets.user.tdwx.shared;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ServletParameters {
|
public class ServletParameters {
|
||||||
|
|
|
@ -7,8 +7,10 @@ import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes a column in the widget model.
|
*
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public class ColumnDefinition implements Serializable {
|
public class ColumnDefinition implements Serializable {
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,9 @@ package org.gcube.portlets.user.tdwx.shared.model;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ColumnKey implements Serializable {
|
public class ColumnKey implements Serializable {
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
package org.gcube.portlets.user.tdwx.shared.model;
|
package org.gcube.portlets.user.tdwx.shared.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum ColumnType {
|
public enum ColumnType {
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
package org.gcube.portlets.user.tdwx.shared.model;
|
package org.gcube.portlets.user.tdwx.shared.model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DataRow {
|
public class DataRow {
|
||||||
|
|
|
@ -10,8 +10,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes a table in the widget model.
|
*
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TableDefinition implements Serializable {
|
public class TableDefinition implements Serializable {
|
||||||
|
|
|
@ -6,7 +6,9 @@ package org.gcube.portlets.user.tdwx.shared.model;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TableId implements Serializable {
|
public class TableId implements Serializable {
|
||||||
|
|
|
@ -6,7 +6,9 @@ package org.gcube.portlets.user.tdwx.shared.model;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum ValueType implements Serializable {
|
public enum ValueType implements Serializable {
|
||||||
|
|
|
@ -9,7 +9,9 @@ import org.gcube.portlets.user.tdwx.server.datasource.util.GridJSonBuilder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TestGridJSonBuilder {
|
public class TestGridJSonBuilder {
|
||||||
|
|
|
@ -18,7 +18,9 @@ import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TestSpeed {
|
public class TestSpeed {
|
||||||
|
|
|
@ -14,7 +14,9 @@ import org.gcube.portlets.user.tdwx.shared.model.ValueType;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TestTableJSonBuilder {
|
public class TestTableJSonBuilder {
|
||||||
|
|
|
@ -17,7 +17,9 @@ import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TestTableJSonWriter {
|
public class TestTableJSonWriter {
|
||||||
|
|
Loading…
Reference in New Issue