@ComponentProfile(summary="A Collection of Channels", tag="base") public class ChannelList extends java.util.AbstractCollection<Channel> implements ComponentLifecycle, java.util.List<Channel>, ComponentLifecycleExtension
Container for a collection of Channel
objects
In the adapter configuration file this class is aliased as channel-list which is the preferred alternative to the fully qualified classname when building your configuration.
Constructor and Description |
---|
ChannelList()
Creates a new instance.
|
ChannelList(java.util.Collection<Channel> coll) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(Channel element) |
void |
add(int index,
Channel element) |
boolean |
addAll(int index,
java.util.Collection<? extends Channel> c) |
void |
addChannel(Channel channel)
Adds a
Channel to the underlying List and validates its unique ID. |
void |
clear() |
void |
close()
Uses the the configured
ChannelLifecycleStrategy to invoke StateManagedComponent.requestClose() on the
underlying Channel s in the List . |
Channel |
get(int index) |
Channel |
getChannel(int pos)
Returns the
Channel stored at the passed pos in the List . |
Channel |
getChannel(java.lang.String uniqueId)
Returns the
Channel with the passed uniqueId or null if no such channel exists. |
java.util.List<Channel> |
getChannels()
Returns the underlying
List of Channel s. |
ChannelLifecycleStrategy |
getLifecycleStrategy() |
int |
indexOf(java.lang.Object o) |
void |
init()
Uses the the configured
ChannelLifecycleStrategy to invoke StateManagedComponent.requestInit() on the
underlying Channel s in the List . |
java.util.Iterator<Channel> |
iterator() |
int |
lastIndexOf(java.lang.Object o) |
java.util.ListIterator<Channel> |
listIterator() |
java.util.ListIterator<Channel> |
listIterator(int index) |
void |
prepare()
Make sure we are ready for initialisation.
|
Channel |
remove(int index) |
boolean |
remove(java.lang.Object o) |
boolean |
removeChannel(Channel channel)
Remove a channel from this channel list.
|
Channel |
set(int index,
Channel element) |
void |
setChannels(java.util.List<Channel> l)
Set the underlying
List of Channel s. |
void |
setLifecycleStrategy(ChannelLifecycleStrategy css)
Specify the strategy to use when handling channel lifecycle.
|
int |
size()
Returns the number of
Channel s in this ChannelList . |
void |
start()
Uses the the configured
ChannelLifecycleStrategy to invoke StateManagedComponent.requestStart() on the
underlying Channel s in the List . |
void |
stop()
Uses the the configured
ChannelLifecycleStrategy to invoke StateManagedComponent.requestStop() on the
underlying Channel s in the List . |
java.util.List<Channel> |
subList(int fromIndex,
int toIndex) |
addAll, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public ChannelList()
Creates a new instance.
public ChannelList(java.util.Collection<Channel> coll)
public void prepare() throws CoreException
prepare
in interface ComponentLifecycleExtension
CoreException
public void init() throws CoreException
Uses the the configured ChannelLifecycleStrategy
to invoke StateManagedComponent.requestInit()
on the
underlying Channel
s in the List
.
init
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
spublic void start() throws CoreException
Uses the the configured ChannelLifecycleStrategy
to invoke StateManagedComponent.requestStart()
on the
underlying Channel
s in the List
.
start
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
spublic void stop()
Uses the the configured ChannelLifecycleStrategy
to invoke StateManagedComponent.requestStop()
on the
underlying Channel
s in the List
.
stop
in interface ComponentLifecycle
public void close()
Uses the the configured ChannelLifecycleStrategy
to invoke StateManagedComponent.requestClose()
on the
underlying Channel
s in the List
.
close
in interface ComponentLifecycle
public java.util.List<Channel> getChannels()
Returns the underlying List
of Channel
s.
List
of Channels
public void setChannels(java.util.List<Channel> l)
Set the underlying List
of Channel
s.
l
- the underlying List
of Channels
public void addChannel(Channel channel)
Adds a Channel
to the underlying List
and validates its unique ID.
channel
- the Channel
to addpublic Channel getChannel(int pos)
Returns the Channel
stored at the passed pos
in the List
.
pos
- the position in the List
Channel
stored at the passed pos
in the List
public int size()
Returns the number of Channel
s in this ChannelList
.
public Channel getChannel(java.lang.String uniqueId)
Returns the Channel
with the passed uniqueId
or null if no such channel exists.
uniqueId
- the unique ID of the Channel to return, may not be null or emptyprepare()
has been called.public ChannelLifecycleStrategy getLifecycleStrategy()
public void setLifecycleStrategy(ChannelLifecycleStrategy css)
If not explicitly specified, then DefaultChannelLifecycleStrategy
will be used to handle the channel operations.
css
- the strategy to setDefaultChannelLifecycleStrategy
,
NonBlockingChannelStartStrategy
public java.util.Iterator<Channel> iterator()
public boolean remove(java.lang.Object o)
public boolean removeChannel(Channel channel)
channel
- public boolean add(Channel element)
public void add(int index, Channel element)
add
in interface java.util.List<Channel>
public boolean addAll(int index, java.util.Collection<? extends Channel> c)
addAll
in interface java.util.List<Channel>
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List<Channel>
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List<Channel>
public void clear()
public java.util.ListIterator<Channel> listIterator()
listIterator
in interface java.util.List<Channel>
public java.util.ListIterator<Channel> listIterator(int index)
listIterator
in interface java.util.List<Channel>
public Channel set(int index, Channel element)
set
in interface java.util.List<Channel>