diff --git a/pom.xml b/pom.xml
index 74ddf0f..03c9445 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
org.gcube.applicationsupportlayer
aslsocial
- 0.7.0-SNAPSHOT
+ 0.7.1-SNAPSHOT
jar
Social Portal ASL Extension
@@ -42,14 +42,21 @@
+
+ org.gcube.common.portal
+ portal-manager
+ [0.1.0-SNAPSHOT, 1.0.0-SNAPSHOT)
+ provided
+
org.gcube.applicationsupportlayer
aslcore
provided
-
- org.gcube.portlets.user
+
+ org.gcube.common
home-library
+ [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
provided
@@ -67,6 +74,23 @@
custom-portal-handler
provided
+
+
+ org.gcube.resources.discovery
+ ic-client
+
+
+ org.gcube.core
+ common-scope-maps
+ [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
+ provided
+
+
+ org.gcube.core
+ common-encryption
+ [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
+ provided
+
com.liferay.portal
portal-service
@@ -75,6 +99,14 @@
log4j
log4j
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ org.slf4j
+ slf4j-api
commons-net
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java
index adca886..136200d 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNewsManager.java
@@ -1,38 +1,43 @@
package org.gcube.applicationsupportlayer.social;
+import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
+import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
+
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
+import java.util.List;
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.application.framework.core.session.ASLSession;
-import org.gcube.common.core.contexts.GHNContext;
-import org.gcube.common.core.informationsystem.client.AtomicCondition;
-import org.gcube.common.core.informationsystem.client.ISClient;
-import org.gcube.common.core.informationsystem.client.queries.GCUBERuntimeResourceQuery;
-import org.gcube.common.core.resources.GCUBERuntimeResource;
-import org.gcube.common.core.scope.GCUBEScope;
-import org.gcube.common.core.utils.logging.GCUBEClientLog;
+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;
import org.gcube.portal.databook.shared.Feed;
import org.gcube.portal.databook.shared.FeedType;
import org.gcube.portal.databook.shared.ImageType;
import org.gcube.portal.databook.shared.PrivacyLevel;
+import org.gcube.resources.discovery.client.api.DiscoveryClient;
+import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
*
* @author Massimiliano Assante, ISTI-CNR
- * @version 0.1 Dec 2012
*
* use to share updates from within your applicationProfile, the update will be published in the Users News Feed belonging to the VRE your applicationProfile runs into
*/
public class ApplicationNewsManager extends SocialPortalBridge implements NewsManager {
- static GCUBEClientLog _log = new GCUBEClientLog(ApplicationNewsManager.class);
+ private static final Logger _log = LoggerFactory.getLogger(ApplicationNewsManager.class);
/**
* the FTP Server RuntimeResource coordinates
@@ -46,7 +51,6 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa
*/
public ApplicationNewsManager(ASLSession session, String portletClassName) {
super(session, portletClassName);
- GCUBEScope.getScope("");
}
/**
* {@inheritDoc}
@@ -132,11 +136,12 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa
String httpBaseURL = "";
String fileName = UUID.randomUUID() + "." + imageExtension.toString().toLowerCase();
try {
- GCUBERuntimeResource res = getConfigurationFromIS();
- ftpUrl = res.getAccessPoints().get(0).getEndpoint();
- httpBaseURL = res.getHostedOn();
- user = res.getAccessPoints().get(0).getUsername();
- pwd = res.getAccessPoints().get(0).getPassword();
+ ServiceEndpoint res = getConfigurationFromIS();
+ AccessPoint ac = res.profile().accessPoints().iterator().next();
+ ftpUrl = ac.address();
+ httpBaseURL = res.profile().runtime().hostedOn();
+ user = ac.username();
+ pwd = StringEncrypter.getEncrypter().decrypt(ac.password());
// Connect to the FTP server as anonymous
client.connect(ftpUrl);
@@ -173,13 +178,21 @@ public class ApplicationNewsManager extends SocialPortalBridge implements NewsMa
* @return the runtime resource of the FTP Server node
* @throws Exception
*/
- private GCUBERuntimeResource getConfigurationFromIS() throws Exception {
- ISClient client = GHNContext.getImplementation(ISClient.class);
- GHNContext ctx = GHNContext.getContext();
- String scope = "/" + (String) ctx.getProperty(GHNContext.INFRASTRUCTURE_NAME, true);
- GCUBERuntimeResourceQuery query = client.getQuery(GCUBERuntimeResourceQuery.class);
- query.addAtomicConditions(new AtomicCondition("/Profile/Name", RUNTIME_RESOURCE_NAME));
- query.addAtomicConditions(new AtomicCondition("/Profile/Category", CATEGORY_NAME));
- return client.execute(query, GCUBEScope.getScope(scope)).get(0);
+ private ServiceEndpoint getConfigurationFromIS() throws Exception {
+
+ //set the scope
+ String currScope = ScopeProvider.instance.get();
+
+ ScopeProvider.instance.set("/"+PortalContext.getConfiguration().getInfrastructureName());
+
+ SimpleQuery query = queryFor(ServiceEndpoint.class);
+ query.addCondition("$resource/Profile/Name/text() eq '"+ RUNTIME_RESOURCE_NAME +"'");
+ query.addCondition("$resource/Profile/Category/text() eq '"+ CATEGORY_NAME +"'");
+
+ DiscoveryClient client = clientFor(ServiceEndpoint.class);
+
+ List conf = client.submit(query);
+ ScopeProvider.instance.set(currScope);
+ return conf.get(0);
}
}
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java
index 66c58f9..e44a41a 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/ApplicationNotificationsManager.java
@@ -7,21 +7,22 @@ import java.util.UUID;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.applicationsupportlayer.social.mailing.EmailPlugin;
-import org.gcube.common.core.utils.logging.GCUBEClientLog;
import org.gcube.portal.databook.shared.ApplicationProfile;
import org.gcube.portal.databook.shared.Notification;
import org.gcube.portal.databook.shared.NotificationChannelType;
import org.gcube.portal.databook.shared.NotificationType;
import org.gcube.portal.databook.shared.RunningJob;
-import org.gcube.portlets.user.homelibrary.home.exceptions.InternalErrorException;
-import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceFolder;
-import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem;
+import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
+import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
+import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalException;
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
import org.gcube.vomanagement.usermanagement.model.UserModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
*
@@ -30,7 +31,8 @@ import org.gcube.vomanagement.usermanagement.model.UserModel;
* use to notify users from within your application
*/
public class ApplicationNotificationsManager extends SocialPortalBridge implements NotificationsManager {
- static GCUBEClientLog _log = new GCUBEClientLog(ApplicationNotificationsManager.class);
+ private static final Logger _log = LoggerFactory.getLogger(ApplicationNotificationsManager.class);
+
/**
* Use this constructor if you do not need notifications to point back to your applications
* @param aslSession the ASLSession instance
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java b/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java
index 1c66f96..b4863db 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/NotificationsManager.java
@@ -5,8 +5,8 @@ import java.util.List;
import org.gcube.portal.databook.shared.ApplicationProfile;
import org.gcube.portal.databook.shared.RunningJob;
-import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceFolder;
-import org.gcube.portlets.user.homelibrary.home.workspace.WorkspaceItem;
+import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
+import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
/**
*
* @author Massimiliano Assante, ISTI-CNR
diff --git a/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java b/src/main/java/org/gcube/applicationsupportlayer/social/SocialPortalBridge.java
index 32725ca..a9ad2f5 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.application.framework.core.session.ASLSession;
import org.gcube.applicationsupportlayer.social.ex.ApplicationProfileNotFoundException;
-import org.gcube.common.core.utils.logging.GCUBEClientLog;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.gcube.common.scope.api.ScopeProvider;
@@ -23,18 +22,20 @@ import org.gcube.resources.discovery.client.queries.api.Query;
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayGroupManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
/**
*
* @author Massimiliano Assante, ISTI-CNR
- * @version 0.1 Dec 2012
*
* superclass for notifications, posting news and so on
*/
public class SocialPortalBridge {
- protected static GCUBEClientLog _log = new GCUBEClientLog(SocialPortalBridge.class);
+ private static final Logger _log = LoggerFactory.getLogger(SocialPortalBridge.class);
+
protected ASLSession aslSession;
protected ApplicationProfile applicationProfile;
//unique instance
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 2b4ce20..fe0725f 100644
--- a/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java
+++ b/src/main/java/org/gcube/applicationsupportlayer/social/mailing/EmailPlugin.java
@@ -10,10 +10,11 @@ import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
-import org.gcube.common.core.utils.logging.GCUBEClientLog;
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
import org.gcube.portal.databook.shared.Notification;
import org.gcube.portal.databook.shared.NotificationType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.liferay.portal.model.UserModel;
import com.liferay.portal.service.UserLocalServiceUtil;
@@ -25,7 +26,8 @@ import com.liferay.portal.util.PortalUtil;
*
*/
public class EmailPlugin {
- private static GCUBEClientLog _log = new GCUBEClientLog(EmailPlugin.class);
+
+ private static final Logger _log = LoggerFactory.getLogger(EmailPlugin.class);
private static String getHTMLEmail(Notification notification2Save, String userFirstName, String portalURL, String email) {