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
This commit is contained in:
parent
1060ed3dac
commit
52838134e5
9
pom.xml
9
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslsocial</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Social Portal ASL Extension</name>
|
||||
<description>
|
||||
|
@ -62,12 +62,7 @@
|
|||
<artifactId>usermanagement-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>custom-portal-handler</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- FWS DEPS -->
|
||||
<!-- FWS DEPS -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>ic-client</artifactId>
|
||||
|
|
|
@ -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 +"'");
|
||||
|
|
|
@ -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: "
|
||||
+ "<br/><div style=\"margin-top: 10px; margin-bottom: 10px; margin-left: 50px; padding-left: 15px; border-left: 3px solid #ccc; font-style: italic;\">"
|
||||
+ messageText +"</div>"
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
||||
}
|
|
@ -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<String> client = client();
|
||||
List<String> appProfile = client.submit(q);
|
||||
|
|
|
@ -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<ServiceEndpoint> resources = getConfigurationFromIS();
|
||||
String currScope = ScopeProvider.instance.get();
|
||||
ScopeBeanExt sbe = new ScopeBeanExt(context);
|
||||
String infraContext = sbe.getInfrastructureScope();
|
||||
List<ServiceEndpoint> 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<ServiceEndpoint> getConfigurationFromIS() throws Exception {
|
||||
PortalContext context = PortalContext.getConfiguration();
|
||||
String scope = "/" + context.getInfrastructureName();
|
||||
private List<ServiceEndpoint> getConfigurationFromIS(String infraContext) throws Exception {
|
||||
;
|
||||
String scope = infraContext;
|
||||
String currScope = ScopeProvider.instance.get();
|
||||
ScopeProvider.instance.set(scope);
|
||||
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||
|
|
|
@ -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<NotificationMail> BUFFER_EMAILS = new ArrayList<NotificationMail>();
|
||||
|
|
|
@ -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("<a href=\"").append(portalURL).append("\" style=\"color:#3B5998;text-decoration:none\" target=\"_blank\">").append(portalHost)
|
||||
.append("</a>. ")
|
||||
.append(" If you don't want to receive these emails in the future, please <a href=\"")
|
||||
.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")
|
||||
.append("\" style=\"color:#3b5998;text-decoration:none\" target=\"_blank\">unsubscribe</a>.")
|
||||
.append("</div></p>")
|
||||
.append("<p><div style=\"color:#999999; font-size:10px; font-family:'lucida grande',tahoma,verdana,arial,sans-serif; padding-top:15px;\">")
|
||||
|
@ -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();
|
||||
|
||||
|
|
|
@ -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 +"'");
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue