Added cache for ModelKnowledge
This commit is contained in:
parent
30eac775f6
commit
2113a6ee97
|
@ -7,6 +7,7 @@ import java.util.UUID;
|
||||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||||
import org.gcube.informationsystem.base.reference.Direction;
|
import org.gcube.informationsystem.base.reference.Direction;
|
||||||
import org.gcube.informationsystem.contexts.reference.entities.Context;
|
import org.gcube.informationsystem.contexts.reference.entities.Context;
|
||||||
|
import org.gcube.informationsystem.model.knowledge.ModelKnowledge;
|
||||||
import org.gcube.informationsystem.model.reference.ERElement;
|
import org.gcube.informationsystem.model.reference.ERElement;
|
||||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||||
|
@ -24,6 +25,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.queries.templ
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.request.RequestInfo;
|
import org.gcube.informationsystem.resourceregistry.api.request.RequestInfo;
|
||||||
import org.gcube.informationsystem.tree.Node;
|
import org.gcube.informationsystem.tree.Node;
|
||||||
|
import org.gcube.informationsystem.types.knowledge.TypeInformation;
|
||||||
import org.gcube.informationsystem.types.reference.Type;
|
import org.gcube.informationsystem.types.reference.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,6 +66,10 @@ public interface ResourceRegistryClient extends RequestInfo {
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
public ModelKnowledge<Type, TypeInformation> getModelKnowledge();
|
||||||
|
|
||||||
|
public void renewModelKnowledge();
|
||||||
|
|
||||||
public boolean existType(String typeName) throws ResourceRegistryException;
|
public boolean existType(String typeName) throws ResourceRegistryException;
|
||||||
|
|
||||||
public <ERElem extends ERElement> boolean existType(Class<ERElem> clazz) throws ResourceRegistryException;
|
public <ERElem extends ERElement> boolean existType(Class<ERElem> clazz) throws ResourceRegistryException;
|
||||||
|
|
|
@ -236,10 +236,12 @@ public class ResourceRegistryClientImpl extends BaseRequestInfo implements Resou
|
||||||
return contextCache;
|
return contextCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ModelKnowledge<Type, TypeInformation> getModelKnowledge() {
|
public ModelKnowledge<Type, TypeInformation> getModelKnowledge() {
|
||||||
return typesKnowledge.getModelKnowledge();
|
return typesKnowledge.getModelKnowledge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void renewModelKnowledge() {
|
public void renewModelKnowledge() {
|
||||||
typesKnowledge.renew();
|
typesKnowledge.renew();
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,12 @@ public class ResourceRegistryClientTest extends ContextTest {
|
||||||
logger.trace("List size {}\n{}", types.size(), getTypeNames(types));
|
logger.trace("List size {}\n{}", types.size(), getTypeNames(types));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTypesKnowledgeExpiring() throws Exception {
|
||||||
|
resourceRegistryClient.getModelKnowledge();
|
||||||
|
resourceRegistryClient.renewModelKnowledge();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testModelKnowledge() throws SchemaNotFoundException, ResourceRegistryException {
|
public void testModelKnowledge() throws SchemaNotFoundException, ResourceRegistryException {
|
||||||
AccessType[] modelTypes = AccessType.getModelTypes();
|
AccessType[] modelTypes = AccessType.getModelTypes();
|
||||||
|
|
Loading…
Reference in New Issue