public class MockDataSource extends DataSource
Constructor and Description |
---|
MockDataSource() |
Modifier and Type | Method and Description |
---|---|
void |
connectRead(ReadRecipe recipe)
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 recipe)
Disconnects the set of channels given by the recipe.
|
void |
disconnectWrite(WriteRecipe writeRecipe)
Releases the resources associated with the given write recipe.
|
List<ChannelReadRecipe> |
getConnectedReadRecipes() |
List<ChannelWriteRecipe> |
getConnectedWriteRecipes() |
ReadRecipe |
getReadRecipe() |
WriteRecipe |
getWriteRecipe() |
WriteRecipe |
getWriteRecipeForWrite() |
void |
write(WriteRecipe writeRecipe,
Runnable callback,
ExceptionHandler exceptionHandler)
Writes the contents in the given write recipe to the channels
of this data sources.
|
channelHandlerLookupName, channelHandlerRegisterName, close, getChannels, isWriteable
protected ChannelHandler createChannel(String channelName)
DataSource
createChannel
in class DataSource
channelName
- the name for a new channelpublic void connectRead(ReadRecipe recipe)
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
recipe
- the instructions for the data connectionpublic void disconnectRead(ReadRecipe recipe)
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
recipe
- 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 usedpublic void write(WriteRecipe writeRecipe, Runnable callback, ExceptionHandler exceptionHandler)
DataSource
The write recipe needs to be first prepared with DataSource.connectWrite(org.epics.pvmanager.WriteRecipe)
and then cleaned up with DataSource.disconnectWrite(org.epics.pvmanager.WriteRecipe)
.
write
in class DataSource
writeRecipe
- the recipe containing the data to writecallback
- function to call when the write is concludedexceptionHandler
- where to report the exceptionspublic ReadRecipe getReadRecipe()
public WriteRecipe getWriteRecipe()
public WriteRecipe getWriteRecipeForWrite()
public List<ChannelReadRecipe> getConnectedReadRecipes()
public List<ChannelWriteRecipe> getConnectedWriteRecipes()
Copyright © 2010–2015. All rights reserved.