public interface DataProvider
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ADD_COMMAND
Constant that can be used as the "ADD" value for the "command" fields
of Items to be processed in COMMAND mode.
|
static java.lang.String |
COMMAND_FIELD
Constant that can be used as field name for the "command" field in Items
to be processed in COMMAND mode.
|
static java.lang.String |
DELETE_COMMAND
Constant that can be used as the "DELETE" value for the "command" fields
of Items to be processed in COMMAND mode.
|
static java.lang.String |
KEY_FIELD
Constant that can be used as field name for the "key" field in Items
to be processed in COMMAND mode.
|
static java.lang.String |
UPDATE_COMMAND
Constant that can be used as the "UPDATE" value for the "command" fields
of Items to be processed in COMMAND mode.
|
Modifier and Type | Method and Description |
---|---|
void |
init(java.util.Map params,
java.io.File configDir)
Called by Lightstreamer Kernel to provide initialization information
to the Data Adapter.
|
boolean |
isSnapshotAvailable(java.lang.String itemName)
Called by Lightstreamer Kernel to know whether the Data Adapter,
after a subscription for an Item, will send some Snapshot ItemEvents
before sending the updates.
|
void |
setListener(ItemEventListener listener)
Called by Lightstreamer Kernel to provide a listener to receive the
ItemEvents carrying data and asynchronous error notifications.
|
void |
subscribe(java.lang.String itemName,
boolean needsIterator)
Called by Lightstreamer Kernel to request data for an Item.
|
void |
unsubscribe(java.lang.String itemName)
Called by Lightstreamer Kernel to end a previous request of data for
an Item.
|
static final java.lang.String KEY_FIELD
static final java.lang.String COMMAND_FIELD
static final java.lang.String ADD_COMMAND
static final java.lang.String UPDATE_COMMAND
static final java.lang.String DELETE_COMMAND
void init(java.util.Map params, java.io.File configDir) throws DataProviderException
params
- A Map-type value object that contains name-value pairs
corresponding to the "param" elements supplied in the Data Adapter
configuration file under the "data_provider" element.
Both names and values are represented as String objects.configDir
- The path of the directory on the local disk
where the Data Adapter configuration file resides.DataProviderException
- if an error occurs that prevents
the correct behavior of the Data Adapter. This causes the Server
not to complete the startup and to exit.void setListener(ItemEventListener listener)
listener
- a listener.void subscribe(java.lang.String itemName, boolean needsIterator) throws SubscriptionException, FailureException
if isSnapshotAvailable(itemName) == true SNAP* [EOS] UPD* else UPD*where:
[SNAP] [EOS] UPD*where a missing snapshot is considered as an empty snapshot.
itemName
- Name of an Item.needsIterator
- Signals that the getNames method will be called
on the ItemEvents received for this Item. If this flag is set to false,
the ItemEvent objects sent for this Item need not implement the method.SubscriptionException
- if the request cannot be satisfied.
A failed subscription is not notified to the clients; it just causes
the clients not to receive data. Upon a failed subscription, the
related unsubscribe(String)
call will not be issued.FailureException
- if the method execution has caused a severe
problem that can compromise future operation of the Data Adapter.
This causes the whole Server to exit, so that an external recovery
mechanism may come into action.ItemEventListener
,
ItemEvent
void unsubscribe(java.lang.String itemName) throws SubscriptionException, FailureException
itemName
- Name of an Item.SubscriptionException
- if the request cannot be satisfied.
This does not prevent Lightstreamer Kernel from calling
unsubscribe(String)
again for the same item, if needed.FailureException
- if the method execution has caused a severe
problem that can compromise future operation of the Data Adapter.
This causes the whole Server to exit, so that an external recovery
mechanism may come into action.boolean isSnapshotAvailable(java.lang.String itemName) throws SubscriptionException
itemName
- Name of an Item.SubscriptionException
- if the Data Adapter is unable to answer
to the request. This causes the subscription to fail and the proper
subscribe(String, boolean)
call not to be issued. A failed
subscription is not notified to the clients; it just causes the clients
not to receive data.