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.Index;
|
||||
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.rest.ConfigurationException;
|
||||
import org.gcube.application.geoportal.common.utils.Files;
|
||||
|
@ -49,7 +48,7 @@ public class Default3PhaseManager extends SimpleLifeCycleManager implements Life
|
|||
@Override
|
||||
protected EventExecutionReport onDeleteDocument(EventExecutionReport report) throws ConfigurationException, InvalidPluginRequestException, MaterializationException, EventException {
|
||||
report = super.onDeleteDocument(report);
|
||||
for(IndexerPluginInterface indexer : getIndexer(report.getTheRequest()))
|
||||
for(IndexerPluginInterface indexer : getIndexers(report.getTheRequest()))
|
||||
report= deIndex(report,indexer,getInternalIndexParams(report.getTheRequest()));
|
||||
return report;
|
||||
}
|
||||
|
@ -64,7 +63,7 @@ public class Default3PhaseManager extends SimpleLifeCycleManager implements Life
|
|||
if(phase.equals(Phases.PUBLISHED))
|
||||
parameters = getPublicIndexParams(theReport.getTheRequest());
|
||||
if(parameters!= null)
|
||||
for(IndexerPluginInterface indexer : getIndexer(theReport.getTheRequest()))
|
||||
for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
|
||||
theReport = index(theReport,indexer,getPublicIndexParams(theReport.getTheRequest()));
|
||||
return theReport;
|
||||
}
|
||||
|
@ -77,11 +76,11 @@ public class Default3PhaseManager extends SimpleLifeCycleManager implements Life
|
|||
protected StepExecutionReport run() throws Exception {
|
||||
// Materialize
|
||||
|
||||
for(MaterializationPlugin mat : getMaterializer(theReport.getTheRequest()))
|
||||
for(MaterializationPlugin mat : getMaterializers(theReport.getTheRequest()))
|
||||
theReport = materializeDocument(theReport,mat,getMaterializationParameters(theReport.getTheRequest()));
|
||||
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)){
|
||||
// Index
|
||||
for(IndexerPluginInterface indexer : getIndexer(theReport.getTheRequest()))
|
||||
for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
|
||||
theReport = index(theReport,indexer,getInternalIndexParams(theReport.getTheRequest()));
|
||||
// setPhase
|
||||
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
|
||||
|
@ -96,7 +95,7 @@ public class Default3PhaseManager extends SimpleLifeCycleManager implements Life
|
|||
@Override
|
||||
protected StepExecutionReport run() throws Exception {
|
||||
// Index
|
||||
for(IndexerPluginInterface indexer : getIndexer(theReport.getTheRequest()))
|
||||
for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
|
||||
theReport = index(theReport,indexer,getPublicIndexParams(theReport.getTheRequest()));
|
||||
// setPhase
|
||||
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.MaterializationPlugin;
|
||||
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.reports.*;
|
||||
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");
|
||||
|
||||
// Materialize
|
||||
for(MaterializationPlugin mat : getMaterializer(theReport.getTheRequest()))
|
||||
for(MaterializationPlugin mat : getMaterializers(theReport.getTheRequest()))
|
||||
theReport = materializeDocument(theReport, mat, getMaterializationParameters(theReport.getTheRequest()));
|
||||
|
||||
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK)){
|
||||
// Index
|
||||
for(IndexerPluginInterface indexer : getIndexer(theReport.getTheRequest()))
|
||||
for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
|
||||
theReport = index(theReport,indexer,getPublicIndexParams(theReport.getTheRequest()));
|
||||
// setPhase
|
||||
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());
|
||||
for (String s : wrapper.getMatchingPaths("..*[?(@." + RegisteredFileSet.PAYLOADS + ")]")){
|
||||
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));
|
||||
if(!report.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
|
||||
break;
|
||||
}
|
||||
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()));
|
||||
}
|
||||
return report;
|
||||
|
@ -155,11 +154,11 @@ public class SimpleLifeCycleManager extends AbstractLifeCycleManager implements
|
|||
protected EventExecutionReport onDeleteFileSet(EventExecutionReport theReport) throws ConfigurationException, InvalidPluginRequestException, MaterializationException, EventException {
|
||||
// dematerialize selected
|
||||
blockNonDraft(theReport);
|
||||
for(MaterializationPlugin mat : getMaterializer(theReport.getTheRequest()))
|
||||
for(MaterializationPlugin mat : getMaterializers(theReport.getTheRequest()))
|
||||
deMaterialize(theReport,mat,
|
||||
theReport.getTheRequest().getCallParameters());
|
||||
// de index
|
||||
for(IndexerPluginInterface indexer : getIndexer(theReport.getTheRequest()))
|
||||
for(IndexerPluginInterface indexer : getIndexers(theReport.getTheRequest()))
|
||||
if(theReport.getToSetLifecycleInformation().getLastOperationStatus().equals(LifecycleInformation.Status.OK))
|
||||
deIndex(theReport,indexer,getPublicIndexParams(theReport.getTheRequest()));
|
||||
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<>();
|
||||
UseCaseDescriptor desc = request.getUseCaseDescriptor();
|
||||
List<HandlerDeclaration> indexers = desc.getHandlersMapByType().get(IndexerPluginDescriptor.INDEXER);
|
||||
|
@ -182,15 +182,16 @@ public class SimpleLifeCycleManager extends AbstractLifeCycleManager implements
|
|||
return toReturn;
|
||||
}
|
||||
|
||||
protected List<MaterializationPlugin> getMaterializer(BaseRequest request) throws ConfigurationException {
|
||||
ArrayList<MaterializationPlugin> toReturn=new ArrayList<>();
|
||||
UseCaseDescriptor desc = request.getUseCaseDescriptor();
|
||||
List<HandlerDeclaration> materializers = desc.getHandlersMapByType().get(MaterializerPluginDescriptor.MATERIALIZER);
|
||||
log.debug("Found UCD [{}] Materializers : {}",desc.getId(),materializers.size());
|
||||
for (HandlerDeclaration handlerDeclaration : materializers) {
|
||||
toReturn.add((MaterializationPlugin) pluginManager.getById(handlerDeclaration.getId()));
|
||||
}
|
||||
return toReturn;
|
||||
protected List<MaterializationPlugin> getMaterializers(BaseRequest request) throws ConfigurationException {
|
||||
log.trace("Looking for materializers for {}",request);
|
||||
ArrayList<MaterializationPlugin> toReturn=new ArrayList<>();
|
||||
UseCaseDescriptor desc = request.getUseCaseDescriptor();
|
||||
List<HandlerDeclaration> materializers = desc.getHandlersMapByType().get(MaterializerPluginDescriptor.MATERIALIZER);
|
||||
log.debug("Found UCD [{}] Materializers : {}",desc.getId(),materializers.size());
|
||||
for (HandlerDeclaration handlerDeclaration : materializers) {
|
||||
toReturn.add((MaterializationPlugin) pluginManager.getById(handlerDeclaration.getId()));
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
protected <T extends DocumentHandlingReport> T deIndex(T report, IndexerPluginInterface indexer, Document parameters) throws InvalidPluginRequestException {
|
||||
|
|
Loading…
Reference in New Issue