Logging
This commit is contained in:
parent
ca32991c18
commit
a7280b0b1d
|
@ -13,7 +13,6 @@ import org.gcube.application.cms.plugins.requests.*;
|
||||||
import org.gcube.application.geoportal.common.model.configuration.Configuration;
|
import org.gcube.application.geoportal.common.model.configuration.Configuration;
|
||||||
import org.gcube.application.geoportal.common.model.configuration.Index;
|
import org.gcube.application.geoportal.common.model.configuration.Index;
|
||||||
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
||||||
import org.gcube.application.geoportal.common.model.plugins.LifecycleManagerDescriptor;
|
|
||||||
import org.gcube.application.geoportal.common.model.plugins.OperationDescriptor;
|
import org.gcube.application.geoportal.common.model.plugins.OperationDescriptor;
|
||||||
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
|
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
|
||||||
import org.gcube.application.geoportal.common.utils.Files;
|
import org.gcube.application.geoportal.common.utils.Files;
|
||||||
|
@ -49,7 +48,7 @@ public class Default3PhaseManager extends SimpleLifeCycleManager implements Life
|
||||||
@Override
|
@Override
|
||||||
protected EventExecutionReport onDeleteDocument(EventExecutionReport report) throws ConfigurationException, InvalidPluginRequestException, MaterializationException, EventException {
|
protected EventExecutionReport onDeleteDocument(EventExecutionReport report) throws ConfigurationException, InvalidPluginRequestException, MaterializationException, EventException {
|
||||||
report = super.onDeleteDocument(report);
|
report = super.onDeleteDocument(report);
|
||||||
for(IndexerPluginInterface indexer : getIndexer(report.getTheRequest()))
|
for(IndexerPluginInterface indexer : getIndexers(report.getTheRequest()))
|
||||||
report= deIndex(report,indexer,getInternalIndexParams(report.getTheRequest()));
|
report= deIndex(report,indexer,getInternalIndexParams(report.getTheRequest()));
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +63,7 @@ public class Default3PhaseManager extends SimpleLifeCycleManager implements Life
|
||||||
if(phase.equals(Phases.PUBLISHED))
|
if(phase.equals(Phases.PUBLISHED))
|
||||||
parameters = getPublicIndexParams(theReport.getTheRequest());
|
parameters = getPublicIndexParams(theReport.getTheRequest());
|
||||||
if(parameters!= null)
|
if(parameters!= null)
|
||||||
for(IndexerPluginInterface indexer : getIndexer(theReport.getTheRequest()))
|
for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
|
||||||
theReport = index(theReport,indexer,getPublicIndexParams(theReport.getTheRequest()));
|
theReport = index(theReport,indexer,getPublicIndexParams(theReport.getTheRequest()));
|
||||||
return theReport;
|
return theReport;
|
||||||
}
|
}
|
||||||
|
@ -77,11 +76,11 @@ public class Default3PhaseManager extends SimpleLifeCycleManager implements Life
|
||||||
protected StepExecutionReport run() throws Exception {
|
protected StepExecutionReport run() throws Exception {
|
||||||
// Materialize
|
// Materialize
|
||||||
|
|
||||||
for(MaterializationPlugin mat : getMaterializer(theReport.getTheRequest()))
|
for(MaterializationPlugin mat : getMaterializers(theReport.getTheRequest()))
|
||||||
theReport = materializeDocument(theReport,mat,getMaterializationParameters(theReport.getTheRequest()));
|
theReport = materializeDocument(theReport,mat,getMaterializationParameters(theReport.getTheRequest()));
|
||||||
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)){
|
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)){
|
||||||
// Index
|
// Index
|
||||||
for(IndexerPluginInterface indexer : getIndexer(theReport.getTheRequest()))
|
for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
|
||||||
theReport = index(theReport,indexer,getInternalIndexParams(theReport.getTheRequest()));
|
theReport = index(theReport,indexer,getInternalIndexParams(theReport.getTheRequest()));
|
||||||
// setPhase
|
// setPhase
|
||||||
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
|
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
|
||||||
|
@ -96,7 +95,7 @@ public class Default3PhaseManager extends SimpleLifeCycleManager implements Life
|
||||||
@Override
|
@Override
|
||||||
protected StepExecutionReport run() throws Exception {
|
protected StepExecutionReport run() throws Exception {
|
||||||
// Index
|
// Index
|
||||||
for(IndexerPluginInterface indexer : getIndexer(theReport.getTheRequest()))
|
for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
|
||||||
theReport = index(theReport,indexer,getPublicIndexParams(theReport.getTheRequest()));
|
theReport = index(theReport,indexer,getPublicIndexParams(theReport.getTheRequest()));
|
||||||
// setPhase
|
// setPhase
|
||||||
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
|
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
|
||||||
|
|
|
@ -6,7 +6,6 @@ import org.gcube.application.cms.plugins.IndexerPluginInterface;
|
||||||
import org.gcube.application.cms.plugins.LifecycleManager;
|
import org.gcube.application.cms.plugins.LifecycleManager;
|
||||||
import org.gcube.application.cms.plugins.MaterializationPlugin;
|
import org.gcube.application.cms.plugins.MaterializationPlugin;
|
||||||
import org.gcube.application.cms.plugins.faults.*;
|
import org.gcube.application.cms.plugins.faults.*;
|
||||||
import org.gcube.application.cms.plugins.implementations.executions.GuardedEventManager;
|
|
||||||
import org.gcube.application.cms.plugins.implementations.executions.GuardedStepExecution;
|
import org.gcube.application.cms.plugins.implementations.executions.GuardedStepExecution;
|
||||||
import org.gcube.application.cms.plugins.reports.*;
|
import org.gcube.application.cms.plugins.reports.*;
|
||||||
import org.gcube.application.cms.plugins.requests.*;
|
import org.gcube.application.cms.plugins.requests.*;
|
||||||
|
@ -95,12 +94,12 @@ public class SimpleLifeCycleManager extends AbstractLifeCycleManager implements
|
||||||
// throw new StepException("Document is not in "+LifecycleInformation.CommonPhases.DRAFT_PHASE+" phase");
|
// throw new StepException("Document is not in "+LifecycleInformation.CommonPhases.DRAFT_PHASE+" phase");
|
||||||
|
|
||||||
// Materialize
|
// Materialize
|
||||||
for(MaterializationPlugin mat : getMaterializer(theReport.getTheRequest()))
|
for(MaterializationPlugin mat : getMaterializers(theReport.getTheRequest()))
|
||||||
theReport = materializeDocument(theReport, mat, getMaterializationParameters(theReport.getTheRequest()));
|
theReport = materializeDocument(theReport, mat, getMaterializationParameters(theReport.getTheRequest()));
|
||||||
|
|
||||||
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)){
|
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)){
|
||||||
// Index
|
// Index
|
||||||
for(IndexerPluginInterface indexer : getIndexer(theReport.getTheRequest()))
|
for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
|
||||||
theReport = index(theReport,indexer,getPublicIndexParams(theReport.getTheRequest()));
|
theReport = index(theReport,indexer,getPublicIndexParams(theReport.getTheRequest()));
|
||||||
// setPhase
|
// setPhase
|
||||||
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
|
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
|
||||||
|
@ -139,13 +138,13 @@ public class SimpleLifeCycleManager extends AbstractLifeCycleManager implements
|
||||||
JSONPathWrapper wrapper = new JSONPathWrapper(report.getTheRequest().getDocument().getTheDocument().toJson());
|
JSONPathWrapper wrapper = new JSONPathWrapper(report.getTheRequest().getDocument().getTheDocument().toJson());
|
||||||
for (String s : wrapper.getMatchingPaths("..*[?(@." + RegisteredFileSet.PAYLOADS + ")]")){
|
for (String s : wrapper.getMatchingPaths("..*[?(@." + RegisteredFileSet.PAYLOADS + ")]")){
|
||||||
log.info("Requesting dematerialization for {} ",s);
|
log.info("Requesting dematerialization for {} ",s);
|
||||||
for(MaterializationPlugin mat : getMaterializer(report.getTheRequest()))
|
for(MaterializationPlugin mat : getMaterializers(report.getTheRequest()))
|
||||||
report = deMaterialize(report,mat,new Document("fileSetPath",s));
|
report = deMaterialize(report,mat,new Document("fileSetPath",s));
|
||||||
if(!report.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
|
if(!report.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(report.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)) {
|
if(report.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)) {
|
||||||
for(IndexerPluginInterface indexer : getIndexer(report.getTheRequest()))
|
for(IndexerPluginInterface indexer : getIndexers(report.getTheRequest()))
|
||||||
report = deIndex(report,indexer,getPublicIndexParams(report.getTheRequest()));
|
report = deIndex(report,indexer,getPublicIndexParams(report.getTheRequest()));
|
||||||
}
|
}
|
||||||
return report;
|
return report;
|
||||||
|
@ -155,11 +154,11 @@ public class SimpleLifeCycleManager extends AbstractLifeCycleManager implements
|
||||||
protected EventExecutionReport onDeleteFileSet(EventExecutionReport theReport) throws ConfigurationException, InvalidPluginRequestException, MaterializationException, EventException {
|
protected EventExecutionReport onDeleteFileSet(EventExecutionReport theReport) throws ConfigurationException, InvalidPluginRequestException, MaterializationException, EventException {
|
||||||
// dematerialize selected
|
// dematerialize selected
|
||||||
blockNonDraft(theReport);
|
blockNonDraft(theReport);
|
||||||
for(MaterializationPlugin mat : getMaterializer(theReport.getTheRequest()))
|
for(MaterializationPlugin mat : getMaterializers(theReport.getTheRequest()))
|
||||||
deMaterialize(theReport,mat,
|
deMaterialize(theReport,mat,
|
||||||
theReport.getTheRequest().getCallParameters());
|
theReport.getTheRequest().getCallParameters());
|
||||||
// de index
|
// de index
|
||||||
for(IndexerPluginInterface indexer : getIndexer(theReport.getTheRequest()))
|
for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
|
||||||
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
|
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
|
||||||
deIndex(theReport,indexer,getPublicIndexParams(theReport.getTheRequest()));
|
deIndex(theReport,indexer,getPublicIndexParams(theReport.getTheRequest()));
|
||||||
return theReport;
|
return theReport;
|
||||||
|
@ -172,7 +171,8 @@ public class SimpleLifeCycleManager extends AbstractLifeCycleManager implements
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected List<IndexerPluginInterface> getIndexer(BaseRequest request) throws ConfigurationException {
|
protected List<IndexerPluginInterface> getIndexers(BaseRequest request) throws ConfigurationException {
|
||||||
|
log.trace("Looking for Indexers for {}",request);
|
||||||
ArrayList<IndexerPluginInterface> toReturn=new ArrayList<>();
|
ArrayList<IndexerPluginInterface> toReturn=new ArrayList<>();
|
||||||
UseCaseDescriptor desc = request.getUseCaseDescriptor();
|
UseCaseDescriptor desc = request.getUseCaseDescriptor();
|
||||||
List<HandlerDeclaration> indexers = desc.getHandlersMapByType().get(IndexerPluginDescriptor.INDEXER);
|
List<HandlerDeclaration> indexers = desc.getHandlersMapByType().get(IndexerPluginDescriptor.INDEXER);
|
||||||
|
@ -182,15 +182,16 @@ public class SimpleLifeCycleManager extends AbstractLifeCycleManager implements
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<MaterializationPlugin> getMaterializer(BaseRequest request) throws ConfigurationException {
|
protected List<MaterializationPlugin> getMaterializers(BaseRequest request) throws ConfigurationException {
|
||||||
ArrayList<MaterializationPlugin> toReturn=new ArrayList<>();
|
log.trace("Looking for materializers for {}",request);
|
||||||
UseCaseDescriptor desc = request.getUseCaseDescriptor();
|
ArrayList<MaterializationPlugin> toReturn=new ArrayList<>();
|
||||||
List<HandlerDeclaration> materializers = desc.getHandlersMapByType().get(MaterializerPluginDescriptor.MATERIALIZER);
|
UseCaseDescriptor desc = request.getUseCaseDescriptor();
|
||||||
log.debug("Found UCD [{}] Materializers : {}",desc.getId(),materializers.size());
|
List<HandlerDeclaration> materializers = desc.getHandlersMapByType().get(MaterializerPluginDescriptor.MATERIALIZER);
|
||||||
for (HandlerDeclaration handlerDeclaration : materializers) {
|
log.debug("Found UCD [{}] Materializers : {}",desc.getId(),materializers.size());
|
||||||
toReturn.add((MaterializationPlugin) pluginManager.getById(handlerDeclaration.getId()));
|
for (HandlerDeclaration handlerDeclaration : materializers) {
|
||||||
}
|
toReturn.add((MaterializationPlugin) pluginManager.getById(handlerDeclaration.getId()));
|
||||||
return toReturn;
|
}
|
||||||
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <T extends DocumentHandlingReport> T deIndex(T report, IndexerPluginInterface indexer, Document parameters) throws InvalidPluginRequestException {
|
protected <T extends DocumentHandlingReport> T deIndex(T report, IndexerPluginInterface indexer, Document parameters) throws InvalidPluginRequestException {
|
||||||
|
|
Loading…
Reference in New Issue