Skip to content

Commit

Permalink
Standing PR for 1.0.0 rc.2 (#16)
Browse files Browse the repository at this point in the history
* 1048 - required fields must not be blank

* initial queryables implementation

* initial switch to rc.2
  • Loading branch information
joshfix authored May 31, 2021
1 parent 1b48114 commit 29f64f1
Show file tree
Hide file tree
Showing 41 changed files with 501 additions and 54 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.planet.staccato</groupId>
<artifactId>staccato</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.2</version>
<packaging>pom</packaging>

<parent>
Expand Down
2 changes: 1 addition & 1 deletion staccato-application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>com.planet.staccato</groupId>
<artifactId>staccato</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.2</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class RootCatalog extends Catalog {
protected Object conformsTo;

public Catalog conformsTo(Object conformsTo) {
this.conformsTo = conformsTo;
setConformsTo(conformsTo);
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;

import static com.planet.staccato.config.StaccatoRelType.QUERYABLES_LINK_REL;
import static org.springframework.web.reactive.function.BodyInserters.fromValue;
import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
Expand Down Expand Up @@ -46,6 +47,7 @@ public class RootCatalogConfig {
public static final String CONFORMANCE_LINK_HREF = "/conformance";
public static final String DATA_LINK_REL = "data";
public static final String DATA_LINK_HREF = "/collections";
public static final String QUERYABLES_LINK_HREF = "/queryables";

/**
* Creates the root catalog object.
Expand Down Expand Up @@ -88,6 +90,11 @@ public Catalog rootCatalog() {
.type(MediaType.APPLICATION_JSON_VALUE)
.href(LinksConfigProps.LINK_PREFIX + DATA_LINK_HREF));

catalog.getLinks().add(Link.build()
.rel(QUERYABLES_LINK_REL)
.type(StaccatoMediaType.APPLICATION_SCHEMA_JSON_VALUE)
.href(LinksConfigProps.LINK_PREFIX + QUERYABLES_LINK_HREF));

return catalog;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.planet.staccato.model.Collections;
import com.planet.staccato.model.Item;
import com.planet.staccato.model.ItemCollection;
import com.planet.staccato.queryables.Queryables;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand All @@ -26,6 +27,10 @@ public interface CollectionApi {
@GetMapping(value = "/collections/{collectionId}", produces = MediaType.APPLICATION_JSON_VALUE)
Mono<CollectionMetadata> getCollection(@PathVariable("collectionId") String collectionId);

@GetMapping(value = "/collections/{collectionId}/queryables",
produces = {StaccatoMediaType.APPLICATION_GEO_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE})
Mono<Queryables> getQueryables(@PathVariable("collectionId") String collectionId);

@GetMapping(value = "/collections/{collectionId}/items",
produces = {StaccatoMediaType.APPLICATION_GEO_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE})
Mono<ItemCollection> getCollectionItems(@PathVariable("collectionId") String collectionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.planet.staccato.model.Collections;
import com.planet.staccato.model.Item;
import com.planet.staccato.model.ItemCollection;
import com.planet.staccato.queryables.Queryables;
import com.planet.staccato.service.ApiService;
import com.planet.staccato.service.CollectionService;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -37,6 +38,11 @@ public Mono<CollectionMetadata> getCollection(@PathVariable("collectionId") Stri
return collectionService.getCollectionMetadata(collectionId);
}

@Override
public Mono<Queryables> getQueryables(String collectionId) {
return collectionService.getQueryables(collectionId);
}

@Override
public Mono<ItemCollection> getCollectionItems(@PathVariable("collectionId") String collectionId,
@RequestParam(value = "filter-lang", required = false) String filterLang,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.planet.staccato.model.Conformance;
import com.planet.staccato.queryables.Queryables;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import javax.annotation.PostConstruct;
Expand All @@ -23,9 +25,14 @@
@Service
public class DefaultOafService {

private final List<Queryables> queryables;
private final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
private final Conformance conformance = new Conformance();

public DefaultOafService(List<Queryables> queryables) {
this.queryables = queryables;
}

@PostConstruct
public void init() {
initConformance();
Expand Down Expand Up @@ -58,4 +65,9 @@ public Mono<Conformance> getConformanceMono() {
return Mono.just(conformance);
}

public Flux<Queryables> getQueryables() {
return Flux.fromIterable(queryables);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import com.planet.staccato.config.StaccatoMediaType;
import com.planet.staccato.model.Conformance;
import com.planet.staccato.queryables.Queryables;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
Expand All @@ -19,4 +21,7 @@ public interface OafApi {
@GetMapping(path = "/conformance", produces = MediaType.APPLICATION_JSON_VALUE)
Mono<Conformance> getConformance();

@GetMapping(path = "/queryables", produces = StaccatoMediaType.APPLICATION_SCHEMA_JSON_VALUE)
Flux<Queryables> getQueryables();

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.planet.staccato.oaf;

import com.planet.staccato.model.Conformance;
import com.planet.staccato.queryables.Queryables;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
Expand All @@ -24,4 +26,10 @@ public Mono<Object> getApi() {
public Mono<Conformance> getConformance() {
return service.getConformanceMono();
}

@Override
public Flux<Queryables> getQueryables() {
return service.getQueryables();
}

}
2 changes: 1 addition & 1 deletion staccato-application/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ logging:
#org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerMapping: WARN

staccato:
version: 1.0.0-rc1
version: 1.0.0-rc.2
rsocket:
enabled: false
kafka:
Expand Down
2 changes: 1 addition & 1 deletion staccato-application/src/main/resources/banner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
___/ / /_/ /_/ / /__/ /__/ /_/ / /_/ /_/ /
/____/\__/\__,_/\___/\___/\__,_/\__/\____/

v1.0.0-rc1
v1.0.0-rc.2
2 changes: 1 addition & 1 deletion staccato-collections/landsat8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>com.planet.staccato</groupId>
<artifactId>staccato-collections</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.2</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public interface Landsat8 {
void setProductId(String productId);

@Mapping(type = MappingType.KEYWORD)
@JsonAlias("processingLevel")
@JsonProperty(EXTENSION_PREFIX + ":processingLevel")
@JsonAlias({"processing_level", "landsat:processingLevel"})
@JsonProperty(EXTENSION_PREFIX + ":processing_level")
String getProcessingLevel();
void setProcessingLevel(String processingLevel);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
import com.planet.staccato.collection.CollectionMetadata;
import com.planet.staccato.collection.LinkHelper;
import com.planet.staccato.config.LinksConfigProps;
import com.planet.staccato.queryables.QueryableProperty;
import com.planet.staccato.queryables.Queryables;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static com.planet.staccato.config.StaccatoSchemas.JSON_SCHEMA;

/**
* @author joshfix
* Created on 10/22/18
Expand All @@ -34,4 +38,62 @@ public CollectionMetadata landsat8Catalog() {
.setCatalogType(CatalogType.CATALOG);
return metadata;
}

@Bean
public Queryables landsat8Queryables() {
Queryables queryables = new Queryables()
.setId(Landsat8CollectionMetadata.ID)
.setDescription(Landsat8CollectionMetadata.DESCRIPTION)
.setType(Queryables.OBJECT_TYPE)
.setTitle(Landsat8CollectionMetadata.TITLE)
.setSchema(JSON_SCHEMA);

queryables.addEOProperties();
queryables.addViewProperties();

queryables.getProperties().put(Landsat8.EXTENSION_PREFIX + ":wrs_path", new QueryableProperty()
.setTitle("WRS Path")
.setType(Queryables.INTEGER_TYPE)
.setMinimum(0)
.setMaximum(251));

queryables.getProperties().put(Landsat8.EXTENSION_PREFIX + ":wrs_row", new QueryableProperty()
.setTitle("WRS Row")
.setType(Queryables.INTEGER_TYPE)
.setMinimum(0)
.setMaximum(119));

queryables.getProperties().put(Landsat8.EXTENSION_PREFIX + ":image_quality_tirs", new QueryableProperty()
.setTitle("Image quality TIRS")
.setType(Queryables.INTEGER_TYPE)
.setMinimum(0));

queryables.getProperties().put(Landsat8.EXTENSION_PREFIX + ":image_quality_oli", new QueryableProperty()
.setTitle("Image quality OLI")
.setType(Queryables.INTEGER_TYPE)
.setMinimum(0));

queryables.getProperties().put(Landsat8.EXTENSION_PREFIX + ":earth_sun_distance", new QueryableProperty()
.setTitle("Earth-sun distance")
.setType(Queryables.INTEGER_TYPE)
.setMinimum(0));

queryables.getProperties().put(Landsat8.EXTENSION_PREFIX + ":scene_id", new QueryableProperty()
.setTitle("Image quality TIRS")
.setType(Queryables.STRING_TYPE)
.setMinLength(1));

queryables.getProperties().put(Landsat8.EXTENSION_PREFIX + ":product_id", new QueryableProperty()
.setTitle("Product ID")
.setType(Queryables.STRING_TYPE)
.setMinLength(1));

queryables.getProperties().put(Landsat8.EXTENSION_PREFIX + ":processing_level", new QueryableProperty()
.setTitle("Processing level")
.setType(Queryables.STRING_TYPE)
.setMinLength(1));

return queryables;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ private void buildProperties() {
properties.setPlatform("landsat-8");
properties.setInstruments(Arrays.asList("OLI_TIRS"));
properties.setConstellation("landsat");
properties.setOffNadir(0);
properties.setBands(buildBands());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
import com.planet.staccato.model.Provider;
import com.planet.staccato.properties.CoreProperties;
import com.planet.staccato.properties.extension.EO;
import com.planet.staccato.properties.extension.View;
import lombok.Data;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.util.List;

/**
Expand All @@ -16,7 +21,7 @@
@Data
@JsonTypeName("landsat-8-l1")
@JsonDeserialize(as = Landsat8ItemProperties.class)
public class Landsat8ItemProperties implements CoreProperties, EO, Landsat8 {
public class Landsat8ItemProperties implements CoreProperties, EO, View, Landsat8 {

// CoreProperties
private String datetime;
Expand All @@ -29,6 +34,7 @@ public class Landsat8ItemProperties implements CoreProperties, EO, Landsat8 {
private String platform;
private String mission;
private String constellation;
private Double gsd;
private List<Provider> providers;
private List<String> instruments;

Expand All @@ -37,18 +43,28 @@ public class Landsat8ItemProperties implements CoreProperties, EO, Landsat8 {

// EO
private Double cloudCover;
private Integer offNadir;
private Double gsd;
//private Double gsd;
private List<Band> bands;

// View
private Double offNadir;
private Double incidenceAngle;
private Double azimuth;
private Double sunAzimuth;
private Double sunElevation;
private List<Band> bands;

// Landsat8
@Min(0)
@Max(251)
private Integer wrsPath;
@Min(0)
@Max(119)
private Integer wrsRow;
@Min(0)
private Integer imageQualityTirs;
@Min(0)
private Integer imageQualityOli;
@Min(0)
private Double earthSunDistance;
private String sceneId;
private String productId;
Expand Down
2 changes: 1 addition & 1 deletion staccato-collections/planet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>com.planet.staccato</groupId>
<artifactId>staccato-collections</artifactId>
<version>1.0.0-rc1</version>
<version>1.0.0-rc.2</version>
</parent>

<properties>
Expand Down
Loading

0 comments on commit 29f64f1

Please sign in to comment.