public class CompositeDataSource extends DataSource
| Constructor and Description |
|---|
CompositeDataSource()
Creates a new CompositeDataSource.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes all DataSources that are registered in the composite.
|
void |
connectRead(ReadRecipe readRecipe)
Connects to a set of channels based on the given recipe.
|
void |
connectWrite(WriteRecipe writeRecipe)
Prepares the channels defined in the write recipe for writes.
|
protected ChannelHandler |
createChannel(String channelName)
Creates a channel handler for the given name.
|
void |
disconnectRead(ReadRecipe readRecipe)
Disconnects the set of channels given by the recipe.
|
void |
disconnectWrite(WriteRecipe writeRecipe)
Releases the resources associated with the given write recipe.
|
Map<String,ChannelHandler> |
getChannels()
Returns the channel handlers for this data source.
|
CompositeDataSourceConfiguration |
getConfiguration()
The configuration used for the composite data source.
|
Map<String,DataSourceProvider> |
getDataSourceProviders()
Returns the data source providers registered to this composite data source.
|
Map<String,DataSource> |
getDataSources()
Returns the data sources used by this composite data source.
|
void |
putDataSource(DataSourceProvider dataSourceProvider)
Adds/replaces the data source corresponding to the given name.
|
void |
putDataSource(String name,
DataSource dataSource)
Adds/replaces the data source corresponding to the given name.
|
void |
setConfiguration(CompositeDataSourceConfiguration conf)
Changes the composite data source configuration.
|
channelHandlerLookupName, channelHandlerRegisterName, isWriteable, writepublic CompositeDataSource()
public CompositeDataSourceConfiguration getConfiguration()
public void setConfiguration(CompositeDataSourceConfiguration conf)
NOTE: the configuration should be changed before any channel is opened. The result of later changes is not well defined.
conf - the new configuration; can't be nullpublic void putDataSource(String name, DataSource dataSource)
name - the name of the data sourcedataSource - the data source to add/replacepublic void putDataSource(DataSourceProvider dataSourceProvider)
dataSourceProvider - the data source to add/replacepublic Map<String,DataSource> getDataSources()
Returns only the data sources that have been created.
public Map<String,DataSourceProvider> getDataSourceProviders()
Returns all registered data sources.
public void connectRead(ReadRecipe readRecipe)
DataSourceThe 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.
connectRead in class DataSourcereadRecipe - the instructions for the data connectionpublic void disconnectRead(ReadRecipe readRecipe)
DataSourceThe 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.
disconnectRead in class DataSourcereadRecipe - the instructions for the data connectionpublic void connectWrite(WriteRecipe writeRecipe)
DataSourceIf these are channels over the network, it will create the network connections with the underlying libraries.
connectWrite in class DataSourcewriteRecipe - the recipe that will contain the write datapublic void disconnectWrite(WriteRecipe writeRecipe)
DataSourceWill close network channels and deallocate memory needed.
disconnectWrite in class DataSourcewriteRecipe - the recipe that will no longer be usedprotected ChannelHandler createChannel(String channelName)
DataSourcecreateChannel in class DataSourcechannelName - the name for a new channelpublic void close()
close in class DataSourcepublic Map<String,ChannelHandler> getChannels()
DataSourcegetChannels in class DataSourceCopyright © 2015. All rights reserved.