refs 2521: Explore the possibility to port the StatMan interface onto Dataminer

https://support.d4science.org/issues/2521

Updated to Liferay 6.2

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@129212 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-06-21 14:24:40 +00:00
parent 032a574d84
commit a2691a1552
6 changed files with 68 additions and 86 deletions

57
pom.xml
View File

@ -73,6 +73,11 @@
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
<version>2.4.0</version>
</dependency>
<!-- Storage --> <!-- Storage -->
<dependency> <dependency>
@ -135,9 +140,6 @@
<version>${gwtVersion}</version> <version>${gwtVersion}</version>
</dependency> </dependency>
<!-- GXT 2 <dependency> <groupId>com.sencha.gxt</groupId> <artifactId>gxt2.2.5-gwt2.X</artifactId>
<version>${gxt2Version}</version> </dependency> -->
<!-- GXT 3 --> <!-- GXT 3 -->
<dependency> <dependency>
@ -145,21 +147,20 @@
<artifactId>gxt</artifactId> <artifactId>gxt</artifactId>
<version>${gxtVersion}</version> <version>${gxtVersion}</version>
</dependency> </dependency>
<!-- <dependency> <groupId>com.ibm.icu</groupId> <artifactId>icu4j</artifactId>
<version>51.2</version> <scope>compile</scope> </dependency> <dependency>
<groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.7.1</version>
<scope>provided</scope> </dependency> <dependency> <groupId>org.gcube.core</groupId>
<artifactId>common-generic-clients</artifactId> <version>[1.0.0-SNAPSHOT,4.0.0-SNAPSHOT)</version>
<scope>provided</scope> </dependency> -->
<dependency> <dependency>
<groupId>javax.portlet</groupId> <groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId> <artifactId>portlet-api</artifactId>
</dependency> </dependency>
<!-- PORTAL -->
<dependency> <dependency>
<groupId>org.gcube.applicationsupportlayer</groupId> <groupId>org.gcube.core</groupId>
<artifactId>accesslogger</artifactId> <artifactId>common-scope-maps</artifactId>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -167,12 +168,6 @@
<artifactId>custom-portal-handler</artifactId> <artifactId>custom-portal-handler</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.applicationsupportlayer</groupId> <groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslcore</artifactId> <artifactId>aslcore</artifactId>
@ -185,6 +180,11 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
<scope>provided</scope>
</dependency>
<!-- Authorization --> <!-- Authorization -->
@ -200,7 +200,7 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- GCube Widget --> <!-- GCube Widgets -->
<dependency> <dependency>
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-widgets</artifactId> <artifactId>gcube-widgets</artifactId>
@ -215,19 +215,6 @@
</dependency> </dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId>
</dependency>
<!-- <dependency> <groupId>org.gcube.core</groupId> <artifactId>common-fw-clients</artifactId>
<scope>provided</scope> </dependency> -->
<!-- Storage --> <!-- Storage -->
<dependency> <dependency>
<groupId>org.gcube.contentmanagement</groupId> <groupId>org.gcube.contentmanagement</groupId>
@ -259,7 +246,7 @@
<artifactId>home-library-model</artifactId> <artifactId>home-library-model</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- Information System Client IC-Client --> <!-- Information System Client IC-Client -->
<dependency> <dependency>
@ -365,7 +352,7 @@
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId> <groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId> <artifactId>maven-portal-bom</artifactId>
<version>2.6.0-SNAPSHOT</version> <version>LATEST</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>

View File

@ -36,8 +36,8 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi 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")
@ -68,12 +68,14 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
try { try {
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session); ASLSession aslSession = SessionUtil.getASLSession(session);
String token = SessionUtil.getToken(aslSession);
UserInfo userInfo = new UserInfo(aslSession.getUsername(), UserInfo userInfo = new UserInfo(aslSession.getUsername(),
aslSession.getGroupId(), aslSession.getGroupName(), aslSession.getGroupId(), aslSession.getGroupName(),
aslSession.getScope(), aslSession.getScopeName(), aslSession.getScope(), aslSession.getScopeName(),
aslSession.getUserEmailAddress(), aslSession.getUserEmailAddress(),
aslSession.getUserFullName()); aslSession.getUserFullName());
logger.debug("UserInfo: " + userInfo); logger.debug("UserInfo: " + userInfo);
logger.debug("UserToken: " + token);
return userInfo; return userInfo;
} catch (ServiceException e) { } catch (ServiceException e) {
e.printStackTrace(); e.printStackTrace();
@ -94,8 +96,8 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session); ASLSession aslSession = SessionUtil.getASLSession(session);
SClient smClient = SessionUtil.getSClient(aslSession); SClient smClient = SessionUtil.getSClient(aslSession);
List<OperatorsClassification> list= smClient.getOperatorsClassifications(); List<OperatorsClassification> list = smClient
//SessionUtil.putSClient(session, smClient); .getOperatorsClassifications();
return list; return list;
} catch (ServiceException e) { } catch (ServiceException e) {
logger.error(e.getLocalizedMessage()); logger.error(e.getLocalizedMessage());
@ -105,7 +107,6 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
"An error occurred getting the OperatorsClassifications list: " "An error occurred getting the OperatorsClassifications list: "
+ e.getLocalizedMessage(), e); + e.getLocalizedMessage(), e);
e.printStackTrace(); e.printStackTrace();
// return null;
throw new ServiceException(e.getLocalizedMessage(), e); throw new ServiceException(e.getLocalizedMessage(), e);
} }
} }
@ -118,8 +119,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
ASLSession aslSession = SessionUtil.getASLSession(session); ASLSession aslSession = SessionUtil.getASLSession(session);
SClient smClient = SessionUtil.getSClient(aslSession); SClient smClient = SessionUtil.getSClient(aslSession);
List<Parameter> list=smClient.getInputParameters(operator); List<Parameter> list = smClient.getInputParameters(operator);
//SessionUtil.putSClient(session, smClient);
return list; return list;
} catch (ServiceException e) { } catch (ServiceException e) {
logger.error(e.getLocalizedMessage()); logger.error(e.getLocalizedMessage());
@ -140,8 +140,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
ASLSession aslSession = SessionUtil.getASLSession(session); ASLSession aslSession = SessionUtil.getASLSession(session);
logger.debug("StartComputation(): [ operator=" + operator + "]"); logger.debug("StartComputation(): [ operator=" + operator + "]");
SClient smClient = SessionUtil.getSClient(aslSession); SClient smClient = SessionUtil.getSClient(aslSession);
ComputationId computationId= smClient.startComputation(operator); ComputationId computationId = smClient.startComputation(operator);
//SessionUtil.putSClient(session, smClient);
return computationId; return computationId;
} catch (ServiceException e) { } catch (ServiceException e) {
logger.error(e.getLocalizedMessage()); logger.error(e.getLocalizedMessage());
@ -160,13 +159,12 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
try { try {
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session); ASLSession aslSession = SessionUtil.getASLSession(session);
logger.debug("Resubmit(): " + itemDescription);
Map<String, String> properties = StorageUtil.getProperties( Map<String, String> properties = StorageUtil.getProperties(
aslSession.getUsername(), itemDescription.getId()); aslSession.getUsername(), itemDescription.getId());
logger.debug("Properties: " + properties); logger.debug("Properties: " + properties);
SClient smClient = SessionUtil.getSClient(aslSession); SClient smClient = SessionUtil.getSClient(aslSession);
ComputationId computationId= smClient.resubmitComputation(properties); ComputationId computationId = smClient
//SessionUtil.putSClient(session, smClient); .resubmitComputation(properties);
return computationId; return computationId;
} catch (ServiceException e) { } catch (ServiceException e) {
logger.error(e.getLocalizedMessage()); logger.error(e.getLocalizedMessage());
@ -185,10 +183,9 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
try { try {
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session); ASLSession aslSession = SessionUtil.getASLSession(session);
SClient smClient = SessionUtil.getSClient(aslSession); SClient smClient = SessionUtil.getSClient(aslSession);
ComputationStatus computationStatus= smClient.getComputationStatus(computationId); ComputationStatus computationStatus = smClient
//SessionUtil.putSClient(session, smClient); .getComputationStatus(computationId);
return computationStatus; return computationStatus;
} catch (ServiceException e) { } catch (ServiceException e) {
@ -202,19 +199,19 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
} }
} }
@Override @Override
public void deleteItem(ItemDescription itemDescription) public void deleteItem(ItemDescription itemDescription)
throws ServiceException { throws ServiceException {
try { try {
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session); ASLSession aslSession = SessionUtil.getASLSession(session);
String token = SessionUtil.getToken(aslSession);
logger.debug("UserToken: " + token);
logger.debug("DeleteItem(): " + itemDescription); logger.debug("DeleteItem(): " + itemDescription);
StorageUtil.deleteItem(aslSession.getUsername(), StorageUtil.deleteItem(aslSession.getUsername(),
itemDescription.getId()); itemDescription.getId());
return; return;
} catch (ServiceException e) { } catch (ServiceException e) {
logger.error(e.getLocalizedMessage()); logger.error(e.getLocalizedMessage());
throw e; throw e;
@ -231,6 +228,8 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
try { try {
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session); ASLSession aslSession = SessionUtil.getASLSession(session);
String token = SessionUtil.getToken(aslSession);
logger.debug("UserToken: " + token);
logger.debug("retrieveTableInformation(): " + item); logger.debug("retrieveTableInformation(): " + item);
TableReader tableReader = new TableReader(aslSession, item); TableReader tableReader = new TableReader(aslSession, item);
TableItemSimple tableItemSimple = tableReader.getTableItemSimple(); TableItemSimple tableItemSimple = tableReader.getTableItemSimple();
@ -250,6 +249,8 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
try { try {
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session); ASLSession aslSession = SessionUtil.getASLSession(session);
String token = SessionUtil.getToken(aslSession);
logger.debug("UserToken: " + token);
logger.debug("getDataMinerWorkArea()"); logger.debug("getDataMinerWorkArea()");
DataMinerWorkAreaManager dataMinerWorkAreaManager = new DataMinerWorkAreaManager( DataMinerWorkAreaManager dataMinerWorkAreaManager = new DataMinerWorkAreaManager(
aslSession); aslSession);
@ -271,6 +272,8 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
try { try {
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session); ASLSession aslSession = SessionUtil.getASLSession(session);
String token = SessionUtil.getToken(aslSession);
logger.debug("UserToken: " + token);
logger.debug("GetPublicLink(): " + itemDescription); logger.debug("GetPublicLink(): " + itemDescription);
String link = StorageUtil.getPublicLink(aslSession.getUsername(), String link = StorageUtil.getPublicLink(aslSession.getUsername(),
itemDescription.getId()); itemDescription.getId());
@ -295,7 +298,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
logger.debug("CancelComputation(): " + computationId); logger.debug("CancelComputation(): " + computationId);
SClient smClient = SessionUtil.getSClient(aslSession); SClient smClient = SessionUtil.getSClient(aslSession);
String result = smClient.cancelComputation(computationId); String result = smClient.cancelComputation(computationId);
//SessionUtil.putSClient(session, smClient); // SessionUtil.putSClient(session, smClient);
return result; return result;
} catch (ServiceException e) { } catch (ServiceException e) {
logger.error(e.getLocalizedMessage()); logger.error(e.getLocalizedMessage());
@ -314,11 +317,9 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
Log.debug("getOutputDataByComputationId: " + computationId); Log.debug("getOutputDataByComputationId: " + computationId);
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session); ASLSession aslSession = SessionUtil.getASLSession(session);
SClient smClient = SessionUtil.getSClient(aslSession); SClient smClient = SessionUtil.getSClient(aslSession);
OutputData outputData = smClient OutputData outputData = smClient
.getOutputDataByComputationId(computationId); .getOutputDataByComputationId(computationId);
//SessionUtil.putSClient(session, smClient);
Log.debug("OutputData: " + outputData); Log.debug("OutputData: " + outputData);
return outputData; return outputData;
} catch (ServiceException e) { } catch (ServiceException e) {
@ -332,8 +333,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
} }
} }
@Override @Override
public ComputationData getComputationData(ItemDescription itemDescription) public ComputationData getComputationData(ItemDescription itemDescription)
throws ServiceException { throws ServiceException {
@ -345,11 +345,10 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
aslSession.getUsername(), itemDescription.getId()); aslSession.getUsername(), itemDescription.getId());
logger.debug("Properties: " + properties); logger.debug("Properties: " + properties);
SClient smClient = SessionUtil.getSClient(aslSession); SClient smClient = SessionUtil.getSClient(aslSession);
ComputationData computationData= smClient.getComputationDataByComputationProperties(properties); ComputationData computationData = smClient
//SessionUtil.putSClient(session, smClient); .getComputationDataByComputationProperties(properties);
return computationData; return computationData;
} catch (ServiceException e) { } catch (ServiceException e) {
logger.error(e.getLocalizedMessage()); logger.error(e.getLocalizedMessage());
throw e; throw e;
@ -366,20 +365,21 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
throws ServiceException { throws ServiceException {
try { try {
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session); ASLSession aslSession = SessionUtil.getASLSession(session);
logger.debug("CancelComputation(): " + itemDescription); logger.debug("CancelComputation(): " + itemDescription);
String compId = itemDescription.getName(); String compId = itemDescription.getName();
if(compId==null){ if (compId == null) {
throw new ServiceException("Computation Id not found!"); throw new ServiceException("Computation Id not found!");
} else { } else {
int lastIndexUnd=compId.lastIndexOf("_"); int lastIndexUnd = compId.lastIndexOf("_");
if(lastIndexUnd==-1){ if (lastIndexUnd == -1) {
throw new ServiceException("Invalid Computation Id: "+compId); throw new ServiceException("Invalid Computation Id: "
+ compId);
} else { } else {
compId=compId.substring(lastIndexUnd+1); compId = compId.substring(lastIndexUnd + 1);
} }
} }
ComputationId computationId=new ComputationId(); ComputationId computationId = new ComputationId();
computationId.setId(compId); computationId.setId(compId);
SClient smClient = SessionUtil.getSClient(aslSession); SClient smClient = SessionUtil.getSClient(aslSession);
String result = smClient.cancelComputation(computationId); String result = smClient.cancelComputation(computationId);

View File

@ -16,10 +16,8 @@ public class Constants {
public static final String DATA_MINER_LANG = "DataMinerLang"; public static final String DATA_MINER_LANG = "DataMinerLang";
public static final String DEFAULT_USER = "giancarlo.panichi"; public static final String DEFAULT_USER = "giancarlo.panichi";
//public static final String DEFAULT_USER = "statistical.manager@gmail.com";
public static final String DEFAULT_ROLE = "OrganizationMember"; public static final String DEFAULT_ROLE = "OrganizationMember";
public static final String DEFAULT_SCOPE = "/gcube/devsec/devVRE"; public static final String DEFAULT_SCOPE = "/gcube/devsec/devVRE";
// public final static String DEFAULT_USER = "test.user";
// public final static String DEFAULT_SCOPE = "/gcube/devNext"; // public final static String DEFAULT_SCOPE = "/gcube/devNext";
// public final static String DEFAULT_SCOPE = "/gcube/devNext/NextNext"; // public final static String DEFAULT_SCOPE = "/gcube/devNext/NextNext";
@ -46,15 +44,9 @@ public class Constants {
public static final String WPSCancelComputationServlet = "CancelComputationServlet"; public static final String WPSCancelComputationServlet = "CancelComputationServlet";
public static final String WPSToken = "f0666597-4302-49ce-bea2-555b94e569cb"; public static final String WPSToken = "f0666597-4302-49ce-bea2-555b94e569cb";
public static final String WPSUser = "giancarlo.panichi"; public static final String WPSUser = "giancarlo.panichi";
/*public static final String WPSToken = "4ccc2c35-60c9-4c9b-9800-616538d5d48b"; /*public static final String WPSToken = "4ccc2c35-60c9-4c9b-9800-616538d5d48b";
public static final String WPSUser = "gianpaolo.coro";*/ public static final String WPSUser = "gianpaolo.coro";*/
//public static final String WPSToken = "45943442-74ef-408b-be64-d26b42cf4c08 ";
//public static final String WPSUser = "statistical.manager@gmail.com";
//DownloadFolderServlet //DownloadFolderServlet
public static final String DOWNLOAD_FOLDER_SERVLET= "DownloadFolderServlet"; public static final String DOWNLOAD_FOLDER_SERVLET= "DownloadFolderServlet";

View File

@ -1,8 +1,9 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 5.2.0//EN" "http://www.liferay.com/dtd/liferay-display_5_2_0.dtd"> <!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.2.0//EN"
"http://www.liferay.com/dtd/liferay-display_6_2_0.dtd">
<display> <display>
<category name="gCube Applications"> <category name="gCube Applications">
<portlet id="DataMinerManager" /> <portlet id="DataMinerManager" />
</category> </category>
</display> </display>

View File

@ -1,6 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 5.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_5_2_0.dtd"> <!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN"
"http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">
<liferay-portlet-app> <liferay-portlet-app>
<portlet> <portlet>
<portlet-name>DataMinerManager</portlet-name> <portlet-name>DataMinerManager</portlet-name>

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0"> version="3.0">
<servlet> <servlet>
<servlet-name>DataMinerManagerServlet</servlet-name> <servlet-name>DataMinerManagerServlet</servlet-name>
<servlet-class>org.gcube.portlets.user.dataminermanager.server.DataMinerManagerServiceImpl</servlet-class> <servlet-class>org.gcube.portlets.user.dataminermanager.server.DataMinerManagerServiceImpl</servlet-class>