Class SchemaSnapshotTypesDiscoverer
java.lang.Object
org.gcube.informationsystem.resourceregistry.types.SchemaSnapshotTypesDiscoverer
- All Implemented Interfaces:
org.gcube.informationsystem.model.knowledge.TypesDiscoverer<org.gcube.informationsystem.types.reference.Type>
public class SchemaSnapshotTypesDiscoverer
extends Object
implements org.gcube.informationsystem.model.knowledge.TypesDiscoverer<org.gcube.informationsystem.types.reference.Type>
TypesDiscoverer backed by an already-loaded SchemaSnapshot: discovers types by
filtering its flat SchemaSnapshot.getTypes() by Type.getAccessType(), in-process
and with no additional I/O.
Unlike RRCTypesDiscoverer/RRCCTypesDiscoverer, which fetch types from the
Resource Registry server over HTTP, this discoverer runs inside the server itself: the snapshot
it reads from has already paid the cost of walking the type graph, so this class only partitions
what is already in memory.
- Author:
- Luca Frosini (ISTI - CNR)
-
Constructor Summary
ConstructorsConstructorDescriptionSchemaSnapshotTypesDiscoverer(SchemaSnapshot snapshot) Creates a discoverer backed by the given snapshot. -
Method Summary
Modifier and TypeMethodDescriptionCollection<org.gcube.informationsystem.types.reference.Type>discover(org.gcube.informationsystem.base.reference.AccessType accessType)
-
Constructor Details
-
SchemaSnapshotTypesDiscoverer
Creates a discoverer backed by the given snapshot.- Parameters:
snapshot- the schema snapshot to discover types from
-
-
Method Details
-
discover
public Collection<org.gcube.informationsystem.types.reference.Type> discover(org.gcube.informationsystem.base.reference.AccessType accessType) Returns every type in the snapshot whose own
Type.getAccessType()equals the requested one -- each leaf schema type (e.g.ResourceSchemaImpl,FacetSchemaImpl) reports its own concreteAccessTyperather than an ancestor's, so this is exactly the subtree a server-sidegetTypeFromServer(accessType.getTypeClass(), DEPTH_UNLIMITED)call would return.- Specified by:
discoverin interfaceorg.gcube.informationsystem.model.knowledge.TypesDiscoverer<org.gcube.informationsystem.types.reference.Type>
-