Event Management Model

This commit is contained in:
Fabio Sinibaldi 2022-02-14 12:23:38 +01:00
parent da148707f6
commit face519810
11 changed files with 130 additions and 9 deletions

View File

@ -1,9 +1,11 @@
package org.gcube.application.cms.plugins;
import org.gcube.application.cms.plugins.faults.EventException;
import org.gcube.application.cms.plugins.faults.StepException;
import org.gcube.application.cms.plugins.reports.ExecutionReport;
import org.gcube.application.cms.plugins.reports.EventExecutionReport;
import org.gcube.application.cms.plugins.reports.StepExecutionReport;
import org.gcube.application.cms.plugins.requests.EventExecutionRequest;
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
import org.gcube.application.geoportal.common.model.rest.Configuration;
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
@ -12,7 +14,9 @@ public interface LifecycleManager extends InitializablePlugin{
// Lifecycle operations
public ExecutionReport performStep(StepExecutionRequest request)throws StepException;
public StepExecutionReport performStep(StepExecutionRequest request)throws StepException;
public Configuration getCurrentConfiguration() throws ConfigurationException;
public EventExecutionReport onEvent(EventExecutionRequest request) throws EventException;
}

View File

@ -0,0 +1,11 @@
package org.gcube.application.cms.plugins;
import org.gcube.application.cms.plugins.faults.MaterializationException;
import org.gcube.application.cms.plugins.reports.MaterializationReport;
import org.gcube.application.cms.plugins.requests.MaterializationRequest;
public interface MaterializationPlugin extends InitializablePlugin{
public MaterializationReport materialize(MaterializationRequest request) throws MaterializationException;
}

View File

@ -0,0 +1,23 @@
package org.gcube.application.cms.plugins.faults;
public class EventException extends Exception{
public EventException() {
}
public EventException(String message) {
super(message);
}
public EventException(String message, Throwable cause) {
super(message, cause);
}
public EventException(Throwable cause) {
super(cause);
}
public EventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}

View File

@ -0,0 +1,23 @@
package org.gcube.application.cms.plugins.faults;
public class MaterializationException extends Exception {
public MaterializationException() {
}
public MaterializationException(String message) {
super(message);
}
public MaterializationException(String message, Throwable cause) {
super(message, cause);
}
public MaterializationException(Throwable cause) {
super(cause);
}
public MaterializationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}

View File

@ -0,0 +1,15 @@
package org.gcube.application.cms.plugins.reports;
import lombok.Data;
import org.bson.Document;
import org.gcube.application.cms.plugins.requests.EventExecutionRequest;
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
import org.gcube.application.geoportal.common.model.profile.Profile;
@Data
public class EventExecutionReport {
private EventExecutionRequest request;
private ProfiledDocument result;
}

View File

@ -1,6 +1,6 @@
package org.gcube.application.cms.plugins.reports;
public class InitializationReport {
public class InitializationReport extends Report{
}

View File

@ -0,0 +1,5 @@
package org.gcube.application.cms.plugins.reports;
public class MaterializationReport extends Report{
}

View File

@ -1,14 +1,20 @@
package org.gcube.application.cms.plugins.reports;
import lombok.Data;
import org.gcube.application.cms.plugins.requests.EventExecutionRequest;
import org.gcube.application.cms.plugins.requests.StepExecutionRequest;
import org.gcube.application.geoportal.common.model.document.LifecycleInformation;
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
import java.util.List;
@Data
public class ExecutionReport {
public class StepExecutionReport {
StepExecutionRequest request;
ProfiledDocument result;
List<EventExecutionRequest> toTriggerEvents;
List<StepExecutionRequest> cascadeSteps;
}

View File

@ -0,0 +1,23 @@
package org.gcube.application.cms.plugins.requests;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
import org.gcube.application.geoportal.common.model.profile.Profile;
@Data
public class EventExecutionRequest {
public static class Events{
public static final String ON_INIT_DOCUMENT="@@@INIT_DOCUMENT@@";
public static final String ON_UPDATE_DOCUMENT="@@@UPDATE_DOCUMENT@@";
public static final String ON_DELETE_DOCUMENT="@@@DELETE_DOCUMENT@@";
}
Profile profile;
ProfiledDocument document;
String event;
Document callParameters;
}

View File

@ -0,0 +1,14 @@
package org.gcube.application.cms.plugins.requests;
import lombok.Data;
import org.bson.Document;
import org.gcube.application.geoportal.common.model.document.ProfiledDocument;
import org.gcube.application.geoportal.common.model.profile.Profile;
@Data
public class MaterializationRequest {
ProfiledDocument document;
Document parameters;
Profile profile;
}

View File

@ -9,9 +9,6 @@ import org.gcube.application.geoportal.common.model.profile.Profile;
public class StepExecutionRequest {
public static class Steps{
public static final String ON_INIT_DOCUMENT="@@@INIT_DOCUMENT@@";
public static final String ON_UPDATE_DOCUMENT="@@@UPDATE_DOCUMENT@@";
public static final String ON_DELETE_DOCUMENT="@@@DELETE_DOCUMENT@@";
public static final String ON_MATERIALIZE_DOCUMENT="@@@MATERIALIZE_DOCUMENT@@";
public static final String ON_DEMATERIALIZE_DOCUMENT="@@@DEMATERIALIZE_DOCUMENT@@";