- REST Structure:
- REST resource location:
If the objective is to download the resource, convert it into object called Cohort and save it locally, here is the solution:
Create Cohort class implementing the root object of the Search API, the Searchable class. This class is basically a simple POJO class to hold the data of the REST resource.
- Create CohortResolver class implementing the top level Resolver class. The cohort resolver will help the API to decide where to download the REST resource and what authentication needed to access it.
- Create CohortAlgorithm class implementing the top level Algorithm class. The Algorithm class define a two way conversion between the REST resource's representation into the correct object.
- Create configuration to tie everything together. The configuration have the following element:
- resource.name: Obviously, the name of the resource. The value of this field will be used to uniquely identify the resource in the pool of all registered resources inside ServiceContext class.
- node.root: The root element in the REST resource's payload JSONPath expression. JSONPath is XPath expression for JSON data. See more about JSONPath.
- resource.object: The target class of the REST resource's payload conversion process.
- algorithm.class: The class which will be used to perform two conversion from the REST resource's payload into the correct object (the correct object is represented in resource.object) and vice versa.
- resolver.class: The class which will point to the location where the API can get the REST resource and the authentication needed to access it.
- field.unique: An element in the REST resource's payload which can be used to uniquely identify the resource among collection of resources.
- field.searchable: Any elements in the REST resource's payload which are searchable.
- Create module to specify the location where lucene index will be stored
- Download and save the object locally