Search in sources :

Example 1 with OgcApiQueryParameter

use of de.ii.ogcapi.foundation.domain.OgcApiQueryParameter in project ldproxy by interactive-instruments.

the class AbstractEndpointTileSingleCollection method computeDefinition.

protected ApiEndpointDefinition computeDefinition(OgcApiDataV2 apiData, String apiEntrypoint, int sortPriority, String basePath, String subSubPath, List<String> tags) {
    ImmutableApiEndpointDefinition.Builder definitionBuilder = new ImmutableApiEndpointDefinition.Builder().apiEntrypoint(apiEntrypoint).sortPriority(sortPriority);
    final String path = basePath + subSubPath;
    final HttpMethods method = HttpMethods.GET;
    final List<OgcApiPathParameter> pathParameters = getPathParameters(extensionRegistry, apiData, path);
    final Optional<OgcApiPathParameter> optCollectionIdParam = pathParameters.stream().filter(param -> param.getName().equals("collectionId")).findAny();
    if (optCollectionIdParam.isEmpty()) {
        LOGGER.error("Path parameter 'collectionId' missing for resource at path '" + path + "'. The GET method will not be available.");
    } else {
        final OgcApiPathParameter collectionIdParam = optCollectionIdParam.get();
        boolean explode = collectionIdParam.getExplodeInOpenApi(apiData);
        final List<String> collectionIds = (explode) ? collectionIdParam.getValues(apiData) : ImmutableList.of("{collectionId}");
        for (String collectionId : collectionIds) {
            List<OgcApiQueryParameter> queryParameters = getQueryParameters(extensionRegistry, apiData, path, collectionId);
            String operationSummary = "fetch a tile of the collection '" + collectionId + "'";
            Optional<String> operationDescription = Optional.of("The tile in the requested tiling scheme ('{tileMatrixSetId}'), " + "on the requested zoom level ('{tileMatrix}'), with the requested grid coordinates ('{tileRow}', '{tileCol}') is returned. " + "The tile has a single layer with all selected features in the bounding box of the tile with the requested properties.");
            String resourcePath = path.replace("{collectionId}", collectionId);
            ImmutableOgcApiResourceData.Builder resourceBuilder = new ImmutableOgcApiResourceData.Builder().path(resourcePath).pathParameters(pathParameters);
            ApiOperation operation = addOperation(apiData, HttpMethods.GET, queryParameters, collectionId, subSubPath, operationSummary, operationDescription, tags);
            if (operation != null)
                resourceBuilder.putOperations(method.name(), operation);
            definitionBuilder.putResources(resourcePath, resourceBuilder.build());
        }
    }
    return definitionBuilder.build();
}
Also used : TileMatrixSetLimits(de.ii.ogcapi.tiles.domain.tileMatrixSet.TileMatrixSetLimits) ExtensionConfiguration(de.ii.ogcapi.foundation.domain.ExtensionConfiguration) CrsTransformationException(de.ii.xtraplatform.crs.domain.CrsTransformationException) OgcApiPathParameter(de.ii.ogcapi.foundation.domain.OgcApiPathParameter) LoggerFactory(org.slf4j.LoggerFactory) QueryInput(de.ii.ogcapi.foundation.domain.QueryInput) EndpointSubCollection(de.ii.ogcapi.collections.domain.EndpointSubCollection) TilesConfiguration(de.ii.ogcapi.tiles.domain.TilesConfiguration) MessageFormat(java.text.MessageFormat) TileMatrixSetLimitsGenerator(de.ii.ogcapi.tiles.domain.tileMatrixSet.TileMatrixSetLimitsGenerator) ImmutableList(com.google.common.collect.ImmutableList) Map(java.util.Map) TileMatrixSetRepository(de.ii.ogcapi.tiles.domain.tileMatrixSet.TileMatrixSetRepository) ImmutableOgcApiResourceData(de.ii.ogcapi.collections.domain.ImmutableOgcApiResourceData) Tile(de.ii.ogcapi.tiles.domain.Tile) ExtensionRegistry(de.ii.ogcapi.foundation.domain.ExtensionRegistry) ApiOperation(de.ii.ogcapi.foundation.domain.ApiOperation) OgcApiQueryParameter(de.ii.ogcapi.foundation.domain.OgcApiQueryParameter) TileCache(de.ii.ogcapi.tiles.domain.TileCache) ApiRequestContext(de.ii.ogcapi.foundation.domain.ApiRequestContext) NotAcceptableException(javax.ws.rs.NotAcceptableException) Logger(org.slf4j.Logger) FeaturesCoreProviders(de.ii.ogcapi.features.core.domain.FeaturesCoreProviders) MinMax(de.ii.ogcapi.tiles.domain.MinMax) OgcApi(de.ii.ogcapi.foundation.domain.OgcApi) HttpMethods(de.ii.ogcapi.foundation.domain.HttpMethods) IOException(java.io.IOException) FeatureProvider2(de.ii.xtraplatform.features.domain.FeatureProvider2) StaticTileProviderStore(de.ii.ogcapi.tiles.domain.StaticTileProviderStore) NotFoundException(javax.ws.rs.NotFoundException) ImmutableApiEndpointDefinition(de.ii.ogcapi.foundation.domain.ImmutableApiEndpointDefinition) Objects(java.util.Objects) ApiEndpointDefinition(de.ii.ogcapi.foundation.domain.ApiEndpointDefinition) List(java.util.List) TilesQueriesHandler(de.ii.ogcapi.tiles.domain.TilesQueriesHandler) ServerErrorException(javax.ws.rs.ServerErrorException) Response(javax.ws.rs.core.Response) OgcApiDataV2(de.ii.ogcapi.foundation.domain.OgcApiDataV2) TileFormatExtension(de.ii.ogcapi.tiles.domain.TileFormatExtension) TileMatrixSet(de.ii.ogcapi.tiles.domain.tileMatrixSet.TileMatrixSet) CrsTransformerFactory(de.ii.xtraplatform.crs.domain.CrsTransformerFactory) TileProvider(de.ii.ogcapi.tiles.domain.TileProvider) Optional(java.util.Optional) Builder(de.ii.ogcapi.tiles.domain.ImmutableQueryInputTileStream.Builder) ImmutableTile(de.ii.ogcapi.tiles.domain.ImmutableTile) UriInfo(javax.ws.rs.core.UriInfo) FeatureTypeConfigurationOgcApi(de.ii.ogcapi.foundation.domain.FeatureTypeConfigurationOgcApi) InputStream(java.io.InputStream) ImmutableApiEndpointDefinition(de.ii.ogcapi.foundation.domain.ImmutableApiEndpointDefinition) HttpMethods(de.ii.ogcapi.foundation.domain.HttpMethods) Builder(de.ii.ogcapi.tiles.domain.ImmutableQueryInputTileStream.Builder) OgcApiPathParameter(de.ii.ogcapi.foundation.domain.OgcApiPathParameter) OgcApiQueryParameter(de.ii.ogcapi.foundation.domain.OgcApiQueryParameter) ImmutableOgcApiResourceData(de.ii.ogcapi.collections.domain.ImmutableOgcApiResourceData) ApiOperation(de.ii.ogcapi.foundation.domain.ApiOperation)

Example 2 with OgcApiQueryParameter

use of de.ii.ogcapi.foundation.domain.OgcApiQueryParameter in project ldproxy by interactive-instruments.

the class AbstractEndpointTileSetMultiCollection method computeDefinition.

protected ApiEndpointDefinition computeDefinition(OgcApiDataV2 apiData, String apiEntrypoint, int sortPriority, String path, List<String> tags) {
    ImmutableApiEndpointDefinition.Builder definitionBuilder = new ImmutableApiEndpointDefinition.Builder().apiEntrypoint(apiEntrypoint).sortPriority(sortPriority);
    HttpMethods method = HttpMethods.GET;
    List<OgcApiPathParameter> pathParameters = getPathParameters(extensionRegistry, apiData, path);
    List<OgcApiQueryParameter> queryParameters = getQueryParameters(extensionRegistry, apiData, path);
    String operationSummary = "retrieve information about a tile set";
    Optional<String> operationDescription = Optional.of("This operation fetches information about a tile set.");
    ImmutableOgcApiResourceAuxiliary.Builder resourceBuilderSet = new ImmutableOgcApiResourceAuxiliary.Builder().path(path).pathParameters(pathParameters);
    ApiOperation operation = addOperation(apiData, queryParameters, path, operationSummary, operationDescription, tags);
    if (operation != null)
        resourceBuilderSet.putOperations(method.name(), operation);
    definitionBuilder.putResources(path, resourceBuilderSet.build());
    return definitionBuilder.build();
}
Also used : ImmutableApiEndpointDefinition(de.ii.ogcapi.foundation.domain.ImmutableApiEndpointDefinition) HttpMethods(de.ii.ogcapi.foundation.domain.HttpMethods) Builder(de.ii.ogcapi.tiles.domain.ImmutableQueryInputTileSet.Builder) ImmutableOgcApiResourceAuxiliary(de.ii.ogcapi.foundation.domain.ImmutableOgcApiResourceAuxiliary) OgcApiPathParameter(de.ii.ogcapi.foundation.domain.OgcApiPathParameter) OgcApiQueryParameter(de.ii.ogcapi.foundation.domain.OgcApiQueryParameter) ApiOperation(de.ii.ogcapi.foundation.domain.ApiOperation)

Example 3 with OgcApiQueryParameter

use of de.ii.ogcapi.foundation.domain.OgcApiQueryParameter in project ldproxy by interactive-instruments.

the class EndpointStylesCollection method computeDefinition.

protected ApiEndpointDefinition computeDefinition(OgcApiDataV2 apiData) {
    ImmutableApiEndpointDefinition.Builder definitionBuilder = new ImmutableApiEndpointDefinition.Builder().apiEntrypoint("collections").sortPriority(ApiEndpointDefinition.SORT_PRIORITY_STYLES_COLLECTION);
    final String subSubPath = "/styles";
    final String path = "/collections/{collectionId}" + subSubPath;
    final HttpMethods method = HttpMethods.GET;
    final List<OgcApiPathParameter> pathParameters = getPathParameters(extensionRegistry, apiData, path);
    final Optional<OgcApiPathParameter> optCollectionIdParam = pathParameters.stream().filter(param -> param.getName().equals("collectionId")).findAny();
    if (!optCollectionIdParam.isPresent()) {
        LOGGER.error("Path parameter 'collectionId' missing for resource at path '" + path + "'. The GET method will not be available.");
    } else {
        final OgcApiPathParameter collectionIdParam = optCollectionIdParam.get();
        boolean explode = collectionIdParam.getExplodeInOpenApi(apiData);
        final List<String> collectionIds = (explode) ? collectionIdParam.getValues(apiData) : ImmutableList.of("{collectionId}");
        for (String collectionId : collectionIds) {
            List<OgcApiQueryParameter> queryParameters = getQueryParameters(extensionRegistry, apiData, path, collectionId);
            String operationSummary = "retrieve a list of the available styles for collection `" + collectionId + "`";
            Optional<String> operationDescription = Optional.of("This operation fetches the set of styles available for this collection. " + "For each style the id, a title, links to the stylesheet of the style in each supported encoding, " + "and the link to the metadata is provided.");
            String resourcePath = path.replace("{collectionId}", collectionId);
            ImmutableOgcApiResourceSet.Builder resourceBuilder = new ImmutableOgcApiResourceSet.Builder().path(resourcePath).pathParameters(pathParameters).subResourceType("Style");
            ApiOperation operation = addOperation(apiData, HttpMethods.GET, queryParameters, collectionId, subSubPath, operationSummary, operationDescription, TAGS);
            if (operation != null)
                resourceBuilder.putOperations(method.name(), operation);
            definitionBuilder.putResources(resourcePath, resourceBuilder.build());
        }
    }
    return definitionBuilder.build();
}
Also used : PathParam(javax.ws.rs.PathParam) ExtensionConfiguration(de.ii.ogcapi.foundation.domain.ExtensionConfiguration) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) OgcApiPathParameter(de.ii.ogcapi.foundation.domain.OgcApiPathParameter) Path(javax.ws.rs.Path) LoggerFactory(org.slf4j.LoggerFactory) Singleton(javax.inject.Singleton) EndpointSubCollection(de.ii.ogcapi.collections.domain.EndpointSubCollection) ImmutableOgcApiResourceSet(de.ii.ogcapi.foundation.domain.ImmutableOgcApiResourceSet) AutoBind(com.github.azahnen.dagger.annotations.AutoBind) Inject(javax.inject.Inject) MediaType(javax.ws.rs.core.MediaType) ConformanceClass(de.ii.ogcapi.foundation.domain.ConformanceClass) ImmutableList(com.google.common.collect.ImmutableList) Builder(de.ii.ogcapi.styles.domain.ImmutableQueryInputStyles.Builder) ExtensionRegistry(de.ii.ogcapi.foundation.domain.ExtensionRegistry) ApiOperation(de.ii.ogcapi.foundation.domain.ApiOperation) OgcApiQueryParameter(de.ii.ogcapi.foundation.domain.OgcApiQueryParameter) ApiRequestContext(de.ii.ogcapi.foundation.domain.ApiRequestContext) Context(javax.ws.rs.core.Context) Logger(org.slf4j.Logger) OgcApi(de.ii.ogcapi.foundation.domain.OgcApi) HttpMethods(de.ii.ogcapi.foundation.domain.HttpMethods) ImmutableApiEndpointDefinition(de.ii.ogcapi.foundation.domain.ImmutableApiEndpointDefinition) QueriesHandlerStyles(de.ii.ogcapi.styles.domain.QueriesHandlerStyles) ApiEndpointDefinition(de.ii.ogcapi.foundation.domain.ApiEndpointDefinition) List(java.util.List) StylesFormatExtension(de.ii.ogcapi.styles.domain.StylesFormatExtension) Response(javax.ws.rs.core.Response) OgcApiDataV2(de.ii.ogcapi.foundation.domain.OgcApiDataV2) StylesConfiguration(de.ii.ogcapi.styles.domain.StylesConfiguration) Optional(java.util.Optional) FormatExtension(de.ii.ogcapi.foundation.domain.FormatExtension) ImmutableApiEndpointDefinition(de.ii.ogcapi.foundation.domain.ImmutableApiEndpointDefinition) HttpMethods(de.ii.ogcapi.foundation.domain.HttpMethods) Builder(de.ii.ogcapi.styles.domain.ImmutableQueryInputStyles.Builder) ImmutableOgcApiResourceSet(de.ii.ogcapi.foundation.domain.ImmutableOgcApiResourceSet) OgcApiPathParameter(de.ii.ogcapi.foundation.domain.OgcApiPathParameter) OgcApiQueryParameter(de.ii.ogcapi.foundation.domain.OgcApiQueryParameter) ApiOperation(de.ii.ogcapi.foundation.domain.ApiOperation)

Example 4 with OgcApiQueryParameter

use of de.ii.ogcapi.foundation.domain.OgcApiQueryParameter in project ldproxy by interactive-instruments.

the class AbstractEndpointTileMultiCollection method computeDefinition.

protected ApiEndpointDefinition computeDefinition(OgcApiDataV2 apiData, String apiEntrypoint, int sortPriority, String path, List<String> tags) {
    ImmutableApiEndpointDefinition.Builder definitionBuilder = new ImmutableApiEndpointDefinition.Builder().apiEntrypoint(apiEntrypoint).sortPriority(sortPriority);
    final HttpMethods method = HttpMethods.GET;
    final List<OgcApiPathParameter> pathParameters = getPathParameters(extensionRegistry, apiData, path);
    final List<OgcApiQueryParameter> queryParameters = getQueryParameters(extensionRegistry, apiData, path);
    String operationSummary = "fetch a tile with multiple layers, one per collection";
    Optional<String> operationDescription = Optional.of("The tile in the requested tiling scheme ('{tileMatrixSetId}'), " + "on the requested zoom level ('{tileMatrix}'), with the requested grid coordinates ('{tileRow}', '{tileCol}') is returned. " + "The tile has one layer per collection with all selected features in the bounding box of the tile with the requested properties.");
    ImmutableOgcApiResourceData.Builder resourceBuilder = new ImmutableOgcApiResourceData.Builder().path(path).pathParameters(pathParameters);
    ApiOperation operation = addOperation(apiData, queryParameters, path, operationSummary, operationDescription, tags);
    if (operation != null)
        resourceBuilder.putOperations(method.name(), operation);
    definitionBuilder.putResources(path, resourceBuilder.build());
    return definitionBuilder.build();
}
Also used : ImmutableApiEndpointDefinition(de.ii.ogcapi.foundation.domain.ImmutableApiEndpointDefinition) HttpMethods(de.ii.ogcapi.foundation.domain.HttpMethods) Builder(de.ii.ogcapi.tiles.domain.ImmutableQueryInputTileStream.Builder) OgcApiPathParameter(de.ii.ogcapi.foundation.domain.OgcApiPathParameter) OgcApiQueryParameter(de.ii.ogcapi.foundation.domain.OgcApiQueryParameter) ImmutableOgcApiResourceData(de.ii.ogcapi.collections.domain.ImmutableOgcApiResourceData) ApiOperation(de.ii.ogcapi.foundation.domain.ApiOperation)

Example 5 with OgcApiQueryParameter

use of de.ii.ogcapi.foundation.domain.OgcApiQueryParameter in project ldproxy by interactive-instruments.

the class AbstractEndpointTileSetSingleCollection method computeDefinition.

protected ApiEndpointDefinition computeDefinition(OgcApiDataV2 apiData, String apiEntrypoint, int sortPriority, String basePath, String subSubPath, List<String> tags) {
    ImmutableApiEndpointDefinition.Builder definitionBuilder = new ImmutableApiEndpointDefinition.Builder().apiEntrypoint(apiEntrypoint).sortPriority(sortPriority);
    final String path = basePath + subSubPath;
    final HttpMethods method = HttpMethods.GET;
    final List<OgcApiPathParameter> pathParameters = getPathParameters(extensionRegistry, apiData, path);
    final Optional<OgcApiPathParameter> optCollectionIdParam = pathParameters.stream().filter(param -> param.getName().equals("collectionId")).findAny();
    if (optCollectionIdParam.isEmpty()) {
        LOGGER.error("Path parameter 'collectionId' missing for resource at path '" + path + "'. The GET method will not be available.");
    } else {
        final OgcApiPathParameter collectionIdParam = optCollectionIdParam.get();
        boolean explode = collectionIdParam.getExplodeInOpenApi(apiData);
        final List<String> collectionIds = (explode) ? collectionIdParam.getValues(apiData) : ImmutableList.of("{collectionId}");
        for (String collectionId : collectionIds) {
            List<OgcApiQueryParameter> queryParameters = getQueryParameters(extensionRegistry, apiData, path, collectionId);
            String operationSummary = "retrieve information about a tile set";
            Optional<String> operationDescription = Optional.of("This operation fetches information about a tile set.");
            String resourcePath = path.replace("{collectionId}", collectionId);
            ImmutableOgcApiResourceAuxiliary.Builder resourceBuilder = new ImmutableOgcApiResourceAuxiliary.Builder().path(resourcePath).pathParameters(pathParameters);
            ApiOperation operation = addOperation(apiData, HttpMethods.GET, queryParameters, collectionId, subSubPath, operationSummary, operationDescription, tags);
            if (operation != null)
                resourceBuilder.putOperations(method.name(), operation);
            definitionBuilder.putResources(resourcePath, resourceBuilder.build());
        }
    }
    return definitionBuilder.build();
}
Also used : ExtensionConfiguration(de.ii.ogcapi.foundation.domain.ExtensionConfiguration) OgcApiPathParameter(de.ii.ogcapi.foundation.domain.OgcApiPathParameter) LoggerFactory(org.slf4j.LoggerFactory) TileSetFormatExtension(de.ii.ogcapi.tiles.domain.TileSetFormatExtension) EndpointSubCollection(de.ii.ogcapi.collections.domain.EndpointSubCollection) TilesConfiguration(de.ii.ogcapi.tiles.domain.TilesConfiguration) ImmutableList(com.google.common.collect.ImmutableList) ExtensionRegistry(de.ii.ogcapi.foundation.domain.ExtensionRegistry) Builder(de.ii.ogcapi.tiles.domain.ImmutableQueryInputTileSet.Builder) ApiOperation(de.ii.ogcapi.foundation.domain.ApiOperation) OgcApiQueryParameter(de.ii.ogcapi.foundation.domain.OgcApiQueryParameter) ApiRequestContext(de.ii.ogcapi.foundation.domain.ApiRequestContext) ImmutableOgcApiResourceAuxiliary(de.ii.ogcapi.foundation.domain.ImmutableOgcApiResourceAuxiliary) Logger(org.slf4j.Logger) FeaturesCoreProviders(de.ii.ogcapi.features.core.domain.FeaturesCoreProviders) HttpMethods(de.ii.ogcapi.foundation.domain.HttpMethods) FeatureProvider2(de.ii.xtraplatform.features.domain.FeatureProvider2) ImmutableApiEndpointDefinition(de.ii.ogcapi.foundation.domain.ImmutableApiEndpointDefinition) ApiEndpointDefinition(de.ii.ogcapi.foundation.domain.ApiEndpointDefinition) List(java.util.List) TilesQueriesHandler(de.ii.ogcapi.tiles.domain.TilesQueriesHandler) Response(javax.ws.rs.core.Response) OgcApiDataV2(de.ii.ogcapi.foundation.domain.OgcApiDataV2) Optional(java.util.Optional) FormatExtension(de.ii.ogcapi.foundation.domain.FormatExtension) FeatureTypeConfigurationOgcApi(de.ii.ogcapi.foundation.domain.FeatureTypeConfigurationOgcApi) ImmutableApiEndpointDefinition(de.ii.ogcapi.foundation.domain.ImmutableApiEndpointDefinition) HttpMethods(de.ii.ogcapi.foundation.domain.HttpMethods) Builder(de.ii.ogcapi.tiles.domain.ImmutableQueryInputTileSet.Builder) ImmutableOgcApiResourceAuxiliary(de.ii.ogcapi.foundation.domain.ImmutableOgcApiResourceAuxiliary) OgcApiPathParameter(de.ii.ogcapi.foundation.domain.OgcApiPathParameter) OgcApiQueryParameter(de.ii.ogcapi.foundation.domain.OgcApiQueryParameter) ApiOperation(de.ii.ogcapi.foundation.domain.ApiOperation)

