org.epics.pvmanager
Class CompositeDataSource

java.lang.Object
  extended by org.epics.pvmanager.DataSource
      extended by org.epics.pvmanager.CompositeDataSource

public class CompositeDataSource
extends DataSource

A data source that can dispatch a request to multiple different data sources.

Author:
carcassi

Nested Class Summary
 
Nested classes/interfaces inherited from class org.epics.pvmanager.DataSource
DataSource.ValueProcessor<P,V>
 
Constructor Summary
CompositeDataSource()
           
 
Method Summary
 void connect(DataRecipe recipe)
          Connects to a set of channels based on the given recipe.
 void disconnect(DataRecipe recipe)
          Disconnects the set of channels given by the recipe.
 java.lang.String getDefaultDataSource()
          Returns which data source is used if no data source is specified in the channel name.
 java.lang.String getDelimiter()
          Returns the delimeter that divides the data source name from the channel name.
 void putDataSource(java.lang.String name, DataSource dataSource)
          Adds/replaces the data source corresponding to the given name.
 void setDefaultDataSource(java.lang.String defaultDataSource)
          Sets the data source to be used if the channel does not specify one explicitely.
 void setDelimiter(java.lang.String delimiter)
          Changes the data source delimiter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeDataSource

public CompositeDataSource()
Method Detail

getDelimiter

public java.lang.String getDelimiter()
Returns the delimeter that divides the data source name from the channel name. Default is "://" so that "epics://pv1" corresponds to the "pv1" channel from the "epics" datasource.

Returns:
data source delimeter; can't be null

setDelimiter

public void setDelimiter(java.lang.String delimiter)
Changes the data source delimiter.

Parameters:
delimiter - new data source delimiter; can't be null

putDataSource

public void putDataSource(java.lang.String name,
                          DataSource dataSource)
Adds/replaces the data source corresponding to the given name.

Parameters:
name - the name of the data source
dataSource - the data source to add/replace

getDefaultDataSource

public java.lang.String getDefaultDataSource()
Returns which data source is used if no data source is specified in the channel name.

Returns:
the default data source, or null if it was never set

setDefaultDataSource

public void setDefaultDataSource(java.lang.String defaultDataSource)
Sets the data source to be used if the channel does not specify one explicitely. The data source must have already been added.

Parameters:
defaultDataSource - the default data source

connect

public void connect(DataRecipe recipe)
Description copied from class: DataSource
Connects to a set of channels based on the given recipe.

The data source must update the value caches relative to each channel. Before updating any cache, it must lock the collector relative to that cache and after any update it must notify the collector.

Specified by:
connect in class DataSource
Parameters:
recipe - the instructions for the data connection

disconnect

public void disconnect(DataRecipe recipe)
Description copied from class: DataSource
Disconnects the set of channels given by the recipe.

The disconnect call is guaranteed to be given the same object, so that the recipe itself can be used as a key in a map to retrieve the list of resources needed to be closed.

Specified by:
disconnect in class DataSource
Parameters:
recipe - the instructions for the data connection


Copyright © 2011. All Rights Reserved.