refs 6548: TDM - Migrate TabMan to new PortalContext
Task-Url: https://support.d4science.org/issues/6548 Updated to new PortalContext git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-mainbox-widget@141743 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
776af9223c
commit
1b1e0a48f8
|
@ -1,4 +1,7 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
|
<Changeset component="org.gcube.portlets-user.tabular-data-mainbox-widget.1-5-0" date="2017-02-15">
|
||||||
|
<Change>Updated to PortalContext [issue #6548]</Change>
|
||||||
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-user.tabular-data-mainbox-widget.1-4-0" date="2015-10-15">
|
<Changeset component="org.gcube.portlets-user.tabular-data-mainbox-widget.1-4-0" date="2015-10-15">
|
||||||
<Change>Updated i18N support</Change>
|
<Change>Updated i18N support</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
|
|
17
pom.xml
17
pom.xml
|
@ -14,7 +14,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>tabular-data-mainbox-widget</artifactId>
|
<artifactId>tabular-data-mainbox-widget</artifactId>
|
||||||
<version>1.4.0-SNAPSHOT</version>
|
<version>1.5.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>tabular-data-mainbox-widget</name>
|
<name>tabular-data-mainbox-widget</name>
|
||||||
<description>tabular-data-mainbox-widget implements a tab panel to shows resources and table</description>
|
<description>tabular-data-mainbox-widget implements a tab panel to shows resources and table</description>
|
||||||
|
@ -105,8 +105,6 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Portal -->
|
<!-- Portal -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.core</groupId>
|
<groupId>org.gcube.core</groupId>
|
||||||
|
@ -115,22 +113,17 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portal</groupId>
|
<groupId>org.gcube.common.portal</groupId>
|
||||||
<artifactId>custom-portal-handler</artifactId>
|
<artifactId>portal-manager</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
<groupId>org.gcube.dvos</groupId>
|
||||||
<artifactId>aslcore</artifactId>
|
<artifactId>usermanagement-core</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
|
||||||
<artifactId>accesslogger</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- WSLT dependencies -->
|
<!-- WSLT dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -5,11 +5,11 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi" <a
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@RemoteServiceRelativePath("tds")
|
@RemoteServiceRelativePath("tds")
|
||||||
public interface TabularDataService extends RemoteService {
|
public interface TabularDataService extends RemoteService {
|
||||||
String hello() throws IllegalArgumentException;
|
String hello() throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
package org.gcube.portlets.user.td.mainboxwidget.server;
|
package org.gcube.portlets.user.td.mainboxwidget.server;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.portlets.user.td.gwtservice.server.SessionUtil;
|
||||||
import org.gcube.application.framework.core.session.SessionManager;
|
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
|
||||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
|
||||||
import org.gcube.portlets.user.td.mainboxwidget.client.rpc.TabularDataService;
|
import org.gcube.portlets.user.td.mainboxwidget.client.rpc.TabularDataService;
|
||||||
import org.gcube.portlets.user.tdwx.datasource.td.TDXDataSourceFactory;
|
import org.gcube.portlets.user.tdwx.datasource.td.TDXDataSourceFactory;
|
||||||
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceXFactoryRegistry;
|
import org.gcube.portlets.user.tdwx.server.datasource.DataSourceXFactoryRegistry;
|
||||||
|
@ -15,17 +13,19 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author giancarlo
|
* @author giancarlo email: <a
|
||||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class TabularDataServiceImpl extends RemoteServiceServlet implements TabularDataService {
|
public class TabularDataServiceImpl extends RemoteServiceServlet implements
|
||||||
|
TabularDataService {
|
||||||
|
|
||||||
|
protected static Logger logger = LoggerFactory
|
||||||
|
.getLogger(TabularDataServiceImpl.class);
|
||||||
|
|
||||||
protected static Logger logger = LoggerFactory.getLogger(TabularDataServiceImpl.class);
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -33,62 +33,45 @@ public class TabularDataServiceImpl extends RemoteServiceServlet implements Tabu
|
||||||
public void init() throws ServletException {
|
public void init() throws ServletException {
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
/*System.out.println("initializing the TabularDataImportManager");
|
/*
|
||||||
TabularDataImporterManager importerManager = new TabularDataImporterManager();
|
* System.out.println("initializing the TabularDataImportManager");
|
||||||
//importerManager.scanAvailableImporters();
|
* TabularDataImporterManager importerManager = new
|
||||||
importerManager.add(new CSVTDImporter());
|
* TabularDataImporterManager();
|
||||||
importerManager.setupImporters();
|
* //importerManager.scanAvailableImporters(); importerManager.add(new
|
||||||
|
* CSVTDImporter()); importerManager.setupImporters();
|
||||||
*/
|
*/
|
||||||
//register the demo csv target
|
// register the demo csv target
|
||||||
//CSVTargetRegistry.getInstance().add(new DemoCSVTarget());
|
// CSVTargetRegistry.getInstance().add(new DemoCSVTarget());
|
||||||
//System.out.println("Registered DemoCSVTarget");
|
// System.out.println("Registered DemoCSVTarget");
|
||||||
|
|
||||||
//ScopeProvider.instance.get();
|
// ScopeProvider.instance.get();
|
||||||
System.out.println("Fix JAXP: jdk.xml.entityExpansionLimit=0");
|
System.out.println("Fix JAXP: jdk.xml.entityExpansionLimit=0");
|
||||||
System.setProperty("jdk.xml.entityExpansionLimit", "0");
|
System.setProperty("jdk.xml.entityExpansionLimit", "0");
|
||||||
|
|
||||||
System.out.println("initializing TDXDataSourceFactory");
|
System.out.println("initializing TDXDataSourceFactory");
|
||||||
DataSourceXFactoryRegistry.getInstance().add(new TDXDataSourceFactory());
|
DataSourceXFactoryRegistry.getInstance()
|
||||||
|
.add(new TDXDataSourceFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected static ASLSession getAslSession(HttpSession httpSession)
|
|
||||||
{
|
|
||||||
String username = (String) httpSession
|
|
||||||
.getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
|
||||||
ASLSession session;
|
|
||||||
if (username == null) {
|
|
||||||
logger.warn("no user found in session, using test one");
|
|
||||||
/*throw new Exception("Session Expired!");*/
|
|
||||||
|
|
||||||
// Remove comment for Test
|
|
||||||
|
|
||||||
username = Constants.DEFAULT_USER;
|
|
||||||
String scope = Constants.DEFAULT_SCOPE;
|
|
||||||
|
|
||||||
httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, username);
|
|
||||||
session = SessionManager.getInstance().getASLSession(
|
|
||||||
httpSession.getId(), username);
|
|
||||||
session.setScope(scope);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
session = SessionManager.getInstance().getASLSession(
|
|
||||||
httpSession.getId(), username);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info("SessionUtil: aslSession " + session.getUsername() + " "
|
|
||||||
+ session.getScope());
|
|
||||||
|
|
||||||
return session;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public String hello() throws IllegalArgumentException {
|
@Override
|
||||||
ASLSession aslSession=getAslSession(this.getThreadLocalRequest().getSession());
|
public String hello() throws Exception {
|
||||||
return "Hello "+aslSession.getUsername();
|
HttpServletRequest httpRequest = null;
|
||||||
|
try {
|
||||||
|
httpRequest = this.getThreadLocalRequest();
|
||||||
|
ServiceCredentials serviceCredentials = SessionUtil
|
||||||
|
.getServiceCredentials(httpRequest);
|
||||||
|
logger.debug("hello()");
|
||||||
|
|
||||||
|
return "Hello " + serviceCredentials.getUserName();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error("Hello(): " + e.getLocalizedMessage(), e);
|
||||||
|
throw new Exception(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue