- Class WsUtil replaced by SessionUtil in class GWTdbManagerServiceImpl.
- logger.error() added in class GWTdbManagerServiceImpl. git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@99989 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
55549daaf3
commit
c23955c7b1
|
@ -16,7 +16,6 @@ import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import net.sf.ehcache.CacheManager;
|
import net.sf.ehcache.CacheManager;
|
||||||
import net.sf.ehcache.Ehcache;
|
import net.sf.ehcache.Ehcache;
|
||||||
import net.sf.ehcache.config.CacheConfiguration;
|
|
||||||
|
|
||||||
import org.apache.regexp.RE;
|
import org.apache.regexp.RE;
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
|
@ -54,16 +53,13 @@ import org.gcube.portlets.user.databasesmanager.client.datamodel.Result;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.datamodel.Row;
|
import org.gcube.portlets.user.databasesmanager.client.datamodel.Row;
|
||||||
import org.gcube.portlets.user.databasesmanager.client.utils.ConstantsPortlet;
|
import org.gcube.portlets.user.databasesmanager.client.utils.ConstantsPortlet;
|
||||||
import org.gcube.portlets.user.databasesmanager.server.util.SessionUtil;
|
import org.gcube.portlets.user.databasesmanager.server.util.SessionUtil;
|
||||||
import org.gcube.portlets.user.databasesmanager.server.util.WsUtil;
|
|
||||||
import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
|
import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
|
||||||
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
|
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
|
||||||
import com.extjs.gxt.ui.client.data.PagingLoadResult;
|
import com.extjs.gxt.ui.client.data.PagingLoadResult;
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
import com.thoughtworks.xstream.XStream;
|
import com.thoughtworks.xstream.XStream;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
//import org.apache.jcs.JCS;
|
|
||||||
//import org.apache.jcs.access.CacheAccess;
|
|
||||||
//import org.apache.jcs.utils.props.PropertyLoader;
|
|
||||||
|
|
||||||
public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
GWTdbManagerService {
|
GWTdbManagerService {
|
||||||
|
@ -111,7 +107,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("dbmanager-> Failed to get cache: " + e);
|
logger.error("dbmanager-> Failed to get cache: " + e);
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,14 +130,14 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
logger.error("dbmanager-> " + e);
|
logger.error("dbmanager-> " + e);
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initVariables() {
|
private void initVariables() {
|
||||||
|
|
||||||
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
ASLSession session = SessionUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
.getSession());
|
.getSession());
|
||||||
|
|
||||||
// the result generated in the LoadTables method
|
// the result generated in the LoadTables method
|
||||||
|
@ -260,6 +256,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
// throw new Exception("Failed to load data. " + e);
|
// throw new Exception("Failed to load data. " + e);
|
||||||
|
logger.error("dbmanager-> " + e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
@ -351,8 +348,9 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
// throw new Exception("Failed to load data " + );
|
// throw new Exception("Failed to load data " + );
|
||||||
|
logger.error("dbmanager-> " + e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,8 +450,9 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
// throw new Exception("Failed to load data. " + e);
|
// throw new Exception("Failed to load data. " + e);
|
||||||
|
logger.error("dbmanager-> " + e);
|
||||||
throw e;
|
throw e;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -554,6 +553,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
// throw new Exception("Failed to load data. " + e);
|
// throw new Exception("Failed to load data. " + e);
|
||||||
|
logger.error("dbmanager-> " + e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -803,6 +803,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
"javax.xml.ws.soap.SOAPFaultException: java.lang.IndexOutOfBoundsException")) {
|
"javax.xml.ws.soap.SOAPFaultException: java.lang.IndexOutOfBoundsException")) {
|
||||||
e = new Exception("ServerException");
|
e = new Exception("ServerException");
|
||||||
}
|
}
|
||||||
|
logger.error("dbmanager-> " + e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1259,7 +1260,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private synchronized List<Result> getSubmitQueryResult(String submitQueryUID) {
|
private synchronized List<Result> getSubmitQueryResult(String submitQueryUID) {
|
||||||
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
ASLSession session = SessionUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
.getSession());
|
.getSession());
|
||||||
HashMap<String, List<Result>> submitQueryResult = (HashMap<String, List<Result>>) session
|
HashMap<String, List<Result>> submitQueryResult = (HashMap<String, List<Result>>) session
|
||||||
.getAttribute("submitQueryResult");
|
.getAttribute("submitQueryResult");
|
||||||
|
@ -1272,7 +1273,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
private synchronized List<Row> getSubmitQueryResultParsed(
|
private synchronized List<Row> getSubmitQueryResultParsed(
|
||||||
String submitQueryUID) {
|
String submitQueryUID) {
|
||||||
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
ASLSession session = SessionUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
.getSession());
|
.getSession());
|
||||||
HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String, List<Row>>) session
|
HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String, List<Row>>) session
|
||||||
.getAttribute("submitQueryResultParsed");
|
.getAttribute("submitQueryResultParsed");
|
||||||
|
@ -1287,7 +1288,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
private synchronized void updateSubmitQueryResultParsed(
|
private synchronized void updateSubmitQueryResultParsed(
|
||||||
String submitQueryUID, List<Row> data) {
|
String submitQueryUID, List<Row> data) {
|
||||||
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
ASLSession session = SessionUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
.getSession());
|
.getSession());
|
||||||
HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String, List<Row>>) session
|
HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String, List<Row>>) session
|
||||||
.getAttribute("submitQueryResultParsed");
|
.getAttribute("submitQueryResultParsed");
|
||||||
|
@ -1300,7 +1301,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void removeResultParsed(String submitQueryUID) {
|
private synchronized void removeResultParsed(String submitQueryUID) {
|
||||||
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
ASLSession session = SessionUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
.getSession());
|
.getSession());
|
||||||
HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String, List<Row>>) session
|
HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String, List<Row>>) session
|
||||||
.getAttribute("submitQueryResultParsed");
|
.getAttribute("submitQueryResultParsed");
|
||||||
|
@ -1316,7 +1317,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
private synchronized void updateSubmitQueryResultMap(String submitQueryUID,
|
private synchronized void updateSubmitQueryResultMap(String submitQueryUID,
|
||||||
List<Result> result) {
|
List<Result> result) {
|
||||||
if (submitQueryUID != null) {
|
if (submitQueryUID != null) {
|
||||||
ASLSession session = WsUtil.getAslSession(this
|
ASLSession session = SessionUtil.getAslSession(this
|
||||||
.getThreadLocalRequest().getSession());
|
.getThreadLocalRequest().getSession());
|
||||||
HashMap<String, List<Result>> submitQueryResult = (HashMap<String, List<Result>>) session
|
HashMap<String, List<Result>> submitQueryResult = (HashMap<String, List<Result>>) session
|
||||||
.getAttribute("submitQueryResult");
|
.getAttribute("submitQueryResult");
|
||||||
|
@ -1326,7 +1327,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void removeResult(String submitQueryUID) {
|
private synchronized void removeResult(String submitQueryUID) {
|
||||||
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
ASLSession session = SessionUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
.getSession());
|
.getSession());
|
||||||
HashMap<String, List<Result>> submitQueryResult = (HashMap<String, List<Result>>) session
|
HashMap<String, List<Result>> submitQueryResult = (HashMap<String, List<Result>>) session
|
||||||
.getAttribute("submitQueryResult");
|
.getAttribute("submitQueryResult");
|
||||||
|
@ -1342,7 +1343,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
private synchronized void updateJobStatus(String jobID, String status) {
|
private synchronized void updateJobStatus(String jobID, String status) {
|
||||||
if (jobID != null) {
|
if (jobID != null) {
|
||||||
// add the job status
|
// add the job status
|
||||||
ASLSession session = WsUtil.getAslSession(this
|
ASLSession session = SessionUtil.getAslSession(this
|
||||||
.getThreadLocalRequest().getSession());
|
.getThreadLocalRequest().getSession());
|
||||||
HashMap<String, String> JobStatusMap = (HashMap<String, String>) session
|
HashMap<String, String> JobStatusMap = (HashMap<String, String>) session
|
||||||
.getAttribute("JobStatusList");
|
.getAttribute("JobStatusList");
|
||||||
|
@ -1353,7 +1354,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
// remove job with the related status
|
// remove job with the related status
|
||||||
private synchronized void removeJobStatus(String jobID) {
|
private synchronized void removeJobStatus(String jobID) {
|
||||||
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
ASLSession session = SessionUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
.getSession());
|
.getSession());
|
||||||
HashMap<String, String> JobStatusMap = (HashMap<String, String>) session
|
HashMap<String, String> JobStatusMap = (HashMap<String, String>) session
|
||||||
.getAttribute("JobStatusList");
|
.getAttribute("JobStatusList");
|
||||||
|
@ -1366,7 +1367,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
// get job status
|
// get job status
|
||||||
private synchronized String getJobStatus(String jobID) {
|
private synchronized String getJobStatus(String jobID) {
|
||||||
ASLSession session = WsUtil.getAslSession(this.getThreadLocalRequest()
|
ASLSession session = SessionUtil.getAslSession(this.getThreadLocalRequest()
|
||||||
.getSession());
|
.getSession());
|
||||||
HashMap<String, String> JobStatusMap = (HashMap<String, String>) session
|
HashMap<String, String> JobStatusMap = (HashMap<String, String>) session
|
||||||
.getAttribute("JobStatusList");
|
.getAttribute("JobStatusList");
|
||||||
|
@ -1378,7 +1379,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
private synchronized void updateJob(String jobID, String computationId) {
|
private synchronized void updateJob(String jobID, String computationId) {
|
||||||
if (jobID != null) {
|
if (jobID != null) {
|
||||||
// add the computation in the map
|
// add the computation in the map
|
||||||
ASLSession session = WsUtil.getAslSession(this
|
ASLSession session = SessionUtil.getAslSession(this
|
||||||
.getThreadLocalRequest().getSession());
|
.getThreadLocalRequest().getSession());
|
||||||
HashMap<String, String> computationIDMap = (HashMap<String, String>) session
|
HashMap<String, String> computationIDMap = (HashMap<String, String>) session
|
||||||
.getAttribute("ComputationIDList");
|
.getAttribute("ComputationIDList");
|
||||||
|
@ -1392,7 +1393,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
if (jobID != null) {
|
if (jobID != null) {
|
||||||
// System.out.println("remove jobID " + job);
|
// System.out.println("remove jobID " + job);
|
||||||
// add the computation in the map
|
// add the computation in the map
|
||||||
ASLSession session = WsUtil.getAslSession(this
|
ASLSession session = SessionUtil.getAslSession(this
|
||||||
.getThreadLocalRequest().getSession());
|
.getThreadLocalRequest().getSession());
|
||||||
HashMap<String, String> computationIDMap = (HashMap<String, String>) session
|
HashMap<String, String> computationIDMap = (HashMap<String, String>) session
|
||||||
.getAttribute("ComputationIDList");
|
.getAttribute("ComputationIDList");
|
||||||
|
@ -1409,7 +1410,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
private synchronized boolean checkJob(String jobID) {
|
private synchronized boolean checkJob(String jobID) {
|
||||||
boolean isContained = false;
|
boolean isContained = false;
|
||||||
if (jobID != null) {
|
if (jobID != null) {
|
||||||
ASLSession session = WsUtil.getAslSession(this
|
ASLSession session = SessionUtil.getAslSession(this
|
||||||
.getThreadLocalRequest().getSession());
|
.getThreadLocalRequest().getSession());
|
||||||
HashMap<String, String> computationIDMap = (HashMap<String, String>) session
|
HashMap<String, String> computationIDMap = (HashMap<String, String>) session
|
||||||
.getAttribute("ComputationIDList");
|
.getAttribute("ComputationIDList");
|
||||||
|
@ -1471,6 +1472,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.info("dbmanager-> startComputation: the job submit has failed!");
|
logger.info("dbmanager-> startComputation: the job submit has failed!");
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
|
logger.error("dbmanager-> " + e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1811,6 +1813,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
employeeCache.remove(key);
|
employeeCache.remove(key);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
|
logger.error("dbmanager-> "+ e);
|
||||||
throw new Exception("Failure to clear the cache. " + e);
|
throw new Exception("Failure to clear the cache. " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class SessionUtil {
|
||||||
|
|
||||||
protected static Logger logger = Logger.getLogger(SessionUtil.class);
|
protected static Logger logger = Logger.getLogger(SessionUtil.class);
|
||||||
|
|
||||||
public static ASLSession getSession(HttpSession httpSession) {
|
public static ASLSession getAslSession(HttpSession httpSession) {
|
||||||
String sessionID = httpSession.getId();
|
String sessionID = httpSession.getId();
|
||||||
String user = (String) httpSession
|
String user = (String) httpSession
|
||||||
.getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
.getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
||||||
|
@ -28,7 +28,7 @@ public class SessionUtil {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
|
|
||||||
// user = "loredana.liccardo";
|
// user = "loredana.liccardo";
|
||||||
user = "dbmanager";
|
user = "database.manager";
|
||||||
httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, user);
|
httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, user);
|
||||||
ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
ScopeProvider.instance.set("/gcube/devsec/devVRE");
|
||||||
ASLSession session = SessionManager.getInstance().getASLSession(
|
ASLSession session = SessionManager.getInstance().getASLSession(
|
||||||
|
@ -48,7 +48,7 @@ public class SessionUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StatisticalManagerFactory getFactory(HttpSession httpSession) {
|
public static StatisticalManagerFactory getFactory(HttpSession httpSession) {
|
||||||
ASLSession session = getSession(httpSession);
|
ASLSession session = getAslSession(httpSession);
|
||||||
return getFactory(session);
|
return getFactory(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public class SessionUtil {
|
||||||
|
|
||||||
public static StatisticalManagerDataSpace getDataSpaceService(
|
public static StatisticalManagerDataSpace getDataSpaceService(
|
||||||
HttpSession httpSession) {
|
HttpSession httpSession) {
|
||||||
ASLSession session = getSession(httpSession);
|
ASLSession session = getAslSession(httpSession);
|
||||||
return getDataSpaceService(session);
|
return getDataSpaceService(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class SessionUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getUsername(HttpSession httpSession) {
|
public static String getUsername(HttpSession httpSession) {
|
||||||
ASLSession session = getSession(httpSession);
|
ASLSession session = getAslSession(httpSession);
|
||||||
return getUsername(session);
|
return getUsername(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public class SessionUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getScope(HttpSession httpSession) {
|
public static String getScope(HttpSession httpSession) {
|
||||||
ASLSession session = getSession(httpSession);
|
ASLSession session = getAslSession(httpSession);
|
||||||
return getScope(session);
|
return getScope(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,128 +1,128 @@
|
||||||
package org.gcube.portlets.user.databasesmanager.server.util;
|
//package org.gcube.portlets.user.databasesmanager.server.util;
|
||||||
|
//
|
||||||
import javax.servlet.http.HttpSession;
|
//import javax.servlet.http.HttpSession;
|
||||||
|
//
|
||||||
import org.apache.log4j.Logger;
|
//import org.apache.log4j.Logger;
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
//import org.gcube.application.framework.core.session.ASLSession;
|
||||||
import org.gcube.application.framework.core.session.SessionManager;
|
//import org.gcube.application.framework.core.session.SessionManager;
|
||||||
//import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
|
////import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
|
||||||
//import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
////import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||||
//import org.gcube.common.homelibrary.home.HomeLibrary;
|
////import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||||
//import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
|
////import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
|
||||||
//import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
////import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||||
//import org.gcube.common.homelibrary.home.workspace.Workspace;
|
////import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||||
//import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
////import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
//import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
//import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
|
////import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
|
||||||
//import org.gcube.portlets.user.workspace.server.GWTWorkspaceBuilder;
|
////import org.gcube.portlets.user.workspace.server.GWTWorkspaceBuilder;
|
||||||
//import org.gcube.portlets.user.workspace.server.notifications.NotificationsProducer;
|
////import org.gcube.portlets.user.workspace.server.notifications.NotificationsProducer;
|
||||||
//import org.gcube.portlets.user.workspace.server.resolver.UriResolverReaderParameter;
|
////import org.gcube.portlets.user.workspace.server.resolver.UriResolverReaderParameter;
|
||||||
//import org.gcube.portlets.user.workspace.server.shortener.UrlShortener;
|
////import org.gcube.portlets.user.workspace.server.shortener.UrlShortener;
|
||||||
//import org.gcube.portlets.user.workspace.server.util.resource.PropertySpecialFolderReader;
|
////import org.gcube.portlets.user.workspace.server.util.resource.PropertySpecialFolderReader;
|
||||||
//import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
|
////import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
|
||||||
|
//
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
*
|
// *
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
// * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* @Feb 18, 2014
|
// * @Feb 18, 2014
|
||||||
*
|
// *
|
||||||
*/
|
// */
|
||||||
public class WsUtil {
|
//public class WsUtil {
|
||||||
|
//
|
||||||
public static final String USERNAME_ATTRIBUTE = ScopeHelper.USERNAME_ATTRIBUTE;
|
// public static final String USERNAME_ATTRIBUTE = ScopeHelper.USERNAME_ATTRIBUTE;
|
||||||
// public static final String FOLDERIMPORTER_ATTRIBUTE = "FOLDER_IMPORTER";
|
//// public static final String FOLDERIMPORTER_ATTRIBUTE = "FOLDER_IMPORTER";
|
||||||
// public static final String METADATACONVERTER_ATTRIBUTE = "METADATA_CONVERTER";
|
//// public static final String METADATACONVERTER_ATTRIBUTE = "METADATA_CONVERTER";
|
||||||
// public static final String WORKSPACE_EVENT_COLLECTOR_ATTRIBUTE = "EVENT_COLLECTOR";
|
//// public static final String WORKSPACE_EVENT_COLLECTOR_ATTRIBUTE = "EVENT_COLLECTOR";
|
||||||
// public static final String WORKSPACEBUILDER_ATTRIBUTE = "WORKSPACEBUILDER";
|
//// public static final String WORKSPACEBUILDER_ATTRIBUTE = "WORKSPACEBUILDER";
|
||||||
// public static final String NOTIFICATION_MANAGER = "NOTIFICATION_MANAGER";
|
//// public static final String NOTIFICATION_MANAGER = "NOTIFICATION_MANAGER";
|
||||||
// public static final String NOTIFICATION_PRODUCER = "NOTIFICATION_PRODUCER";
|
//// public static final String NOTIFICATION_PRODUCER = "NOTIFICATION_PRODUCER";
|
||||||
// public static final String WS_RUN_IN_TEST_MODE = "WS_RUN_IN_TEST_MODE";
|
//// public static final String WS_RUN_IN_TEST_MODE = "WS_RUN_IN_TEST_MODE";
|
||||||
// public static final String WORKSPACE_SCOPE_UTIL = "WORKSPACE_SCOPE_UTIL";
|
//// public static final String WORKSPACE_SCOPE_UTIL = "WORKSPACE_SCOPE_UTIL";
|
||||||
// public static final String URL_SHORTENER_SERVICE = "URL_SHORTENER_SERVICE";
|
//// public static final String URL_SHORTENER_SERVICE = "URL_SHORTENER_SERVICE";
|
||||||
// public static final String URI_RESOLVER_SERVICE = "URI_RESOLVER_SERVICE";
|
//// public static final String URI_RESOLVER_SERVICE = "URI_RESOLVER_SERVICE";
|
||||||
// public static final String PROPERTY_SPECIAL_FOLDER = "PROPERTY_SPECIAL_FOLDER";
|
//// public static final String PROPERTY_SPECIAL_FOLDER = "PROPERTY_SPECIAL_FOLDER";
|
||||||
// public static final String NOTIFICATION_PORTLET_CLASS_ID = "org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl"; //IN DEV
|
//// public static final String NOTIFICATION_PORTLET_CLASS_ID = "org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl"; //IN DEV
|
||||||
|
//
|
||||||
// public static final String TEST_SCOPE = "/gcube/devsec";
|
//// public static final String TEST_SCOPE = "/gcube/devsec";
|
||||||
public static final String TEST_SCOPE = "/gcube/devsec/devVRE";
|
// public static final String TEST_SCOPE = "/gcube/devsec/devVRE";
|
||||||
|
//
|
||||||
|
//
|
||||||
// public static final String TEST_USER = "pasquale.pagano";
|
//// public static final String TEST_USER = "pasquale.pagano";
|
||||||
// public static final String TEST_USER = "federico.defaveri";
|
//// public static final String TEST_USER = "federico.defaveri";
|
||||||
// public static final String TEST_USER = "massimiliano.assante";
|
//// public static final String TEST_USER = "massimiliano.assante";
|
||||||
// public static final String TEST_USER = "pasquale.pagano";
|
//// public static final String TEST_USER = "pasquale.pagano";
|
||||||
// public static final String TEST_USER = "aureliano.gentile";
|
//// public static final String TEST_USER = "aureliano.gentile";
|
||||||
// public static final String TEST_USER = "antonio.gioia";
|
//// public static final String TEST_USER = "antonio.gioia";
|
||||||
|
//
|
||||||
//COMMENT THIS FOR RELEASE
|
// //COMMENT THIS FOR RELEASE
|
||||||
// public static final String TEST_USER = "francesco.mangiacrapa";
|
//// public static final String TEST_USER = "francesco.mangiacrapa";
|
||||||
// public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
|
//// public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
|
||||||
|
//
|
||||||
//UNCOMMENT THIS FOR RELEASE
|
// //UNCOMMENT THIS FOR RELEASE
|
||||||
// public static final String TEST_USER = "test.user";
|
//// public static final String TEST_USER = "test.user";
|
||||||
// public static final String TEST_USER_FULL_NAME = "Test User";
|
//// public static final String TEST_USER_FULL_NAME = "Test User";
|
||||||
|
//
|
||||||
public static final String TEST_USER = "dbmanager";
|
// public static final String TEST_USER = "dbmanager";
|
||||||
public static final String TEST_USER_FULL_NAME = "dbmanager";
|
// public static final String TEST_USER_FULL_NAME = "dbmanager";
|
||||||
|
//
|
||||||
|
//
|
||||||
protected static Logger logger = Logger.getLogger(WsUtil.class);
|
// protected static Logger logger = Logger.getLogger(WsUtil.class);
|
||||||
|
//
|
||||||
public static boolean withoutPortal = false;
|
// public static boolean withoutPortal = false;
|
||||||
|
//
|
||||||
public static ASLSession getAslSession(HttpSession httpSession)
|
// public static ASLSession getAslSession(HttpSession httpSession)
|
||||||
{
|
// {
|
||||||
String sessionID = httpSession.getId();
|
// String sessionID = httpSession.getId();
|
||||||
String user = (String) httpSession.getAttribute(USERNAME_ATTRIBUTE);
|
// String user = (String) httpSession.getAttribute(USERNAME_ATTRIBUTE);
|
||||||
ASLSession session;
|
// ASLSession session;
|
||||||
|
//
|
||||||
if (user == null) {
|
// if (user == null) {
|
||||||
|
//
|
||||||
/*USE ANOTHER ACCOUNT (OTHERWHISE BY TEST_USER) FOR RUNNING
|
// /*USE ANOTHER ACCOUNT (OTHERWHISE BY TEST_USER) FOR RUNNING
|
||||||
* COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/
|
// * COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/
|
||||||
user=TEST_USER;
|
// user=TEST_USER;
|
||||||
|
//
|
||||||
//UNCOMMENT THIS IN DEVELOP ENVIROMENT
|
// //UNCOMMENT THIS IN DEVELOP ENVIROMENT
|
||||||
// user = "francesco.mangiacrapa";
|
//// user = "francesco.mangiacrapa";
|
||||||
// user = "valentina.marioli";
|
//// user = "valentina.marioli";
|
||||||
|
//
|
||||||
logger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:");
|
// logger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:");
|
||||||
logger.warn("session id: "+sessionID);
|
// logger.warn("session id: "+sessionID);
|
||||||
logger.warn("TEST_USER: "+user);
|
// logger.warn("TEST_USER: "+user);
|
||||||
logger.warn("TEST_SCOPE: "+TEST_SCOPE);
|
// logger.warn("TEST_SCOPE: "+TEST_SCOPE);
|
||||||
logger.warn("USERNAME_ATTRIBUTE: "+USERNAME_ATTRIBUTE);
|
// logger.warn("USERNAME_ATTRIBUTE: "+USERNAME_ATTRIBUTE);
|
||||||
session = SessionManager.getInstance().getASLSession(sessionID, user);
|
// session = SessionManager.getInstance().getASLSession(sessionID, user);
|
||||||
session.setScope(TEST_SCOPE);
|
// session.setScope(TEST_SCOPE);
|
||||||
|
//
|
||||||
|
//
|
||||||
//MANDATORY FOR SOCIAL LIBRARY
|
// //MANDATORY FOR SOCIAL LIBRARY
|
||||||
session.setUserAvatarId(user + "Avatar");
|
// session.setUserAvatarId(user + "Avatar");
|
||||||
session.setUserFullName(TEST_USER_FULL_NAME);
|
// session.setUserFullName(TEST_USER_FULL_NAME);
|
||||||
session.setUserEmailAddress(user + "@mail.test");
|
// session.setUserEmailAddress(user + "@mail.test");
|
||||||
|
//
|
||||||
//SET HTTP SESSION ATTRIBUTE
|
// //SET HTTP SESSION ATTRIBUTE
|
||||||
httpSession.setAttribute(USERNAME_ATTRIBUTE, user);
|
// httpSession.setAttribute(USERNAME_ATTRIBUTE, user);
|
||||||
|
|
||||||
withoutPortal = true;
|
|
||||||
|
|
||||||
return session;
|
|
||||||
|
|
||||||
}else if(user.compareToIgnoreCase(TEST_USER)==0){
|
|
||||||
|
|
||||||
withoutPortal = true;
|
|
||||||
|
|
||||||
//*** COMMENT THIS IN PRODUCTION ENVIROMENT
|
|
||||||
// }else if(user.compareToIgnoreCase("francesco.mangiacrapa")==0){
|
|
||||||
//
|
//
|
||||||
// withoutPortal = true;
|
// withoutPortal = true;
|
||||||
//*** END UNCOMMENT
|
//
|
||||||
}else{
|
// return session;
|
||||||
|
//
|
||||||
withoutPortal = false;
|
// }else if(user.compareToIgnoreCase(TEST_USER)==0){
|
||||||
}
|
//
|
||||||
|
// withoutPortal = true;
|
||||||
return SessionManager.getInstance().getASLSession(sessionID, user);
|
//
|
||||||
}
|
////*** COMMENT THIS IN PRODUCTION ENVIROMENT
|
||||||
|
//// }else if(user.compareToIgnoreCase("francesco.mangiacrapa")==0){
|
||||||
}
|
////
|
||||||
|
//// withoutPortal = true;
|
||||||
|
////*** END UNCOMMENT
|
||||||
|
// }else{
|
||||||
|
//
|
||||||
|
// withoutPortal = false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return SessionManager.getInstance().getASLSession(sessionID, user);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
|
Loading…
Reference in New Issue