Aggregations

OgcApiQueryParameter (de.ii.ogcapi.foundation.domain.OgcApiQueryParameter)51 ApiOperation (de.ii.ogcapi.foundation.domain.ApiOperation)42 ImmutableApiEndpointDefinition (de.ii.ogcapi.foundation.domain.ImmutableApiEndpointDefinition)40 OgcApiDataV2 (de.ii.ogcapi.foundation.domain.OgcApiDataV2)32 OgcApiPathParameter (de.ii.ogcapi.foundation.domain.OgcApiPathParameter)31 HttpMethods (de.ii.ogcapi.foundation.domain.HttpMethods)30 List (java.util.List)30 Optional (java.util.Optional)30 Logger (org.slf4j.Logger)29 LoggerFactory (org.slf4j.LoggerFactory)29 ImmutableList (com.google.common.collect.ImmutableList)28 ExtensionRegistry (de.ii.ogcapi.foundation.domain.ExtensionRegistry)28 ApiRequestContext (de.ii.ogcapi.foundation.domain.ApiRequestContext)25 AutoBind (com.github.azahnen.dagger.annotations.AutoBind)24 ApiEndpointDefinition (de.ii.ogcapi.foundation.domain.ApiEndpointDefinition)24 ExtensionConfiguration (de.ii.ogcapi.foundation.domain.ExtensionConfiguration)24 Inject (javax.inject.Inject)24 Singleton (javax.inject.Singleton)24 OgcApi (de.ii.ogcapi.foundation.domain.OgcApi)23 Response (javax.ws.rs.core.Response)23