diff --git a/.classpath b/.classpath
index b64646f..4557899 100644
--- a/.classpath
+++ b/.classpath
@@ -12,11 +12,6 @@
-
-
-
-
-
@@ -34,5 +29,10 @@
+
+
+
+
+
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index 65eedd1..ea3d26e 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -4,6 +4,7 @@
+
diff --git a/distro/changelog.xml b/distro/changelog.xml
index d329b3a..70c4066 100644
--- a/distro/changelog.xml
+++ b/distro/changelog.xml
@@ -1,7 +1,9 @@
- Minor fixes
+ Minor fixes
+ Removed asl session
+ Moved to Liferay logging system
diff --git a/pom.xml b/pom.xml
index 0131847..363091f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,8 +57,11 @@
- com.github.gwtbootstrap
- gwt-bootstrap
+ xerces
+ xercesImpl
+ 2.9.1
+ provided
+
com.google.gwt
@@ -78,30 +81,24 @@
provided
2.7.0
-
- org.gcube.portlets.user
- gcube-widgets
- compile
- [2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)
-
org.gcube.portal
custom-portal-handler
[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)
provided
-
- org.gcube.applicationsupportlayer
- aslcore
-
com.google
gwt-jsonmaker
+
+ com.github.gwtbootstrap
+ gwt-bootstrap
+
commons-codec
commons-codec
- compile
+ provided
org.gcube.core
@@ -113,6 +110,11 @@
portlet-api
provided
+
+ org.gcube.portlets.user
+ gcube-widgets
+ compile
+
org.gcube.portal
social-networking-library
diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/Statistics.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/Statistics.java
index 46b6c9f..add6d74 100644
--- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/Statistics.java
+++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/Statistics.java
@@ -1,15 +1,10 @@
package org.gcube.portlet.user.userstatisticsportlet.client;
-import org.gcube.portlets.user.gcubewidgets.client.ClientScopeHelper;
-
import com.google.gwt.core.client.EntryPoint;
-import com.google.gwt.user.client.Window.Location;
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define onModuleLoad()
.
- *
* @author Costantino Perciante at ISTI-CNR
*/
public class Statistics implements EntryPoint {
@@ -18,15 +13,8 @@ public class Statistics implements EntryPoint {
* This is the entry point method.
*/
public void onModuleLoad() {
- ClientScopeHelper.getService().setScope(Location.getHref(), new AsyncCallback() {
- @Override
- public void onSuccess(Boolean result) {
- // fill container with incoming statistics
- RootPanel.get("statistics-container").add(new StatisticsPanel());
- }
- @Override
- public void onFailure(Throwable caught) {
- }
- });
+
+ RootPanel.get("statistics-container").add(new StatisticsPanel());
+
}
}
diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/UserStatisticsServiceAsync.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/UserStatisticsServiceAsync.java
index 8d910e9..c670c19 100644
--- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/UserStatisticsServiceAsync.java
+++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/client/UserStatisticsServiceAsync.java
@@ -7,7 +7,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* Async version of the UserStatisticsService interface
- *
* @author Costantino Perciante at ISTI-CNR
*/
public interface UserStatisticsServiceAsync {
diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/ServerUtils.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/ServerUtils.java
index a436904..0e93275 100644
--- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/ServerUtils.java
+++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/ServerUtils.java
@@ -4,17 +4,19 @@ import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.List;
-import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpServletRequest;
-import org.gcube.application.framework.core.session.ASLSession;
-import org.gcube.application.framework.core.session.SessionManager;
-import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
+import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
+import org.gcube.common.portal.PortalContext;
+import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
+import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.gcube.vomanagement.usermanagement.util.ManagementUtils;
-import org.slf4j.LoggerFactory;
+import com.liferay.portal.kernel.log.Log;
+import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.model.Contact;
import com.liferay.portal.model.User;
import com.liferay.portal.model.Website;
@@ -33,36 +35,63 @@ import com.liferay.portlet.expando.model.ExpandoColumnConstants;
public class ServerUtils {
// Logger
- private static final org.slf4j.Logger logger = LoggerFactory.getLogger(ServerUtils.class);
+ // private static final org.slf4j.Logger logger = LoggerFactory.getLogger(UserStatisticsServiceImpl.class);
+ private static final Log logger = LogFactoryUtil.getLog(ServerUtils.class);
/**
- * the current ASLSession
- * @return the session
+ * Retrieve the current user by using the portal manager
+ * @return a GcubeUser object
*/
- public static ASLSession getASLSession(HttpSession session) {
+ public static GCubeUser getCurrentUser(HttpServletRequest request){
- String sessionID = session.getId();
- String user = (String) session.getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
+ if(request == null)
+ throw new IllegalArgumentException("HttpServletRequest is null!");
- if (user == null) {
-
- logger.warn("USER IS NULL setting " + UserStatisticsServiceImpl.TEST_USER + " and Running OUTSIDE PORTAL");
- user = getDevelopmentUser();
- SessionManager.getInstance().getASLSession(sessionID, user).setScope(UserStatisticsServiceImpl.TEST_CONTEXT);
-
- }
-
- return SessionManager.getInstance().getASLSession(sessionID, user);
+ PortalContext pContext = PortalContext.getConfiguration();
+ GCubeUser user = pContext.getCurrentUser(request);
+ logger.debug("Returning user " + user);
+ return user;
}
/**
- * when packaging test will fail if the user is not set to test.user
- * @return .
+ * Retrieve the current scope by using the portal manager
+ * @param b
+ * @return a GcubeUser object
*/
- public static String getDevelopmentUser() {
- String user = UserStatisticsServiceImpl.TEST_USER;
- // user = "costantino.perciante";
- return user;
+ public static String getCurrentContext(HttpServletRequest request, boolean setInThread){
+
+ if(request == null)
+ throw new IllegalArgumentException("HttpServletRequest is null!");
+
+ PortalContext pContext = PortalContext.getConfiguration();
+ String context = pContext.getCurrentScope(request);
+ logger.debug("Returning context " + context);
+
+ if(context != null && setInThread)
+ ScopeProvider.instance.set(context);
+
+ return context;
+ }
+
+ /**
+ * Get current user token
+ * @param request
+ * @param setInThread
+ * @return
+ */
+ public static String getCurrentSecurityToken(
+ HttpServletRequest request, boolean setInThread) {
+ if(request == null)
+ throw new IllegalArgumentException("HttpServletRequest is null!");
+
+ PortalContext pContext = PortalContext.getConfiguration();
+ String token = pContext.getCurrentUserToken(request);
+ logger.debug("Returning token " + token);
+
+ if(token != null && setInThread)
+ SecurityTokenProvider.instance.set(token);
+
+ return token;
}
/**
@@ -71,11 +100,11 @@ public class ServerUtils {
* the statistics to return are the ones available in the whole infrastructure
* @return true
if it is, false
otherwise.
*/
- public static boolean isInfrastructureScope(String userid, HttpSession session) {
+ public static boolean isInfrastructureScope(String userid, HttpServletRequest request) {
boolean toReturn = false;
try {
GroupManager manager = new LiferayGroupManager();
- long groupId = manager.getGroupIdFromInfrastructureScope(getASLSession(session).getScope());
+ long groupId = manager.getGroupIdFromInfrastructureScope(getCurrentContext(request, false));
toReturn = !manager.isVRE(groupId) || userid != null;
return toReturn;
}
@@ -242,17 +271,16 @@ public class ServerUtils {
* Set the permission checker to set/get custom fields into liferay
*/
public static void setPermissionChecker(){
-
- // set permission checker
- try{
- long adminId = LiferayUserManager.getAdmin().getUserId();
- PrincipalThreadLocal.setName(adminId);
- PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(UserLocalServiceUtil.getUser(adminId));
- PermissionThreadLocal.setPermissionChecker(permissionChecker);
- }catch(Exception e){
- logger.error("Unable to set permission checker. Custom fields set/get operations are likely to fail...");
+ if(isWithinPortal()){
+ try{
+ long adminId = LiferayUserManager.getAdmin().getUserId();
+ PrincipalThreadLocal.setName(adminId);
+ PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(UserLocalServiceUtil.getUser(adminId));
+ PermissionThreadLocal.setPermissionChecker(permissionChecker);
+ }catch(Exception e){
+ logger.error("Unable to set permission checker. Custom fields set/get operations are likely to fail...");
+ }
}
-
}
/**
@@ -260,35 +288,23 @@ public class ServerUtils {
* @param customFieldNameUserStatisticsVisibility
* @param b
*/
- public static void createUserCustomField(
- String customFieldNameUserStatisticsVisibility, boolean startingValue) {
-
- // set permission checker
- ServerUtils.setPermissionChecker();
-
- try{
-
- User defaultUser = UserLocalServiceUtil.getDefaultUser(ManagementUtils.getCompany().getCompanyId());
-
- // check if it exists
- boolean exists = defaultUser.getExpandoBridge().hasAttribute(customFieldNameUserStatisticsVisibility);
-
- if(exists){
-
- logger.debug("Custom field already exists... There is no need to create it");
-
- }else{
-
- logger.debug("Creating custom field " + customFieldNameUserStatisticsVisibility +
- " with starting value " + startingValue);
-
- // create
- defaultUser.getExpandoBridge().addAttribute(customFieldNameUserStatisticsVisibility, ExpandoColumnConstants.BOOLEAN, (Serializable)(true));
-
- }
-
- }catch(Exception e){
- logger.error("Unable to create custom field " + customFieldNameUserStatisticsVisibility);
- }
+ public static void createUserCustomField(String customFieldNameUserStatisticsVisibility, boolean startingValue) {
+ if(isWithinPortal()){
+ try{
+ ServerUtils.setPermissionChecker();
+ User defaultUser = UserLocalServiceUtil.getDefaultUser(ManagementUtils.getCompany().getCompanyId());
+ boolean exists = defaultUser.getExpandoBridge().hasAttribute(customFieldNameUserStatisticsVisibility);
+ if(exists){
+ logger.debug("Custom field already exists... There is no need to create it");
+ }else{
+ logger.debug("Creating custom field " + customFieldNameUserStatisticsVisibility +
+ " with starting value " + startingValue);
+ defaultUser.getExpandoBridge().addAttribute(customFieldNameUserStatisticsVisibility, ExpandoColumnConstants.BOOLEAN, (Serializable)(true));
+ }
+ }catch(Exception e){
+ logger.error("Unable to create custom field " + customFieldNameUserStatisticsVisibility);
+ }
+ }
}
+
}
diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java
index a851a0c..b8bc73d 100644
--- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java
+++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java
@@ -7,7 +7,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.workspace.Workspace;
import org.gcube.common.portal.PortalContext;
@@ -26,10 +25,11 @@ import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
import org.gcube.vomanagement.usermanagement.util.ManagementUtils;
-import org.slf4j.LoggerFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.liferay.portal.kernel.cache.CacheRegistryUtil;
+import com.liferay.portal.kernel.log.Log;
+import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.model.User;
import com.liferay.portal.service.UserLocalServiceUtil;
@@ -39,9 +39,8 @@ import com.liferay.portal.service.UserLocalServiceUtil;
@SuppressWarnings("serial")
public class UserStatisticsServiceImpl extends RemoteServiceServlet implements UserStatisticsService {
- private static final org.slf4j.Logger logger = LoggerFactory.getLogger(UserStatisticsServiceImpl.class);
- public static final String TEST_USER = "test.user";
- public static final String TEST_CONTEXT = "/gcube/devsec/devVRE";
+ // private static final org.slf4j.Logger logger = LoggerFactory.getLogger(UserStatisticsServiceImpl.class);
+ private static final Log logger = LogFactoryUtil.getLog(UserStatisticsServiceImpl.class);
private DatabookStore store;
private static final String CUSTOM_FIELD_NAME_USER_STATISTICS_VISIBILITY = "show_user_statistics_other_people";
private UserManager userManager = new LiferayUserManager();
@@ -63,34 +62,37 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
@Override
public String getTotalSpaceInUse(String userid) {
String storageInUse = null;
- ASLSession session = ServerUtils.getASLSession(this.getThreadLocalRequest().getSession());
- String userName = session.getUsername();
+ String userName = ServerUtils.getCurrentUser(this.getThreadLocalRequest()).getUsername();
+
+ // get context & token and set
+ ServerUtils.getCurrentContext(this.getThreadLocalRequest(), true);
+ ServerUtils.getCurrentSecurityToken(this.getThreadLocalRequest(), true);
+
+ if(userName == null){
+ logger.warn("Unable to determine the current user, returing null");
+ }
+
String statisticsOfUsername = userName;
if(userid != null && !userid.equals(userName))
statisticsOfUsername = userid;
- if (userName.compareTo(TEST_USER) == 0) {
- logger.debug("Found " + userName + " returning nothing");
- return null;
- }else{
+ logger.debug("Getting " + statisticsOfUsername + " amount of workspace in use.");
+ try{
+ UserInfrastructureSpaceCache cacheWorkspace = UserInfrastructureSpaceCache.getCacheInstance();
+ Long storageInUseLong = (Long) cacheWorkspace.get(statisticsOfUsername);
- logger.debug("Getting " + statisticsOfUsername + " amount of workspace in use.");
- try{
- UserInfrastructureSpaceCache cacheWorkspace = UserInfrastructureSpaceCache.getCacheInstance();
- Long storageInUseLong = (Long) cacheWorkspace.get(statisticsOfUsername);
-
- if(storageInUseLong == null){
- Workspace workspace = HomeLibrary.getUserWorkspace(statisticsOfUsername);
- storageInUseLong = workspace.getDiskUsage();
- cacheWorkspace.insert(statisticsOfUsername, storageInUseLong);
- }
-
- storageInUse = ServerUtils.formatFileSize(storageInUseLong);
- }catch(Exception e){
- logger.error("Unable to retrieve workspace information!");
+ if(storageInUseLong == null){
+ Workspace workspace = HomeLibrary.getUserWorkspace(statisticsOfUsername);
+ storageInUseLong = workspace.getDiskUsage();
+ cacheWorkspace.insert(statisticsOfUsername, storageInUseLong);
}
+
+ storageInUse = ServerUtils.formatFileSize(storageInUseLong);
+ }catch(Exception e){
+ logger.error("Unable to retrieve workspace information!", e);
}
+
return storageInUse;
}
@@ -98,36 +100,40 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
public int getProfileStrength(String userid) {
int profileStrenght = -1;
- ASLSession session = ServerUtils.getASLSession(this.getThreadLocalRequest().getSession());
- String userName = session.getUsername();
+ String userName = ServerUtils.getCurrentUser(this.getThreadLocalRequest()).getUsername();
+
+ if(userName == null){
+ logger.warn("Unable to determine the current user, returing null");
+ }
+
String statisticsOfUsername = userName;
if(userid != null && !userid.equals(userName))
statisticsOfUsername = userid;
- if (userName.compareTo(TEST_USER) == 0) {
- logger.debug("Found " + userName + " returning nothing");
- return profileStrenght;
- }else{
-
- if(ServerUtils.isWithinPortal()){
- try{
- boolean avatarPresent = (userManager.getUserAvatarBytes(statisticsOfUsername) != null);
- User user = UserLocalServiceUtil.getUserByScreenName(SiteManagerUtil.getCompany().getCompanyId(), statisticsOfUsername);
- profileStrenght = ServerUtils.evaluateProfileStrenght(user, avatarPresent);
- }catch(Exception e){
- logger.error("Profile strenght evaluation failed!!" + e.toString(), e);
- }
+ if(ServerUtils.isWithinPortal()){
+ try{
+ boolean avatarPresent = (userManager.getUserAvatarBytes(statisticsOfUsername) != null);
+ User user = UserLocalServiceUtil.getUserByScreenName(SiteManagerUtil.getCompany().getCompanyId(), statisticsOfUsername);
+ profileStrenght = ServerUtils.evaluateProfileStrenght(user, avatarPresent);
+ }catch(Exception e){
+ logger.error("Profile strenght evaluation failed!!" + e.toString(), e);
}
}
+
return profileStrenght;
}
@Override
public UserInformation getUserSettings(String userid) {
- ASLSession session = ServerUtils.getASLSession(this.getThreadLocalRequest().getSession());
- String userName = session.getUsername();
+ String userName = ServerUtils.getCurrentUser(this.getThreadLocalRequest()).getUsername();
+
+ if(userName == null){
+ logger.warn("Unable to determine the current user, returing null");
+ return null;
+ }
+
String statisticsOfUsername = userName;
boolean isOwner = false;
boolean isProfileShowable = true;
@@ -143,13 +149,8 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
logger.info("Is profile showable for user " + userid + " " + isProfileShowable);
}
- if (userName.compareTo(TEST_USER) == 0) {
- logger.debug("Found " + userName + " returning nothing");
- return null;
- }
-
if(ServerUtils.isWithinPortal()){
- boolean isInfrastructure = ServerUtils.isInfrastructureScope(userid, this.getThreadLocalRequest().getSession());
+ boolean isInfrastructure = ServerUtils.isInfrastructureScope(userid, this.getThreadLocalRequest());
logger.debug("User scope is " + (isInfrastructure ? " the whole infrastucture " : " a VRE"));
String thumbnailURL = null;
@@ -162,7 +163,8 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
String actualVre = null;
if(!isInfrastructure){
- String[] temp = session.getScope().split("/");
+
+ String[] temp = ServerUtils.getCurrentContext(this.getThreadLocalRequest(), true).split("/");
actualVre = temp[temp.length - 1];
}
@@ -172,7 +174,7 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
return bean;
}
else
- return new UserInformation(true, null, userName, TEST_CONTEXT, true, true);
+ return new UserInformation(true, null, userName, ServerUtils.getCurrentContext(this.getThreadLocalRequest(), false), true, true);
}
/**
@@ -181,39 +183,39 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
* @return
*/
private boolean checkUserPrivacyOption(String username) {
- try{
-
- ServerUtils.setPermissionChecker();
- CacheRegistryUtil.clear();
- User user = UserLocalServiceUtil.getUserByScreenName(ManagementUtils.getCompany().getCompanyId(), username);
- if(!user.getExpandoBridge().hasAttribute(CUSTOM_FIELD_NAME_USER_STATISTICS_VISIBILITY))
+ if(ServerUtils.isWithinPortal()){
+ try{
+ ServerUtils.setPermissionChecker();
+ CacheRegistryUtil.clear();
+ User user = UserLocalServiceUtil.getUserByScreenName(ManagementUtils.getCompany().getCompanyId(), username);
+ if(!user.getExpandoBridge().hasAttribute(CUSTOM_FIELD_NAME_USER_STATISTICS_VISIBILITY))
+ return true;
+ return (boolean)user.getExpandoBridge().getAttribute(CUSTOM_FIELD_NAME_USER_STATISTICS_VISIBILITY);
+ }catch(Exception e){
+ logger.error("Unable to retrieve user's privacy option for his statistics");
return true;
- return (boolean)user.getExpandoBridge().getAttribute(CUSTOM_FIELD_NAME_USER_STATISTICS_VISIBILITY);
- }catch(Exception e){
- logger.error("Unable to retrieve user's privacy option for his statistics");
- return true;
+ }
}
+ return false;
}
@Override
public PostsStatsBean getPostsStats(String userid){
- ASLSession session = ServerUtils.getASLSession(this.getThreadLocalRequest().getSession());
- String userName = session.getUsername();
- String scope = session.getScope();
+ String userName = ServerUtils.getCurrentUser(this.getThreadLocalRequest()).getUsername();
- if (userName.compareTo(TEST_USER) == 0) {
- logger.debug("Found " + userName + " returning nothing");
- return null;
+ if(userName == null){
+ logger.warn("Unable to determine the current user, returing null");
}
+ String scope = ServerUtils.getCurrentContext(this.getThreadLocalRequest(), true);
PostsStatsBean toReturn = null;
String statisticsOfUsername = userName;
if(userid != null && !userid.equals(userName))
statisticsOfUsername = userid;
- boolean isInfrastructure = ServerUtils.isInfrastructureScope(userid, this.getThreadLocalRequest().getSession());
+ boolean isInfrastructure = ServerUtils.isInfrastructureScope(userid, this.getThreadLocalRequest());
Calendar oneYearAgo = Calendar.getInstance();
oneYearAgo.set(Calendar.YEAR, oneYearAgo.get(Calendar.YEAR) - 1);
@@ -281,12 +283,13 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U
public void setShowMyOwnStatisticsToOtherPeople(boolean show) {
if(ServerUtils.isWithinPortal()){
- ASLSession session = ServerUtils.getASLSession(this.getThreadLocalRequest().getSession());
- String username = session.getUsername();
- if (username.compareTo(TEST_USER) == 0) {
- logger.debug("Found " + username + " returning nothing");
- return;
+
+ String username = ServerUtils.getCurrentUser(this.getThreadLocalRequest()).getUsername();
+
+ if(username == null){
+ logger.warn("Unable to determine the current user, returing null");
}
+
try{
ServerUtils.setPermissionChecker();
CacheRegistryUtil.clear();
diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/cache/UserInfrastructureSpaceCache.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/cache/UserInfrastructureSpaceCache.java
index 1292761..72871ec 100644
--- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/cache/UserInfrastructureSpaceCache.java
+++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/cache/UserInfrastructureSpaceCache.java
@@ -3,7 +3,8 @@ package org.gcube.portlet.user.userstatisticsportlet.server.cache;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.slf4j.LoggerFactory;
+import com.liferay.portal.kernel.log.Log;
+import com.liferay.portal.kernel.log.LogFactoryUtil;
/**
* Cache for the user's space in use within the infrastructure
@@ -11,8 +12,9 @@ import org.slf4j.LoggerFactory;
* (costantino.perciante@isti.cnr.it)
*/
public class UserInfrastructureSpaceCache implements CacheInterface {
-
- private static final org.slf4j.Logger logger = LoggerFactory.getLogger(UserInfrastructureSpaceCache.class);
+
+ //private static final org.slf4j.Logger logger = LoggerFactory.getLogger(UserInfrastructureSpaceCache.class);
+ private static final Log logger = LogFactoryUtil.getLog(UserInfrastructureSpaceCache.class);
/**
* The instance
@@ -33,9 +35,7 @@ public class UserInfrastructureSpaceCache implements CacheInterface();
-
}
/**
@@ -43,18 +43,14 @@ public class UserInfrastructureSpaceCache implements CacheInterface bean = userSpaceMap.get(key);
-
if(CacheUtilities.expired(bean.getTTL(), EXPIRED_AFTER)){
userSpaceMap.remove(key);
logger.debug("Amount of space in the infrastructure used expired for key " + key + ", returning null");
@@ -62,21 +58,13 @@ public class UserInfrastructureSpaceCache implements CacheInterface newBean = new CacheValueBean(value, System.currentTimeMillis());
-
- if(userSpaceMap.containsKey(key))
- userSpaceMap.remove(key);
-
userSpaceMap.put(key, newBean);
-
return true;
}
}
diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/portlet/UserStatisticsPortlet.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/portlet/UserStatisticsPortlet.java
index f007723..2f7986e 100644
--- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/portlet/UserStatisticsPortlet.java
+++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/portlet/UserStatisticsPortlet.java
@@ -10,12 +10,9 @@ import javax.portlet.PortletRequestDispatcher;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
-import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
-
public class UserStatisticsPortlet extends GenericPortlet {
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
response.setContentType("text/html");
- ScopeHelper.setContext(request);
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/Statistics_view.jsp");
dispatcher.include(request, response);
}
diff --git a/src/main/resources/clientlog4j.properties b/src/main/resources/clientlog4j.properties
deleted file mode 100644
index 4a2e1cd..0000000
--- a/src/main/resources/clientlog4j.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-log4j.rootLogger=DEBUG, A1
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-
-# Print the date in ISO 8601 format
-log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
-
-# Print only messages of level TRACE or above in the package org.gcube
-log4j.logger.org.gcube=TRACE
-log4j.logger.org.gcube.application.framework.core.session=INFO
-log4j.logger.org.gcube.common.scope.impl.DefaultScopeProvider=ERROR
-log4j.logger.com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor=ERROR
\ No newline at end of file
diff --git a/src/main/resources/org/gcube/portlet/user/userstatisticsportlet/Statistics.gwt.xml b/src/main/resources/org/gcube/portlet/user/userstatisticsportlet/Statistics.gwt.xml
index 72ed0ab..94bd433 100644
--- a/src/main/resources/org/gcube/portlet/user/userstatisticsportlet/Statistics.gwt.xml
+++ b/src/main/resources/org/gcube/portlet/user/userstatisticsportlet/Statistics.gwt.xml
@@ -5,7 +5,6 @@
-
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index 018029a..2f1330a 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -10,19 +10,11 @@
userStatisticsServlet
org.gcube.portlet.user.userstatisticsportlet.server.UserStatisticsServiceImpl
-
- scopeService
- org.gcube.portlets.user.gcubewidgets.server.ScopeServiceImpl
-
userStatisticsServlet
/statistics/statisticservice
-
- scopeService
- /statistics/scopeService
-
diff --git a/src/test/java/org/gcube/portlet/user/userstatisticsportlet/client/TestForDeploy.java b/src/test/java/org/gcube/portlet/user/userstatisticsportlet/client/TestForDeploy.java
deleted file mode 100644
index e652fc1..0000000
--- a/src/test/java/org/gcube/portlet/user/userstatisticsportlet/client/TestForDeploy.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.gcube.portlet.user.userstatisticsportlet.client;
-
-import static org.junit.Assert.assertTrue;
-
-import org.gcube.portlet.user.userstatisticsportlet.server.ServerUtils;
-import org.gcube.portlet.user.userstatisticsportlet.server.UserStatisticsServiceImpl;
-import org.junit.Test;
-
-public class TestForDeploy {
-
- @Test
- public void testUserIsTestUser() {
- String username = ServerUtils.getDevelopmentUser();
- System.out.println("username for deploy is: " + username);
- assertTrue(username.compareTo(UserStatisticsServiceImpl.TEST_USER) == 0);
- System.out.println("Test OK!");
- }
-
-}