new ResponseProviderByDirectory(directory, options)
Provides responses by loading all of the files in a directory as responses
Responses are loaded asynchronously but if a response is requested before being loaded
it will be immediately loaded and then skipped by the asynchronous processing.
Parameters:
Name |
Type |
Description |
directory |
String
|
The directory to read all responses from |
options |
Object
|
Options for the was the directory is process
Properties
Name |
Type |
Attributes |
Default |
Description |
fileEncoding |
String
|
<optional>
|
utf8
|
The encoding of the files. |
filenameFormatter |
FileNameFormatter
|
<optional>
|
DefaultJSONFilenameFormatter
|
The FilenameFormmatter to use to parse the
filenames to determine response name as well as how to format the responseId to become a filename. This object will only
load files that match the formatters isValid() method |
responseBuilder |
ResponseBuilder
|
<optional>
|
DefaultResponseBuilder
|
The ResponseBuilder to use when building responses. Defaults to DefaultResponseBuilder |
|
- Implements:
- Source:
- See:
-
Methods
processItem(items, itemId, fileName, options)
Parameters:
Name |
Type |
Description |
items |
Map
|
Map of the items being processed |
itemId |
String
|
The Id of the item to process |
fileName |
String
|
The name of the file being processed |
options |
Object
|
Any options that are being passed to the ItemProcessor (can be null) |
- Implements:
- Source:
processItems(items, fileName, options)
Synchronously reads a file and, using the ResponseBuilder from the constructor, builds a response for the
use in AbstractProviderByDictionary
Parameters:
Name |
Type |
Description |
items |
Map
|
Map of the items being processed |
fileName |
String
|
The name of the file being processed |
options |
Object
|
Any options that are being passed to the ItemProcessor (can be null) |
- Implements:
- Source: