# Common Entities

The Common Entities plugin provides entities whose dependencies (if any) include only those upon which the Rosetta framework itself depends (e.g. Jackson).

# Dependency Information

<dependency>
  <groupId>com.k-int.rosetta</groupId>
  <artifactId>rosetta-common-entities</artifactId>
  <version>3.0.0</version>
</dependency>

# Providers

# jackson-streaming

The jackson-streaming Provider retrieves records stored in JSON files on the local filesystem using the Jackson Streaming API, which allows very large files to be processed with minimal memory footprint. The JSON file used for a specific request may depend on the request parameters or may be a single static file. Each JSON file MUST be a top-level array whose items are JSON objects (key-value maps) that are interpreted as the individual results/records that this Provider provides.

Requests made against this Provider MUST conform to the GenericSearchRequest schema, where the individual request parameters are interpreted as follows:

  • queries[0]: The first item in the queries array is used as the key to look up the JSON file path in the files map in the properties.
    If the files map is not specified, or there is no mapping for the given queries[0] value, then the file property will be used, if specified.
    Otherwise, the Provider response will be empty.
  • from: The zero-based array offset in the JSON array from which results will be taken.
  • size: The maximum number of results to be returned for this request.

# Properties

Property Type Default Description
file String null The file path of the source JSON file. Acts as the default if there is no matching file in the files map for the given request.
files Map<String, String> null A map of JSON source file paths where the key is the string value that must match the first item in the queries array in the GenericSearchRequest received by the provider.
skip_total_count Enum: SkipTotalCount auto An enum that determines the behaviour around whether the total record count is calculated while fulfilling each request. See table SkipTotalCount for allowed values.
offset_cache.enabled Boolean true Enables a cache that stores the last accessed byte-offset for each JSON file. This allows for sequential requests to be delivered faster (especially for very large files) by resuming from the last accessed byte position.
offset_cache.duration Duration 5m Sets the duration since last access after which each cache entry will be evicted.
offset_cache.max_files Long 100 Sets the maximum number of files allowed in the cache.
offset_cache.max_offsets Long 100 Sets the maximum number of offsets per file allowed in the cache.
offset_cache.cache_all_offsets Boolean false If true, then the offset will be cached after each result is processed. Otherwise, it will only cache after the first and last result in the current request is processed.
# SkipTotalCount
Value Description
auto The total count will only be calculated if its value has not yet been cached for a given file.
always Always skip calculating the total count. This may be useful for speeding up requests against very large files where knowledge of the total count is not necessary for the use case.
never Never skip calculating the total count.

# Example

name: my-provider
type: jackson-streaming
properties:
  file: /data/default_file.json
  files:
    objects: /data/objects.json
    media: /data/media.json
  skip_total_count: auto
  offset_cache:
    enabled: true
    duration: 5m
    max_files: 100
    max_offsets: 100
    cache_all_offsets: false

# self

The self Provider retrieves results by executing a nested DataServiceRequest against the same Rosetta instance that is handling the current request. This can be used to wrap additional static transforms around a variable "base" Rosetta Profile, for instance.

All results and custom metadata are transcribed into the Provider response from the DataServiceResponse received after executing the DataServiceRequest.

Note that only single result set (i.e. single provider) base Profiles are supported. If multiple result sets are detected, then only the first result set will be used and a warning will be logged.

# Properties

Property Type Default Description
profile String default The root profile used to execute the DataServiceRequest.

# Example

name: my-provider
type: self
properties:
  profile: search