Updated to DataMiner service

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@133853 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-11-03 11:31:43 +00:00
parent a00fc87c91
commit f2757b816d
17 changed files with 1119 additions and 1128 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/databases-manager-portlet-1.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/databases-manager-portlet-1.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -25,5 +25,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/databases-manager-portlet-1.5.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/databases-manager-portlet-1.6.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -4,6 +4,9 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="data-miner-manager-cl-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/data-miner-manager-cl/data-miner-manager-cl">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="databases-manager-portlet"/>
</wb-module>

View File

@ -1,4 +1,8 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets.user.databases-manager-portlet.1-6-0"
date="2016-12-01">
<Change>Porting to DataMiner service</Change>
</Changeset>
<Changeset component="org.gcube.portlets.user.databases-manager-portlet.1-5-0"
date="2016-10-01">
<Change>Updated dependencies</Change>

71
pom.xml
View File

@ -15,14 +15,14 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>databases-manager-portlet</artifactId>
<packaging>war</packaging>
<version>1.5.0-SNAPSHOT</version>
<version>1.6.0-SNAPSHOT</version>
<name>DatabasesResourceManagerPortlet</name>
<description>Databases Resource Manager Portlet</description>
<scm>
<url>https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet</url>
</scm>
<developers>
<developer>
<name>Giancarlo Panichi</name>
@ -45,7 +45,7 @@
<gwtLogVersion>3.3.2</gwtLogVersion>
<gxtVersion>3.1.1</gxtVersion>
<gxt2Version>2.6.1</gxt2Version>
<KEYS>${env.KEYS}</KEYS>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -66,36 +66,23 @@
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
</dependency>
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>gxt2.2.5-gwt2.X</artifactId>
<version>${gxt2Version}</version>
</dependency>
<!--
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</scope>
</dependency> -->
<!--
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope</artifactId>
</dependency>
-->
<!-- <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId>
<version>1.0.0.GA</version> <scope>test</scope> </dependency> <dependency>
<groupId>javax.validation</groupId> <artifactId>validation-api</artifactId>
<version>1.0.0.GA</version> <classifier>sources</classifier> <scope>test</scope>
</dependency> -->
<!-- <dependency> <groupId>org.gcube.core</groupId> <artifactId>common-scope</artifactId>
</dependency> -->
<!-- Portlet -->
<dependency>
<groupId>javax.portlet</groupId>
@ -147,7 +134,7 @@
<artifactId>gcube-widgets</artifactId>
<scope>compile</scope>
</dependency>
<!-- Session Checker -->
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
@ -169,18 +156,19 @@
</dependency>
<!-- Statistical -->
<!-- Statistical <dependency> <groupId>org.gcube.data.analysis</groupId>
<artifactId>statistical-manager-cl</artifactId> <version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
</dependency> <dependency> <groupId>org.gcube.core</groupId> <artifactId>common-fw-clients</artifactId>
</dependency> -->
<!-- data-miner-manager-cl -->
<dependency>
<groupId>org.gcube.data.analysis</groupId>
<artifactId>statistical-manager-cl</artifactId>
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
<groupId>data-miner-manager-cl</groupId>
<artifactId>data-miner-manager-cl</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-fw-clients</artifactId>
<!-- <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
</dependency>
<!-- Jakarta RegExp -->
<dependency>
@ -190,6 +178,8 @@
<scope>compile</scope>
</dependency>
<!-- <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId>
<version>2.8.0</version> <scope>provided</scope> </dependency> -->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
@ -197,6 +187,7 @@
<scope>provided</scope>
</dependency>
<!-- Uri Resolver Manager -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>
@ -226,7 +217,7 @@
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
@ -248,7 +239,7 @@
</repository>
</repositories>
<build>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>

View File

