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.
|
Map<String,DataSource> |
getDataSources()
Returns the data sources registered to this composite data source.
|
String |
getDefaultDataSource()
Returns which data source is used if no data source is specified in the
channel name.
|
String |
getDelimiter()
Returns the delimeter that divides the data source name from the
channel name.
|
void |
putDataSource(String name,
DataSource dataSource)
Adds/replaces the data source corresponding to the given name.
|
void |
setDefaultDataSource(String defaultDataSource)
Sets the data source to be used if the channel does not specify
one explicitely.
|
void |
setDelimiter(String delimiter)
Changes the data source delimiter.
|
channelHandlerLookupName, channelHandlerRegisterName, isWriteable, write
public CompositeDataSource()
public String getDelimiter()
public void setDelimiter(String delimiter)
delimiter
- new data source delimiter; can't be nullpublic void putDataSource(String name, DataSource dataSource)
name
- the name of the data sourcedataSource
- the data source to add/replacepublic String getDefaultDataSource()
public Map<String,DataSource> getDataSources()
public void setDefaultDataSource(String defaultDataSource)
defaultDataSource
- the default data sourcepublic void connectRead(ReadRecipe readRecipe)
DataSource
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.
connectRead
in class DataSource
readRecipe
- the instructions for the data connectionpublic void disconnectRead(ReadRecipe readRecipe)
DataSource
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.
disconnectRead
in class DataSource
readRecipe
- the instructions for the data connectionpublic void connectWrite(WriteRecipe writeRecipe)
DataSource
If these are channels over the network, it will create the network connections with the underlying libraries.
connectWrite
in class DataSource
writeRecipe
- the recipe that will contain the write datapublic void disconnectWrite(WriteRecipe writeRecipe)
DataSource
Will close network channels and deallocate memory needed.
disconnectWrite
in class DataSource
writeRecipe
- the recipe that will no longer be usedprotected ChannelHandler createChannel(String channelName)
DataSource
createChannel
in class DataSource
channelName
- the name for a new channelpublic void close()
close
in class DataSource
public Map<String,ChannelHandler> getChannels()
DataSource
getChannels
in class DataSource
Copyright © 2010–2015. All rights reserved.