resource-registry-client/src/main/java/org/gcube/informationsystem/resourceregistry/client/RRCTypesDiscoverer.java

31 lines
941 B
Java
Raw Permalink Normal View History

package org.gcube.informationsystem.resourceregistry.client;
import java.util.Collection;
import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.model.knowledge.TypesDiscoverer;
2023-10-30 17:08:46 +01:00
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.types.reference.Type;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class RRCTypesDiscoverer implements TypesDiscoverer<Type> {
2023-10-30 17:08:46 +01:00
protected ResourceRegistryClientImpl resourceRegistryClient;
2023-10-30 17:08:46 +01:00
public RRCTypesDiscoverer(ResourceRegistryClientImpl resourceRegistryClient) {
this.resourceRegistryClient = resourceRegistryClient;
}
@Override
public Collection<Type> discover(AccessType accessType) {
2023-10-30 17:08:46 +01:00
try {
return resourceRegistryClient.getTypeFromServer(accessType.getTypeClass(), true);
} catch (ResourceRegistryException e) {
throw new RuntimeException(e);
}
}
}