DESY ACOP Beans Home

de.desy.acop.transport.adapters
Class ReverseConsumer

java.lang.Object
  extended by de.desy.acop.transport.adapters.ReverseConsumer
All Implemented Interfaces:
DataConsumer, NonblockingNumberConsumer, SynchronousNumberConsumer

public class ReverseConsumer
extends java.lang.Object
implements SynchronousNumberConsumer, NonblockingNumberConsumer

ReverseConsumer is an implementation consumer that is attached to those consumers which also act as data sources. This consumers receive data from those sources and forward it to the TINE channel.

Author:
Jaka Bobnar, Cosylab

Field Summary
static java.lang.Class<?>[] SUPPORTED_CONSUMER_TYPES
          Supporter consumer types
 
Constructor Summary
ReverseConsumer(ConnectionParameters param, AcopTransport tran, int size)
           
 
Method Summary
 DataConsumer getDataConsumer(java.lang.Class type)
           Returns data consumer for requested data consumer type.
 DataConsumer getDefaultDataConsumer()
          Returns the implementation of default consumer type supported by this data consumer.
 java.lang.String getName()
          Returns name of this data consumer.
 java.lang.String[] getSupportedCharacteristics()
          Resturns array with names of supported characteristics.
 java.lang.Class[] getSupportedConsumerTypes()
          Returns array of supported data consumer types, which can be used as parameter and returnned with getDataCosnumer(Class) method.
 void release()
          Releases this consumer.
 void setCharacteristics(java.util.Map attributes)
          Sets new dynamic value characteristics to this data consumer.
 void updateDataState(DataState state)
          Push data state (quality) update change for dynamic value.
 void updateNonblocking(java.lang.Number value)
          Notifys this consumer about new dynamic value update.
 void updateSynchronously(long timestamp, java.lang.Number value)
          Notifys this consumer about new dynamic value update.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUPPORTED_CONSUMER_TYPES

public static final java.lang.Class<?>[] SUPPORTED_CONSUMER_TYPES
Supporter consumer types

Constructor Detail

ReverseConsumer

public ReverseConsumer(ConnectionParameters param,
                       AcopTransport tran,
                       int size)
Method Detail

getDataConsumer

public DataConsumer getDataConsumer(java.lang.Class type)
Description copied from interface: DataConsumer

Returns data consumer for requested data consumer type. If this data consumer does not support required data consumer, null is returned.

If this data cosnumer does not support specific data consumer type, then it means, that it is not desirable to cast data of that type to any by this consumer supported data consumer types.

Specified by:
getDataConsumer in interface DataConsumer
Parameters:
type - Class of specific data consumer (e.g. DoubleConsumer)
Returns:
implementation of required data consumer or null if not supported

getDefaultDataConsumer

public DataConsumer getDefaultDataConsumer()
Description copied from interface: DataConsumer
Returns the implementation of default consumer type supported by this data consumer.

Specified by:
getDefaultDataConsumer in interface DataConsumer
Returns:
the implementation of default consumer type supported by this data consumer

updateDataState

public void updateDataState(DataState state)
Description copied from interface: DataConsumer
Push data state (quality) update change for dynamic value. Usually called by data source.

Specified by:
updateDataState in interface DataConsumer
Parameters:
state - new data state(quality) descriptor

setCharacteristics

public void setCharacteristics(java.util.Map attributes)
Description copied from interface: DataConsumer
Sets new dynamic value characteristics to this data consumer. This is usually called only at initializaation, before first data state or value is updated. Usually carries characteristics such as value minimum or maximum. Name and meaning of atributes is defined with contract betwean data consumer and source implementation.

Specified by:
setCharacteristics in interface DataConsumer
Parameters:
attributes - the Map with attri

getName

public java.lang.String getName()
Description copied from interface: DataConsumer
Returns name of this data consumer.

Specified by:
getName in interface DataConsumer
Returns:
the name of this data consumer

getSupportedCharacteristics

public java.lang.String[] getSupportedCharacteristics()
Description copied from interface: DataConsumer
Resturns array with names of supported characteristics. Data source can use this method to optimize setting characteristics to this data consumer. If arrray of length 0 is return, then consumer does not need or support any characteristic. If null is returned, than consumer expect all existing characteristics from data source.

Specified by:
getSupportedCharacteristics in interface DataConsumer
Returns:
array with names of supported characteristics

getSupportedConsumerTypes

public java.lang.Class[] getSupportedConsumerTypes()
Description copied from interface: DataConsumer
Returns array of supported data consumer types, which can be used as parameter and returnned with getDataCosnumer(Class) method.

Specified by:
getSupportedConsumerTypes in interface DataConsumer
Returns:
array of supported data consumer types

updateSynchronously

public void updateSynchronously(long timestamp,
                                java.lang.Number value)
                         throws CommonException
Description copied from interface: SynchronousNumberConsumer
Notifys this consumer about new dynamic value update.

Specified by:
updateSynchronously in interface SynchronousNumberConsumer
Parameters:
timestamp - the time of dynamic value event
value - new value
Throws:
CommonException

updateNonblocking

public void updateNonblocking(java.lang.Number value)
Description copied from interface: NonblockingNumberConsumer
Notifys this consumer about new dynamic value update.

Specified by:
updateNonblocking in interface NonblockingNumberConsumer
Parameters:
value - new value

release

public void release()
Releases this consumer.



Copyright © 2010. All Rights Reserved.