UCD Cache TTL

This commit is contained in:
Fabio Sinibaldi 2022-05-06 18:03:48 +02:00
parent c44a8c851f
commit 66fcdfd72a
4 changed files with 43 additions and 3 deletions

View File

@ -85,7 +85,6 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
// Check UseCaseDescriptor ID
log.info("Loading useCaseDescriptor ID {} ",profileId);
if(profileId==null) throw new InvalidParameterException("UseCaseDescriptor ID cannot be null");
Map<String, UseCaseDescriptor> profiles=ImplementationProvider.get().getProvidedObjectByClass(ProfileMap.class);
useCaseDescriptor = ImplementationProvider.get().getProvidedObjectByClass(UCDManagerI.class).getById(profileId);
if(useCaseDescriptor == null )
throw new WebApplicationException("UseCaseDescriptor " + profileId + " not registered", Response.Status.NOT_FOUND);

View File

@ -15,12 +15,26 @@ import org.gcube.application.geoportal.service.model.internal.faults.Registratio
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAmount;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import static java.lang.Thread.sleep;
/**
* Provider of UCDManagerI (this)
*
* - nb on get should check / trigger cache refresh TTL
* - uses UCDMongoManager for storing
* - profile live map engine is discovered
*
*
*
*/
@Slf4j
public class UCDManager extends AbstractScopedMap<UCDManagerI> implements UCDManagerI {
@ -28,6 +42,7 @@ public class UCDManager extends AbstractScopedMap<UCDManagerI> implements UCDMan
public UCDManager() {
super("UCD MANAGER");
setTTL(Duration.of(1, ChronoUnit.MINUTES));
}

View File

@ -1,4 +1,30 @@
package org.gcube.application.cms.notifications;
public class NotificationsPlugin {
import org.gcube.application.cms.plugins.implementations.AbstractPlugin;
import org.gcube.application.geoportal.common.model.plugins.PluginDescriptor;
public class NotificationsPlugin extends AbstractPlugin {
@Override
public PluginDescriptor getDescriptor() {
/*
Should basically perform something like
curl --location --request POST 'https://api.dev.d4science.org/social-networking-library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bWFpbF92ZXJpZmllZCI6dHJ1ZSwibmFtZSI6Ik1hc3NpbWlsaWFuIEFzc2FudGUiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJtYXNzaW1pbGlhbm8uYXNzYW50ZSIsImdpdmVuX25hbWUiOiJNYXNzaW1pbGlhbiIsImxvY2FsZSI6ImVuIiwiZmFtaWx5X25hbWUiOiJBc3NhbnRlIiwiZW1haWwiOiJtYXNzaW1pbGlhbm8uYXNzYW50ZUBpc3RpLmNuci5pdCJ9.b7TBRgsW0__3kl2H_ljcL7fSI9I1QaIqQq0Y7S90bWHtkRvmPkPyzWuGq9hhyN1kRg52Ue_3tEEDEkGgtceBEoZ0RAbpppkum7AJvjX6tKHF79k7wpnbxl7ED65VZFk0EazfC2w_n0WvPHQsb67zdwFeZk97G0pbjsVxYUBrhmnEMtXNzmAWaC0cc_-DriE5BBn3DjuWnaxXDxp3DB74YZoJmYR9HYN94c7Y0IV1XZxGFXLZ8V7UTfcJrGqulhF7HU79jd8hccZniam3NEfTZV-knJ4uEnupRHfMLBhnn1MGzxYFPN1xPIPgwiLSvRef7lK2sjI_bi6GAcT0sg5zwA' \
--data-raw ' {
"idsToNotify" : ["leonardo.candela", "luca.frosini"],
"itemId" : "Conversational search dataset with labels",
"notifyText" : "published the test item '\''Conversational search dataset with labels'\''",
"itemURL" : "https://data.d4science.org/ctlg/ResourceCatalogue/conversational_dataset_with_labels",
"idsAsGroup" : false,
"type" : "ITEM_PUBLISHED"
}
*/
return null;
}
}

View File

@ -21,7 +21,7 @@
"_id": "SDI-Indexer-Plugin",
"_type": "Indexer",
"_configuration": {
"coordinatesPath" :[{"x" : "$.GE.GEC.GECX", "y" : "$.GE.GEC.GECY"}],
"coordinatesPath" :[{"x" : "$._theDocument.GE.GEC.GECX", "y" : "$._theDocument.GE.GEC.GECY"}],
"explicitFieldMapping": [],
"additionalLayers": [
{