From 52838134e5193425428f826dab136888576b581d Mon Sep 17 00:00:00 2001 From: "massimiliano.assante" Date: Mon, 16 Jan 2017 17:10:09 +0000 Subject: [PATCH] partially removed dependency toward portal manager git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@141591 82a268e6-3cf1-43bd-a215-b396298e98cf --- pom.xml | 9 ++--- .../social/ApplicationNewsManager.java | 6 ++-- .../ApplicationNotificationsManager.java | 36 ++++++++++--------- .../social/ScopeBeanExt.java | 19 ++++++++++ .../social/SocialPortalBridge.java | 6 ++-- .../mailing/EmailNotificationsConsumer.java | 23 ++++++------ .../social/mailing/EmailPlugin.java | 18 ++++++---- .../social/mailing/SocialMailingUtil.java | 6 ++-- .../social/storage/FTPManager.java | 24 +++++++------ .../storage/UriResolverReaderParameter.java | 6 ++-- 10 files changed, 89 insertions(+), 64 deletions(-) create mode 100644 src/main/java/org/gcube/applicationsupportlayer/social/ScopeBeanExt.java diff --git a/pom.xml b/pom.xml index a589481..a45eb49 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.applicationsupportlayer aslsocial - 1.1.0-SNAPSHOT + 1.2.0-SNAPSHOT jar Social Portal ASL Extension @@ -62,12 +62,7 @@ usermanagement-core provided - - org.gcube.portal - custom-portal-handler - provided - - + org.gcube.resources.discovery ic-client diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java index d440548..23aa49b 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java @@ -15,7 +15,6 @@ import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser; import org.gcube.common.encryption.StringEncrypter; -import org.gcube.common.portal.PortalContext; import org.gcube.common.resources.gcore.ServiceEndpoint; import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint; import org.gcube.common.scope.api.ScopeProvider; @@ -181,8 +180,9 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa //set the scope String currScope = ScopeProvider.instance.get(); - - ScopeProvider.instance.set("/"+PortalContext.getConfiguration().getInfrastructureName()); + ScopeBeanExt sbe = new ScopeBeanExt(this.currScope); + String scopeToQuery = sbe.getInfrastructureScope(); + ScopeProvider.instance.set(scopeToQuery); SimpleQuery query = queryFor(ServiceEndpoint.class); query.addCondition("$resource/Profile/Name/text() eq '"+ RUNTIME_RESOURCE_NAME +"'"); diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java index c604507..814f93e 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java @@ -11,7 +11,6 @@ import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser; import org.gcube.common.homelibrary.home.exceptions.InternalErrorException; import org.gcube.common.homelibrary.home.workspace.WorkspaceItem; import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder; -import org.gcube.common.portal.GCubePortalConstants; import org.gcube.portal.databook.shared.ApplicationProfile; import org.gcube.portal.databook.shared.Notification; import org.gcube.portal.databook.shared.NotificationChannelType; @@ -37,7 +36,10 @@ import com.liferay.portal.kernel.exception.SystemException; */ public class ApplicationNotificationsManager extends SocialPortalBridge implements NotificationsManager { private static final Logger _log = LoggerFactory.getLogger(ApplicationNotificationsManager.class); - + public static final String USER_WORKSPACE_FRIENDLY_URL = "/workspace"; + public static final String USER_MESSAGES_FRIENDLY_URL = "/messages"; + public static final String USER_NOTIFICATION_FRIENDLY_URL = "/notifications"; + private String portalName; private String senderEmail; private String portalURL; @@ -112,7 +114,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen _log.error("Error While trying to save Notification"); } if (channels.contains(NotificationChannelType.EMAIL)) { - EmailPlugin.getInstance().sendNotification(portalURL, siteLandingPagePath, notification2Save, currGroupName, portalName, senderEmail, hashtags); + EmailPlugin.getInstance(currScope).sendNotification(portalURL, siteLandingPagePath, notification2Save, currGroupName, portalName, senderEmail, hashtags); } if (channels.isEmpty()) { _log.info("Notification was not needed as "+ notification2Save.getUserid() +" decided not to be notified for " + notification2Save.getType()); @@ -153,7 +155,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify sharedFolder.getId(), new Date(), - siteLandingPagePath + GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), "shared the workspace folder \""+ sharedFolderName +"\" with you", false, currUser.getUsername(), @@ -174,7 +176,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify unsharedFolderId, new Date(), - siteLandingPagePath + GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL +"?itemid="+unsharedFolderId, + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+unsharedFolderId, "unshared the workspace folder \""+ unsharedFolderName+"\"", false, currUser.getUsername(), @@ -196,7 +198,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify sharedFolder.getId(), new Date(), - siteLandingPagePath + GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), "upgraded you to Administrator of the workspace folder \""+ sharedFolderName+"\"", false, currUser.getUsername(), @@ -218,7 +220,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify sharedFolder.getId(), new Date(), - siteLandingPagePath + GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), "downgraded you from Administrator of the workspace folder \""+ sharedFolderName+"\"", false, currUser.getUsername(), @@ -240,7 +242,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify renamedFolderId, //the new Date(), - siteLandingPagePath + GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL +"?itemid="+renamedFolderId, + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+renamedFolderId, "renamed your shared folder \""+ previousName +"\" as \"" + newName+"\"", false, currUser.getUsername(), @@ -265,7 +267,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify sharedFolder.getId(), //the new Date(), - siteLandingPagePath + GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), "added "+ user.getFullname() +" to your workspace shared folder \""+ sharedFolder.getName()+"\"", false, currUser.getUsername(), @@ -296,7 +298,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify sharedFolder.getId(), //the new Date(), - siteLandingPagePath + GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), "added "+ addedUsersFullNames +" to your workspace shared folder \""+ sharedFolder.getName()+"\"", false, currUser.getUsername(), @@ -319,7 +321,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify sharedFolder.getId(), //the new Date(), - siteLandingPagePath + GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), "unshared his shared folder \""+ sharedFolder.getName() + "\" from your workspace", false, currUser.getUsername(), @@ -344,7 +346,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify item.getId(), //the new Date(), - siteLandingPagePath + GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL +"?itemid="+item.getParent().getId(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+item.getParent().getId(), notifyText, false, currUser.getUsername(), @@ -368,7 +370,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify item.getId(), //the new Date(), - siteLandingPagePath + GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), notifyText, false, currUser.getUsername(), @@ -392,7 +394,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify sharedFolder.getId(), //the new Date(), - siteLandingPagePath + GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+sharedFolder.getId(), notifyText, false, currUser.getUsername(), @@ -416,7 +418,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify item.getId(), //the new Date(), - siteLandingPagePath + GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL +"?itemid="+item.getParent().getId(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+item.getParent().getId(), notifyText, false, currUser.getUsername(), @@ -440,7 +442,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify renamedItem.getId(), //the new Date(), - siteLandingPagePath + GCubePortalConstants.USER_WORKSPACE_FRIENDLY_URL +"?itemid="+renamedItem.getParent().getId(), + siteLandingPagePath + USER_WORKSPACE_FRIENDLY_URL +"?itemid="+renamedItem.getParent().getId(), notifyText, false, currUser.getUsername(), @@ -471,7 +473,7 @@ public class ApplicationNotificationsManager extends SocialPortalBridge implemen userIdToNotify, //user no notify messageId, //the unique identifier of the message new Date(), - siteLandingPagePath + GCubePortalConstants.USER_MESSAGES_FRIENDLY_URL, + siteLandingPagePath + USER_MESSAGES_FRIENDLY_URL, "sent you a message: " + "
" + messageText +"
" diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ScopeBeanExt.java b/src/main/java/org/gcube/applicationsupportlayer/social/ScopeBeanExt.java new file mode 100644 index 0000000..88dbe71 --- /dev/null +++ b/src/main/java/org/gcube/applicationsupportlayer/social/ScopeBeanExt.java @@ -0,0 +1,19 @@ +package org.gcube.applicationsupportlayer.social; + +import org.gcube.common.scope.impl.ScopeBean; + +public class ScopeBeanExt extends ScopeBean { + + public ScopeBeanExt(String scope) throws IllegalArgumentException { + super(scope); + } + /** + * + * @return the infrastructure scope e.g. /gcube + */ + public String getInfrastructureScope() { + String[] components = name().split(separator); + return separator+components[1]; + } + +} diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java b/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java index 8dba217..1111144 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java @@ -10,7 +10,6 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.gcube.applicationsupportlayer.social.ex.ApplicationProfileNotFoundException; import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser; -import org.gcube.common.portal.PortalContext; import org.gcube.common.resources.gcore.utils.XPathHelper; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.impl.ScopeBean; @@ -124,8 +123,9 @@ public class SocialPortalBridge { String currScope = ScopeProvider.instance.get(); - String scopeToQuery = PortalContext.getConfiguration().getInfrastructureName(); - ScopeProvider.instance.set("/"+scopeToQuery); + ScopeBeanExt sbe = new ScopeBeanExt(this.currScope); + String scopeToQuery = sbe.getInfrastructureScope(); + ScopeProvider.instance.set(scopeToQuery); DiscoveryClient client = client(); List appProfile = client.submit(q); diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailNotificationsConsumer.java b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailNotificationsConsumer.java index 48e773c..88b5702 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailNotificationsConsumer.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailNotificationsConsumer.java @@ -15,8 +15,8 @@ import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; +import org.gcube.applicationsupportlayer.social.ScopeBeanExt; import org.gcube.common.encryption.StringEncrypter; -import org.gcube.common.portal.PortalContext; import org.gcube.common.resources.gcore.ServiceEndpoint; import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint; import org.gcube.common.scope.api.ScopeProvider; @@ -40,12 +40,15 @@ public class EmailNotificationsConsumer extends Thread { private String mailServiceHost = "localhost"; private String mailServicePort = "25"; - public EmailNotificationsConsumer() { + public EmailNotificationsConsumer(String context) { super(); _log.info("EmailNotificationsConsumer thread started at " + new Date() + " trying to fetch SMTP configuration from infrastructure ..."); //query try { - List resources = getConfigurationFromIS(); + String currScope = ScopeProvider.instance.get(); + ScopeBeanExt sbe = new ScopeBeanExt(context); + String infraContext = sbe.getInfrastructureScope(); + List resources = getConfigurationFromIS(infraContext); if (resources.size() > 1) { _log.error("Too many Service Endpoints having name " + SERVICE_ENDPOINT_NAME +" in this scope having Category " + SERVICE_ENDPOINT_CATEGORY); } @@ -58,11 +61,8 @@ public class EmailNotificationsConsumer extends Thread { mailServiceHost = found.address().split(":")[0].trim(); mailServicePort = found.address().split(":")[1].trim(); smtpUsername = found.username(); - - PortalContext context = PortalContext.getConfiguration(); - String currScope = ScopeProvider.instance.get(); - String scope = "/" + context.getInfrastructureName(); - ScopeProvider.instance.set(scope); + + ScopeProvider.instance.set(infraContext); smtpPasswd = StringEncrypter.getEncrypter().decrypt(found.password()); ScopeProvider.instance.set(currScope); _log.info("Found SMTP Configuration: "+mailServiceHost+":"+mailServicePort+ " usr="+smtpUsername+ " pwd=*******"); @@ -75,12 +75,13 @@ public class EmailNotificationsConsumer extends Thread { } /** * + * @param context * @return the * @throws Exception */ - private List getConfigurationFromIS() throws Exception { - PortalContext context = PortalContext.getConfiguration(); - String scope = "/" + context.getInfrastructureName(); + private List getConfigurationFromIS(String infraContext) throws Exception { +; + String scope = infraContext; String currScope = ScopeProvider.instance.get(); ScopeProvider.instance.set(scope); SimpleQuery query = queryFor(ServiceEndpoint.class); diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java index bb3a994..a13e4a2 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java @@ -17,16 +17,20 @@ public class EmailPlugin { private static final Logger _log = LoggerFactory.getLogger(EmailPlugin.class); protected static final int SECONDS2WAIT = 60; private static EmailPlugin singleton; - - - public static EmailPlugin getInstance() { - if (singleton == null) - singleton = new EmailPlugin(); + /** + * + * @param context the infrastucture context (scope) + * @return + */ + public static EmailPlugin getInstance(String context) { + if (singleton == null) { + singleton = new EmailPlugin(context); + } return singleton; } - private EmailPlugin() { - new EmailNotificationsConsumer().start(); + private EmailPlugin(String context) { + new EmailNotificationsConsumer(context).start(); } protected static ArrayList BUFFER_EMAILS = new ArrayList(); diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/SocialMailingUtil.java b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/SocialMailingUtil.java index 38961a8..2073b7a 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/SocialMailingUtil.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/SocialMailingUtil.java @@ -4,7 +4,7 @@ import java.text.Format; import java.text.SimpleDateFormat; import java.util.List; -import org.gcube.common.portal.GCubePortalConstants; +import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager; import org.gcube.portal.databook.shared.Comment; import org.gcube.portal.databook.shared.Feed; import org.gcube.portal.databook.shared.Notification; @@ -100,7 +100,7 @@ public class SocialMailingUtil { .append("").append(portalHost) .append(". ") .append(" If you don't want to receive these emails in the future, please unsubscribe.") .append("

