org.epics.pvmanager
Interface DataSourceTypeAdapter<ConnectionPayload,MessagePayload>

Type Parameters:
ConnectionPayload - the type of payload given at connection
MessagePayload - the type of payload for each message
All Known Implementing Classes:
JCATypeAdapter

public interface DataSourceTypeAdapter<ConnectionPayload,MessagePayload>

Matches and fills a cache with the data from connection and message payloads. This optional class helps the writer of a datasource to manage the type matching and conversions.

Author:
carcassi

Method Summary
 java.lang.Object getSubscriptionParameter(ValueCache<?> cache, ConnectionPayload connection)
          The parameters required to open a monitor for the channel.
 int match(ValueCache<?> cache, ConnectionPayload connection)
          Determines whether the converter can take values from the channel described by the connection payload and transform them in a type required by the cache.
 boolean updateCache(ValueCache cache, ConnectionPayload connection, MessagePayload message)
          Takes the information in the message and updates the cache.
 

Method Detail

match

int match(ValueCache<?> cache,
          ConnectionPayload connection)
Determines whether the converter can take values from the channel described by the connection payload and transform them in a type required by the cache.

Parameters:
cache - the cache where data will need to be written
connection - the connection information
Returns:
zero if there is no match, or the position of the type matched

getSubscriptionParameter

java.lang.Object getSubscriptionParameter(ValueCache<?> cache,
                                          ConnectionPayload connection)
The parameters required to open a monitor for the channel. The type of the parameters will be datasource specific

For channels multiplexed on a single subscription, this method is never used.

Parameters:
cache - the cache where data will need to be written
connection - the connection information
Returns:
datasource specific subscription information

updateCache

boolean updateCache(ValueCache cache,
                    ConnectionPayload connection,
                    MessagePayload message)
Takes the information in the message and updates the cache.

Parameters:
cache - cache to be updated
connection - the connection information
message - the payload of each message
Returns:
true if a new value was stored