@ -11,7 +11,7 @@ import com.google.gwt.user.client.ui.RootPanel;
import org.gcube.portlets.user.databasesmanager.client.panels.GxtBorderLayoutPanel;
import org.gcube.portlets.user.databasesmanager.client.resources.Resources;
import org.gcube.portlets.user.databasesmanager.shared.ConstantsPortlet;
import org.gcube.portlets.user.databasesmanager.shared.Constants;
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
/**
@ -49,7 +49,7 @@ public class DatabasesManager implements EntryPoint {
try {
borderLayout = new GxtBorderLayoutPanel(eventBus, service);
RootPanel.get(ConstantsPortlet.CONTENTDIV).add(borderLayout);
RootPanel.get(Constants.CONTENTDIV).add(borderLayout);
Window.addResizeHandler(new ResizeHandler() {
@Override
@ -76,7 +76,7 @@ public class DatabasesManager implements EntryPoint {
*/
public void updateSize() {
RootPanel rootPanel = RootPanel.get(ConstantsPortlet.CONTENTDIV);
RootPanel rootPanel = RootPanel.get(Constants.CONTENTDIV);
int topBorder = rootPanel.getAbsoluteTop();

View File

@ -11,15 +11,17 @@ public class Parameter implements Serializable {
private String objectType;
private String defaultValue;
public Parameter(String paramName, String paramDescription,
public Parameter(String name, String paramDescription,
String objectType, String defaultValue) {
this.setName(paramName);
this.setParamDescription(paramDescription);
this.setObjectType(objectType);
this.setDefaultValue(defaultValue);
super();
this.name=name;
this.paramDescription=paramDescription;
this.objectType=objectType;
this.defaultValue=defaultValue;
}
public Parameter() {
super();
}
public String getValue() {
@ -61,4 +63,14 @@ public class Parameter implements Serializable {
public String getDefaultValue() {
return defaultValue;
}
@Override
public String toString() {
return "Parameter [value=" + value + ", name=" + name
+ ", paramDescription=" + paramDescription + ", objectType="
+ objectType + ", defaultValue=" + defaultValue + "]";
}
}

View File

@ -3,7 +3,7 @@ package org.gcube.portlets.user.databasesmanager.client.datamodel;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.databasesmanager.shared.ConstantsPortlet;
import org.gcube.portlets.user.databasesmanager.shared.Constants;
import com.extjs.gxt.ui.client.data.BaseModelData;
@ -31,9 +31,9 @@ public class SQLDialect extends BaseModelData {
public static List<SQLDialect> loadData() {
List<SQLDialect> dialects = new ArrayList<SQLDialect>();
SQLDialect element1 = new SQLDialect(ConstantsPortlet.NONE);
SQLDialect element2 = new SQLDialect(ConstantsPortlet.POSTGRES);
SQLDialect element3 = new SQLDialect(ConstantsPortlet.MYSQL);
SQLDialect element1 = new SQLDialect(Constants.NONE);
SQLDialect element2 = new SQLDialect(Constants.POSTGRES);
SQLDialect element3 = new SQLDialect(Constants.MYSQL);
dialects.add(element1);
dialects.add(element2);

View File

@ -31,7 +31,7 @@ import org.gcube.portlets.user.databasesmanager.client.events.interfaces.SmartSa
import org.gcube.portlets.user.databasesmanager.client.events.interfaces.SubmitQueryEventHandler;
import org.gcube.portlets.user.databasesmanager.client.resources.Images;
import org.gcube.portlets.user.databasesmanager.client.toolbar.GxtToolbarFunctionality;
import org.gcube.portlets.user.databasesmanager.shared.ConstantsPortlet;
import org.gcube.portlets.user.databasesmanager.shared.Constants;
import org.gcube.portlets.user.databasesmanager.shared.SessionExpiredException;
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
@ -363,7 +363,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
dataInput.put("ResourceName", resource);
dataInput.put("DatabaseName", database);
dataInput.put("SchemaName", "");
elementType = ConstantsPortlet.DATABASE;
elementType = Constants.DATABASE;
} else { // the selected item is a schema
rootLogger.log(Level.INFO, "selected element is a schema ");
FileModel db = treePanel.getTreeStore().getParent(element);
@ -374,7 +374,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
dataInput.put("ResourceName", resource);
dataInput.put("DatabaseName", database);
dataInput.put("SchemaName", schema);
elementType = ConstantsPortlet.SCHEMA;
elementType = Constants.SCHEMA;
}
// print check
@ -837,13 +837,13 @@ public class GxtBorderLayoutPanel extends ContentPanel {
"determined Dialect for smart correction: " + dialect);
}
}
String language = ConstantsPortlet.NONE;
String language = Constants.NONE;
if (dialect.toUpperCase().contains(ConstantsPortlet.POSTGRES)) {
language = ConstantsPortlet.POSTGRES;
if (dialect.toUpperCase().contains(Constants.POSTGRES)) {
language = Constants.POSTGRES;
}
if (dialect.toUpperCase().contains(ConstantsPortlet.MYSQL)) {
language = ConstantsPortlet.MYSQL;
if (dialect.toUpperCase().contains(Constants.MYSQL)) {
language = Constants.MYSQL;
}
rootLogger.log(Level.INFO, "Dialect used for smart correction: "
+ language);
@ -1329,7 +1329,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "SchemaName: " + "");
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
elementType = ConstantsPortlet.DATABASE;
elementType = Constants.DATABASE;
} else {
// the table has a schema because the selected item is a schema
schema = selectedItem;
@ -1346,7 +1346,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
elementType = ConstantsPortlet.SCHEMA;
elementType = Constants.SCHEMA;
}
// to mask the entire content panel
@ -1453,7 +1453,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
rootLogger.log(Level.INFO, "SchemaName: " + "");
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
elementType = ConstantsPortlet.DATABASE;
elementType = Constants.DATABASE;
} else {
// the table has a schema
schema = selectedItem;
@ -1469,7 +1469,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
elementType = ConstantsPortlet.SCHEMA;
elementType = Constants.SCHEMA;
}
// to mask the entire content panel
obj.mask("Sampling the table", "x-mask-loading");
@ -1571,7 +1571,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
rootLogger.log(Level.INFO, "SchemaName: " + "");
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
elementType = ConstantsPortlet.DATABASE;
elementType = Constants.DATABASE;
} else {
// the table has a schema
schema = selectedItem;
@ -1587,7 +1587,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
rootLogger.log(Level.INFO, "DatabaseName: " + database.getName());
rootLogger.log(Level.INFO, "SchemaName: " + schema.getName());
rootLogger.log(Level.INFO, "TableName: " + currentselectedTable);
elementType = ConstantsPortlet.SCHEMA;
elementType = Constants.SCHEMA;
}
// to mask the entire content panel

View File

@ -32,7 +32,7 @@ import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import org.gcube.portlets.user.databasesmanager.client.datamodel.GeneralOutputFromServlet;
import org.gcube.portlets.user.databasesmanager.shared.ConstantsPortlet;
import org.gcube.portlets.user.databasesmanager.shared.Constants;
import org.gcube.portlets.user.databasesmanager.shared.SessionExpiredException;
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
@ -291,7 +291,7 @@ public class GxtTreePanel extends LayoutContainer {
case 3: // the selected item is a database
if (selectedItem.getDatabaseType().equals(
ConstantsPortlet.POSTGRES)) {
Constants.POSTGRES)) {
// to mask the tree panel
treePanel.mask("Loading", "x-mask-loading");
// load schema
@ -468,13 +468,13 @@ public class GxtTreePanel extends LayoutContainer {
DBInfo.add(row);
if (driver.toUpperCase().contains(
ConstantsPortlet.POSTGRES)) {
DatabaseType = ConstantsPortlet.POSTGRES;
Constants.POSTGRES)) {
DatabaseType = Constants.POSTGRES;
}
if (driver.toUpperCase().contains(
ConstantsPortlet.MYSQL)) {
DatabaseType = ConstantsPortlet.MYSQL;
Constants.MYSQL)) {
DatabaseType = Constants.MYSQL;
}
}
@ -512,14 +512,14 @@ public class GxtTreePanel extends LayoutContainer {
child.setDatabaseType(DatabaseType);
if (DatabaseType
.equals(ConstantsPortlet.MYSQL)) {
child.setDatabaseType(ConstantsPortlet.MYSQL);
.equals(Constants.MYSQL)) {
child.setDatabaseType(Constants.MYSQL);
child.setIsExpanded(false);
treePanel.setExpanded(child, false);
}
if (DatabaseType
.equals(ConstantsPortlet.POSTGRES)) {
child.setDatabaseType(ConstantsPortlet.POSTGRES);
.equals(Constants.POSTGRES)) {
child.setDatabaseType(Constants.POSTGRES);
}
children.add(child);
}
@ -722,16 +722,16 @@ public class GxtTreePanel extends LayoutContainer {
String value;
if (Depth == 1) { // root tree
elementType = ConstantsPortlet.RESOURCESLIST;
value = ConstantsPortlet.RESOURCESLIST;
elementType = Constants.RESOURCESLIST;
value = Constants.RESOURCESLIST;
inputData.put(value, value);
} else if (Depth == 2) { // resource
elementType = ConstantsPortlet.RESOURCE;
elementType = Constants.RESOURCE;
value = selectedItem.getName();
inputData.put("ResourceName", value);
} else if (Depth == 3) { // database
elementType = ConstantsPortlet.DATABASE;
elementType = Constants.DATABASE;
String database = selectedItem.getName();
// get the database type
// String dbType = selectedItem.getDatabaseType();
@ -740,7 +740,7 @@ public class GxtTreePanel extends LayoutContainer {
if (selectedItem.getDatabaseType() != null
&& (selectedItem.getDatabaseType()
.equals(ConstantsPortlet.POSTGRES))) { // refresh
.equals(Constants.POSTGRES))) { // refresh
// schema
// list and
// query
@ -750,7 +750,7 @@ public class GxtTreePanel extends LayoutContainer {
}
if (selectedItem.getDatabaseType() != null
&& (selectedItem.getDatabaseType()
.equals(ConstantsPortlet.MYSQL))) { // refresh
.equals(Constants.MYSQL))) { // refresh
// tables list,
// query
// executed and
@ -762,7 +762,7 @@ public class GxtTreePanel extends LayoutContainer {
} else if (Depth == 4) { // Schema. Refresh tables list, query executed
// and samplings
elementType = ConstantsPortlet.SCHEMA;
elementType = Constants.SCHEMA;
String schema = selectedItem.getName();
FileModel db = store.getParent(selectedItem);
String database = db.getName();
@ -812,7 +812,7 @@ public class GxtTreePanel extends LayoutContainer {
removeChildren(selectedItem);
tree.layout(true);
if (elemType.equals(ConstantsPortlet.RESOURCESLIST)) {
if (elemType.equals(Constants.RESOURCESLIST)) {
List<FileModel> output = new ArrayList<FileModel>();
output = result.getListOutput();
@ -828,7 +828,7 @@ public class GxtTreePanel extends LayoutContainer {
selectedItem.setIsLoaded(true);
} else if (elemType.equals(ConstantsPortlet.RESOURCE)) {
} else if (elemType.equals(Constants.RESOURCE)) {
LinkedHashMap<String, FileModel> output = new LinkedHashMap<String, FileModel>();
output = result.getMapOutput();
@ -898,15 +898,15 @@ public class GxtTreePanel extends LayoutContainer {
if (driver
.toUpperCase()
.contains(
ConstantsPortlet.POSTGRES)) {
DatabaseType = ConstantsPortlet.POSTGRES;
Constants.POSTGRES)) {
DatabaseType = Constants.POSTGRES;
}
if (driver
.toUpperCase()
.contains(
ConstantsPortlet.MYSQL)) {
DatabaseType = ConstantsPortlet.MYSQL;
Constants.MYSQL)) {
DatabaseType = Constants.MYSQL;
}
}
@ -949,7 +949,7 @@ public class GxtTreePanel extends LayoutContainer {
child.setDatabaseType(DatabaseType);
if (DatabaseType
.equals(ConstantsPortlet.MYSQL)) {
.equals(Constants.MYSQL)) {
child.setIsExpanded(false);
treePanel.setExpanded(child,
false);
@ -971,7 +971,7 @@ public class GxtTreePanel extends LayoutContainer {
selectedItem.setIsLoaded(true);
} else if (elemType.equals(ConstantsPortlet.DATABASE)) {
} else if (elemType.equals(Constants.DATABASE)) {
List<FileModel> output = new ArrayList<FileModel>();
output = result.getListOutput();

View File

@ -20,7 +20,7 @@ import org.gcube.portlets.user.databasesmanager.client.events.interfaces.Selecte
import org.gcube.portlets.user.databasesmanager.client.events.interfaces.SelectedTableEventHandler;
import org.gcube.portlets.user.databasesmanager.client.form.GxtFormSubmitQuery;
import org.gcube.portlets.user.databasesmanager.client.utils.UIDGenerator;
import org.gcube.portlets.user.databasesmanager.shared.ConstantsPortlet;
import org.gcube.portlets.user.databasesmanager.shared.Constants;
import org.gcube.portlets.user.databasesmanager.shared.SessionExpiredException;
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
@ -101,7 +101,7 @@ public class GxtToolbarFunctionality {
// setLayout(new FlowLayout(10));
// Button for tables list
btnTablesList = new Button(ConstantsPortlet.TABLESLIST);
btnTablesList = new Button(Constants.TABLESLIST);
// btnSubmitQuery.setIcon(Resources.ICONS.text());
btnTablesList.setScale(ButtonScale.SMALL);
btnTablesList.setArrowAlign(ButtonArrowAlign.BOTTOM);
@ -110,7 +110,7 @@ public class GxtToolbarFunctionality {
toolBar.add(btnTablesList);
// Button for Submit Query
btnSubmitQuery = new Button(ConstantsPortlet.SUBMITQUERY);
btnSubmitQuery = new Button(Constants.SUBMITQUERY);
// btnSubmitQuery.setIcon(Resources.ICONS.text());
btnSubmitQuery.setScale(ButtonScale.SMALL);
btnSubmitQuery.setArrowAlign(ButtonArrowAlign.BOTTOM);
@ -119,7 +119,7 @@ public class GxtToolbarFunctionality {
toolBar.add(btnSubmitQuery);
// Button to get the "show create table"
btnShowCreateTable = new Button(ConstantsPortlet.TABLEDETAILS);
btnShowCreateTable = new Button(Constants.TABLEDETAILS);
btnShowCreateTable.setScale(ButtonScale.SMALL);
btnShowCreateTable.setArrowAlign(ButtonArrowAlign.BOTTOM);
btnShowCreateTable
@ -128,14 +128,14 @@ public class GxtToolbarFunctionality {
toolBar.add(new SeparatorToolItem());
// Button for Simple Sample
btnSimpleSample = new Button(ConstantsPortlet.SAMPLING);
btnSimpleSample = new Button(Constants.SAMPLING);
btnSimpleSample.setScale(ButtonScale.SMALL);
btnSimpleSample.setArrowAlign(ButtonArrowAlign.BOTTOM);
btnSimpleSample.setToolTip("retrieves the first 100 rows of the table");
toolBar.add(btnSimpleSample);
// Button for Smart Sample
btnSmartSample = new Button(ConstantsPortlet.SMARTSAMPLING);
btnSmartSample = new Button(Constants.SMARTSAMPLING);
btnSmartSample.setScale(ButtonScale.SMALL);
btnSmartSample.setArrowAlign(ButtonArrowAlign.BOTTOM);
btnSmartSample
@ -143,7 +143,7 @@ public class GxtToolbarFunctionality {
toolBar.add(btnSmartSample);
// button for Random Sample
btnRandomSample = new Button(ConstantsPortlet.RANDOMSAMPLING);
btnRandomSample = new Button(Constants.RANDOMSAMPLING);
btnRandomSample.setScale(ButtonScale.SMALL);
btnRandomSample.setArrowAlign(ButtonArrowAlign.BOTTOM);
btnRandomSample
@ -152,7 +152,7 @@ public class GxtToolbarFunctionality {
toolBar.add(new SeparatorToolItem());
// button for Random Sample
btnRefresCachedData = new Button(ConstantsPortlet.REFRESHCACHEDDATA);
btnRefresCachedData = new Button(Constants.REFRESHCACHEDDATA);
btnRefresCachedData.setScale(ButtonScale.SMALL);
btnRefresCachedData.setArrowAlign(ButtonArrowAlign.BOTTOM);
btnRefresCachedData.setToolTip("refreshes data");
@ -494,7 +494,7 @@ public class GxtToolbarFunctionality {
case 3:
if ((databaseType != null)
&& (databaseType.equals(ConstantsPortlet.MYSQL))) {
&& (databaseType.equals(Constants.MYSQL))) {
btnTablesList.enable();
btnSubmitQuery.enable();
btnRefresCachedData.enable();
@ -506,7 +506,7 @@ public class GxtToolbarFunctionality {
}
if ((databaseType != null)
&& (databaseType.equals(ConstantsPortlet.POSTGRES))) {
&& (databaseType.equals(Constants.POSTGRES))) {
btnTablesList.disable();
btnSubmitQuery.enable();
btnRefresCachedData.enable();
@ -632,7 +632,7 @@ public class GxtToolbarFunctionality {
String query = "";
if (tableInfo.isDatabase()) {
if (tableInfo.getDatabaseType().equals(ConstantsPortlet.MYSQL)) {
if (tableInfo.getDatabaseType().equals(Constants.MYSQL)) {
String dbName = tableInfo.getDatabaseName();
// the full name equal to "dbname.tablename"

View File

@ -1,124 +1,72 @@
package org.gcube.portlets.user.databasesmanager.server.util;
import java.util.concurrent.TimeUnit;
import java.util.HashMap;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.data.analysis.statisticalmanager.proxies.StatisticalManagerDSL;
import org.gcube.data.analysis.statisticalmanager.proxies.StatisticalManagerDataSpace;
import org.gcube.data.analysis.statisticalmanager.proxies.StatisticalManagerFactory;
import org.gcube.data.analysis.dataminermanagercl.server.DataMinerService;
import org.gcube.data.analysis.dataminermanagercl.server.dmservice.SClient;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portlets.user.databasesmanager.shared.Constants;
import org.gcube.portlets.user.databasesmanager.shared.SessionExpiredException;
public class SessionUtil {
protected static Logger logger = Logger.getLogger(SessionUtil.class);
public static final String TEST_USER = "test.user";
public static final String USER = "database.manager";
public static ASLSession getAslSession(HttpSession httpSession) {
String sessionID = httpSession.getId();
String user = (String) httpSession
.getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
if (user == null) {
// user = "loredana.liccardo";
user = USER;
httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, user);
ScopeProvider.instance.set("/gcube/devsec/devVRE");
ASLSession session = SessionManager.getInstance().getASLSession(
sessionID, user);
session.setScope("/gcube/devsec/devVRE");
return session;
// return null;
} else {
logger.trace("user found in session " + user);
}
ASLSession session = SessionManager.getInstance().getASLSession(
sessionID, user);
return session;
}
private static Logger logger = Logger.getLogger(SessionUtil.class);
//public static final String TEST_USER = "test.user";
//public static final String USER = "database.manager";
public static boolean isSessionExpired(HttpSession httpSession) throws Exception {
logger.info("session validating...");
//reading username from asl session
String userUsername = getAslSession(httpSession).getUsername();
/*COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/
if(userUsername.compareToIgnoreCase(USER)==0){
logger.error("session is expired! username is: "+SessionUtil.USER);
return true; //is USER, session is expired
}
if(userUsername.compareToIgnoreCase(TEST_USER)==0){
logger.error("session is expired! username is: "+SessionUtil.TEST_USER);
return true; //is TEST_USER, session is expired
public static ASLSession getASLSession(HttpSession httpSession)
throws Exception {
String username = (String) httpSession
.getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
ASLSession aslSession;
if (username == null) {
if (Constants.DEBUG_MODE) {
logger.info("no user found in session, use test user");
// Remove comment for Test
username = Constants.DEFAULT_USER;
String scope = Constants.DEFAULT_SCOPE;
httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE,
username);
aslSession = SessionManager.getInstance().getASLSession(
httpSession.getId(), username);
aslSession.setScope(scope);
} else {
logger.info("No user found in session");
throw new SessionExpiredException();
}
} else {
aslSession = SessionManager.getInstance().getASLSession(
httpSession.getId(), username);
}
logger.info("session is valid! current username is: "+userUsername);
return false;
logger.info("SessionUtil: aslSession " + aslSession.getUsername() + " "
+ aslSession.getScope());
return aslSession;
}
public static StatisticalManagerFactory getFactory(HttpSession httpSession) {
ASLSession session = getAslSession(httpSession);
return getFactory(session);
}
public static String getToken(ASLSession aslSession) throws Exception {
String token = null;
if (Constants.DEBUG_MODE) {
token = Constants.DEFAULT_TOKEN;
} else {
token = aslSession.getSecurityToken();
}
logger.info("received token: " + token);
return token;
public static StatisticalManagerFactory getFactory(ASLSession session) {
ScopeProvider.instance.set(session.getScope());
return getFactory(session.getScope());
}
public static StatisticalManagerFactory getFactory(String scope) {
ScopeProvider.instance.set(scope.toString());
return StatisticalManagerDSL.createStateful()
.withTimeout(5, TimeUnit.MINUTES).build(); // IS
}
public static StatisticalManagerDataSpace getDataSpaceService(
HttpSession httpSession) {
ASLSession session = getAslSession(httpSession);
return getDataSpaceService(session);
}
public static StatisticalManagerDataSpace getDataSpaceService(
ASLSession session) {
ScopeProvider.instance.set(getScope(session));
return StatisticalManagerDSL.dataSpace()
.withTimeout(5, TimeUnit.MINUTES).build();
}
public static String getUsername(HttpSession httpSession) {
ASLSession session = getAslSession(httpSession);
return getUsername(session);
}
private static String getUsername(ASLSession session) {
return session.getUsername();
}
public static String getScope(HttpSession httpSession) {
ASLSession session = getAslSession(httpSession);
return getScope(session);
}
private static String getScope(ASLSession session) {
return session.getScope().toString();
}
}
}

View File

@ -0,0 +1,67 @@
package org.gcube.portlets.user.databasesmanager.shared;
import java.util.Arrays;
import java.util.List;
/**
*
*
*/
public enum AlgorithmsName {
LISTDBNAMES("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.LISTDBNAMES"),
LISTDBINFO("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.LISTDBINFO"),
LISTDBSCHEMA("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.LISTDBSCHEMA"),
LISTTABLES("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.LISTTABLES"),
GETTABLEDETAILS("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.GETTABLEDETAILS"),
SUBMITQUERY("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.SUBMITQUERY"),
SAMPLEONTABLE("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.SAMPLEONTABLE"),
SMARTSAMPLEONTABLE("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.SMARTSAMPLEONTABLE"),
RANDOMSAMPLEONTABLE("org.gcube.dataanalysis.wps.statisticalmanager.synchserver.mappedclasses.transducerers.RANDOMSAMPLEONTABLE");
/**
* @param text
*/
private AlgorithmsName(final String fullPackageName) {
this.fullPackageName = fullPackageName;
}
private final String fullPackageName;
@Override
public String toString() {
return fullPackageName;
}
public String getFullPackageName() {
return fullPackageName;
}
public String getId() {
return name();
}
/**
*
* @param fullPackageName
* @return
*/
public static AlgorithmsName getFromFullPackageName(String fullPackageName) {
if (fullPackageName == null || fullPackageName.isEmpty())
return null;
for (AlgorithmsName type : values()) {
if (type.fullPackageName.compareToIgnoreCase(fullPackageName) == 0) {
return type;
}
}
return null;
}
public static List<AlgorithmsName> asList() {
List<AlgorithmsName> list = Arrays.asList(values());
return list;
}
}

View File

@ -0,0 +1,54 @@
package org.gcube.portlets.user.databasesmanager.shared;
public class Constants {
public static final boolean DEBUG_MODE = false;
public static final boolean TEST_ENABLE = false;
public static final String DEFAULT_USER = "giancarlo.panichi";
public final static String DEFAULT_SCOPE = "/gcube/devNext";
public final static String DEFAULT_TOKEN = "16e65d4f-11e0-4e4a-84b9-351688fccc12-98187548";
// SClientMap
public static final String SClientMap = "DataMinerClientMap";
// Div Gwt
public static final String CONTENTDIV = "contentDiv";
// Toolbar button
public static final String TABLESLIST = "Tables List";
public static final String SUBMITQUERY = "Submit Query";
public static final String GETINFO = "Get Info";
public static final String TABLEDETAILS = "Table Details";
public static final String SAMPLING = "Sampling";
public static final String SMARTSAMPLING = "Smart Sampling";
public static final String RANDOMSAMPLING = "Random Sampling";
public static final String REFRESHCACHEDDATA = "Refresh Data";
// sql Dialects
public static final String POSTGRES = "POSTGRES";
public static final String MYSQL = "MYSQL";
public static final String NONE = "NONE";
// element types
// public static final String DATABASE="Database";
// public static final String SCHEMA="Schema";
// elements type
public static final String RESOURCESLIST = "ResourcesList";
public static final String RESOURCE = "resource";
public static final String DATABASE = "database";
public static final String SCHEMA = "schema";
// algorithmID
/*
public static final String ALGID_GETRESOURCE = "LISTDBNAMES";
public static final String ALGID_GETDBINFO = "LISTDBINFO";
public static final String ALGID_GETDBSCHEMA = "LISTDBSCHEMA";
public static final String ALGID_GETTABLES = "LISTTABLES";
public static final String ALGID_GETTABLEDETAILS = "GETTABLEDETAILS";
public static final String ALGID_SUBMITQUERY = "SUBMITQUERY";
public static final String ALGID_SAMPLEONTABLE = "SAMPLEONTABLE";
public static final String ALGID_SMARTSAMPLEONTABLE = "SMARTSAMPLEONTABLE";
public static final String ALGID_RANDOMSAMPLEONTABLE = "RANDOMSAMPLEONTABLE";
*/
}

View File

@ -1,43 +0,0 @@
package org.gcube.portlets.user.databasesmanager.shared;
public class ConstantsPortlet {
// Div Gwt
public static final String CONTENTDIV = "contentDiv";
//Toolbar button
public static final String TABLESLIST = "Tables List";
public static final String SUBMITQUERY = "Submit Query";
public static final String GETINFO = "Get Info";
public static final String TABLEDETAILS = "Table Details";
public static final String SAMPLING = "Sampling";
public static final String SMARTSAMPLING = "Smart Sampling";
public static final String RANDOMSAMPLING = "Random Sampling";
public static final String REFRESHCACHEDDATA = "Refresh Data";
//sql Dialects
public static final String POSTGRES = "POSTGRES";
public static final String MYSQL = "MYSQL";
public static final String NONE = "NONE";
//element types
// public static final String DATABASE="Database";
// public static final String SCHEMA="Schema";
//algorithmID
public static final String ALGID_GETRESOURCE="LISTDBNAMES";
public static final String ALGID_GETDBINFO="LISTDBINFO";
public static final String ALGID_GETDBSCHEMA="LISTDBSCHEMA";
public static final String ALGID_GETTABLES="LISTTABLES";
public static final String ALGID_GETTABLEDETAILS="GETTABLEDETAILS";
public static final String ALGID_SUBMITQUERY="SUBMITQUERY";
public static final String ALGID_SAMPLEONTABLE="SAMPLEONTABLE";
public static final String ALGID_SMARTSAMPLEONTABLE="SMARTSAMPLEONTABLE";
public static final String ALGID_RANDOMSAMPLEONTABLE="RANDOMSAMPLEONTABLE";
//elements type
public static final String RESOURCESLIST="ResourcesList";
public static final String RESOURCE="resource";
public static final String DATABASE="database";
public static final String SCHEMA="schema";
}

View File

@ -1,9 +1,11 @@
package org.gcube.portlets.user.databasesmanager.client.datamodel;
package org.gcube.portlets.user.databasesmanager.shared.computation;
import java.io.Serializable;
import java.util.LinkedHashMap;
public class ComputationOutput {
public class ComputationOutput implements Serializable {
private static final long serialVersionUID = -5508917907248426765L;
private LinkedHashMap<String, String> mapValues;
private LinkedHashMap<String, String> mapKeys;
private String urlFile;
@ -12,7 +14,7 @@ public class ComputationOutput {
public ComputationOutput() {
mapKeys = new LinkedHashMap<String, String>();
mapValues = new LinkedHashMap<String, String>();
urlFile="";
urlFile = "";
}
public void setMapValues(LinkedHashMap<String, String> mapValues) {
@ -30,20 +32,28 @@ public class ComputationOutput {
public LinkedHashMap<String, String> getmapKeys() {
return mapKeys;
}
public void setUrlFile(String url){
this.urlFile=url;
public void setUrlFile(String url) {
this.urlFile = url;
}
public String getUrlFile(){
public String getUrlFile() {
return this.urlFile;
}
public void setSubmitQueryTotalRows(int val){
public void setSubmitQueryTotalRows(int val) {
this.submitQueryTotalRows = val;
}
public int getSubmitQueryTotalRows(){
public int getSubmitQueryTotalRows() {
return this.submitQueryTotalRows;
}
@Override
public String toString() {
return "ComputationOutput [mapValues=" + mapValues + ", mapKeys="
+ mapKeys + ", urlFile=" + urlFile + ", submitQueryTotalRows="
+ submitQueryTotalRows + "]";
}
}

View File

@ -0,0 +1,10 @@
./addAlgorithm.sh LISTDBINFO DATABASES org.gcube.dataaccess.algorithms.drmalgorithms.ListDBInfo /gcube/devNext/NextNext transducerers N k "legacy algorithm"
./addAlgorithm.sh LISTDBNAMES DATABASES org.gcube.dataaccess.algorithms.drmalgorithms.ListNames /gcube/devNext/NextNext transducerers N k "legacy algorithm"
./addAlgorithm.sh LISTDBSCHEMA DATABASES org.gcube.dataaccess.algorithms.drmalgorithms.ListSchemas /gcube/devNext/NextNext transducerers N k "legacy algorithm"
./addAlgorithm.sh LISTTABLES DATABASES org.gcube.dataaccess.algorithms.drmalgorithms.ListTables /gcube/devNext/NextNext transducerers N k "legacy algorithm"
./addAlgorithm.sh GETTABLEDETAILS DATABASES org.gcube.dataaccess.algorithms.drmalgorithms.GetTableDetails /gcube/devNext/NextNext transducerers N k "legacy algorithm"
./addAlgorithm.sh SUBMITQUERY DATABASES org.gcube.dataaccess.algorithms.drmalgorithms.SubmitQuery /gcube/devNext/NextNext transducerers N k "legacy algorithm"
./addAlgorithm.sh RANDOMSAMPLEONTABLE DATABASES org.gcube.dataaccess.algorithms.drmalgorithms.RandomSampleOnTable /gcube/devNext/NextNext transducerers N k "legacy algorithm"
./addAlgorithm.sh SAMPLEONTABLE DATABASES org.gcube.dataaccess.algorithms.drmalgorithms.SampleOnTable /gcube/devNext/NextNext transducerers N k "legacy algorithm"
./addAlgorithm.sh SMARTSAMPLEONTABLE DATABASES org.gcube.dataaccess.algorithms.drmalgorithms.SmartSampleOnTable /gcube/devNext/NextNext transducerers N k "legacy algorithm"