") .append("

") @@ -177,7 +177,7 @@ public class SocialMailingUtil { .append(" by ") .append(portalHost) .append(" If you don't want to receive these emails in the future, please unsubscribe here: ") - .append(portalURL).append(siteLandingPagePath).append(GCubePortalConstants.USER_NOTIFICATION_FRIENDLY_URL).append("?showsettings=true"); + .append(portalURL).append(siteLandingPagePath).append(ApplicationNotificationsManager.USER_NOTIFICATION_FRIENDLY_URL).append("?showsettings=true"); return body.toString(); diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/storage/FTPManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/storage/FTPManager.java index cd3e504..63a0c04 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/storage/FTPManager.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/storage/FTPManager.java @@ -13,8 +13,8 @@ import java.util.UUID; import org.apache.commons.io.IOUtils; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; +import org.gcube.applicationsupportlayer.social.ScopeBeanExt; import org.gcube.common.encryption.StringEncrypter; -import org.gcube.common.portal.PortalContext; import org.gcube.common.resources.gcore.ServiceEndpoint; import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint; import org.gcube.common.scope.api.ScopeProvider; @@ -38,23 +38,24 @@ public class FTPManager { private static String RUNTIME_RESOURCE_NAME = "SocialPortalStorage"; private static String CATEGORY_NAME = "FTPServer"; private static String UPLOAD_FOLDER_NAME = "previews"; - + private String context; private static FTPManager singleton; private ServiceEndpoint endPoint; - private FTPManager() { + private FTPManager(String context) { try { - this.endPoint = getConfigurationFromIS(); + this.context = context; + this.endPoint = getConfigurationFromIS(context); singleton = this; } catch (Exception e) { e.printStackTrace(); } } - public static FTPManager getInstance() { + public static FTPManager getInstance(String context) { if (singleton == null) - singleton = new FTPManager(); + singleton = new FTPManager(context); return singleton; } /** @@ -82,7 +83,9 @@ public class FTPManager { //set the scope String currScope = ScopeProvider.instance.get(); - ScopeProvider.instance.set("/"+PortalContext.getConfiguration().getInfrastructureName()); + ScopeBeanExt sbe = new ScopeBeanExt(context); + String scopeToQuery = sbe.getInfrastructureScope(); + ScopeProvider.instance.set(scopeToQuery); pwd = StringEncrypter.getEncrypter().decrypt(ac.password()); ScopeProvider.instance.set(currScope); @@ -128,12 +131,13 @@ public class FTPManager { * @return the runtime resource of the FTP Server node * @throws Exception */ - private ServiceEndpoint getConfigurationFromIS() throws Exception { + private ServiceEndpoint getConfigurationFromIS(String context) throws Exception { //set the scope String currScope = ScopeProvider.instance.get(); - - ScopeProvider.instance.set("/"+PortalContext.getConfiguration().getInfrastructureName()); + ScopeBeanExt sbe = new ScopeBeanExt(context); + String scopeToQuery = sbe.getInfrastructureScope(); + ScopeProvider.instance.set(scopeToQuery); SimpleQuery query = queryFor(ServiceEndpoint.class); query.addCondition("$resource/Profile/Name/text() eq '"+ RUNTIME_RESOURCE_NAME +"'"); diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/storage/UriResolverReaderParameter.java b/src/main/java/org/gcube/applicationsupportlayer/social/storage/UriResolverReaderParameter.java index 5856d8f..9f81d16 100644 --- a/src/main/java/org/gcube/applicationsupportlayer/social/storage/UriResolverReaderParameter.java +++ b/src/main/java/org/gcube/applicationsupportlayer/social/storage/UriResolverReaderParameter.java @@ -15,7 +15,6 @@ import java.util.List; import java.util.Map; import org.apache.log4j.Logger; -import org.gcube.common.portal.PortalContext; import org.gcube.common.resources.gcore.ServiceEndpoint; import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint; import org.gcube.common.scope.api.ScopeProvider; @@ -48,12 +47,13 @@ public class UriResolverReaderParameter { /** + * @param context the current infrastructure context (scope) * @throws Exception * */ - public UriResolverReaderParameter() throws Exception { + public UriResolverReaderParameter(String context) throws Exception { - ScopeProvider.instance.set("/"+PortalContext.getConfiguration().getInfrastructureName()); + ScopeProvider.instance.set(context); XQuery query = queryFor(ServiceEndpoint.class);