Compare commits
43 Commits
feature/25
...
master
|
@ -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>
|
||||
|
|
|
@ -4,9 +4,14 @@
|
|||
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] - 2024-04-22
|
||||
|
||||
- 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
|
||||
- Feature 27286 - Removed noisy logs
|
||||
|
||||
## [v2.0.0] - 2023-12-04
|
||||
|
||||
- Support for Cassandra 4.1.3 using DataStax java driver
|
||||
|
||||
## [v1.17.0] - 2022-05-13
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
12
pom.xml
12
pom.xml
|
@ -5,13 +5,13 @@
|
|||
<parent>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<version>1.1.0</version>
|
||||
<version>1.2.0</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<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>
|
||||
|
|
|
@ -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()) {
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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.
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -7,12 +7,20 @@ 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);
|
||||
|
||||
public Tester() {
|
||||
store = new DBCassandraAstyanaxImpl("gcube"); //set to true if you want to drop the KeySpace and recreate it
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException, FeedIDNotFoundException, FeedTypeNotFoundException {
|
||||
|
|
|
@ -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 + "]" ;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue