Browse Source

removed HL dependency

Feature/21689
Massimiliano Assante 7 months ago
parent
commit
b677ce347b
  1. 47
      CHANGELOG.md
  2. 26
      FUNDING.md
  3. 1
      distro/LICENSE
  4. 67
      distro/README
  5. 40
      distro/changelog.xml
  6. 42
      distro/descriptor.xml
  7. 25
      distro/profile.xml
  8. 21
      pom.xml
  9. 45
      src/main/java/org/gcube/portal/socialmail/PeriodicTask.java

47
CHANGELOG.md

@ -0,0 +1,47 @@
# Changelog for workspace
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.5.0-SNAPSHOT] - 2021-06-22
- Feature #21689 Social Mail Servlet to StorageHub migration
- Removed HomeLibrary Dependency
## [v2.4.0] - 2019-12-30
- Ported to git
## [v2.3.0] - 2018-08-30
- Fix for Incident #12351 Email Parser stuck on AGINFRA Gateway
- Support #12332 Notifications via emails not working for bfr.bund.de domain
- Feature #12613, Replace use of "$" character with "_" when sending notification emails about posts and messages
## [v2.1.1] - 2017-02-03
- Minor refactor for comment replies
- Resilient to Email server failures
## [v2.1.0] - 2016-08-31
- Added possibility to change poller time at runtime as well as to quit it by editing a property file in the server
- Added support for oAuth2
## [v1.2.0] - 2015-10-14
- Added support for reply via email in Messages
- Read LDAP service endpoint from infrastructure
- Fix for bug #577
## [v1.0.0] - 2015-07-07
- First release

26
FUNDING.md

