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> <groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId> <artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version> <version>${gwtVersion}</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

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

View File

@ -76,7 +76,9 @@ public class DownloadFolderServlet extends HttpServlet {
logger.debug("DownloadFolderServlet session id: " + session.getId()); logger.debug("DownloadFolderServlet session id: " + session.getId());
ASLSession aslSession = SessionUtil.getASLSession(session); 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 itemId = request.getParameter(Constants.DOWNLOAD_FOLDER_SERVLET_ITEM_ID_PARAMETER);
String folderName = request.getParameter(Constants.DOWNLOAD_FOLDER_SERVLET_FOLDER_NAME_PARAMETER); String folderName = request.getParameter(Constants.DOWNLOAD_FOLDER_SERVLET_FOLDER_NAME_PARAMETER);
logger.debug("Request: [itemId=" + itemId + ", folderName=" logger.debug("Request: [itemId=" + itemId + ", folderName="

View File

@ -6,6 +6,7 @@ package org.gcube.portlets.user.dataminermanager.server;
import static org.gcube.common.authorization.client.Constants.authorizationService; import static org.gcube.common.authorization.client.Constants.authorizationService;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpSession; 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 { throws Exception {
if(aslSession==null){ if(aslSession==null){
@ -94,24 +95,44 @@ public class SessionUtil {
} }
SClient sClient; SClient sClient;
Object obj=aslSession.getAttribute(Constants.SClient); Object obj=session.getAttribute(Constants.SClientMap);
if(obj==null){ 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(), ServiceCredential serviceCredential=new ServiceCredential(aslSession.getUsername(), aslSession.getScope(),
SessionUtil.getToken(aslSession)); SessionUtil.getToken(aslSession));
SClientBuilder sBuilder = new SClient4WPSBuilder(serviceCredential); SClientBuilder sBuilder = new SClient4WPSBuilder(serviceCredential);
SClientDirector director = new SClientDirector(); SClientDirector director = new SClientDirector();
director.setSClientBuilder(sBuilder); director.setSClientBuilder(sBuilder);
director.constructSClient(); director.constructSClient();
sClient = director.getSClient(); sClient = director.getSClient();
aslSession.setAttribute(Constants.SClient, sClient);
sClientMap.put(aslSession.getScope(), sClient);
session.setAttribute(Constants.SClientMap, sClientMap);
} else { } else {
if (obj instanceof SClient) { if (obj instanceof HashMap<?, ?>) {
logger.info("Use SClient in session"); @SuppressWarnings("unchecked")
sClient=(SClient) obj; 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);
SClientDirector director = new SClientDirector();
director.setSClientBuilder(sBuilder);
director.constructSClient();
sClient = director.getSClient();
sClientMap.put(aslSession.getScope(), sClient);
session.setAttribute(Constants.SClientMap, sClientMap);
}
} else { } 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!"); 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); operatorsClass.add(op);
logger.debug("OperatorClass: " + operatorsClass); //logger.debug("OperatorClass: " + operatorsClass);
return 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 DATA_MINER_SERVICE_NAME = "DataMiner";
public static final String DATAMINER_SERVICE_CATEGORY = "DataAnalysis"; 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 static final long serialVersionUID = -2826549639677017234L;
private String username; private String username;
private long groupId; private Long groupId;
private String groupName; private String groupName;
private String scope; private String scope;
private String scopeName; private String scopeName;
@ -34,7 +34,7 @@ public class UserInfo implements Serializable {
* @param userEmailAddress * @param userEmailAddress
* @param userFullName * @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 scope, String scopeName, String userEmailAddress,
String userFullName) { String userFullName) {
super(); super();
@ -55,11 +55,11 @@ public class UserInfo implements Serializable {
this.username = username; this.username = username;
} }
public long getGroupId() { public Long getGroupId() {
return groupId; return groupId;
} }
public void setGroupId(long groupId) { public void setGroupId(Long groupId) {
this.groupId = 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 { .smLayoutContainer {
/* Blue /* Blue
box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.11), 0 0 0 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"?> <?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> <portlet>
<description>DataMinerManager</description> <description>DataMinerManager</description>
<portlet-name>DataMinerManager</portlet-name> <portlet-name>DataMinerManager</portlet-name>
@ -14,5 +17,11 @@
<title>DataMinerManager</title> <title>DataMinerManager</title>
<short-title>DataMinerManager</short-title> <short-title>DataMinerManager</short-title>
</portlet-info> </portlet-info>
<portlet-preferences>
<preference>
<name>portlet-setup-show-borders</name>
<value>false</value>
</preference>
</portlet-preferences>
</portlet> </portlet>
</portlet-app> </portlet-app>