Compare commits

...

40 Commits

Author SHA1 Message Date
Ahmed Salah Tawfik Ibrahim 8509015a18 2.0.1 2024-04-16 15:19:38 +02:00
Ahmed Salah Tawfik Ibrahim 9fbec3653d 2.0.1-SNAPSHOT 2024-04-16 15:19:04 +02:00
Ahmed Salah Tawfik Ibrahim 85ab33184d cleaning logs 2024-04-16 15:04:52 +02:00
Ahmed Salah Tawfik Ibrahim 01821f5da3 cleaning logs 2024-04-16 15:03:57 +02:00
Ahmed Salah Tawfik Ibrahim bcbec61646 bug fix 2024-04-12 17:25:49 +02:00
Ahmed Salah Tawfik Ibrahim 93e501d65f bug fix 2024-04-12 17:25:22 +02:00
Ahmed Salah Tawfik Ibrahim 9a64a684d1 bug fix 2024-04-12 17:17:48 +02:00
Ahmed Salah Tawfik Ibrahim 5b5dfb56c4 bug fix 2024-04-12 17:17:23 +02:00
Ahmed Salah Tawfik Ibrahim 1562e6a441 bug fix 2024-04-12 17:02:13 +02:00
Ahmed Salah Tawfik Ibrahim 29471627da bug fix 2024-04-12 17:01:16 +02:00
Ahmed Salah Tawfik Ibrahim 8b6f4ccf2f bug fix 2024-04-12 16:32:02 +02:00
Ahmed Salah Tawfik Ibrahim 82d13b556b snapshot bug fix 2024-04-12 16:31:23 +02:00
Ahmed Salah Tawfik Ibrahim 899640141c possible fix 2024-04-11 18:30:21 +02:00
Ahmed Salah Tawfik Ibrahim 368d420799 possible fix 2024-04-11 18:19:55 +02:00
Ahmed Salah Tawfik Ibrahim 18cb5b7312 bug fixed 2024-04-11 14:44:58 +02:00
Ahmed Salah Tawfik Ibrahim b8f9b0a90a debug_error 2024-04-11 12:39:35 +02:00
Ahmed Salah Tawfik Ibrahim bcd8e29a8c Merge remote-tracking branch 'origin/master' 2023-12-13 13:47:29 +01:00
Ahmed Salah Tawfik Ibrahim 35c8cfdc5a Debug notification 2023-12-13 13:47:19 +01:00
Massimiliano Assante c06e47ea68 ready to release 2023-12-11 12:58:57 +01:00
Massimiliano Assante 5c2e5d5874 SNAPSHOT version 2023-12-11 12:58:08 +01:00
Ahmed Salah Tawfik Ibrahim 2a9bdc6c4a Ready for Release 2023-12-07 14:24:14 +01:00
Ahmed Salah Tawfik Ibrahim 083ca91e45 SNAPSHOT Version Ready 2023-12-07 14:23:28 +01:00
Ahmed Salah Tawfik Ibrahim 7aa3a1244e Ready for release 2023-12-07 14:21:20 +01:00
Ahmed Salah Tawfik Ibrahim 70d7e31540 Test new datacenter name 2023-12-07 14:14:23 +01:00
Ahmed Salah Tawfik Ibrahim 02bc40b6e8 Added Service Discovery 2023-12-06 16:40:46 +01:00
Ahmed Salah Tawfik Ibrahim 68a7532379 Added Service Discovery 2023-12-06 15:53:23 +01:00
Ahmed Salah Tawfik Ibrahim 79f326d906 Ready to release 2023-12-05 16:39:16 +01:00
Ahmed Salah Tawfik Ibrahim 0a9e97f680 Ready to release 2023-12-05 16:38:31 +01:00
Ahmed Salah Tawfik Ibrahim 099432f9a1 Ready to release 2023-12-05 16:31:08 +01:00
Ahmed Salah Tawfik Ibrahim 81542d5c0a Merge remote-tracking branch 'origin/master' 2023-12-05 16:30:09 +01:00
Ahmed Salah Tawfik Ibrahim 0d435d2398 Ready to release 2023-12-05 16:30:00 +01:00
Massimiliano Assante 38fdd5b762 fixed pom 2023-12-05 15:47:12 +01:00
Massimiliano Assante 9d04f4af59 fixed pom 2023-12-05 15:46:36 +01:00
Ahmed Salah Tawfik Ibrahim e8ca4a46a7 Ready to release 2023-12-04 18:16:12 +01:00
Ahmed Salah Tawfik Ibrahim 8a27841094 Snapshot version 2023-12-04 18:15:03 +01:00
Ahmed Salah Tawfik Ibrahim 785511f6a3 Bugs fixed 2023-12-04 17:38:33 +01:00
Ahmed Salah Tawfik Ibrahim b968a6f7dd Attachments bug fixed 2023-11-28 19:40:20 +01:00
Ahmed Salah Tawfik Ibrahim 61723dcc11 DB Write bug fixed 2023-11-27 15:45:26 +01:00
Ahmed Salah Tawfik Ibrahim 36eefcba26 Added author. 2023-11-24 11:49:40 +01:00
Ahmed Salah Tawfik Ibrahim 9ea2895833 Bug fixed - nullpointer exception result.all(), result.one() 2023-11-22 19:40:29 +01:00
11 changed files with 795 additions and 273 deletions