@ -0,0 +1,26 @@
# Acknowledgments
The projects leading to this software have received funding from a series of European Union programmes including:
- the Sixth Framework Programme for Research and Technological Development
- [DILIGENT](https://cordis.europa.eu/project/id/004260) (grant no. 004260).
- the Seventh Framework Programme for research, technological development and demonstration
- [D4Science](https://cordis.europa.eu/project/id/212488) (grant no. 212488);
- [D4Science-II](https://cordis.europa.eu/project/id/239019) (grant no.239019);
- [ENVRI](https://cordis.europa.eu/project/id/283465) (grant no. 283465);
- [iMarine](https://cordis.europa.eu/project/id/283644) (grant no. 283644);
- [EUBrazilOpenBio](https://cordis.europa.eu/project/id/288754) (grant no. 288754).
- the H2020 research and innovation programme
- [SoBigData](https://cordis.europa.eu/project/id/654024) (grant no. 654024);
- [PARTHENOS](https://cordis.europa.eu/project/id/654119) (grant no. 654119);
- [EGI-Engage](https://cordis.europa.eu/project/id/654142) (grant no. 654142);
- [ENVRI PLUS](https://cordis.europa.eu/project/id/654182) (grant no. 654182);
- [BlueBRIDGE](https://cordis.europa.eu/project/id/675680) (grant no. 675680);
- [PerformFISH](https://cordis.europa.eu/project/id/727610) (grant no. 727610);
- [AGINFRA PLUS](https://cordis.europa.eu/project/id/731001) (grant no. 731001);
- [DESIRA](https://cordis.europa.eu/project/id/818194) (grant no. 818194);
- [ARIADNEplus](https://cordis.europa.eu/project/id/823914) (grant no. 823914);
- [RISIS 2](https://cordis.europa.eu/project/id/824091) (grant no. 824091);
- [EOSC-Pillar](https://cordis.europa.eu/project/id/857650) (grant no. 857650);
- [Blue Cloud](https://cordis.europa.eu/project/id/862409) (grant no. 862409);
- [SoBigData-PlusPlus](https://cordis.europa.eu/project/id/871042) (grant no. 871042);

1
distro/LICENSE

@ -1 +0,0 @@
${gcube.license}

67
distro/README

@ -1,67 +0,0 @@
The gCube System - ${name}
--------------------------------------------------
${description}
${gcube.description}
${gcube.funding}
Version
--------------------------------------------------
${version} (${buildDate})
Please see the file named "changelog.xml" in this directory for the release notes.
Authors
--------------------------------------------------
* Massimiliano Assante (massimiliano.assante-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
Maintainers
-----------
* Massimiliano Assante (massimiliano.assante-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
Download information
--------------------------------------------------
Source code is available from SVN:
${scm.url}
Binaries can be downloaded from the gCube website:
${gcube.website}
Installation
--------------------------------------------------
Installation documentation is available on-line in the gCube Wiki:
${gcube.wikiRoot}/
Documentation
--------------------------------------------------
Documentation is available on-line in the gCube Wiki:
${gcube.wikiRoot}/
${gcube.wikiRoot}/
Support
--------------------------------------------------
Bugs and support requests can be reported in the gCube issue tracking tool:
${gcube.issueTracking}
Licensing
--------------------------------------------------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

40
distro/changelog.xml

@ -1,40 +0,0 @@
<ReleaseNotes>
<Changeset component="org.gcube.portal.social-mail-servlet.2-3-0"
date="2018-08-30">
<Change>Fix for Incident #12351 Email Parser stuck on AGINFRA Gateway</Change>
<Change>Support #12332 Notifications via emails not working for bfr.bund.de domain, Feature #12613, Replace use of "$" character with "_" when sending notification emails about posts and messages</Change>
</Changeset>
<Changeset component="org.gcube.portal.social-mail-servlet.2-1-1"
date="2017-02-03">
<Change>Minor refactor for comment replies</Change>
<Change>Resilient to Email server failures</Change>
</Changeset>
<Changeset component="org.gcube.portal.social-mail-servlet.2-1-0"
date="2016-08-31">
<Change>Added possibility to change poller time at runtime as well as
to quit it by editing a property file in the server</Change>
<Change>Added support for Auth2</Change>
</Changeset>
<Changeset component="org.gcube.portal.social-mail-servlet.1-4-0"
date="2016-02-29">
<Change>Discussion is now reported in email's body</Change>
<Change>Upgraded deprecated methods of asl social</Change>
</Changeset>
<Changeset component="org.gcube.portal.social-mail-servlet.1-3-0"
date="2015-12-11">
<Change>Removed the part the export users to LDAP</Change>
</Changeset>
<Changeset component="org.gcube.portal.social-mail-servlet.1-2-0"
date="2015-10-14">
<Change>Added support for reply via email in Messages</Change>
</Changeset>
<Changeset component="org.gcube.portal.social-mail-servlet.1-1-0"
date="2015-09-22">
<Change>Fix for #577</Change>
<Change>Read LDAP service endpoint from infrastructure</Change>
</Changeset>
<Changeset component="org.gcube.portal.social-mail-servlet.1-0-0"
date="2015-07-07">
<Change>First Release</Change>
</Changeset>
</ReleaseNotes>

42
distro/descriptor.xml

@ -1,42 +0,0 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>servicearchive</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<directory>${distroDirectory}</directory>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>README</include>
<include>LICENSE</include>
<include>changelog.xml</include>
<include>profile.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
<fileSet>
<directory>target/apidocs</directory>
<outputDirectory>/${artifactId}/doc/api</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>${distroDirectory}/profile.xml</source>
<outputDirectory>./</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>target/${build.finalName}.war</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
</files>
</assembly>

25
distro/profile.xml

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID></ID>
<Type>Library</Type>
<Profile>
<Description>${description}</Description>
<Class>Portal</Class>
<Name>${artifactId}</Name>
<Version>1.0.0</Version>
<Packages>
<Software>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<Files>
<File>${build.finalName}.war</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

21
pom.xml

@ -12,7 +12,7 @@
<groupId>org.gcube.portal</groupId>
<artifactId>social-mail-servlet</artifactId>
<packaging>war</packaging>
<version>2.4.0</version>
<version>2.5.0-SNAPSHOT</version>
<scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
@ -37,7 +37,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.0</version>
<version>3.6.2-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -72,23 +72,22 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
<scope>provided</scope>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-client-library</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>notifications-common-library</artifactId>
<artifactId>social-networking-library</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId>
<scope>provided</scope>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library-jcr</artifactId>
<groupId>org.gcube.portal</groupId>
<artifactId>notifications-common-library</artifactId>
<scope>provided</scope>
</dependency>
<dependency>

45
src/main/java/org/gcube/portal/socialmail/PeriodicTask.java

@ -2,11 +2,9 @@ package org.gcube.portal.socialmail;
import static org.gcube.common.authorization.client.Constants.authorizationService;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Properties;
@ -26,7 +24,7 @@ import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage.RecipientType;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.application.framework.core.util.GenderType;
@ -37,16 +35,10 @@ import org.gcube.applicationsupportlayer.social.mailing.SocialMailingUtil;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
import org.gcube.common.authorization.library.provider.UserInfo;
import org.gcube.common.homelibrary.home.HomeLibrary;
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
import org.gcube.common.homelibrary.home.workspace.Workspace;
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException;
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
import org.gcube.common.homelibrary.home.workspace.sharing.WorkspaceMessage;
import org.gcube.common.homelibrary.home.workspace.sharing.WorkspaceMessageManager;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
import org.gcube.common.storagehub.client.proxies.MessageManagerClient;
import org.gcube.portal.databook.server.DatabookStore;
import org.gcube.portal.databook.shared.Comment;
import org.gcube.portal.databook.shared.Feed;
@ -266,18 +258,17 @@ public class PeriodicTask implements Runnable {
_log.debug("Found message reply, subject: " + subject + " body: " + messageText);
String newMessageId = null;
Workspace workspace;
List<String> recipientIds = null;
try {
workspace = getWorkspace(fakeSession);
setAuthorizationToken(fakeSession);
MessageManagerClient mmClient = AbstractPlugin.messages().build();
org.gcube.common.storagehub.model.messages.Message theMessage = mmClient.get(messageId);
WorkspaceMessageManager messageManager = workspace.getWorkspaceMessageManager();
WorkspaceMessage theMessage = messageManager.getReceivedMessage(messageId);
recipientIds = theMessage.getAddresses();
recipientIds = Arrays.asList(theMessage.getAddresses());
//add the sender and remove the person who is replying from the recipients
String sender = theMessage.getSender().getPortalLogin();
String sender = theMessage.getSender().getUserName();
String originalText = theMessage.getBody();
Date originalSentTime = theMessage.getSendTime().getTime();
Date originalSentTime = theMessage.getCreationTime().getTime();
recipientIds.add(sender);
recipientIds.remove(fakeSession.getUsername());
@ -289,9 +280,9 @@ public class PeriodicTask implements Runnable {
messageText += getReplyHeaderMessage(sender, originalSentTime, originalText);
_log.debug("Trying to send message with subject: " + subject + " to: " + recipientIds.toString());
newMessageId = messageManager.sendMessageToPortalLogins(subject, messageText, new ArrayList<String>(), recipientIds);
newMessageId = mmClient.sendMessage(recipientIds, subject, messageText, new ArrayList<String>());
} catch (WorkspaceFolderNotFoundException | InternalErrorException | HomeNotFoundException | ItemNotFoundException e) {
} catch (Exception e) {
e.printStackTrace();
}
@ -617,16 +608,6 @@ public class PeriodicTask implements Runnable {
return toReturn;
}
/**
*
* @return the workspace instance
* @throws InternalErrorException
* @throws HomeNotFoundException
* @throws WorkspaceFolderNotFoundException
*/
private Workspace getWorkspace(ASLSession session) throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException {
Workspace workspace = HomeLibrary.getUserWorkspace(session.getUsername());
return workspace;
}
}

Loading…
Cancel
Save