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>
|
||||
<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">
|
||||
<Change>Updated i18N support</Change>
|
||||
</Changeset>
|
||||
|
|
19
pom.xml
19
pom.xml
|
@ -14,7 +14,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-mainbox-widget</artifactId>
|
||||
<version>1.4.0-SNAPSHOT</version>
|
||||
<version>1.5.0-SNAPSHOT</version>
|
||||
|
||||
<name>tabular-data-mainbox-widget</name>
|
||||
<description>tabular-data-mainbox-widget implements a tab panel to shows resources and table</description>
|
||||
|
@ -105,8 +105,6 @@
|
|||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Portal -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
|
@ -115,22 +113,17 @@
|
|||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>custom-portal-handler</artifactId>
|
||||
<groupId>org.gcube.common.portal</groupId>
|
||||
<artifactId>portal-manager</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslcore</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>accesslogger</artifactId>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- WSLT dependencies -->
|
||||
<dependency>
|
||||
|
|
|
@ -5,11 +5,11 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
@RemoteServiceRelativePath("tds")
|
||||
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;
|
||||
|
||||
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.application.framework.core.session.SessionManager;
|
||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.SessionUtil;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.util.ServiceCredentials;
|
||||
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.server.datasource.DataSourceXFactoryRegistry;
|
||||
|
@ -15,17 +13,19 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
@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}
|
||||
*/
|
||||
|
@ -33,62 +33,45 @@ public class TabularDataServiceImpl extends RemoteServiceServlet implements Tabu
|
|||
public void init() throws ServletException {
|
||||
super.init();
|
||||
|
||||
/*System.out.println("initializing the TabularDataImportManager");
|
||||
TabularDataImporterManager importerManager = new TabularDataImporterManager();
|
||||
//importerManager.scanAvailableImporters();
|
||||
importerManager.add(new CSVTDImporter());
|
||||
importerManager.setupImporters();
|
||||
/*
|
||||
* System.out.println("initializing the TabularDataImportManager");
|
||||
* TabularDataImporterManager importerManager = new
|
||||
* TabularDataImporterManager();
|
||||
* //importerManager.scanAvailableImporters(); importerManager.add(new
|
||||
* CSVTDImporter()); importerManager.setupImporters();
|
||||
*/
|
||||
//register the demo csv target
|
||||
//CSVTargetRegistry.getInstance().add(new DemoCSVTarget());
|
||||
//System.out.println("Registered DemoCSVTarget");
|
||||
// register the demo csv target
|
||||
// CSVTargetRegistry.getInstance().add(new DemoCSVTarget());
|
||||
// System.out.println("Registered DemoCSVTarget");
|
||||
|
||||
//ScopeProvider.instance.get();
|
||||
// ScopeProvider.instance.get();
|
||||
System.out.println("Fix JAXP: jdk.xml.entityExpansionLimit=0");
|
||||
System.setProperty("jdk.xml.entityExpansionLimit", "0");
|
||||
|
||||
|
||||
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}
|
||||
*/
|
||||
public String hello() throws IllegalArgumentException {
|
||||
ASLSession aslSession=getAslSession(this.getThreadLocalRequest().getSession());
|
||||
return "Hello "+aslSession.getUsername();
|
||||
@Override
|
||||
public String hello() throws Exception {
|
||||
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