Skip to content

Commit 95e69c7

Browse files
joshfixzachrouseFE
andauthored
V1.0.0 (#18)
* Initial 1.0.0 commit * fixed conformance * Added CORS config * tiny typo (#17) Saw a tiny typo and wanted to get on the board. Great stuff * Removed properties from collections Co-authored-by: zachrouseFE <39569018+zachrouseFE@users.noreply.github.com>
1 parent 29f64f1 commit 95e69c7

30 files changed

Lines changed: 127 additions & 213 deletions

File tree

README.md

Lines changed: 4 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
## About
77

88
Staccato is a server that enables browsing and search of geospatial assets like satellite imagery. It implements the
9-
SpatioTemporal Asset Catalog (STAC) v0.8.0 standard and is backed by [Elasticsearch](https://www.elastic.co/products/elasticsearch).
9+
SpatioTemporal Asset Catalog (STAC) v1.0.0 standard and is backed by [Elasticsearch](https://www.elastic.co/products/elasticsearch).
1010
In addition to the core STAC catalog browsing and search functionality, it includes support for transactions, statistics,
1111
auto-generated schemas, [gRPC](https://grpc.io/) endpoints and [Kafka](https://kafka.apache.org/) ingestion.
1212

@@ -55,31 +55,6 @@ Any of the following methods are acceptable ways of running Staccato
5555

5656
## Endpoints
5757

58-
### API Endpoints
59-
60-
- GET /search - dynamic catalog endpoint
61-
- GET /search/{id} - returns an item by ID
62-
63-
### Collection Endpoints
64-
65-
- GET /collection/{collection_id} - retrieves a collection by ID
66-
- GET /collection/{collection_id}/items - retrieves a collection of items belonging to a collection
67-
- GET /collection/{collection_id}/items/{id} - retrieves an item by ID from a collection
68-
69-
### Catalog Endpoints
70-
71-
- GET / - retrieves the root catalog
72-
- GET /stac/{catalog_id} - retrieves a catalog by ID
73-
- GET /stac/{catalog_id}/items - retrieves a collection of items belonging to a collection
74-
- GET /stac/{collection_id}/items/{id} - retrieves an item by ID from a collection
75-
76-
### Transaction Endpoints
77-
78-
- POST /collection/{collection_id}/items - creates a new item
79-
- PUT /collection/{collection_id}/items/{item_id} - creates a new item
80-
- PATCH /collection/{collection_id}/items/{item_id} - updates an item item
81-
- DELETE /collection/{collection_id}/items/{item_id} - deletes an item
82-
8358
### Stats Endpoints
8459

8560
- GET /stats - retrieves aggregations for all collections
@@ -94,72 +69,6 @@ Any of the following methods are acceptable ways of running Staccato
9469

9570
- GET /actuator - returns a list of utility endpoints for the application
9671

97-
### Query Parameters (all optional)
98-
- **limit** the maximum number of items to return, example limit=100
99-
- **page** to paginate, example page=2 (for the second page of results)
100-
- **time** implicit range query, example time=1995-01-01T00:00:2005-01-01T00:00:00
101-
- **bbox** implicit intersects query, example bbox=-180,-90,180,90
102-
- **intersects** a valid GeoJSON geometry
103-
- **query** a Common Query Language text string to query properties of the catalog entry (see below for examples)
104-
- **ids** a list of comma separated IDs to be returned
105-
- **collections** a list of comma separated collection IDs on which to filter the results
106-
- **fields** a comma separated list of json field names to include in the result; fields to be excluded can be prefixed with "-"
107-
- **sortby** a comma separated list of fields to sort by
108-
109-
Examples:
110-
_GET_
111-
- <https://stac.boundlessgeo.io/search?fields.include=id,bbox>
112-
- [https://stac.boundlessgeo.io/search?query=landsat:wrs_path=105 AND landsat:wrs_row=83](https://stac.boundlessgeo.io/stac/search?query=landsat:wrs_path=105%20AND%20landsat:wrs_row=83)
113-
- <https://stac.boundlessgeo.io/search?ids=LC81050832019135LGN00,LC81050822019135LGN00&collections=landsat-8-l1>
114-
- [https://stac.boundlessgeo.io/search?limit=20&page=2&query=eo:cloud_cover<0.1&bbox=27.3245,29.85465,30.5214,31.8685&time=2018-02-12T00:00:00Z/2019-06-12T00:00:00Z](https://stac.boundlessgeo.io/stac/search?limit=20&page=2&query=eo:cloud_cover%3C.1&bbox=27.3245,29.85465,30.5214,31.8685&time=2018-02-12T00:00:00Z/2019-06-12T00:00:00Z)
115-
116-
_POST_
117-
118-
```json
119-
{
120-
"fields": {
121-
"include": ["id", "bbox"]
122-
}
123-
}
124-
```
125-
```json
126-
{
127-
"query": "landsat:wrs_path=105 AND landsat:wrs_row=83"
128-
}
129-
```
130-
```json
131-
{
132-
"ids": ["LC81050832019135LGN00", "LC81050822019135LGN00"],
133-
"collections": ["landsat-8-l1"]
134-
}
135-
```
136-
```json
137-
{
138-
"limit": 2,
139-
"query": "eo:cloud_cover<0.1",
140-
"time": "2018-02-12T00:00:00Z/2019-06-12T00:00:00Z",
141-
"intersects": {
142-
"type": "Polygon",
143-
"coordinates": [[
144-
[-77.08248138427734, 38.788612962793636], [-77.01896667480469, 38.788612962793636],
145-
[-77.01896667480469, 38.835161408189364], [-77.08248138427734, 38.835161408189364],
146-
[-77.08248138427734, 38.788612962793636]
147-
]]
148-
},
149-
"sort": [
150-
{
151-
"field": "properties.eo:cloud_cover",
152-
"direction": "desc"
153-
},
154-
{
155-
"field": "properties.landsat:image_quality_tirs",
156-
"direction": "asc"
157-
}
158-
]
159-
}
160-
```
161-
162-
16372
## Configuration
16473

16574
The STAC API has several properties that are configurable from the command line, as environment properties in the
@@ -178,7 +87,7 @@ staccato.es.host | localhost | The hostname of the Elasticsearch aggregationServ
17887
staccato.es.port | 9200 | The Elasticsearch aggregationService port
17988
staccato.es.number-of-shards | 5 | The number of shards used when auto-initializing an Elasticsearch index
18089
staccato.es.number-of-replicas | 0 | The number of replicas used when auto-initializing an Elasticsearch index
181-
staccato.es.type | _doc | The Elasticsearch document type. It is not recommended to change this from it's default value as "_doc" will be the only value supported in ES7
90+
staccato.es.type | _doc | The Elasticsearch document type. It is not recommended to change this from its default value as "_doc" will be the only value supported in ES7
18291
staccato.es.max-reconnection-attempts | 10 | The number of reconnection attempts to the Elasticsearch aggregationService
18392
staccato.es.rest-client-max-connections-total | 200 | The Elasticsearch client threadpool size. This is the maximum number of connections a single STAC instance may have open to Elasticsearch.
18493
staccato.es.rest-client-max-connections-per-route | 200 | The maximum number of Elasticsearch client connections per route.
@@ -310,7 +219,7 @@ It is also important to note that this implementation currently relies on implem
310219
the `collection` field in every item. Because each collection will have a different properties implementation that may
311220
implement several different extension interfaces or custom fieldsExtension, Jackson cannot deserialize Item classes without
312221
more information on which properties class to deserialize to. Having the "collections" field in each item provides an
313-
extremely convenient 1:1 relationship between the item and it's properties implementation. The Jackson configuration
222+
extremely convenient 1:1 relationship between the item and its properties implementation. The Jackson configuration
314223
for this can be found [here](./staccato-application/src/main/java/com/planet/staccato/config/ExtensionConfig.java).
315224

316225
### Custom annotations
@@ -331,7 +240,6 @@ methods with this annotation and build a subcatalog link containing the field na
331240
containing all unique values in Elasticsearch for that field. After all eligible subcatalog fieldsExtension have been
332241
traversed, the links section will be populated with links to all items that match the selected subcatalog values.
333242

334-
335243
## Elasticsearch
336244

337245
### Automatic Initialization
@@ -414,7 +322,7 @@ Elasticsearch to rollover the index. When the criteria has been met, Elasticsea
414322
index named `my-index-name-000002`. Because this name matches the pattern `my-index-name-*` that was established in
415323
our template, all of the shard, read replica, mapping, etc configuration will automatically be applied. In addition,
416324
the `my-index-name` write alias will automatically be changed to point to `my-index-name-000002`, and the search alias
417-
`my-index-name-search` will add to it's list. `my-index-name-000002`. When executing searches against the search
325+
`my-index-name-search` will add to its list. `my-index-name-000002`. When executing searches against the search
418326
alias `my=index-name-search`, Elasticsearch will return matches from both indexes, `my-index-name-000001` and
419327
`my-index-name-000002`. The one important note: if a record needs to be updated, you need to first determine which
420328
actual index it belongs to and update it on that index.

pom.xml

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
<groupId>com.planet.staccato</groupId>
77
<artifactId>staccato</artifactId>
8-
<version>1.0.0-rc.2</version>
8+
<version>1.0.0</version>
99
<packaging>pom</packaging>
1010

1111
<parent>
1212
<groupId>org.springframework.boot</groupId>
1313
<artifactId>spring-boot-starter-parent</artifactId>
14-
<version>2.4.4</version>
14+
<version>2.4.6</version>
1515
<relativePath/> <!-- lookup parent from repository -->
1616
</parent>
1717

@@ -45,7 +45,7 @@
4545
<dependency>
4646
<groupId>org.springframework.cloud</groupId>
4747
<artifactId>spring-cloud-dependencies</artifactId>
48-
<version>Hoxton.SR1</version>
48+
<version>Hoxton.SR11</version>
4949
<type>pom</type>
5050
<scope>import</scope>
5151
</dependency>
@@ -131,34 +131,6 @@
131131
<enabled>false</enabled>
132132
</snapshots>
133133
</repository>
134-
<!--
135-
<repository>
136-
<id>boundless</id>
137-
<name>Boundless Maven Repository</name>
138-
<url>https://repo.boundlessgeo.com/main</url>
139-
<snapshots>
140-
<enabled>true</enabled>
141-
</snapshots>
142-
</repository>
143-
<repository>
144-
<id>boundless-release</id>
145-
<name>Boundless Maven Repository</name>
146-
<url>https://repo.boundlessgeo.com/release/</url>
147-
</repository>
148-
<repository>
149-
<id>boundless-snapshot</id>
150-
<name>Boundless Maven Repository</name>
151-
<url>https://repo.boundlessgeo.com/snapshot/</url>
152-
</repository>
153-
<repository>
154-
<id>boundless_ext</id>
155-
<name>Boundless Maven Repository</name>
156-
<url>https://repo.boundlessgeo.com/ext-release-local/</url>
157-
<snapshots>
158-
<enabled>false</enabled>
159-
</snapshots>
160-
</repository>
161-
-->
162134
<repository>
163135
<id>osgeo</id>
164136
<name>OSGeo Repository</name>
@@ -193,7 +165,7 @@
193165
</snapshots>
194166
<id>central</id>
195167
<name>Maven Plugin Repository</name>
196-
<url>http://repo1.maven.org/maven2</url>
168+
<url>https://repo1.maven.org/maven2</url>
197169
</pluginRepository>
198170
<pluginRepository>
199171
<id>spring-snapshots</id>

staccato-application/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ MAINTAINER josh@federal.planet.com
44
ARG JAR_NAME
55
ENV JAR_NAME $JAR_NAME
66

7-
COPY target/${JAR_NAME} /${JAR_NAME}
7+
#COPY target/${JAR_NAME} /${JAR_NAME}
8+
ADD target/${JAR_NAME} /${JAR_NAME}
89

9-
ENTRYPOINT java -jar /$JAR_NAME
10+
ENTRYPOINT ["java", "-jar", "/staccato-1.0.0.jar"]
1011
#ENTRYPOINT java "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" -jar /$JAR_NAME

staccato-application/pom.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
<parent>
1313
<groupId>com.planet.staccato</groupId>
1414
<artifactId>staccato</artifactId>
15-
<version>1.0.0-rc.2</version>
15+
<version>1.0.0</version>
1616
</parent>
1717

1818
<properties>
1919
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2020
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
21-
<dockerfile-maven-version>1.4.4</dockerfile-maven-version>
21+
<dockerfile-maven-version>1.4.13</dockerfile-maven-version>
2222
</properties>
2323

2424
<dependencies>
@@ -177,7 +177,8 @@
177177
</execution>
178178
</executions>
179179
<configuration>
180-
<repository>quay.io/boundlessgeo/staccato</repository>
180+
<!--<repository>quay.io/boundlessgeo/staccato</repository>-->
181+
<repository>gcr.io/focus-cargo-315523/staccato</repository>
181182
<tag>${project.version}</tag>
182183
<buildArgs>
183184
<JAR_NAME>staccato-${project.version}.jar</JAR_NAME>

staccato-application/src/main/java/com/planet/staccato/catalog/RootCatalog.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
import lombok.Data;
55
import lombok.RequiredArgsConstructor;
66

7+
import java.util.List;
8+
79
@Data
810
@RequiredArgsConstructor
911
public class RootCatalog extends Catalog {
1012

11-
protected Object conformsTo;
13+
protected String[] conformsTo;
1214

13-
public Catalog conformsTo(Object conformsTo) {
15+
public Catalog conformsTo(String[] conformsTo) {
1416
setConformsTo(conformsTo);
1517
return this;
1618
}

staccato-application/src/main/java/com/planet/staccato/config/ExtensionConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void init() {
4141

4242
mapper.addMixIn(Item.class, ItemMixin.class);
4343
collectionMetadataList.forEach(metadata -> {
44-
metadata.setVersion(configProps.getVersion());
44+
metadata.setStacVersion(configProps.getVersion());
4545
NamedType namedType = new NamedType(metadata.getProperties().getClass(), metadata.getId());
4646
mapper.registerSubtypes(namedType);
4747
});

staccato-application/src/main/java/com/planet/staccato/config/StacConfiguration.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import org.springframework.context.annotation.Bean;
66
import org.springframework.context.annotation.Configuration;
77
import org.springframework.stereotype.Component;
8+
import org.springframework.web.cors.CorsConfiguration;
9+
import org.springframework.web.cors.reactive.CorsWebFilter;
10+
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
811

912
import java.util.HashMap;
1013
import java.util.List;
@@ -28,4 +31,18 @@ public Map<String, CollectionMetadata> collectionMetadataMap() {
2831
return metadataMap;
2932
}
3033

34+
@Bean
35+
public CorsWebFilter corsWebFilter() {
36+
CorsConfiguration corsConfig = new CorsConfiguration();
37+
corsConfig.setAllowedOrigins(List.of("*"));
38+
corsConfig.setMaxAge(8000L);
39+
corsConfig.addAllowedMethod("*");
40+
41+
UrlBasedCorsConfigurationSource source =
42+
new UrlBasedCorsConfigurationSource();
43+
source.registerCorsConfiguration("/**", corsConfig);
44+
45+
return new CorsWebFilter(source);
46+
}
47+
3148
}

staccato-application/src/main/java/com/planet/staccato/config/StacWebFluxConfig.java

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.planet.staccato.filters;
2+
3+
import com.planet.staccato.config.LinksConfigProps;
4+
import com.planet.staccato.config.StacConfigProps;
5+
import com.planet.staccato.config.StaccatoMediaType;
6+
import com.planet.staccato.dto.api.SearchRequest;
7+
import com.planet.staccato.model.Item;
8+
import com.planet.staccato.model.Link;
9+
import lombok.RequiredArgsConstructor;
10+
import org.springframework.http.MediaType;
11+
import org.springframework.stereotype.Component;
12+
13+
import java.util.Arrays;
14+
import java.util.HashSet;
15+
import java.util.Set;
16+
17+
/**
18+
* We do not want to store links in the database, as the deployed hostname/DNS is subject to change. This class will
19+
* dynamically build links using the configured protocol/host/port.
20+
*
21+
* @author joshfix
22+
* Created on 2/12/18
23+
*/
24+
@Component
25+
@RequiredArgsConstructor
26+
public class VersionFilter implements ItemSearchFilter {
27+
28+
private final StacConfigProps stacConfigProps;
29+
private final static Set<String> types = new HashSet<>(Arrays.asList("*"));
30+
31+
@Override
32+
public Set<String> types() {
33+
return types;
34+
}
35+
36+
@Override
37+
public Item doFilter(Item item, SearchRequest request) {
38+
return item.stacVersion(stacConfigProps.getVersion());
39+
}
40+
}

0 commit comments

Comments
 (0)