diff --git a/cms-plugin-framework/CHANGELOG.md b/cms-plugin-framework/CHANGELOG.md
index 5b4ba43..dd00c5e 100644
--- a/cms-plugin-framework/CHANGELOG.md
+++ b/cms-plugin-framework/CHANGELOG.md
@@ -1,5 +1,8 @@
# Changelog for org.gcube.application.cms-plugin-framework
+## [v1.0.5-SNAPSHOT] - 2023-12-21
+- Added Event Manager
+
## [v1.0.4] - 2023-09-06
- Using parent range version [#25572]
diff --git a/cms-plugin-framework/pom.xml b/cms-plugin-framework/pom.xml
index 4234ce8..e87f8eb 100644
--- a/cms-plugin-framework/pom.xml
+++ b/cms-plugin-framework/pom.xml
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
cms-plugin-framework
- 1.0.4
+ 1.0.5-SNAPSHOT
org.gcube.application.cms
diff --git a/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/EventListener.java b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/EventListener.java
new file mode 100644
index 0000000..1bdacf2
--- /dev/null
+++ b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/EventListener.java
@@ -0,0 +1,7 @@
+package org.gcube.application.cms.plugins.events;
+
+public interface EventListener {
+
+ public void updated(T observerd);
+
+}
diff --git a/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/EventManager.java b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/EventManager.java
new file mode 100644
index 0000000..fdfa9d8
--- /dev/null
+++ b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/EventManager.java
@@ -0,0 +1,130 @@
+package org.gcube.application.cms.plugins.events;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * The Class EventManager.
+ *
+ * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
+ *
+ * Dec 11, 2023
+ */
+public class EventManager implements EventManagerInterface {
+
+ private HashMap>> listeners = new HashMap>>();
+
+ /**
+ * The Class Event.
+ *
+ * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
+ *
+ * Nov 29, 2023
+ */
+ public static enum Event {
+
+ PROJECT_CREATED("PROJECT_CREATED"),
+ PROJECT_UPDATED("PROJECT_UPDATED"),
+ PROJECT_DELETED("PROJECT_DELETED"),
+ LIFECYCLE_STEP_PERFORMED("LIFECYCLE_STEP_PERFORMED");
+
+ String name;
+
+ /**
+ * Instantiates a new event.
+ *
+ * @param name the name
+ */
+ Event(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ }
+
+ // private instance, so that it can be
+ // accessed by only by getInstance() method
+ private static EventManager instance;
+
+ /**
+ * Instantiates a new event manager.
+ */
+ private EventManager() {
+ // private constructor
+ }
+
+ /**
+ * Gets the single instance of EventManager.
+ *
+ * @return single instance of EventManager
+ */
+ public static EventManager getInstance() {
+ if (instance == null) {
+ // synchronized block to remove overhead
+ synchronized (EventManager.class) {
+ if (instance == null) {
+ // if instance is null, initialize
+ instance = new EventManager();
+ }
+
+ }
+ }
+ return instance;
+ }
+
+ /**
+ * Subscribe.
+ *
+ * @param eventType the event type
+ * @param listener the listener
+ */
+ public void subscribe(Event eventType, EventListener listener) {
+ List> list = listeners.get(eventType);
+ if (list == null)
+ list = new ArrayList>();
+
+ list.add(listener);
+ listeners.put(eventType, list);
+ }
+
+ /**
+ * Unsubscribe.
+ *
+ * @param eventType the event type
+ * @param listener the listener
+ */
+ public void unsubscribe(Event eventType, EventListener listener) {
+ List> list = listeners.get(eventType);
+ if (list == null)
+ return;
+
+ list.remove(listener);
+ listeners.put(eventType, list);
+ }
+
+ /**
+ * Notify.
+ *
+ * @param eventType the event type
+ * @param item the item
+ */
+ public void notify(Event eventType, ItemObservable item) {
+ for (EventManager.Event event : listeners.keySet()) {
+ if (event.equals(eventType)) {
+ for (EventListener eventListner : listeners.get(eventType)) {
+ eventListner.updated(item);
+ }
+ }
+ }
+ }
+
+}
diff --git a/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/EventManagerInterface.java b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/EventManagerInterface.java
new file mode 100644
index 0000000..dc5706b
--- /dev/null
+++ b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/EventManagerInterface.java
@@ -0,0 +1,13 @@
+package org.gcube.application.cms.plugins.events;
+
+import org.gcube.application.cms.plugins.events.EventManager.Event;
+
+public interface EventManagerInterface {
+
+ public void subscribe(Event eventType, EventListener listener);
+
+ public void unsubscribe(Event eventType, EventListener listener);
+
+ public void notify(Event eventType, T item);
+
+}
diff --git a/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/ItemObservable.java b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/ItemObservable.java
new file mode 100644
index 0000000..dab4c0c
--- /dev/null
+++ b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/ItemObservable.java
@@ -0,0 +1,7 @@
+package org.gcube.application.cms.plugins.events;
+
+public interface ItemObservable {
+
+ public String getId();
+
+}
diff --git a/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/ItemObserved.java b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/ItemObserved.java
new file mode 100644
index 0000000..0f68750
--- /dev/null
+++ b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/ItemObserved.java
@@ -0,0 +1,31 @@
+package org.gcube.application.cms.plugins.events;
+
+import org.gcube.application.geoportal.common.model.document.Project;
+import org.gcube.application.geoportal.common.model.document.accounting.Context;
+import org.gcube.application.geoportal.common.model.document.accounting.User;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+@Slf4j
+public class ItemObserved implements ItemObservable {
+ User caller;
+ Context context;
+ T project;
+ EventManager.Event event;
+
+ public String getId() {
+ log.debug("Called getId");
+ if (project == null)
+ return null;
+ return project.getId();
+ }
+
+}