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

View File

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

View File

@ -1,8 +1,9 @@
<?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>
<category name="gCube Applications">
<portlet id="DataMinerManager" />
</category>
<category name="gCube Applications">
<portlet id="DataMinerManager" />
</category>
</display>

View File

@ -1,6 +1,7 @@
<?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>
<portlet>
<portlet-name>DataMinerManager</portlet-name>

View File

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