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@129407 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-06-24 12:24:29 +00:00
parent c5194dbe18
commit e611bffa8c
10 changed files with 94 additions and 797 deletions

771
log.txt

File diff suppressed because one or more lines are too long

View File

@ -131,6 +131,7 @@
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -95,7 +95,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
try {
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session);
SClient smClient = SessionUtil.getSClient(aslSession);
SClient smClient = SessionUtil.getSClient(aslSession, session);
List<OperatorsClassification> list = smClient
.getOperatorsClassifications();
return list;
@ -118,7 +118,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session);
SClient smClient = SessionUtil.getSClient(aslSession);
SClient smClient = SessionUtil.getSClient(aslSession, session);
List<Parameter> list = smClient.getInputParameters(operator);
return list;
} catch (ServiceException e) {
@ -139,7 +139,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session);
logger.debug("StartComputation(): [ operator=" + operator + "]");
SClient smClient = SessionUtil.getSClient(aslSession);
SClient smClient = SessionUtil.getSClient(aslSession, session);
ComputationId computationId = smClient.startComputation(operator);
return computationId;
} catch (ServiceException e) {
@ -162,7 +162,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
Map<String, String> properties = StorageUtil.getProperties(
aslSession.getUsername(), itemDescription.getId());
logger.debug("Properties: " + properties);
SClient smClient = SessionUtil.getSClient(aslSession);
SClient smClient = SessionUtil.getSClient(aslSession, session);
ComputationId computationId = smClient
.resubmitComputation(properties);
return computationId;
@ -183,7 +183,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
try {
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session);
SClient smClient = SessionUtil.getSClient(aslSession);
SClient smClient = SessionUtil.getSClient(aslSession, session);
ComputationStatus computationStatus = smClient
.getComputationStatus(computationId);
return computationStatus;
@ -296,7 +296,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session);
logger.debug("CancelComputation(): " + computationId);
SClient smClient = SessionUtil.getSClient(aslSession);
SClient smClient = SessionUtil.getSClient(aslSession, session);
String result = smClient.cancelComputation(computationId);
// SessionUtil.putSClient(session, smClient);
return result;
@ -317,7 +317,7 @@ 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);
SClient smClient = SessionUtil.getSClient(aslSession, session);
OutputData outputData = smClient
.getOutputDataByComputationId(computationId);
Log.debug("OutputData: " + outputData);
@ -344,7 +344,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
Map<String, String> properties = StorageUtil.getProperties(
aslSession.getUsername(), itemDescription.getId());
logger.debug("Properties: " + properties);
SClient smClient = SessionUtil.getSClient(aslSession);
SClient smClient = SessionUtil.getSClient(aslSession, session);
ComputationData computationData = smClient
.getComputationDataByComputationProperties(properties);
return computationData;
@ -381,7 +381,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
}
ComputationId computationId = new ComputationId();
computationId.setId(compId);
SClient smClient = SessionUtil.getSClient(aslSession);
SClient smClient = SessionUtil.getSClient(aslSession, session);
String result = smClient.cancelComputation(computationId);
return result;
} catch (ServiceException e) {

View File

@ -76,6 +76,8 @@ public class DownloadFolderServlet extends HttpServlet {
logger.debug("DownloadFolderServlet session id: " + session.getId());
ASLSession aslSession = SessionUtil.getASLSession(session);
String token=SessionUtil.getToken(aslSession);
logger.debug("UserToken: "+token);
String itemId = request.getParameter(Constants.DOWNLOAD_FOLDER_SERVLET_ITEM_ID_PARAMETER);
String folderName = request.getParameter(Constants.DOWNLOAD_FOLDER_SERVLET_FOLDER_NAME_PARAMETER);

View File

@ -6,6 +6,7 @@ package org.gcube.portlets.user.dataminermanager.server;
import static org.gcube.common.authorization.client.Constants.authorizationService;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpSession;
@ -85,7 +86,7 @@ public class SessionUtil {
}
public static SClient getSClient(ASLSession aslSession)
public static SClient getSClient(ASLSession aslSession, HttpSession session)
throws Exception {
if(aslSession==null){
@ -94,9 +95,30 @@ public class SessionUtil {
}
SClient sClient;
Object obj=aslSession.getAttribute(Constants.SClient);
Object obj=session.getAttribute(Constants.SClientMap);
if(obj==null){
logger.info("Created new SClient");
logger.info("Create new SClientMap");
HashMap<String,SClient> sClientMap=new HashMap<>();
logger.info("Create new SClient");
ServiceCredential serviceCredential=new ServiceCredential(aslSession.getUsername(), aslSession.getScope(),
SessionUtil.getToken(aslSession));
SClientBuilder sBuilder = new SClient4WPSBuilder(serviceCredential);
SClientDirector director = new SClientDirector();
director.setSClientBuilder(sBuilder);
director.constructSClient();
sClient = director.getSClient();
sClientMap.put(aslSession.getScope(), sClient);
session.setAttribute(Constants.SClientMap, sClientMap);
} else {
if (obj instanceof HashMap<?, ?>) {
@SuppressWarnings("unchecked")
HashMap<String,SClient> sClientMap=(HashMap<String,SClient>) obj;
if(sClientMap.containsKey(aslSession.getScope())){
logger.info("Use SClient in session");
sClient=sClientMap.get(aslSession.getScope());
} else {
logger.info("Create new SClient");
ServiceCredential serviceCredential=new ServiceCredential(aslSession.getUsername(), aslSession.getScope(),
SessionUtil.getToken(aslSession));
SClientBuilder sBuilder = new SClient4WPSBuilder(serviceCredential);
@ -105,13 +127,12 @@ public class SessionUtil {
director.setSClientBuilder(sBuilder);
director.constructSClient();
sClient = director.getSClient();
aslSession.setAttribute(Constants.SClient, sClient);
sClientMap.put(aslSession.getScope(), sClient);
session.setAttribute(Constants.SClientMap, sClientMap);
}
} else {
if (obj instanceof SClient) {
logger.info("Use SClient in session");
sClient=(SClient) obj;
} else {
logger.error("Portlet is Changed!");
logger.error("Attention no SClientMap in Session!");
throw new ServiceException("Sign Out, portlet is changed, a new session is required!");
}
}

View File

@ -261,7 +261,7 @@ public class SClient4WPS extends SClient {
operatorsClass.add(op);
logger.debug("OperatorClass: " + operatorsClass);
//logger.debug("OperatorClass: " + operatorsClass);
return operatorsClass;
}

View File

@ -23,7 +23,7 @@ public class Constants {
public static final String SClient = "DataMinerClient";
public static final String SClientMap = "DataMinerClientMap";
public static final String DATA_MINER_SERVICE_NAME = "DataMiner";
public static final String DATAMINER_SERVICE_CATEGORY = "DataAnalysis";

View File

@ -13,7 +13,7 @@ public class UserInfo implements Serializable {
private static final long serialVersionUID = -2826549639677017234L;
private String username;
private long groupId;
private Long groupId;
private String groupName;
private String scope;
private String scopeName;
@ -34,7 +34,7 @@ public class UserInfo implements Serializable {
* @param userEmailAddress
* @param userFullName
*/
public UserInfo(String username, long groupId, String groupName,
public UserInfo(String username, Long groupId, String groupName,
String scope, String scopeName, String userEmailAddress,
String userFullName) {
super();
@ -55,11 +55,11 @@ public class UserInfo implements Serializable {
this.username = username;
}
public long getGroupId() {
public Long getGroupId() {
return groupId;
}
public void setGroupId(long groupId) {
public void setGroupId(Long groupId) {
this.groupId = groupId;
}

View File

@ -1,3 +1,38 @@
/* FIX FOR Portal Theme */
.aui input[type="text"], .aui select, .aui textarea, .aui .uneditable-input {
margin-bottom: 1px !important;
padding: 0px !important;
}
.aui input, .aui textarea, .aui .uneditable-input {
width: 100% !important;
}
.aui p {
margin: 0px !important;
}
.aui img {
vertical-align: baseline !important;
}
.aui fieldset {
padding: 9px !important;
/* margin: 0; */
border: 1px solid rgb(181, 184, 200) !important;
}
.aui legend {
margin-bottom: 0px !important;
width: auto !important;
border-bottom: none !important;
}
/* Data Miner */
.smLayoutContainer {
/* Blue
box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.11), 0 0 0

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd' version='2.0'>
<portlet-app xmlns='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
version='2.0'>
<portlet>
<description>DataMinerManager</description>
<portlet-name>DataMinerManager</portlet-name>
@ -14,5 +17,11 @@
<title>DataMinerManager</title>
<short-title>DataMinerManager</short-title>
</portlet-info>
<portlet-preferences>
<preference>
<name>portlet-setup-show-borders</name>
<value>false</value>
</preference>
</portlet-preferences>
</portlet>
</portlet-app>