diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index a54ee93b..0139ef9f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -10,19 +10,40 @@ The concept flow through the code is single threaded down a stack. What this tra
What happens if new code cannot fit into the current concept flow? A refactoring of the concept flow will need to take place and all existing classes will have to be updated to the new structure. This should be resolved before any code changes take place.
-Lastly, the code is divided into packages that very roughly group the functionality. It is not well defined and therefore much of the code is smeared about and any clean up of the smearing is welcome - always. Below is a rough definition for each package:
-
-gov.nasa.pds.api.
-
-model.xml - strictly autogenerated code by swagger from model/swagger.yml
-registry - base package that contains interfaces to break circular dependencies and spring-boot content.
-registry.business - supposed to be the PDS specific stuff but it is much more of a hodgepodge at this time.
-registry.configuration - AWS, spring-boot, and swagger configuration information
-registry.controllers - where the user request is bottled into a UserContext or should be but it currently has a lot of business loging in it.
-registry.exceptions - all locally defined exceptions
-registry.lexer - strictly autogenerated code by antlr
-registry.opensearch - required opensearch configuration for a connection and a collection of stuff that binds business needs with opensearch
-registry.serialize - once the business logic is done, these unit seralize them into the request output format (header Accept value).
+The overall architecture/design is the MVC. In this insteance, the controller is the transmutation of uer inputs into the interfaces necessary for the model to fullfil the request. The model represents how the PDS data is stored internally. The view is the serialized output in its appropriate format since that is what the user sees or views.
+
+Lastly, the code is divided into packages that very roughly group the functionality that reflect the MVC architecture/design. While they may not perfectly enforced currently, the implementation is moving in this direction:
+
+**gov.nasa.pds.**
+
+**model**
+ - strictly autogenerated code by swagger from model/swagger.yml
+
+**api.registry**
+ - base package that contains
+ - interfaces to break circular dependencies and improve encapsulation
+ - spring-boot content.
+
+**api.registry.configuration**
+ - AWS, spring-boot, and swagger configuration information
+
+**api.registry.controller**
+ - *control* bidirectional transmutation between registry Java design/implementation and the swagger model (auto generated code)
+
+**api.registry.exceptions**
+ - all locally defined exceptions
+
+**api.registry.lexer**
+ - strictly autogenerated code by antlr
+
+**api.registry.model**
+ - supposed to be the model of how the data is stored and organized but it is much more of a hodgepodge at this time.
+
+**api.registry.search**
+ - required opensearch configuration for a connection and a collection of stuff that binds model needs with opensearch
+
+**api.registry.view**
+ - once the model has found the needed data, these unit seralize them into the request output format (header Accept value) to complete the request.
All of the interfaces in registry are a Context. What does context mean here. It represents the conceptual flow of information. Many users can access the same endpoint with differnt parameters. These context items hold the state for those individual requests just a context is normally used with program threading. They help separate those classes that need state from that which is purely functional help. In the case of the registry, very little state is needed and is easily represented with these interfaces.
diff --git a/README.md b/README.md
index 3a7d5510..2850ee4f 100644
--- a/README.md
+++ b/README.md
@@ -19,9 +19,7 @@ Based on `docker` you can easily start all the prerequisites as configured in th
git clone https://github.com/NASA-PDS/registry.git
-Start the prerequisites:
-
- docker compose --profile=dev-api up
+Start the prerequisites by following the [Quick Start Guide](https://github.com/NASA-PDS/registry/tree/main/docker#-quick-start-guide---with-default-configurations)
## Start the application from a released package
@@ -53,8 +51,11 @@ Builds the application:
cd service
- mvn sprint-boot:run
+ mvn spring-boot:run
+
+## View Swagger UI
+Go to http://localhost:8080
## Tests
diff --git a/docs/requirements/v1.0.1/REQUIREMENTS.md b/docs/requirements/v1.0.1/REQUIREMENTS.md
new file mode 100644
index 00000000..aed7ecaa
--- /dev/null
+++ b/docs/requirements/v1.0.1/REQUIREMENTS.md
@@ -0,0 +1,90 @@
+
+Requirements Summary
+====================
+
+# default
+
+## As an API user, I want an average query response time of 1 second for q=* queries ([#69](https://github.com/NASA-PDS/registry-api/issues/69))
+
+
+This requirement is not impacted by the current version
+## As an API user, I want to handle long-running queries that take >10 seconds. ([#68](https://github.com/NASA-PDS/registry-api/issues/68))
+
+
+This requirement is not impacted by the current version
+## As an operator, I want to have a wrapper script for starting up the API service ([#67](https://github.com/NASA-PDS/registry-api/issues/67))
+
+
+This requirement is not impacted by the current version
+## As a user, I want to know why my query syntax is invalid ([#66](https://github.com/NASA-PDS/registry-api/issues/66))
+
+
+This requirement is not impacted by the current version
+## As a user, I want specific end points for products which are not collections or bundles ([#65](https://github.com/NASA-PDS/registry-api/issues/65))
+
+
+This requirement is not impacted by the current version
+## As a user, I want the /products end point to work for any class of products ([#64](https://github.com/NASA-PDS/registry-api/issues/64))
+
+
+This requirement is not impacted by the current version
+## As a user, I want the end-point /api to redirect to the API documentation ([#63](https://github.com/NASA-PDS/registry-api/issues/63))
+
+
+This requirement is not impacted by the current version
+## As a user, I want to have singular urls when I should only expect a single element in the response ([#61](https://github.com/NASA-PDS/registry-api/issues/61))
+
+
+This requirement is not impacted by the current version
+## As a user, I want to see the version of the API specification in the URL of the service ([#59](https://github.com/NASA-PDS/registry-api/issues/59))
+
+
+This requirement is not impacted by the current version
+## As a user, I want to see the version of the API specification in the URL of the service ([#8](https://github.com/NASA-PDS/registry-api/issues/8))
+
+
+This requirement is not impacted by the current version
+## As a user, I want the /products end point to work for any class of products ([#11](https://github.com/NASA-PDS/registry-api/issues/11))
+
+
+This requirement is not impacted by the current version
+## As a user, I want specific end points for products which are not collections or bundles ([#12](https://github.com/NASA-PDS/registry-api/issues/12))
+
+
+This requirement is not impacted by the current version
+## As a user, I want to know why my query syntax is invalid ([#13](https://github.com/NASA-PDS/registry-api/issues/13))
+
+
+This requirement is not impacted by the current version
+## As an operator, I want to have a wrapper script for starting up the API service ([#14](https://github.com/NASA-PDS/registry-api/issues/14))
+
+
+This requirement is not impacted by the current version
+## As an API user, I want to handle long-running queries that take >10 seconds. ([#15](https://github.com/NASA-PDS/registry-api/issues/15))
+
+
+This requirement is not impacted by the current version
+## As an API user, I want an average query response time of 1 second for q=* queries ([#16](https://github.com/NASA-PDS/registry-api/issues/16))
+
+
+This requirement is not impacted by the current version
+## As an API caller(user) I want to specify fields for endpoints given a lidvid ([#80](https://github.com/NASA-PDS/registry-api/issues/80))
+
+
+This requirement is not impacted by the current version
+## the default proposed mime type in swagger-ui.html should be 'application/json' ([#88](https://github.com/NASA-PDS/registry-api/issues/88))
+
+
+This requirement is not impacted by the current version
+## As a user, I want to have an administrator contact when I am getting an error 500 from the server ([#109](https://github.com/NASA-PDS/registry-api/issues/109))
+
+
+This requirement is not impacted by the current version
+## As a user I want consistent /type/lidvlid/{child,parent}/{latest,all} ([#126](https://github.com/NASA-PDS/registry-api/issues/126))
+
+
+This requirement is not impacted by the current version
+## As a user, I want to get the product identifiers in a application/kvp+json format ([#132](https://github.com/NASA-PDS/registry-api/issues/132))
+
+
+This requirement is not impacted by the current version
\ No newline at end of file
diff --git a/model/pom.xml b/model/pom.xml
index ae68f2d7..e0560d44 100644
--- a/model/pom.xml
+++ b/model/pom.xml
@@ -120,27 +120,22 @@
io.springfox
- springfox-swagger2
- ${springfox-version}
-
-
- io.springfox
- springfox-swagger-ui
- ${springfox-version}
-
-
+ springfox-boot-starter
+ 3.0.0
+
+
org.springframework
spring-web
- 5.3.19
+ 5.3.20
org.springframework
spring-context
- 5.3.19
+ 5.3.20
diff --git a/model/swagger.yml b/model/swagger.yml
index 8adcfa55..48e70c0d 100644
--- a/model/swagger.yml
+++ b/model/swagger.yml
@@ -17,13 +17,13 @@ servers:
description: production server
paths:
- /products:
+ /gid/{group}:
get:
tags:
- products
summary: |
- returns all PDS data products, including bundles, collections, documentation, context and observational products that meet all given constraints.
- operationId: products
+ returns all PDS products of the given PDS product class that meet all given constraints.
+ operationId: group-list
responses:
'200':
$ref: "#/components/responses/Plural"
@@ -37,20 +37,20 @@ paths:
$ref: "#/components/responses/Error"
parameters:
- $ref: "#/components/parameters/Fields"
+ - $ref: "#/components/parameters/Group"
- $ref: "#/components/parameters/Keyword"
- $ref: "#/components/parameters/Limit"
- $ref: "#/components/parameters/Query"
- $ref: "#/components/parameters/Sort"
- $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /products/{identifier}:
+ /uid/{identifier}:
get:
tags:
- products
summary: |
- returns one product with the identifier selected from all PDS data products, including bundles, collections, documentation, context and observational products. See identifier for details on how it determines what is returned.
- operationId: products-by-lidvid
+ returns one PDS Product with the identifier selected from all PDS Products, including bundles, collections, data, documentation, context and observational products. See identifier for details on how it determines what is returned.
+ operationId: select-by-lidvid
responses:
'200':
$ref: "#/components/responses/Singular"
@@ -65,13 +65,13 @@ paths:
parameters:
- $ref: "#/components/parameters/Fields"
- $ref: "#/components/parameters/Identifier"
- /products/{identifier}/latest:
+ /uid/{identifier}/latest:
get:
tags:
- products
summary: |
- returns one product with the identifier selected from all PDS data products, including bundles, collections, documentation, context and observational products. See identifier for details on how it determines what is returned.
- operationId: products-by-lidvid-latest
+ returns one PDS Product with the identifier selected from all PDS Products. See identifier for details on how it determines what is returned.
+ operationId: select-by-lidvid-latest
responses:
'200':
$ref: "#/components/responses/Singular"
@@ -86,13 +86,15 @@ paths:
parameters:
- $ref: "#/components/parameters/Fields"
- $ref: "#/components/parameters/Identifier"
- /products/{identifier}/all:
+ /uid/{identifier}/all:
get:
tags:
- products
summary: |
- returns all product versions with the identifier (lid) selected from all PDS data products, including bundles, collections, documentation, context and observational products. See identifier for details on how it determines what is returned.
- operationId: products-by-lidvid-all
+ returns all product versions with the identifier (lid) selected from all PDS Products. See identifier for details on how it determines what is returned.
+
+ note: if given a lidvid, it will be translated to a lid
+ operationId: select-by-lidvid-all
responses:
'200':
$ref: "#/components/responses/Plural"
@@ -110,14 +112,13 @@ paths:
- $ref: "#/components/parameters/Limit"
- $ref: "#/components/parameters/Sort"
- $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /products/{identifier}/bundles:
+ /gid/{group}/referencing/{identifier}:
get:
tags:
- - products containing bundles
+ - product references
summary: |
- returns one or more bundles that contain or reference the product specified by identifier selected from all PDS data products, including bundles, collections, documentation, context and observational products. See identifier for details on how it determines what is returned.
- operationId: bundles-containing-product
+ returns one or more PDS Products of the specificed class that contain or reference the specified product identifier. See identifier for details on how it determines what is returned.
+ operationId: group-referencing-id
responses:
'200':
$ref: "#/components/responses/Plural"
@@ -131,18 +132,18 @@ paths:
$ref: "#/components/responses/Error"
parameters:
- $ref: "#/components/parameters/Fields"
+ - $ref: "#/components/parameters/Group"
- $ref: "#/components/parameters/Identifier"
- $ref: "#/components/parameters/Limit"
- $ref: "#/components/parameters/Sort"
- $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /products/{identifier}/collections:
+ /gid/{group}/referencing/{identifier}/{versions}:
get:
tags:
- - product containing collections
+ - product references
summary: |
- returns one or more collections that contain or reference the product specified by identifier selected from all PDS data products, including bundles, collections, documentation, context and observational products. See identifier for details on how it determines what is returned.
- operationId: collections-containing-product
+ returns one or more PDS Products of the specificed class that reference the product identifier. See identifier for details on how it determines what is returned.
+ operationId: group-referencing-id-vers
responses:
'200':
$ref: "#/components/responses/Plural"
@@ -156,329 +157,19 @@ paths:
$ref: "#/components/responses/Error"
parameters:
- $ref: "#/components/parameters/Fields"
+ - $ref: "#/components/parameters/Group"
- $ref: "#/components/parameters/Identifier"
- $ref: "#/components/parameters/Limit"
- $ref: "#/components/parameters/Sort"
- $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /collections:
+ - $ref: "#/components/parameters/Versions"
+ /uid/{identifier}/referencing/{group}:
get:
tags:
- - collections
+ - product references
summary: |
- returns all PDS collections that meet all given constraints.
- operationId: get collection
- responses:
- '200':
- $ref: "#/components/responses/Plural"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Keyword"
- - $ref: "#/components/parameters/Limit"
- - $ref: "#/components/parameters/Query"
- - $ref: "#/components/parameters/Sort"
- - $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /collections/{identifier}:
- get:
- tags:
- - collections
- summary: |
- returns one product with the identifier selected from all PDS collections. See identifier for details on how it determines what is returned.
- operationId: collections-by-lidvid
- responses:
- '200':
- $ref: "#/components/responses/Singular"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Identifier"
- /collections/{identifier}/latest:
- get:
- tags:
- - collections
- summary: |
- returns one product with the identifier selected from all PDS collections. See identifier for details on how it determines what is returned.
- operationId: collections-by-lidvid-latest
- responses:
- '200':
- $ref: "#/components/responses/Singular"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Identifier"
- /collections/{identifier}/all:
- get:
- tags:
- - collections
- summary: |
- returns all collection versions with the identifier (lid) selected from all PDS collections. See identifier for details on how it determines what is returned.
- operationId: collections-by-lidvid-all
- responses:
- '200':
- $ref: "#/components/responses/Plural"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Identifier"
- - $ref: "#/components/parameters/Limit"
- - $ref: "#/components/parameters/Sort"
- - $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /collections/{identifier}/bundles:
- get:
- tags:
- - collection's containing bundles
- summary: |
- returns one or more bundles that contain or reference the product specified by identifier selected from all PDS collections. See identifier for details on how it determines what is returned.
- operationId: bundles-containing-collection
- responses:
- '200':
- $ref: "#/components/responses/Plural"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Identifier"
- - $ref: "#/components/parameters/Limit"
- - $ref: "#/components/parameters/Sort"
- - $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /collections/{identifier}/products:
- get:
- tags:
- - collection's products
- summary: |
- returns one or more latest version products that are contained or referenced by the collection specified by identifier. See identifier for details on how it determines what is returned.
- operationId: products-of-a-collection
- responses:
- '200':
- $ref: "#/components/responses/Plural"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Identifier"
- - $ref: "#/components/parameters/Limit"
- - $ref: "#/components/parameters/Sort"
- - $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /collections/{identifier}/products/latest:
- get:
- tags:
- - collection's products
- summary: |
- returns one or more latest version products that are contained or referenced by the collection specified by identifier. See identifier for details on how it determines what is returned.
- operationId: products-of-a-collection-latest
- responses:
- '200':
- $ref: "#/components/responses/Plural"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Identifier"
- - $ref: "#/components/parameters/Limit"
- - $ref: "#/components/parameters/Sort"
- - $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /collections/{identifier}/products/all:
- get:
- tags:
- - collection's products
- summary: |
- returns one or more products that are contained or referenced by the collection specified by identifier. See identifier for details on how it determines what is returned.
- operationId: products-of-a-collection-all
- responses:
- '200':
- $ref: "#/components/responses/Plural"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Identifier"
- - $ref: "#/components/parameters/Limit"
- - $ref: "#/components/parameters/Sort"
- - $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /bundles:
- get:
- tags:
- - bundles
- summary: |
- returns all PDS bundles that meet all given constraints.
- operationId: get bundles
- responses:
- '200':
- $ref: "#/components/responses/Plural"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Keyword"
- - $ref: "#/components/parameters/Limit"
- - $ref: "#/components/parameters/Query"
- - $ref: "#/components/parameters/Sort"
- - $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /bundles/{identifier}:
- get:
- tags:
- - bundles
- summary: |
- returns one product with the identifier selected from all PDS bundles. See identifier for details on how it determines what is returned.
- operationId: bundle-by-lidvid
- responses:
- '200':
- $ref: "#/components/responses/Singular"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Identifier"
- /bundles/{identifier}/latest:
- get:
- tags:
- - bundles
- summary: |
- returns one product with the identifier selected from all PDS bundles. See identifier for details on how it determines what is returned.
- operationId: bundle-by-lidvid-latest
- responses:
- '200':
- $ref: "#/components/responses/Singular"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Identifier"
- /bundles/{identifier}/all:
- get:
- tags:
- - bundles
- summary: |
- returns all product versions with the identifier (lid) selected from all PDS bundles. See identifier for details on how it determines what is returned.
- operationId: bundle-by-lidvid-all
- responses:
- '200':
- $ref: "#/components/responses/Plural"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Identifier"
- - $ref: "#/components/parameters/Limit"
- - $ref: "#/components/parameters/Sort"
- - $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /bundles/{identifier}/collections:
- get:
- tags:
- - bundle's collections
- summary: |
- returns one or more latest version collections that are contained or referenced by the bundle specified by identifier. See identifier for details on how it determines what is returned.
- operationId: collections-of-a-bundle
- responses:
- '200':
- $ref: "#/components/responses/Plural"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Identifier"
- - $ref: "#/components/parameters/Limit"
- - $ref: "#/components/parameters/Sort"
- - $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /bundles/{identifier}/collections/latest:
- get:
- tags:
- - bundle's collections
- summary: |
- returns one or more latest version collections that are contained or referenced by the bundle specified by identifier. See identifier for details on how it determines what is returned.
- operationId: collections-of-a-bundle-latest
+ returns one or more PDS Products of the specificed class that the specified product identifier contains or references. See identifier for details on how it determines what is returned.
+ operationId: id-referencing-group
responses:
'200':
$ref: "#/components/responses/Plural"
@@ -492,18 +183,18 @@ paths:
$ref: "#/components/responses/Error"
parameters:
- $ref: "#/components/parameters/Fields"
+ - $ref: "#/components/parameters/Group"
- $ref: "#/components/parameters/Identifier"
- $ref: "#/components/parameters/Limit"
- $ref: "#/components/parameters/Sort"
- $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /bundles/{identifier}/collections/all:
+ /uid/{identifier}/referencing/{group}/{versions}:
get:
tags:
- - bundle's collections
+ - product references
summary: |
- returns one or more collections that are contained or referenced by the bundle specified by identifier. See identifier for details on how it determines what is returned.
- operationId: collections-of-a-bundle-all
+ returns one or more PDS Products of the specificed class that the specified product identifier contains or references. See identifier for details on how it determines what is returned.
+ operationId: id-referencing-group--vers
responses:
'200':
$ref: "#/components/responses/Plural"
@@ -517,36 +208,12 @@ paths:
$ref: "#/components/responses/Error"
parameters:
- $ref: "#/components/parameters/Fields"
+ - $ref: "#/components/parameters/Group"
- $ref: "#/components/parameters/Identifier"
- $ref: "#/components/parameters/Limit"
- $ref: "#/components/parameters/Sort"
- $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
- /bundles/{identifier}/products:
- get:
- tags:
- - bundle's products
- summary: |
- returns one or more latest version products that are contained or referenced by the bundle specified by identifier. See identifier for details on how it determines what is returned.
- operationId: products-of-a-bundle
- responses:
- '200':
- $ref: "#/components/responses/Plural"
- '400':
- $ref: "#/components/responses/Error"
- '404':
- $ref: "#/components/responses/Error"
- '500':
- $ref: "#/components/responses/Error"
- '501':
- $ref: "#/components/responses/Error"
- parameters:
- - $ref: "#/components/parameters/Fields"
- - $ref: "#/components/parameters/Identifier"
- - $ref: "#/components/parameters/Limit"
- - $ref: "#/components/parameters/Sort"
- - $ref: "#/components/parameters/Start"
- - $ref: "#/components/parameters/SummaryOnly"
+ - $ref: "#/components/parameters/Versions"
externalDocs:
description: Find out more information on the PDS API Specification
@@ -567,6 +234,17 @@ components:
type: array
items:
type: string
+ Group:
+ name: group
+ in: path
+ description: |
+ syntax: one of the allowable enum values
+
+ This is a shortcut for doing a query with ...
+ required: true
+ schema:
+ type: string
+ enum: [any,bundle,collection,product]
Identifier:
name: identifier
in: path
@@ -603,10 +281,12 @@ components:
syntax: limit=10
behavior: maximum number of matching results returned, for pagination
+
+ note: limit=0 returns just the summary
required: false
schema:
type: integer
- minimum: 1
+ minimum: 0
default: 100
Query:
name: q
@@ -644,16 +324,17 @@ components:
type: integer
minimum: 0
default: 0
- SummaryOnly:
- name: summary-only
- in: query
+ Versions:
+ name: versions
+ in: path
description: |
- syntax: summary-only={true,false}
-
- behavior: only return the summary when a list is returned. Useful to get the list of available properties.
+ syntax: one of the allowable enum values
+
+ This is a shortcut for doing a query with ...
+ required: true
schema:
- type: boolean
- default: false
+ type: string
+ enum: [all,latest]
responses:
Error:
description: Unsuccessful request
diff --git a/service/docker/Dockerfile b/service/docker/Dockerfile
index cd76e345..79026c41 100644
--- a/service/docker/Dockerfile
+++ b/service/docker/Dockerfile
@@ -80,7 +80,7 @@ WORKDIR /usr/local/registry-api-service
EXPOSE 80
CMD [ \
"java", \
- "-jar", "/usr/local/registry-api-service/registry-api-service.jar", ] \
+ "-jar", "/usr/local/registry-api-service/registry-api-service.jar", \
"gov.nasa.pds.api.registry.SpringBootMain" \
]
diff --git a/service/docker/Dockerfile.aws b/service/docker/Dockerfile.aws
new file mode 100644
index 00000000..ff845876
--- /dev/null
+++ b/service/docker/Dockerfile.aws
@@ -0,0 +1,100 @@
+# Copyright © 2022, California Institute of Technology ("Caltech").
+# U.S. Government sponsorship acknowledged.
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# • Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# • Redistributions must reproduce the above copyright notice, this list of
+# conditions and the following disclaimer in the documentation and/or other
+# materials provided with the distribution.
+# • Neither the name of Caltech nor its operating division, the Jet Propulsion
+# Laboratory, nor the names of its contributors may be used to endorse or
+# promote products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Dockerfile for the Registry API
+# ===============================
+#
+# Depending on the build arguments, you could get a Dockerfile using local
+# assets or one with built and released assets.
+#
+#
+# Basis
+# -----
+#
+# Normally we'd prefer Alpine Linux, but JDK 11 isn't available with it, so
+# we go with a slim Debian. Debian's good too.
+
+FROM openjdk:11-slim
+
+
+# API JAR file
+# ------------
+#
+# Provide a `--build-arg` to tell the image builder where the Registry API
+# `.jar` file may found. This can be a file on the filesystem (sent as part
+# of the build context) or a URL to a remote file.
+
+ARG api_jar
+
+
+# Layering
+# --------
+#
+# Add the API JAR file and the libtcnative-1 package—which is needed for
+# some reason.
+
+ADD $api_jar /usr/local/registry-api-service/registry-api-service.jar
+
+RUN : &&\
+ apt-get update --quiet --yes &&\
+ apt-get install --quiet --yes libtcnative-1 &&\
+ apt-get autoclean --quiet --yes &&\
+ rm --recursive --force /var/lib/apt/lists/* &&\
+ :
+
+# Copy in the AWS-specific application properties file. The contents of this file dictates that certain runtime
+# values are obtained in th manner appropriate to AWS (e.g. the Opensearch login is obtained from an environment
+# variable that has been set via the Secrets Manager.).
+COPY src/main/resources/application.properties.aws /usr/local/registry-api-service/application.properties
+
+
+# Image Morphology
+# ----------------
+#
+# External context.
+
+WORKDIR /usr/local/registry-api-service
+EXPOSE 80
+CMD [ \
+ "java", \
+ "-jar", "/usr/local/registry-api-service/registry-api-service.jar", \
+ "gov.nasa.pds.api.registry.SpringBootMain" \
+]
+
+
+# Labels
+# ------
+#
+# `org.label-schema` is deprecated, but no one can figure out whatever
+# replaced it, so we'll use it here.
+
+LABEL "org.label-schema.name" = "PDS Registry API"
+LABEL "org.label-schema.description" = "Planetary Data System's Application Programmer's Interface for the Registry"
+LABEL "org.label-schema.url" = "https://github.com/NASA-PDS/registry-api"
diff --git a/service/docker/README.md b/service/docker/README.md
index c4f35198..8d032464 100644
--- a/service/docker/README.md
+++ b/service/docker/README.md
@@ -28,6 +28,10 @@ Building an image from a released jar file:
$ docker image build --build-arg api_jar=https://github.com/NASA-PDS/registry-api/releases/download/v1.0.0/registry-api-service-1.0.0.jar --tag nasapds/registry-api-service:1.0.0 --file service/docker/Dockerfile .
```
+## 📍 Dockerfile.aws
+
+This Dockerfile is used to make images for AWS deployments of the registry manager. It copies in an AWS-specific application.properties file which has been setup to inform the service to obtain certain properties as environment variable values that have been injected by the Elastic Container Service (ECS) runtime. An example of this is the Opensearch credentials from the Secrets Manager.
+
## 📍 Dockerfile.local
You can ignore `Dockerfile.local` unless you're @al-niessner.
diff --git a/service/pom.xml b/service/pom.xml
index 9ac33716..6ec275b6 100644
--- a/service/pom.xml
+++ b/service/pom.xml
@@ -1,369 +1,370 @@
+ Copyright © 2021–2021, California Institute of Technology ("Caltech").
+ U.S. Government sponsorship acknowledged.
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ • Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ • Redistributions must reproduce the above copyright notice, this list of
+ conditions and the following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+ • Neither the name of Caltech nor its operating division, the Jet Propulsion
+ Laboratory, nor the names of its contributors may be used to endorse or
+ promote products derived from this software without specific prior written
+ permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ -->
- 4.0.0
- gov.nasa.pds
- registry-api-service
- 1.0.2
- gov.nasa.pds.api.registry-service
- registry api service contributing to the PDS federated API
-
- 11
- 11
- UTF-8
- 2.13.2
- 3.0.0
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- repackage
-
-
-
-
- gov.nasa.pds.api.registry.SpringBootMain
-
-
-
- org.apache.maven.plugins
- maven-site-plugin
- 3.8.2
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- 3.1.1
-
-
- bin-release
- package
-
- single
-
-
- true
-
- src/main/assembly/tar-assembly.xml
- src/main/assembly/zip-assembly.xml
-
-
-
-
-
- posix
-
-
-
-
-
-
-
-
-
- ossrh
- https://oss.sonatype.org/content/repositories/snapshots
-
-
- ossrh
- https://oss.sonatype.org/service/local/staging/deploy/maven2/
-
-
- dummy URL to enabling doc staging
- https://{project.artifactId}
-
-
-
-
- https://github.com/NASA-PDS/registry-api-service
- scm:git:git@github.com/NASA-PDS/registry-api-service.git
- scm:git:git@github.com:NASA-PDS/registry-api-service.git
+ 4.0.0
+ gov.nasa.pds
+ registry-api-service
+ 1.1.0-SNAPSHOT
+ gov.nasa.pds.api.registry-service
+ registry api service contributing to the PDS federated API
+
+ 11
+ 11
+ UTF-8
+ 2.13.2
+ 3.0.0
+
+
+
+
+ src/main/resources
+ true
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+ gov.nasa.pds.api.registry.SpringBootMain
+
+
+
+ org.apache.maven.plugins
+ maven-site-plugin
+ 3.8.2
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 3.1.1
+
+
+ bin-release
+ package
+
+ single
+
+
+ true
+
+ src/main/assembly/tar-assembly.xml
+ src/main/assembly/zip-assembly.xml
+
+
+
+
+
+ posix
+
+
+
+
+
+
+
+
+
+ ossrh
+ https://oss.sonatype.org/content/repositories/snapshots
+
+
+ ossrh
+ https://oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+ dummy URL to enabling doc staging
+ https://{project.artifactId}
+
+
+
+
+ https://github.com/NASA-PDS/registry-api-service
+ scm:git:git@github.com/NASA-PDS/registry-api-service.git
+ scm:git:git@github.com:NASA-PDS/registry-api-service.git
HEAD
-
-
-
-
- io.springfox
- springfox-swagger2
- ${springfox-version}
-
-
- io.springfox
- springfox-swagger-ui
- ${springfox-version}
-
-
-
-
- org.springframework
- spring-web
-
-
-
-
- org.springframework
- spring-context
-
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-starter-thymeleaf
-
-
-
- org.springframework
- spring-jdbc
-
-
-
-
-
- org.springframework.boot
- spring-boot-autoconfigure
-
-
-
-
-
- javax.servlet
- servlet-api
- 2.5
- provided
-
-
-
-
-
- javax.validation
- validation-api
-
-
-
-
- com.fasterxml.jackson.jaxrs
- jackson-jaxrs-base
- ${jackson-version}
-
-
- com.fasterxml.jackson.core
- jackson-core
- ${jackson-version}
-
-
- com.fasterxml.jackson.core
- jackson-annotations
-
-
- com.fasterxml.jackson.core
- jackson-databind
- ${jackson-version}.2
-
-
- com.fasterxml.jackson.jaxrs
- jackson-jaxrs-json-provider
- ${jackson-version}
-
-
-
- com.fasterxml.jackson.dataformat
- jackson-dataformat-xml
- ${jackson-version}
-
-
-
-
- com.github.joschi.jackson
- jackson-datatype-threetenbp
- 2.12.5
-
-
-
-
- joda-time
- joda-time
- 2.10.6
-
-
-
- com.sun.xml.bind
- jaxb-core
- 2.3.0.1
-
-
- javax.xml.bind
- jaxb-api
- 2.3.1
-
-
- com.sun.xml.bind
- jaxb-impl
- 2.3.1
-
-
- org.javassist
- javassist
- 3.25.0-GA
-
-
-
-
- org.threeten
- threetenbp
- 1.4.4
-
-
-
- gov.nasa.pds
- registry-api-model
- 1.0.1
-
-
-
- gov.nasa.pds
- registry-api-lexer
- 1.1.1
-
-
-
- org.antlr
- antlr4-runtime
- 4.9.2
-
-
-
- org.opensearch.client
- opensearch-rest-client
- 1.2.4
-
-
- org.opensearch.client
- opensearch-rest-high-level-client
- 1.2.4
-
-
-
-
- org.apache.httpcomponents
- httpclient
- 4.5.13
-
-
-
-
- org.apache.commons
- commons-collections4
- 4.2
-
-
-
-
- org.springframework.boot
- spring-boot-starter-test
-
-
- junit
- junit
-
-
-
-
-
-
- org.junit.jupiter
- junit-jupiter-api
-
-
- org.junit.jupiter
- junit-jupiter-engine
-
-
- org.springframework.boot
- spring-boot-starter-validation
-
-
-
- com.amazonaws
- aws-java-sdk-secretsmanager
- 1.12.201
-
-
-
-
- com.google.guava
- guava
- 31.1-jre
-
-
-
-
-
+
+
+
+
+ io.springfox
+ springfox-boot-starter
+ 3.0.0
+
+
+
+
+ org.springframework
+ spring-web
+
+
+
+
+ org.springframework
+ spring-context
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+
+ org.springframework
+ spring-jdbc
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure
+
+
+
+
+
+ javax.servlet
+ servlet-api
+ 2.5
+ provided
+
+
+
+
+
+ javax.validation
+ validation-api
+
+
+
+
+ com.fasterxml.jackson.jaxrs
+ jackson-jaxrs-base
+ ${jackson-version}
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ ${jackson-version}
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ ${jackson-version}.2
+
+
+ com.fasterxml.jackson.jaxrs
+ jackson-jaxrs-json-provider
+ ${jackson-version}
+
+
+
+ com.fasterxml.jackson.dataformat
+ jackson-dataformat-xml
+ ${jackson-version}
+
+
+
+
+ com.github.joschi.jackson
+ jackson-datatype-threetenbp
+ 2.12.5
+
+
+
+
+ joda-time
+ joda-time
+ 2.10.6
+
+
+
+ com.sun.xml.bind
+ jaxb-core
+ 2.3.0.1
+
+
+ javax.xml.bind
+ jaxb-api
+ 2.3.1
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ 2.3.1
+
+
+ org.javassist
+ javassist
+ 3.25.0-GA
+
+
+
+
+ org.threeten
+ threetenbp
+ 1.4.4
+
+
+
+ gov.nasa.pds
+ registry-api-model
+ 1.0.1
+
+
+
+ gov.nasa.pds
+ registry-api-lexer
+ 1.1.1
+
+
+
+ org.antlr
+ antlr4-runtime
+ 4.9.2
+
+
+
+ org.opensearch.client
+ opensearch-rest-client
+ 1.2.4
+
+
+ org.opensearch.client
+ opensearch-rest-high-level-client
+ 1.2.4
+
+
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.13
+
+
+
+
+ org.apache.commons
+ commons-collections4
+ 4.2
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+
+
+ junit
+ junit
+
+
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
+
+
+ com.amazonaws
+ aws-java-sdk-secretsmanager
+ 1.12.201
+
+
+
+
+ com.google.guava
+ guava
+ 31.1-jre
+
+
+
+
+
-
- org.springframework.boot
- spring-boot-dependencies
- 2.6.6
- pom
- import
-
+
+ org.springframework.boot
+ spring-boot-dependencies
+ 2.7.0
+ pom
+ import
+
-
-
-
-
- oss.sonatype.org-snapshot
- https://oss.sonatype.org/content/repositories/snapshots
-
- true
-
-
- true
-
-
-
+
+
+
+
+ oss.sonatype.org-snapshot
+ https://oss.sonatype.org/content/repositories/snapshots
+
+ true
+
+
+ true
+
+
+
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/GroupConstraint.java b/service/src/main/java/gov/nasa/pds/api/registry/GroupConstraint.java
new file mode 100644
index 00000000..f7eebae9
--- /dev/null
+++ b/service/src/main/java/gov/nasa/pds/api/registry/GroupConstraint.java
@@ -0,0 +1,23 @@
+package gov.nasa.pds.api.registry;
+
+import java.util.List;
+import java.util.Map;
+
+import com.google.errorprone.annotations.Immutable;
+
+@Immutable
+public interface GroupConstraint
+{
+ /**
+ * A set of PDS keywords/values that ALL must be true to define just PDS items that make up this Group.
+ */
+ public Map> all();
+ /**
+ * A set of PDS keywords/values that ANY must be true to define just PDS items that make up this Group.
+ */
+ public Map> any();
+ /**
+ * A set of PDS keywords/values that NONE must be true to define just PDS items that make up this Group.
+ */
+ public Map> not();
+}
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/LidvidsContext.java b/service/src/main/java/gov/nasa/pds/api/registry/LidvidsContext.java
new file mode 100644
index 00000000..11bffa9a
--- /dev/null
+++ b/service/src/main/java/gov/nasa/pds/api/registry/LidvidsContext.java
@@ -0,0 +1,8 @@
+package gov.nasa.pds.api.registry;
+
+public interface LidvidsContext
+{
+ public String getLidVid();
+ public Integer getLimit();
+ public Integer getStart();
+}
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/ReferencingLogic.java b/service/src/main/java/gov/nasa/pds/api/registry/ReferencingLogic.java
new file mode 100644
index 00000000..8c255617
--- /dev/null
+++ b/service/src/main/java/gov/nasa/pds/api/registry/ReferencingLogic.java
@@ -0,0 +1,31 @@
+package gov.nasa.pds.api.registry;
+
+import java.io.IOException;
+
+import com.google.errorprone.annotations.Immutable;
+
+import gov.nasa.pds.api.registry.exceptions.ApplicationTypeException;
+import gov.nasa.pds.api.registry.exceptions.LidVidNotFoundException;
+import gov.nasa.pds.api.registry.exceptions.UnknownGroupNameException;
+import gov.nasa.pds.api.registry.model.RequestAndResponseContext;
+
+@Immutable
+public interface ReferencingLogic
+{
+ /**
+ * Map the set of PDS constraints that define just PDS items that make up this Group.
+ */
+ public GroupConstraint constraints();
+
+ /**
+ * Find all of the PDS items of the given Group that reference the specified ID.
+ */
+ public RequestAndResponseContext find(ControlContext context, UserContext input)
+ throws ApplicationTypeException, IOException, LidVidNotFoundException, UnknownGroupNameException;
+
+ /**
+ * Find all of the PDS items of the given ID that reference the specified Group.
+ */
+ public RequestAndResponseContext given(ControlContext context, UserContext input)
+ throws ApplicationTypeException, IOException, LidVidNotFoundException, UnknownGroupNameException;
+}
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/RequestBuildContext.java b/service/src/main/java/gov/nasa/pds/api/registry/RequestBuildContext.java
index 98e3b8d0..5e5c77e5 100644
--- a/service/src/main/java/gov/nasa/pds/api/registry/RequestBuildContext.java
+++ b/service/src/main/java/gov/nasa/pds/api/registry/RequestBuildContext.java
@@ -1,10 +1,9 @@
package gov.nasa.pds.api.registry;
import java.util.List;
-import java.util.Map;
public interface RequestBuildContext
{
public List getFields(); // must not return null but an empty list
- public Map getPresetCriteria(); // must not return null but an empty list
+ public GroupConstraint getPresetCriteria(); // must not return null but an empty list
}
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/SpringBootMain.java b/service/src/main/java/gov/nasa/pds/api/registry/SpringBootMain.java
index d707213d..9d36d34f 100644
--- a/service/src/main/java/gov/nasa/pds/api/registry/SpringBootMain.java
+++ b/service/src/main/java/gov/nasa/pds/api/registry/SpringBootMain.java
@@ -10,7 +10,7 @@
@SpringBootApplication
@EnableSwagger2
-@ComponentScan(basePackages = { "gov.nasa.pds.api.registry.business", "gov.nasa.pds.api.registry.configuration ", "gov.nasa.pds.api.registry.controllers", "gov.nasa.pds.api.registry.opensearch"})
+@ComponentScan(basePackages = { "gov.nasa.pds.api.registry.configuration ", "gov.nasa.pds.api.registry.controller", "gov.nasa.pds.api.registry.model", "gov.nasa.pds.api.registry.search"})
public class SpringBootMain implements CommandLineRunner {
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/UserContext.java b/service/src/main/java/gov/nasa/pds/api/registry/UserContext.java
index 5eca0112..4a05c346 100644
--- a/service/src/main/java/gov/nasa/pds/api/registry/UserContext.java
+++ b/service/src/main/java/gov/nasa/pds/api/registry/UserContext.java
@@ -2,17 +2,17 @@
import java.util.List;
-import gov.nasa.pds.api.registry.business.ProductVersionSelector;
+import gov.nasa.pds.api.registry.model.ProductVersionSelector;
-public interface UserContext
+public interface UserContext extends LidvidsContext
{
+ public String getAccept();
public List getFields();
+ public String getGroup();
public String getIdentifier();
public List getKeywords();
- public Integer getLimit();
public String getQuery();
public ProductVersionSelector getSelector();
public List getSort();
- public Integer getStart();
- public Boolean getSummanryOnly();
+ public String getVersion();
}
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/business/BundleDAO.java b/service/src/main/java/gov/nasa/pds/api/registry/business/BundleDAO.java
deleted file mode 100644
index 255e76d0..00000000
--- a/service/src/main/java/gov/nasa/pds/api/registry/business/BundleDAO.java
+++ /dev/null
@@ -1,174 +0,0 @@
-package gov.nasa.pds.api.registry.business;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.opensearch.action.search.SearchRequest;
-import org.opensearch.client.RequestOptions;
-import org.opensearch.search.SearchHit;
-import org.opensearch.search.SearchHits;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import gov.nasa.pds.api.registry.ControlContext;
-import gov.nasa.pds.api.registry.RequestBuildContext;
-import gov.nasa.pds.api.registry.exceptions.LidVidNotFoundException;
-import gov.nasa.pds.api.registry.opensearch.RequestBuildContextFactory;
-import gov.nasa.pds.api.registry.opensearch.RequestConstructionContextFactory;
-import gov.nasa.pds.api.registry.opensearch.SearchRequestFactory;
-
-/**
- * Bundle Data Access Object (DAO).
- * Provides methods to get bundle information from opensearch.
- *
- * @author karpenko
- */
-public class BundleDAO
-{
- @SuppressWarnings("unused")
- private static final Logger log = LoggerFactory.getLogger(BundleDAO.class);
-
- static public Map searchConstraints()
- {
- Map preset = new HashMap();
- preset.put("product_class", "Product_Bundle");
- return preset;
- }
-
- /**
- * Get collections of a bundle by bundle LIDVID.
- * If a bundle has LIDVID collection references, then those collections are returned.
- * If a bundle has LID collection references, then the latest versions of collections are returned.
- * @return a list of collection LIDVIDs
- * @throws IOException IO exception
- * @throws LidVidNotFoundException LIDVID not found exception
- */
- static public List getBundleCollectionLidVids(
- String bundleLidVid,
- ControlContext ctlContext,
- RequestBuildContext reqBuildContext)
- throws IOException, LidVidNotFoundException
- {
- // Fetch collection references only.
- List fields = new ArrayList(
- Arrays.asList("ref_lidvid_collection","ref_lidvid_collection_secondary",
- "ref_lid_collection", "ref_lid_collection_secondary"));
-
- // Get bundle by lidvid.
- SearchRequest request = new SearchRequestFactory(RequestConstructionContextFactory.given(bundleLidVid), ctlContext.getConnection())
- .build(RequestBuildContextFactory.given(fields, BundleDAO.searchConstraints()), ctlContext.getConnection().getRegistryIndex());
-
- // Call opensearch
- SearchHit hit;
- SearchHits hits = ctlContext.getConnection().getRestHighLevelClient().search(request, RequestOptions.DEFAULT).getHits();
- if(hits == null || hits.getTotalHits() == null || hits.getTotalHits().value != 1)
- throw new LidVidNotFoundException(bundleLidVid);
- else hit = hits.getAt(0);
-
- // Get fields
- // LidVid references (e.g., OREX bundle)
- Map fieldMap = hit.getSourceAsMap();
- List primaryIds = ResponseUtils.getFieldValues(fieldMap, "ref_lidvid_collection");
- List secondaryIds = ResponseUtils.getFieldValues(fieldMap, "ref_lidvid_collection_secondary");
-
- List lidVids = new ArrayList();
- if(primaryIds != null) lidVids.addAll(primaryIds);
- if(secondaryIds != null) lidVids.addAll(secondaryIds);
-
- // !!! NOTE !!!
- // Harvest converts LIDVID references to LID references and stores them in
- // "ref_lid_collection" and "ref_lid_collection_secondary" fields.
- // To get "real" LID references, we have to exclude LIDVID references from these fields.
- Set lidsToRemove = new TreeSet();
- for(String lidVid: lidVids)
- {
- int idx = lidVid.indexOf("::");
- if(idx > 0)
- {
- String lid = lidVid.substring(0, idx);
- lidsToRemove.add(lid);
- }
- }
-
- // Lid references (e.g., Kaguya bundle) plus LIDVID references converted by Harvest
- primaryIds = ResponseUtils.getFieldValues(fieldMap, "ref_lid_collection");
- secondaryIds = ResponseUtils.getFieldValues(fieldMap, "ref_lid_collection_secondary");
-
- List lids = new ArrayList();
- if(primaryIds != null) lids.addAll(primaryIds);
- if(secondaryIds != null) lids.addAll(secondaryIds);
-
- // Get "real" LIDs
- if(!lidsToRemove.isEmpty())
- {
- lids.removeAll(lidsToRemove);
- }
-
- // Get the latest versions of LIDs
- if(!lids.isEmpty())
- {
- List latestLidVids = LidVidUtils.getLatestLidVidsByLids(ctlContext,
- RequestBuildContextFactory.given(reqBuildContext.getFields(), CollectionDAO.searchConstraints()), lids);
- lidVids.addAll(latestLidVids);
- }
-
- return lidVids;
- }
-
-
- /**
- * Get all versions of bundle's collections by bundle LIDVID.
- * @param bundleLidVid bundle LIDVID (Could not pass LID here)
- * @return a list of collection LIDVIDs
- * @throws IOException IO exception
- * @throws LidVidNotFoundException LIDVID not found exception
- */
- static public List getAllBundleCollectionLidVids(
- String bundleLidVid,
- ControlContext ctlContext,
- RequestBuildContext reqBuildContext)
- throws IOException, LidVidNotFoundException
- {
- // Fetch collection references only.
- List fields = new ArrayList(
- Arrays.asList("ref_lid_collection", "ref_lid_collection_secondary"));
-
- // Get bundle by lidvid.
- SearchRequest request = new SearchRequestFactory(RequestConstructionContextFactory.given(bundleLidVid), ctlContext.getConnection())
- .build(RequestBuildContextFactory.given(fields, BundleDAO.searchConstraints()), ctlContext.getConnection().getRegistryIndex());
-
- // Call opensearch
- SearchHit hit;
- SearchHits hits = ctlContext.getConnection().getRestHighLevelClient().search(request, RequestOptions.DEFAULT).getHits();
- if (hits == null || hits.getTotalHits() == null || hits.getTotalHits().value != 1)
- throw new LidVidNotFoundException(bundleLidVid);
- else hit = hits.getAt(0);
-
- // Get fields
- Map fieldMap = hit.getSourceAsMap();
-
- // Lid references (e.g., Kaguya bundle)
- List primaryIds = ResponseUtils.getFieldValues(fieldMap, "ref_lid_collection");
- List secondaryIds = ResponseUtils.getFieldValues(fieldMap, "ref_lid_collection_secondary");
-
- List ids = new ArrayList();
- if(primaryIds != null) ids.addAll(primaryIds);
- if(secondaryIds != null) ids.addAll(secondaryIds);
-
- if(!ids.isEmpty())
- {
- // Get the latest versions of LIDs (Return LIDVIDs)
- ids = LidVidUtils.getAllLidVidsByLids(ctlContext, reqBuildContext, ids);
- return ids;
- }
-
- return new ArrayList(0);
- }
-
-}
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/business/CollectionDAO.java b/service/src/main/java/gov/nasa/pds/api/registry/business/CollectionDAO.java
deleted file mode 100644
index 968dd73a..00000000
--- a/service/src/main/java/gov/nasa/pds/api/registry/business/CollectionDAO.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package gov.nasa.pds.api.registry.business;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class CollectionDAO
-{
- static public Map searchConstraints()
- {
- Map preset = new HashMap();
- preset.put("product_class", "Product_Collection");
- return preset;
- }
-}
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/business/ProductDAO.java b/service/src/main/java/gov/nasa/pds/api/registry/business/ProductDAO.java
deleted file mode 100644
index e97af05c..00000000
--- a/service/src/main/java/gov/nasa/pds/api/registry/business/ProductDAO.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package gov.nasa.pds.api.registry.business;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class ProductDAO
-{
- static public Map searchConstraints()
- {
- Map preset = new HashMap();
- return preset;
- }
-}
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/business/ResponseUtils.java b/service/src/main/java/gov/nasa/pds/api/registry/business/ResponseUtils.java
deleted file mode 100644
index 99731ba6..00000000
--- a/service/src/main/java/gov/nasa/pds/api/registry/business/ResponseUtils.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package gov.nasa.pds.api.registry.business;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-
-public class ResponseUtils
-{
- @SuppressWarnings({"unchecked", "rawtypes"})
- public static List getFieldValues(Map fieldMap, String fieldName)
- {
- if(fieldMap == null || fieldName == null) return null;
-
- Object obj = fieldMap.get(fieldName);
- if(obj == null) return null;
-
- if(obj instanceof String)
- {
- return Arrays.asList((String)obj);
- }
- else if(obj instanceof List)
- {
- return (List)obj;
- }
-
- return null;
- }
-}
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/configuration/ApiDocumentation.java b/service/src/main/java/gov/nasa/pds/api/registry/configuration/ApiDocumentation.java
index 86fab0db..ff76ffc5 100644
--- a/service/src/main/java/gov/nasa/pds/api/registry/configuration/ApiDocumentation.java
+++ b/service/src/main/java/gov/nasa/pds/api/registry/configuration/ApiDocumentation.java
@@ -22,7 +22,7 @@ public String index() {
String contextPath = this.contextPath.endsWith("/")?this.contextPath:this.contextPath+"/";
- System.out.println(contextPath+"swagger-ui.html");
- return "redirect:"+contextPath+"swagger-ui.html";
+ System.out.println(contextPath+"swagger-ui/index.html");
+ return "redirect:"+contextPath+"swagger-ui/index.html";
}
}
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/configuration/SwaggerDocumentationConfig.java b/service/src/main/java/gov/nasa/pds/api/registry/configuration/SwaggerDocumentationConfig.java
index 02737986..e479d12c 100644
--- a/service/src/main/java/gov/nasa/pds/api/registry/configuration/SwaggerDocumentationConfig.java
+++ b/service/src/main/java/gov/nasa/pds/api/registry/configuration/SwaggerDocumentationConfig.java
@@ -1,5 +1,6 @@
package gov.nasa.pds.api.registry.configuration;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -15,14 +16,17 @@
@Configuration
public class SwaggerDocumentationConfig {
- ApiInfo apiInfo() {
+ @Value("${registry.service.version:undefined}")
+ private String version;
+
+ ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("PDS federated API")
.description("Federated PDS API which provides actionable end points standardized between the different nodes. ")
.license("Apache 2.0")
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
.termsOfServiceUrl("")
- .version("0.0.1")
+ .version(this.version)
.contact(new Contact("","", "pds_operator@jpl.nasa.gov"))
.build();
}
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/configuration/WebMVCConfig.java b/service/src/main/java/gov/nasa/pds/api/registry/configuration/WebMVCConfig.java
index 91a27352..2f0dd222 100644
--- a/service/src/main/java/gov/nasa/pds/api/registry/configuration/WebMVCConfig.java
+++ b/service/src/main/java/gov/nasa/pds/api/registry/configuration/WebMVCConfig.java
@@ -14,27 +14,27 @@
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-import gov.nasa.pds.api.registry.serializer.CsvErrorMessageSerializer;
-import gov.nasa.pds.api.registry.serializer.CsvPluralSerializer;
-import gov.nasa.pds.api.registry.serializer.CsvSingularSerializer;
-import gov.nasa.pds.api.registry.serializer.HtmlErrorMessageSerializer;
-import gov.nasa.pds.api.registry.serializer.JsonErrorMessageSerializer;
-import gov.nasa.pds.api.registry.serializer.JsonPluralSerializer;
-import gov.nasa.pds.api.registry.serializer.JsonProductSerializer;
-import gov.nasa.pds.api.registry.serializer.JsonSingularSerializer;
-import gov.nasa.pds.api.registry.serializer.Pds4JsonProductSerializer;
-import gov.nasa.pds.api.registry.serializer.Pds4JsonProductsSerializer;
-import gov.nasa.pds.api.registry.serializer.Pds4XmlProductSerializer;
-import gov.nasa.pds.api.registry.serializer.Pds4XmlProductsSerializer;
-import gov.nasa.pds.api.registry.serializer.PdsProductTextHtmlSerializer;
-import gov.nasa.pds.api.registry.serializer.PdsProductXMLSerializer;
-import gov.nasa.pds.api.registry.serializer.PdsProductsTextHtmlSerializer;
-import gov.nasa.pds.api.registry.serializer.PdsProductsXMLSerializer;
-import gov.nasa.pds.api.registry.serializer.XmlErrorMessageSerializer;
+import gov.nasa.pds.api.registry.view.CsvErrorMessageSerializer;
+import gov.nasa.pds.api.registry.view.CsvPluralSerializer;
+import gov.nasa.pds.api.registry.view.CsvSingularSerializer;
+import gov.nasa.pds.api.registry.view.HtmlErrorMessageSerializer;
+import gov.nasa.pds.api.registry.view.JsonErrorMessageSerializer;
+import gov.nasa.pds.api.registry.view.JsonPluralSerializer;
+import gov.nasa.pds.api.registry.view.JsonProductSerializer;
+import gov.nasa.pds.api.registry.view.JsonSingularSerializer;
+import gov.nasa.pds.api.registry.view.Pds4JsonProductSerializer;
+import gov.nasa.pds.api.registry.view.Pds4JsonProductsSerializer;
+import gov.nasa.pds.api.registry.view.Pds4XmlProductSerializer;
+import gov.nasa.pds.api.registry.view.Pds4XmlProductsSerializer;
+import gov.nasa.pds.api.registry.view.PdsProductTextHtmlSerializer;
+import gov.nasa.pds.api.registry.view.PdsProductXMLSerializer;
+import gov.nasa.pds.api.registry.view.PdsProductsTextHtmlSerializer;
+import gov.nasa.pds.api.registry.view.PdsProductsXMLSerializer;
+import gov.nasa.pds.api.registry.view.XmlErrorMessageSerializer;
@Configuration
@EnableWebMvc
-@ComponentScan(basePackages = { "gov.nasa.pds.api.registry.configuration ", "gov.nasa.pds.api.registry.controllers", "gov.nasa.pds.api.registry.opensearch"})
+@ComponentScan(basePackages = { "gov.nasa.pds.api.registry.configuration ", "gov.nasa.pds.api.registry.controller", "gov.nasa.pds.api.registry.search"})
public class WebMVCConfig implements WebMvcConfigurer
{
private static final Logger log = LoggerFactory.getLogger(WebMVCConfig.class);
@@ -42,9 +42,6 @@ public class WebMVCConfig implements WebMvcConfigurer
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry)
{
- registry.addResourceHandler("swagger-ui.html")
- .addResourceLocations("classpath:/META-INF/resources/");
-
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
diff --git a/service/src/main/java/gov/nasa/pds/api/registry/controller/EndpointHandler.java b/service/src/main/java/gov/nasa/pds/api/registry/controller/EndpointHandler.java
new file mode 100644
index 00000000..9a4c8493
--- /dev/null
+++ b/service/src/main/java/gov/nasa/pds/api/registry/controller/EndpointHandler.java
@@ -0,0 +1,18 @@
+package gov.nasa.pds.api.registry.controller;
+
+import java.io.IOException;
+
+import org.springframework.http.ResponseEntity;
+
+import gov.nasa.pds.api.registry.ControlContext;
+import gov.nasa.pds.api.registry.UserContext;
+import gov.nasa.pds.api.registry.exceptions.ApplicationTypeException;
+import gov.nasa.pds.api.registry.exceptions.LidVidNotFoundException;
+import gov.nasa.pds.api.registry.exceptions.NothingFoundException;
+import gov.nasa.pds.api.registry.exceptions.UnknownGroupNameException;
+
+interface EndpointHandler
+{
+ public ResponseEntity