View File

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="social-library">
<wb-resource deploy-path="/" source-path="/src/main/java"/>
<wb-resource deploy-path="/" source-path="/src/test/java"/>
</wb-module>
<wb-module deploy-name="social-library">
<wb-resource deploy-path="/" source-path="/src/main/java"/>
</wb-module>
</project-modules>

View File

@ -4,9 +4,13 @@
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.0.0] - 2023-10-30
## [v2.0.1] - 2023-12-04
- Feature #25901-fix, same as feature 25901 but with minor fixes related to deprecated methods and classes
- Bug 27218 - Null pointer exception getting notifications preferences fixed
## [v2.0.0] - 2023-12-04
- Support for Cassandra 4.1.3 using DataStax java driver
## [v1.17.0] - 2022-05-13

View File

@ -24,10 +24,14 @@ See [Releases](https://code-repo.d4science.org/gCubeSystem/social-util-library/r
* **Massimiliano Assante** ([ORCID](https://orcid.org/0000-0002-3761-1492)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/M.Assante)
* **Ahmed Ibrahim** ([ORCID](https://orcid.org/0009-0001-3009-5755)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/en/about/people-detail/976/Ahmed_Salah_Tawfik_Ibrahim)
## Maintainers
* **Massimiliano Assante** ([ORCID](https://orcid.org/0000-0002-3761-1492)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/People/M.Assante)
* **Ahmed Ibrahim** ([ORCID](https://orcid.org/0009-0001-3009-5755)) - [ISTI-CNR Infrascience Group](https://www.isti.cnr.it/en/about/people-detail/976/Ahmed_Salah_Tawfik_Ibrahim)
## License
This project is licensed under the EUPL V.1.1 License - see the [LICENSE.md](LICENSE.md) file for details.
@ -39,4 +43,4 @@ open-source software toolkit used for building and operating Hybrid Data
Infrastructures enabling the dynamic deployment of Virtual Research Environments
by favouring the realisation of reuse oriented policies.
The projects leading to this software have received funding from a series of European Union programmes see [FUNDING.md](FUNDING.md)
The projects leading to this software have received funding from a series of European Union programmes see [FUNDING.md](FUNDING.md)

10
pom.xml
View File

@ -11,7 +11,7 @@
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>2.0.1</version>
<name>gCube Social Networking Library</name>
<description>
The gCube Social Networking Library is the 'bridge' between your gCube Applications and the social networking facilities.
@ -36,7 +36,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.4</version>
<version>3.7.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -47,16 +47,19 @@
<groupId>com.datastax.oss</groupId>
<artifactId>java-driver-query-builder</artifactId>
<version>${cassandra.driver.oss.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.datastax.oss</groupId>
<artifactId>java-driver-mapper-runtime</artifactId>
<version>${cassandra.driver.oss.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google</groupId>
<artifactId>gwt-jsonmaker</artifactId>
<version>1.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
@ -88,15 +91,18 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>

View File

@ -19,7 +19,7 @@ import org.slf4j.LoggerFactory;
/**
* @author Massimiliano Assante ISTI-CNR
* @author Ahmed Salah Tawfik Ibrahim ISTI-CNR
* @author Ahmed Ibrahim ISTI-CNR
*
*/
public class CassandraClusterConnection {
@ -41,7 +41,7 @@ public class CassandraClusterConnection {
* @param dropSchema set true if you want do drop the current and set up new one
* the connection to cassandra cluster
*/
protected CassandraClusterConnection(boolean dropSchema) {
protected CassandraClusterConnection(boolean dropSchema) throws Exception {
if (hosts == null || datacenterName == null || keyspaceName == null) {
RunningCluster cluster = RunningCluster.getInstance(null);
@ -62,7 +62,7 @@ public class CassandraClusterConnection {
* @param dropSchema set true if you want to drop the current and set up new one
* the connection to cassandra cluster
*/
protected CassandraClusterConnection(boolean dropSchema, String infrastructureName) {
protected CassandraClusterConnection(boolean dropSchema, String infrastructureName) throws Exception {
if (hosts == null || datacenterName == null || keyspaceName == null) {
RunningCluster cluster = RunningCluster.getInstance(infrastructureName);
//host = cluster.getHost();
@ -145,7 +145,7 @@ public class CassandraClusterConnection {
CqlSession cqlSession = configBuilder(CqlSession.builder())
.addContactPoints(hosts)
.withKeyspace(KEYSPACE_NAME)
.withLocalDatacenter("1")
.withLocalDatacenter(datacenterName)
.build();
_log.info("[OK] Connected to Keyspace {} ", KEYSPACE_NAME);
return cqlSession;
@ -180,7 +180,7 @@ public class CassandraClusterConnection {
private static void createKeyspace(String keyspaceName, int replicationFactor) {
try (CqlSession cqlSession = configBuilder(CqlSession.builder())
.addContactPoints(hosts)
.withLocalDatacenter("1")
.withLocalDatacenter(datacenterName)
.build()) {
cqlSession.execute(SchemaBuilder.createKeyspace(keyspaceName)
.ifNotExists()
@ -196,7 +196,7 @@ public class CassandraClusterConnection {
ResultSet toreturn;
try (CqlSession cqlSession = configBuilder(CqlSession.builder())
.addContactPoints(hosts)
.withLocalDatacenter("1")
.withLocalDatacenter(datacenterName)
.build()) {
toreturn = cqlSession.execute(SchemaBuilder.dropKeyspace(keyspaceName).ifExists().build());
_log.info("Keyspace {} dropped.", keyspaceName);
@ -207,7 +207,7 @@ public class CassandraClusterConnection {
private void createTables(){
try (CqlSession cqlSession = configBuilder(CqlSession.builder())
.addContactPoints(hosts)
.withLocalDatacenter("1")
.withLocalDatacenter(datacenterName)
.withKeyspace(keyspaceName)
.build()) {

View File

@ -654,6 +654,11 @@ public interface DatabookStore {
*/
List<Attachment> getAttachmentsByFeedId(String feedId) throws FeedIDNotFoundException;
/**
* save an attachment
*/
boolean saveAttachmentEntry(String feedId, Attachment toSave);
/**
* Retrieve all the ids of the vre
* @return the set of ids of the vre available or empty list in case of errors.

View File

@ -27,7 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Massimiliano Assante ISTI-CNR
* @author Ahmed Salah Tawfik Ibrahim ISTI-CNR
* @author Ahmed Ibrahim ISTI-CNR
*
* @version 2.0.0 October 2023
*
@ -49,7 +49,7 @@ public class RunningCluster implements Serializable {
/**
* other constants
*/
private final static String RUNTIME_RESOURCE_NAME = "SocialPortalDataStore";
private final static String RUNTIME_RESOURCE_NAME = "SocialDB";
private final static String PLATFORM_NAME = "Cassandra";
private static final String DEFAULT_CONFIGURATION = "/org/gcube/portal/databook/server/resources/databook.properties";
@ -72,7 +72,7 @@ public class RunningCluster implements Serializable {
* @param infrastructureName could be null
* @return an instance of the RunningCluster
*/
public static synchronized RunningCluster getInstance(String infrastructureName) {
public static synchronized RunningCluster getInstance(String infrastructureName){
if (singleton == null) {
singleton = new RunningCluster(infrastructureName);
}
@ -81,9 +81,10 @@ public class RunningCluster implements Serializable {
/**
* private constructor
*/
private RunningCluster(String infrastructureName) {
private RunningCluster(String infrastructureName){
//Query the IS (for the future)
/*List<ServiceEndpoint> resources = getConfigurationFromIS(infrastructureName);
try{
List<ServiceEndpoint> resources = getConfigurationFromIS(infrastructureName);
if (resources.size() > 1) {
_log.error("Too many Runtime Resource having name " + RUNTIME_RESOURCE_NAME +" in this scope ");
throw new TooManyRunningClustersException("There exist more than 1 Runtime Resource in this scope having name "
@ -97,17 +98,17 @@ public class RunningCluster implements Serializable {
for (ServiceEndpoint res : resources) {
AccessPoint found = res.profile().accessPoints().iterator().next();
host = found.address();
clusterName = found.description();
datacenterName = found.description();
keyspaceName = found.name();
}
}
} catch (Exception e) {
e.printStackTrace();
}*/
}
host = "10.1.28.55:9042, 10.1.30.142:9042, 10.1.28.100:9042";
/*host = "10.1.28.55:9042, 10.1.30.142:9042, 10.1.28.100:9042";
datacenterName = "1";
keyspaceName = "dev_mig_new_schema_test";
keyspaceName = "dev_mig_consistent";*/
}
/**
@ -115,7 +116,7 @@ public class RunningCluster implements Serializable {
* @return the
* @throws Exception
*/
private List<ServiceEndpoint> getConfigurationFromIS(String infrastructureName) throws Exception {
private List<ServiceEndpoint> getConfigurationFromIS(String infrastructureName) {
_log.debug("getConfigurationFromIS infrastructureName="+infrastructureName );
String scope = "/";
if(infrastructureName != null && !infrastructureName.isEmpty())

View File

@ -1,5 +1,13 @@
package org.gcube.portal.databook.server;
/**
* @author Massimiliano Assante ISTI-CNR
* @author Ahmed Ibrahim ISTI-CNR
*
* @version 2.0.0 October 2023
*
*/
public class Schema {
//Tables
public static final String NOTIFICATIONS = "Notifications";

View File

@ -7,6 +7,13 @@ import org.slf4j.LoggerFactory;
import java.util.List;
/**
* @author Massimiliano Assante ISTI-CNR
* @author Ahmed Ibrahim ISTI-CNR
*
* @version 2.0.0 October 2023
*
*/
public class Tester {
private static DBCassandraAstyanaxImpl store;
private static Logger LOGGER = LoggerFactory.getLogger(Tester.class);

View File

@ -0,0 +1,56 @@
package org.gcube.portal.databook.shared;
import java.io.Serializable;
import java.util.List;
@SuppressWarnings("serial")
public class PostWithAttachment implements Serializable {
private Post post;
private List<Attachment> attachments;
public PostWithAttachment(Post post, List<Attachment> attachments){
super();
this.post = post;
this.attachments = attachments;
}
public void setAttachments(List<Attachment> attachments) {
this.attachments = attachments;
}
public void setPost(Post post) {
this.post = post;
}
public List<Attachment> getAttachments() {
return attachments;
}
public Post getPost() {
return post;
}
public String toString() {
String postInfo = "Post [key=" + post.getKey() + ", type=" + post.getType() + ", entityId=" + post.getEntityId()
+ ", time=" + post.getTime() + ", vreid=" + post.getVreid() + ", uri=" + post.getUri()
+ ", uriThumbnail=" + post.getUriThumbnail() + ", description="
+ post.getDescription() + ", privacy=" + post.getPrivacy() + ", fullName="
+ post.getFullName() + ", email=" + post.getEmail() + ", thumbnailURL="
+ post.getThumbnailURL() + ", commentsNo=" + post.getCommentsNo() + ", likesNo="
+ post.getLikesNo() + ", linkTitle=" + post.getLinkTitle() + ", linkDescription="
+ post.getLinkDescription() + ", linkHost=" + post.getLinkHost()
+ ", applicationFeed=" + post.isApplicationFeed()
+ ", multiFileUpload=" + post.isMultiFileUpload() + "]";
String attachmentInfo = "[Attachments: ";
for (Attachment attachment: attachments){
attachmentInfo += "[Attachment [key=" + attachment.getId() + ", uri=" + attachment.getUri() + ", name=" + attachment.getName() + ", description="
+ attachment.getDescription() + ", thumbnailURL=" + attachment.getThumbnailURL()
+ ", mimeType=" + attachment.getMimeType() + "]],";
}
attachmentInfo = attachmentInfo.substring(0, attachmentInfo.length()-1);
attachmentInfo += "]";
;
return "[" + postInfo + ", " + attachmentInfo + "]" ;
}
}