improved some logs

This commit is contained in:
Francesco Mangiacrapa 2023-04-28 14:40:44 +02:00
parent 1b5eb2e5b0
commit f0488d5c73
4 changed files with 113 additions and 22 deletions

View File

@ -1,7 +1,9 @@
# Changelog for org.gcube.application.cms.sdi-plugins
## [v1.1.0]
## [v1.1.1-SNAPSHOT]
- Improved some logs
## [v1.1.0]
- Integrated the field 'geov_link' (Geoportal GisViewer link) in the centroid layer [#24859]
## [v1.0.4] - 2023-03-06

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>sdi-plugins</artifactId>
<version>1.1.0</version>
<version>1.1.1-SNAPSHOT</version>
<name>gCube CMS - SDI Plugins</name>

View File

@ -50,6 +50,15 @@ import com.vdurmont.semver4j.Semver;
import lombok.extern.slf4j.Slf4j;
/**
* The Class SDIIndexerPlugin.
*
* @author created by Fabio Sinibaldi
* @author new architect and maintainer - Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Apr 28, 2023
*/
@Slf4j
public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPluginInterface {
@ -67,11 +76,22 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
}
/**
* Gets the descriptor.
*
* @return the descriptor
*/
@Override
public PluginDescriptor getDescriptor() {
return DESCRIPTOR;
}
/**
* Inits the in context.
*
* @return the initialization report
* @throws InitializationException the initialization exception
*/
@Override
public InitializationReport initInContext() throws InitializationException {
InitializationReport report = new InitializationReport();
@ -90,8 +110,9 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
@Override
public IndexDocumentReport index(IndexDocumentRequest request) throws InvalidPluginRequestException {
log.info("Indexer {} : Serving Index Request {} ", this.getDescriptor().getId(), request);
log.info("Serving Indexer {} : request CallParameters {}, request Context {}: ", this.getDescriptor().getId(),
request.getCallParameters(), request.getContext());
log.debug("Indexer {} : Serving Request {} ", this.getDescriptor().getId(), request);
Project project = request.getDocument();
UseCaseDescriptor useCaseDescriptor = request.getUseCaseDescriptor();
@ -123,8 +144,7 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
// Added by Francesco. Creating Gis Viewer Link as public or private
Boolean isInternalIndex = null;
try {
isInternalIndex = requestArguments
.getBoolean(IndexConstants.INDEX_PARAMETER_FLAGINTERNALINDEX);
isInternalIndex = requestArguments.getBoolean(IndexConstants.INDEX_PARAMETER_FLAGINTERNALINDEX);
log.debug(IndexConstants.INDEX_PARAMETER_FLAGINTERNALINDEX + " read as {} ", isInternalIndex);
} catch (Exception e) {
// TODO: handle exception
@ -281,13 +301,29 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
}
}
/**
* Gets the mappings.
*
* @param useCaseDescriptor the use case descriptor
* @return the mappings
* @throws InvalidProfileException the invalid profile exception
*/
private List<MappingObject> getMappings(UseCaseDescriptor useCaseDescriptor) throws InvalidProfileException {
return MappingObject.getMappingsFromUCD(useCaseDescriptor, getDescriptor().getId());
}
/**
* Deindex.
*
* @param request the request
* @return the index document report
* @throws InvalidPluginRequestException the invalid plugin request exception
*/
@Override
public IndexDocumentReport deindex(IndexDocumentRequest request) throws InvalidPluginRequestException {
log.info("Indexer {} : Serving Index Request {} ", this.getDescriptor().getId(), request);
log.info("Serving DeIndexer {} : request CallParameters {}, request Context {}: ", this.getDescriptor().getId(),
request.getCallParameters(), request.getContext());
log.debug("DeIndexer {} : Serving Request {} ", this.getDescriptor().getId(), request);
IndexDocumentReport report = new IndexDocumentReport(request);
try {
PostgisIndexer indexer = getIndexer(request.getUseCaseDescriptor(), request.getCallParameters());
@ -306,11 +342,11 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
}
/**
* Expected parameters : workspace indexName
* Expected parameters : workspace indexName.
*
* @param request
* @return
* @throws ConfigurationException
* @param request the request
* @return the index
* @throws ConfigurationException the configuration exception
*/
@Override
public Index getIndex(BaseRequest request) throws ConfigurationException {
@ -323,6 +359,17 @@ public class SDIIndexerPlugin extends SDIAbstractPlugin implements IndexerPlugin
}
// Inits index
/**
* Gets the indexer.
*
* @param ucd the ucd
* @param params the params
* @return the indexer
* @throws ConfigurationException the configuration exception
* @throws SQLException the SQL exception
* @throws InvalidProfileException the invalid profile exception
* @throws SDIInteractionException the SDI interaction exception
*/
// TODO CACHE
private PostgisIndexer getIndexer(UseCaseDescriptor ucd, Document params)
throws ConfigurationException, SQLException, InvalidProfileException, SDIInteractionException {

View File

@ -36,9 +36,21 @@ import lombok.Data;
import lombok.Synchronized;
import lombok.extern.slf4j.Slf4j;
/**
* The Class SDIMaterializerPlugin.
*
* @author created by Fabio Sinibaldi
* @author new architect and maintainer - Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Apr 28, 2023
*/
@Slf4j
public class SDIMaterializerPlugin extends AbstractPlugin implements MaterializationPlugin {
/**
* Instantiates a new materialization config.
*/
@Data
public static class MaterializationConfig{
private String schemaField;
@ -48,12 +60,23 @@ public class SDIMaterializerPlugin extends AbstractPlugin implements Materializa
Map<String, SDIManagerWrapper> sdiManagerMap=null;
/**
* Gets the SDI manager.
*
* @return the SDI manager
*/
private SDIManagerWrapper getSDIManager(){
String context = UserUtils.getCurrent().getContext();
log.debug("Getting SDIManagerWrapper from cache map for context {}");
return sdiManagerMap.get(context);
}
/**
* Inits the in context.
*
* @return the initialization report
* @throws InitializationException the initialization exception
*/
@Override
@Synchronized
public InitializationReport initInContext() throws InitializationException {
@ -72,6 +95,12 @@ public class SDIMaterializerPlugin extends AbstractPlugin implements Materializa
return report;
}
/**
* Inits the.
*
* @return the initialization report
* @throws InitializationException the initialization exception
*/
@Override
@Synchronized
public InitializationReport init() throws InitializationException {
@ -81,6 +110,11 @@ public class SDIMaterializerPlugin extends AbstractPlugin implements Materializa
return report;
}
/**
* Shutdown.
*
* @throws ShutDownException the shut down exception
*/
@Override
public void shutdown() throws ShutDownException {
@ -89,15 +123,17 @@ public class SDIMaterializerPlugin extends AbstractPlugin implements Materializa
/**
* Expected params :
* -workspace MANDATORY
* -titleField
* -titleField.
*
* @param request
* @return
* @throws MaterializationException
* @param request the request
* @return the materialization report
* @throws MaterializationException the materialization exception
* @throws InvalidPluginRequestException the invalid plugin request exception
*/
@Override
public MaterializationReport materialize(MaterializationRequest request) throws MaterializationException, InvalidPluginRequestException {
log.info("Materializer {} : Performing {} ",this.getDescriptor().getId(),request);
log.info("Serving Materialize {} : request CallParameters {}, request Context {}: ",this.getDescriptor().getId(), request.getCallParameters(), request.getContext());
log.debug("Materialize request {}",request);
Project project =request.getDocument();
UseCaseDescriptor useCaseDescriptor = request.getUseCaseDescriptor();
Document requestArguments=Serialization.convert(request.getCallParameters(),Document.class);
@ -167,16 +203,17 @@ public class SDIMaterializerPlugin extends AbstractPlugin implements Materializa
/**
* Expected parameters
* - fileSetPath
* - fileSetPath.
*
* @param request
* @return
* @throws MaterializationException
* @throws InvalidPluginRequestException
* @param request the request
* @return the materialization report
* @throws MaterializationException the materialization exception
* @throws InvalidPluginRequestException the invalid plugin request exception
*/
@Override
public MaterializationReport dematerialize(MaterializationRequest request) throws MaterializationException, InvalidPluginRequestException {
log.info("Serving DeMaterialization {} ",request);
log.info("Serving DeMaterialize {} : request CallParameters {}, request Context {}: ",this.getDescriptor().getId(), request.getCallParameters(), request.getContext());
log.debug("DeMaterialize request {}",request);
MaterializationReport report= new MaterializationReport(request);
try{
SDIManagerWrapper sdi=getSDIManager();
@ -221,6 +258,11 @@ public class SDIMaterializerPlugin extends AbstractPlugin implements Materializa
DESCRIPTOR.setVersion(new Semver("1.0.0"));
}
/**
* Gets the descriptor.
*
* @return the descriptor
*/
@Override
public PluginDescriptor getDescriptor() {
return DESCRIPTOR;