updated to the new HL ans FWS
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/applicationSupportLayerSocial@82148 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0096e39262
commit
c9bd224764
38
pom.xml
38
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslsocial</artifactId>
|
||||
<version>0.7.0-SNAPSHOT</version>
|
||||
<version>0.7.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Social Portal ASL Extension</name>
|
||||
<description>
|
||||
|
@ -42,14 +42,21 @@
|
|||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common.portal</groupId>
|
||||
<artifactId>portal-manager</artifactId>
|
||||
<version>[0.1.0-SNAPSHOT, 1.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslcore</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -67,6 +74,23 @@
|
|||
<artifactId>custom-portal-handler</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- FWS DEPS -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>ic-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope-maps</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-encryption</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>portal-service</artifactId>
|
||||
|
@ -75,6 +99,14 @@
|
|||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-net</groupId>
|
||||
|
|
|
@ -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<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||
|
||||
List<ServiceEndpoint> conf = client.submit(query);
|
||||
ScopeProvider.instance.set(currScope);
|
||||
return conf.get(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue