org.epics.pvmanager.jca
Class JCATypeAdapter

java.lang.Object
  extended by org.epics.pvmanager.jca.JCATypeAdapter
All Implemented Interfaces:
DataSourceTypeAdapter<Channel,JCAMessagePayload>

public abstract class JCATypeAdapter
extends java.lang.Object
implements DataSourceTypeAdapter<Channel,JCAMessagePayload>

Type adapter for JCA data source. Will match a channel based on the value type provided and the array flag. Will match the cache based on the type class.

Author:
carcassi

Constructor Summary
JCATypeAdapter(java.lang.Class<?> typeClass, DBRType epicsValueType, DBRType epicsMetaType, java.lang.Boolean array)
          Creates a new type adapter.
 
Method Summary
abstract  java.lang.Object createValue(DBR value, DBR metadata, boolean disconnected)
          Given the value and the (optional) metadata, will create the new value.
 java.lang.Object getSubscriptionParameter(ValueCache cache, Channel channel)
          The parameters required to open a monitor for the channel.
 int match(ValueCache<?> cache, Channel channel)
          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, Channel channel, JCAMessagePayload message)
          Takes the information in the message and updates the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCATypeAdapter

public JCATypeAdapter(java.lang.Class<?> typeClass,
                      DBRType epicsValueType,
                      DBRType epicsMetaType,
                      java.lang.Boolean array)
Creates a new type adapter.

Parameters:
typeClass - the java type this adapter will create
epicsValueType - the epics type used for the monitor
epicsMetaType - the epics type for the get at connection time; null if no metadata is needed
array - true whether this will require an array type
Method Detail

match

public int match(ValueCache<?> cache,
                 Channel channel)
Description copied from interface: DataSourceTypeAdapter
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.

Specified by:
match in interface DataSourceTypeAdapter<Channel,JCAMessagePayload>
Parameters:
cache - the cache where data will need to be written
channel - the connection information
Returns:
zero if there is no match, or the position of the type matched

getSubscriptionParameter

public java.lang.Object getSubscriptionParameter(ValueCache cache,
                                                 Channel channel)
Description copied from interface: DataSourceTypeAdapter
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.

Specified by:
getSubscriptionParameter in interface DataSourceTypeAdapter<Channel,JCAMessagePayload>
Parameters:
cache - the cache where data will need to be written
channel - the connection information
Returns:
datasource specific subscription information

updateCache

public boolean updateCache(ValueCache cache,
                           Channel channel,
                           JCAMessagePayload message)
Description copied from interface: DataSourceTypeAdapter
Takes the information in the message and updates the cache.

Specified by:
updateCache in interface DataSourceTypeAdapter<Channel,JCAMessagePayload>
Parameters:
cache - cache to be updated
channel - the connection information
message - the payload of each message
Returns:
true if a new value was stored

createValue

public abstract java.lang.Object createValue(DBR value,
                                             DBR metadata,
                                             boolean disconnected)
Given the value and the (optional) metadata, will create the new value.

Parameters:
value - the value taken from the monitor
metadata - the value taken as metadata
disconnected - true if the value should report the channel is currently disconnected
Returns:
the new value