Class: AbstractProviderByFile

AbstractProviderByFile

(abstract) new AbstractProviderByFile(file, options)

Provides items by single file with multiple items defined in the file items are loaded asynchronously but if a item is requested before being loaded it will be immediately loaded and then skipped by the asychronous processing.
Parameters:
Name Type Description
file String The file to read all items from
options Object.<String, Object> Options for configuration. This can also be used as a map to pass to the itemProcessor if the implementing class wants to pass information into the itemProcessor method
Properties
Name Type Attributes Default Description
preload Boolean <optional>
false Should the file be preloaded or only loaded when a item is requested
fileEncoding String <optional>
utf8 The file encoding to use when reading files and directories
itemMap Object.<String, Object> <optional>
A map that may be passed in to prime the internal map with.
Implements:
Source:

Methods

getItem(itemId) → {item}

Returns the item based on the itemId
Parameters:
Name Type Description
itemId String The id of the item to retrieve. If the file is not already loaded, it will load it to look for the item
Implements:
Source:
Returns:
The item. Null if no item is found
Type
item

getItems() → {Map}

Returns all items that were loaded
Implements:
Source:
Returns:
Map of the items where the Key is the itemId and the Value is the item itself
Type
Map

(abstract) processItem(items, itemId, fileName, options)

Processes the specific item and returns the result
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:

(abstract) processItems(items, fileName, options)

Processes multiple items at once
Parameters:
Name Type Description
items Map Map of the items being processeds
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: