From a753d297476fe1e3631168fa99b7139e147ed35f Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Mon, 3 Feb 2020 16:59:35 +0100 Subject: [PATCH] Fixed readme and added native log support on Landing Page manager --- README.md | 4 ++-- .../portal/landingpage/LandingPageManager.java | 13 +++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index af23f9e..541b03d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# gCube System - VRE Folder Hook +# gCube System - Landing page Library -This component is a library used in different hooks that understands from which sites the user enter the gateway and redirects accordingly. +This component is a shared library (used in different hooks) that figures out from which sites the user enter the gateway and redirects accordingly. ## Structure of the project diff --git a/src/main/java/org/gcube/portal/landingpage/LandingPageManager.java b/src/main/java/org/gcube/portal/landingpage/LandingPageManager.java index 46260e9..53c360a 100644 --- a/src/main/java/org/gcube/portal/landingpage/LandingPageManager.java +++ b/src/main/java/org/gcube/portal/landingpage/LandingPageManager.java @@ -1,21 +1,19 @@ package org.gcube.portal.landingpage; import java.util.ArrayList; -import java.util.Date; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.gcube.common.portal.PortalContext; import org.gcube.portal.notifications.thread.NewUserSiteRegistrationNotificationThread; -import org.gcube.vomanagement.usermanagement.UserManager; import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; +import com.liferay.portal.kernel.log.Log; +import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.util.PropsKeys; import com.liferay.portal.kernel.util.PropsUtil; import com.liferay.portal.kernel.util.StringBundler; @@ -35,7 +33,7 @@ import com.liferay.portal.util.PortalUtil; * */ public class LandingPageManager { - private static final Logger _log = LoggerFactory.getLogger(LandingPageManager.class); + private static Log _log = LogFactoryUtil.getLog(LandingPageManager.class); public static final String GUEST_GROUP_FRIENDLY_URL = "/guest"; public static final String PRIVATE_GROUP_SERVLET_MAPPING = PropsUtil.get(PropsKeys.LAYOUT_FRIENDLY_URL_PRIVATE_GROUP_SERVLET_MAPPING); public static final String PORTAL_CONTEXT = PortalUtil.getPathContext(); @@ -43,6 +41,7 @@ public class LandingPageManager { public static String getLandingPagePath(final HttpServletRequest request) throws PortalException, SystemException { User currentUser = PortalUtil.getUser(request); + _log.info("getLandingPagePath called for user " + currentUser.getScreenName()); return getLandingPagePath(request, currentUser); } /** @@ -57,7 +56,7 @@ public class LandingPageManager { String sitePath = StringPool.BLANK; String currentVirtualHost = request.getServerName(); - _log.debug("currentHost is " + currentVirtualHost); + _log.info("currentHost is " + currentVirtualHost); Group site = null; List vHosts = VirtualHostLocalServiceUtil.getVirtualHosts(0, VirtualHostLocalServiceUtil.getVirtualHostsCount()); for (VirtualHost virtualHost : vHosts) { @@ -81,8 +80,6 @@ public class LandingPageManager { _log.info("But user " + currentUser.getFullName() + " is not registered to " + site.getName() + ". going to register ..."); String portalURL = PortalContext.getConfiguration().getGatewayURL(request); registerUserToSite(currentUser, site, portalURL); - - _log.info("currentVirtualHost = " + currentVirtualHost); //only for SBD Gateway we check if the user belongs to resource catalogue VRE and SoBigDataLab VRE if (currentVirtualHost.equalsIgnoreCase(SBD_GATEWAY_VHOST)) { _log.debug("currentVirtualHost.equalsIgnoreCase ->" + SBD_GATEWAY_VHOST);