|
|
|
@ -6,18 +6,19 @@ import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Properties;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
|
|
|
|
|
|
import org.gcube.application.framework.core.session.ASLSession;
|
|
|
|
|
import org.gcube.application.framework.core.session.SessionManager;
|
|
|
|
|
import org.gcube.common.homelibrary.home.HomeLibrary;
|
|
|
|
|
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
|
|
|
|
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException;
|
|
|
|
|
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
|
|
|
|
|
import org.gcube.common.portal.PortalContext;
|
|
|
|
|
import org.gcube.portal.custom.communitymanager.SiteManagerUtil;
|
|
|
|
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
|
|
|
|
import org.gcube.portlets.user.gcubeloggedin.client.LoggedinService;
|
|
|
|
|
import org.gcube.portlets.user.gcubeloggedin.shared.VObject;
|
|
|
|
@ -27,10 +28,11 @@ import org.gcube.portlets.user.gcubewidgets.server.ScopeServiceImpl;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.GroupManager;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.UserManager;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayGroupManager;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.model.RoleModel;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.model.UserModel;
|
|
|
|
|
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.model.GCubeRole;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
@ -38,11 +40,13 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
|
|
|
|
import com.liferay.portal.kernel.bean.BeanLocatorException;
|
|
|
|
|
import com.liferay.portal.kernel.exception.PortalException;
|
|
|
|
|
import com.liferay.portal.kernel.exception.SystemException;
|
|
|
|
|
import com.liferay.portal.kernel.servlet.ImageServletTokenUtil;
|
|
|
|
|
import com.liferay.portal.kernel.management.PortalManager;
|
|
|
|
|
import com.liferay.portal.kernel.util.WebKeys;
|
|
|
|
|
import com.liferay.portal.model.Group;
|
|
|
|
|
import com.liferay.portal.model.Organization;
|
|
|
|
|
import com.liferay.portal.model.RoleModel;
|
|
|
|
|
import com.liferay.portal.model.User;
|
|
|
|
|
import com.liferay.portal.model.UserModel;
|
|
|
|
|
import com.liferay.portal.security.permission.PermissionChecker;
|
|
|
|
|
import com.liferay.portal.security.permission.PermissionCheckerFactoryUtil;
|
|
|
|
|
import com.liferay.portal.security.permission.PermissionThreadLocal;
|
|
|
|
@ -107,18 +111,18 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
"", "", "", UserBelongingClient.BELONGING, false, true);
|
|
|
|
|
}
|
|
|
|
|
_log.trace("getting Selected Research Environment");
|
|
|
|
|
Organization currOrg = null;
|
|
|
|
|
GroupManager gm = new LiferayGroupManager();
|
|
|
|
|
GCubeGroup currSite = null;
|
|
|
|
|
try {
|
|
|
|
|
List<Group> groups = GroupLocalServiceUtil.getGroups(0, GroupLocalServiceUtil.getGroupsCount());
|
|
|
|
|
for (Group g : groups) {
|
|
|
|
|
if (g.isOrganization() || g.isCommunity())
|
|
|
|
|
if (g.getFriendlyURL().compareTo(friendlyURL) == 0) {
|
|
|
|
|
long organizationId = g.getClassPK();
|
|
|
|
|
currOrg = OrganizationLocalServiceUtil.getOrganization(organizationId);
|
|
|
|
|
String scopeToSet = ScopeServiceImpl.buildScope(g);
|
|
|
|
|
getASLSession().setScope(scopeToSet);
|
|
|
|
|
_log.info("GOT Selected Research Environment: " + scopeToSet);
|
|
|
|
|
}
|
|
|
|
|
List<GCubeGroup> groups = gm.listGroups();
|
|
|
|
|
for (GCubeGroup g : groups) {
|
|
|
|
|
if (g.getFriendlyURL().compareTo(friendlyURL) == 0) {
|
|
|
|
|
long groupId = g.getGroupId();
|
|
|
|
|
String scopeToSet = gm.getInfrastructureScope(groupId);
|
|
|
|
|
getASLSession().setScope(scopeToSet);
|
|
|
|
|
_log.info("GOT Selected Research Environment: " + scopeToSet);
|
|
|
|
|
currSite = g;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
@ -127,27 +131,33 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
/**
|
|
|
|
|
* set the current ORG bean in session
|
|
|
|
|
*/
|
|
|
|
|
aslSession.setAttribute(ScopeHelper.CURR_ORG, currOrg);
|
|
|
|
|
aslSession.setAttribute(ScopeHelper.CURR_ORG, currSite);
|
|
|
|
|
|
|
|
|
|
aslSession.setGroupModelInfos(currOrg.getName(), currOrg.getOrganizationId());
|
|
|
|
|
aslSession.setGroupModelInfos(currSite.getGroupName(), currSite.getGroupId());
|
|
|
|
|
|
|
|
|
|
_log.trace("CURRENT ORG SET IN SESSION: " + currOrg.getName());
|
|
|
|
|
_log.trace("CURRENT ORG SET IN SESSION: " + currSite.getGroupName());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String name = currOrg.getName();
|
|
|
|
|
long logoId = currOrg.getLogoId();
|
|
|
|
|
ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY);
|
|
|
|
|
String logoURL = themeDisplay.getPathImage()+"/organization_logo?img_id="+ logoId +"&t" + ImageServletTokenUtil.getToken(logoId);
|
|
|
|
|
String name = currSite.getGroupName();
|
|
|
|
|
String logoURL = "/image/layout_set_logo?img_id="+currSite.getLogoId();
|
|
|
|
|
String desc = "";
|
|
|
|
|
//set the description for the vre
|
|
|
|
|
if (currOrg.getComments() != null)
|
|
|
|
|
desc = currOrg.getComments();
|
|
|
|
|
VREClient vre = new VREClient(name, "", desc, logoURL, "", UserBelongingClient.BELONGING, isEnabled(username, currOrg, MANDATORY_GROUP), isEnabled(username, currOrg, REQUEST_BASED_GROUP));
|
|
|
|
|
if (currSite.getDescription() != null)
|
|
|
|
|
desc = currSite.getDescription();
|
|
|
|
|
Group currGroup = null;
|
|
|
|
|
try {
|
|
|
|
|
currGroup = GroupLocalServiceUtil.getGroup(currSite.getGroupId());
|
|
|
|
|
} catch (PortalException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} catch (SystemException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
VREClient vre = new VREClient(name, "", desc, logoURL, "", UserBelongingClient.BELONGING, isEnabled(username, currGroup, MANDATORY_GROUP), isEnabled(username, currGroup, REQUEST_BASED_GROUP));
|
|
|
|
|
return vre;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Boolean isEnabled(String username, Organization currOrg, String attrToCheck) {
|
|
|
|
|
private Boolean isEnabled(String username, Group currOrg, String attrToCheck) {
|
|
|
|
|
Boolean isEnabled = false;
|
|
|
|
|
if (username.compareTo("test.user") == 0) {
|
|
|
|
|
_log.warn("Found test.user maybe you are in dev mode, returning ... ");
|
|
|
|
@ -155,14 +165,14 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
long companyId = OrganizationsUtil.getCompany().getCompanyId();
|
|
|
|
|
long companyId = SiteManagerUtil.getCompany().getCompanyId();
|
|
|
|
|
_log.trace("Setting Thread Permission");
|
|
|
|
|
User user = UserLocalServiceUtil.getUserByScreenName(companyId, ScopeHelper.getAdministratorUsername());
|
|
|
|
|
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user, false);
|
|
|
|
|
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user);
|
|
|
|
|
PermissionThreadLocal.setPermissionChecker(permissionChecker);
|
|
|
|
|
_log.trace("Setting Permission ok!");
|
|
|
|
|
|
|
|
|
|
User currentUser = OrganizationsUtil.validateUser(username);
|
|
|
|
|
User currentUser = SiteManagerUtil.validateUser(username);
|
|
|
|
|
if (currOrg.getExpandoBridge().getAttribute(attrToCheck) == null || currOrg.getExpandoBridge().getAttribute(attrToCheck).equals("")) {
|
|
|
|
|
_log.trace("Attribute " + attrToCheck + " must be initialized");
|
|
|
|
|
setOrgCustomAttribute(username, currOrg, attrToCheck);
|
|
|
|
@ -174,10 +184,10 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_log.trace("Setting Thread Permission back to regular");
|
|
|
|
|
permissionChecker = PermissionCheckerFactoryUtil.create(currentUser, false);
|
|
|
|
|
permissionChecker = PermissionCheckerFactoryUtil.create(currentUser);
|
|
|
|
|
PermissionThreadLocal.setPermissionChecker(permissionChecker);
|
|
|
|
|
_log.trace("Setting Permission ok! returning ...");
|
|
|
|
|
System.out.println(" returning *********** isEnabled=" + isEnabled);
|
|
|
|
|
_log.debug(" returning *********** isEnabled=" + isEnabled);
|
|
|
|
|
return isEnabled;
|
|
|
|
|
} catch (BeanLocatorException ex) {
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
@ -194,17 +204,17 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
* @param username
|
|
|
|
|
* @param attribute2Set
|
|
|
|
|
*/
|
|
|
|
|
private void setOrgCustomAttribute(String username, Organization currOrg, String attribute2Set) {
|
|
|
|
|
private void setOrgCustomAttribute(String username, Group currGroup, String attribute2Set) {
|
|
|
|
|
User currUser = null;
|
|
|
|
|
if (username.compareTo("test.user") == 0) {
|
|
|
|
|
_log.warn("Found Test User, returning ... ");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
long companyId = OrganizationsUtil.getCompany().getCompanyId();
|
|
|
|
|
long companyId = SiteManagerUtil.getCompany().getCompanyId();
|
|
|
|
|
_log.trace("Setting Thread Permission");
|
|
|
|
|
User user = UserLocalServiceUtil.getUserByScreenName(companyId, ScopeHelper.getAdministratorUsername());
|
|
|
|
|
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user, false);
|
|
|
|
|
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user);
|
|
|
|
|
PermissionThreadLocal.setPermissionChecker(permissionChecker);
|
|
|
|
|
_log.trace("Setting Permission ok!");
|
|
|
|
|
|
|
|
|
@ -212,15 +222,15 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
//add the custom attrs
|
|
|
|
|
currUser = UserLocalServiceUtil.getUserByScreenName(companyId, username);
|
|
|
|
|
|
|
|
|
|
if (! currOrg.getExpandoBridge().hasAttribute(attribute2Set))
|
|
|
|
|
currOrg.getExpandoBridge().addAttribute(attribute2Set);
|
|
|
|
|
if (! currGroup.getExpandoBridge().hasAttribute(attribute2Set))
|
|
|
|
|
currGroup.getExpandoBridge().addAttribute(attribute2Set);
|
|
|
|
|
|
|
|
|
|
currOrg.getExpandoBridge().setAttribute(attribute2Set, "true");
|
|
|
|
|
currGroup.getExpandoBridge().setAttribute(attribute2Set, "true");
|
|
|
|
|
_log.trace("setAttribute true");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_log.trace("Setting Thread Permission back to regular");
|
|
|
|
|
permissionChecker = PermissionCheckerFactoryUtil.create(currUser, false);
|
|
|
|
|
permissionChecker = PermissionCheckerFactoryUtil.create(currUser);
|
|
|
|
|
PermissionThreadLocal.setPermissionChecker(permissionChecker);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
@ -228,48 +238,6 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The Default Community is a community where all portal user belong to
|
|
|
|
|
* @return the default community URL
|
|
|
|
|
* @throws SystemException
|
|
|
|
|
* @throws PortalException
|
|
|
|
|
*/
|
|
|
|
|
public String getDefaultCommunityURL() {
|
|
|
|
|
//get the portles to look for from the property file
|
|
|
|
|
Properties props = new Properties();
|
|
|
|
|
String comName = "";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
String propertyfile = this.getServletContext().getRealPath("")+"/config/resources.properties";
|
|
|
|
|
File propsFile = new File(propertyfile);
|
|
|
|
|
FileInputStream fis = new FileInputStream(propsFile);
|
|
|
|
|
props.load( fis);
|
|
|
|
|
comName = props.getProperty("defaultcommunity");
|
|
|
|
|
}
|
|
|
|
|
//catch exception in case properties file does not exist
|
|
|
|
|
catch(IOException e) {
|
|
|
|
|
_log.error("/config/resources.properties not found, Returning \"Data e-Infrastructure gateway\" as default Community");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String toReturn = "";
|
|
|
|
|
_log.trace("Default Community Read from config file: " + comName);
|
|
|
|
|
Group myPlace = null;
|
|
|
|
|
try {
|
|
|
|
|
myPlace = GroupLocalServiceUtil.getGroup(OrganizationsUtil.getCompany().getCompanyId(), comName);
|
|
|
|
|
|
|
|
|
|
if(myPlace.isCommunity()) {
|
|
|
|
|
ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY);
|
|
|
|
|
toReturn = myPlace.getPathFriendlyURL(true, themeDisplay) + myPlace.getFriendlyURL();
|
|
|
|
|
}
|
|
|
|
|
} catch (PortalException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} catch (SystemException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
toReturn = getPortalBasicUrl()+toReturn;
|
|
|
|
|
_log.trace("RETURNING Default Community URL: " + toReturn);
|
|
|
|
|
return toReturn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -306,8 +274,8 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
try {
|
|
|
|
|
userM.dismissUserFromGroup(getCurrentGroupID(), userM.getUserId(username));
|
|
|
|
|
removeUserFromHLGroup(username, getASLSession().getScope());
|
|
|
|
|
sendUserUnregisteredNotification(username, getASLSession().getScope(), getPortalBasicUrl(), readGatewayName());
|
|
|
|
|
return getDefaultCommunityURL();
|
|
|
|
|
sendUserUnregisteredNotification(username, getASLSession().getScope(), getPortalBasicUrl(), PortalContext.getConfiguration().getGatewayName());
|
|
|
|
|
return "/";
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
@ -320,7 +288,7 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
* @return the current group ID or null if an exception is thrown
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
private String getCurrentGroupID(){
|
|
|
|
|
private long getCurrentGroupID(){
|
|
|
|
|
ASLSession session = getASLSession();
|
|
|
|
|
_log.debug("The current group NAME is --> " + session.getGroupName());
|
|
|
|
|
try {
|
|
|
|
@ -333,7 +301,7 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void removeUserFromHLGroup(String username, String group) {
|
|
|
|
@ -350,14 +318,14 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
protected static ArrayList<String> getAdministratorsEmails(String scope) {
|
|
|
|
|
LiferayUserManager userManager = new LiferayUserManager();
|
|
|
|
|
LiferayGroupManager groupManager = new LiferayGroupManager();
|
|
|
|
|
String groupId = null;
|
|
|
|
|
long groupId = -1;
|
|
|
|
|
try {
|
|
|
|
|
List<org.gcube.vomanagement.usermanagement.model.GroupModel> allGroups = groupManager.listGroups();
|
|
|
|
|
List<GCubeGroup> allGroups = groupManager.listGroups();
|
|
|
|
|
_log.debug("Number of groups retrieved: " + allGroups.size());
|
|
|
|
|
for (int i = 0; i < allGroups.size(); i++) {
|
|
|
|
|
String grId = allGroups.get(i).getGroupId();
|
|
|
|
|
long grId = allGroups.get(i).getGroupId();
|
|
|
|
|
String groupScope = groupManager.getScope(grId);
|
|
|
|
|
System.out.println("Comparing: " + groupScope + " " + scope);
|
|
|
|
|
_log.debug("Comparing: " + groupScope + " " + scope);
|
|
|
|
|
if (groupScope.equals(scope)) {
|
|
|
|
|
groupId = allGroups.get(i).getGroupId();
|
|
|
|
|
break;
|
|
|
|
@ -366,16 +334,16 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
HashMap<UserModel, List<RoleModel>> usersAndRoles = null;
|
|
|
|
|
Map<GCubeUser, List<GCubeRole>> usersAndRoles = null;
|
|
|
|
|
try {
|
|
|
|
|
usersAndRoles = userManager.listUsersAndRolesByGroup(groupId);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
Set<UserModel> users = usersAndRoles.keySet();
|
|
|
|
|
Set<GCubeUser> users = usersAndRoles.keySet();
|
|
|
|
|
ArrayList<String> adminEmailsList = new ArrayList<String>();
|
|
|
|
|
for (UserModel usr:users) {
|
|
|
|
|
List<RoleModel> roles = usersAndRoles.get(usr);
|
|
|
|
|
for (GCubeUser usr:users) {
|
|
|
|
|
List<GCubeRole> roles = usersAndRoles.get(usr);
|
|
|
|
|
for (int i = 0; i < roles.size(); i++) {
|
|
|
|
|
if (roles.get(i).getRoleName().equals("VO-Admin") || roles.get(i).getRoleName().equals("VRE-Manager")) {
|
|
|
|
|
adminEmailsList.add(usr.getEmail());
|
|
|
|
@ -394,10 +362,10 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
*/
|
|
|
|
|
public static void sendUserUnregisteredNotification(String username, String scope, String portalbasicurl, String gatewayName) {
|
|
|
|
|
ArrayList<String> adminEmails = getAdministratorsEmails(scope);
|
|
|
|
|
|
|
|
|
|
User currUser = null;
|
|
|
|
|
UserManager um = new LiferayUserManager();
|
|
|
|
|
GCubeUser currUser = null;
|
|
|
|
|
try {
|
|
|
|
|
currUser = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), username);
|
|
|
|
|
currUser = um.getUserByUsername(username);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -415,7 +383,7 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
body.append("<br />");
|
|
|
|
|
body.append("<b>Username: </b>" + username);
|
|
|
|
|
body.append("<br />");
|
|
|
|
|
body.append("<b>e-mail: </b>" + currUser.getEmailAddress());
|
|
|
|
|
body.append("<b>e-mail: </b>" + currUser.getEmail());
|
|
|
|
|
body.append("</p>");
|
|
|
|
|
body.append("<p>");
|
|
|
|
|
body.append("WARNING / LEGAL TEXT: This message is intended only for the use of the individual or entity to which it is addressed and may contain"+
|
|
|
|
@ -433,24 +401,4 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String readGatewayName() {
|
|
|
|
|
//get the portles to look for from the property file
|
|
|
|
|
Properties props = new Properties();
|
|
|
|
|
String gatewayLabel = "gCube Gateway";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
String propertyfile = System.getenv("CATALINA_HOME")+"/conf/gcube-data.properties";
|
|
|
|
|
File propsFile = new File(propertyfile);
|
|
|
|
|
FileInputStream fis = new FileInputStream(propsFile);
|
|
|
|
|
props.load( fis);
|
|
|
|
|
//set the gateway label in the session
|
|
|
|
|
gatewayLabel = props.getProperty("portalinstancename");
|
|
|
|
|
}
|
|
|
|
|
//catch exception in case properties file does not exist
|
|
|
|
|
catch(IOException e) {
|
|
|
|
|
_log.warn("$CATALINA_HOME/conf/gcube-data.properties not found, Returning gateway name: " + gatewayLabel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return gatewayLabel;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|