public interface ChannelSelector
AgentChannel satisfies certain criteria.
Selectors are created by calling one of the static compile(...) methods that convert
string representation of selectors into instances of ChannelSelector.
See AgentChannelsFilter for details on how string representations are interpreted.
| Modifier and Type | Field and Description |
|---|---|
static ChannelSelector |
ALL
Predefined selector that accepts all channels.
|
static Pattern |
pRegEx |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
accept(List<String> agents,
List<ChannelSelector> channelSelectors,
AgentChannel channel)
Checks whether the specified channel is accepted by at least one of the provided selectors.
|
static boolean |
accept(List<String> agents,
List<ChannelSelector> channelSelectors,
String originPath)
Checks whether the specified channel is accepted by at least one of the provided selectors.
|
static List<ChannelSelector> |
compile(Collection<String> rawSelectors)
Constructs selectors from their string representations (in path, template, or selector format).
|
static ChannelSelector |
compile(String rawSelector)
Constructs a selector based on a string in path, template, or selector format.
|
static <T extends AgentChannel> |
filter(AgentChannelsFilter filter,
Collection<T> channels)
Filters a list of channels, selecting those that might satisfy the provided filter, taking
into account its
List<String> getOriginChannels() and getAgents() methods. |
static <T extends AgentChannel> |
filter(List<String> agents,
List<ChannelSelector> channelSelectors,
Collection<T> channels)
Filters list of channels, selecting those that match at least one of the selectors.
|
static <T extends AgentChannel> |
filter(List<String> agents,
List<ChannelSelector> channelSelectors,
Collection<T> channels,
List<T> out)
Appends channels matching at least one of the selectors to the provided list.
|
static List<String> |
filterPaths(AgentChannelsFilter filter,
Collection<String> paths)
Filters a list of original channel paths, selecting those that might satisfy the provided filter, taking
into account its
List<String> getOriginChannels() and getAgents() methods. |
static List<String> |
filterPaths(List<String> agents,
List<ChannelSelector> channelSelectors,
Collection<String> paths)
Filters list of original channel paths, selecting those that match at least one of the selectors.
|
String |
getAgent()
Returns the name of the agent this selector is applicable to.
|
default boolean |
match(AgentChannel channel)
Checks whether the specified channel is accepted by this selector.
|
boolean |
match(String originPath)
Checks whether the specified channel path is accepted by this selector.
|
static final ChannelSelector ALL
static final Pattern pRegEx
static ChannelSelector compile(String rawSelector)
AgentStatusAggregator.addListener(...) for details.rawSelector - String representation of selector.ChannelSelector, or null if the provided string is not a valid representation of a channel selector.static List<ChannelSelector> compile(Collection<String> rawSelectors)
AgentStatusAggregator.addListener(...) for details.rawSelectors - String representations of selectors.ChannelSelector.static boolean accept(List<String> agents, List<ChannelSelector> channelSelectors, AgentChannel channel)
agents - Acceptable agents (null means all) for selectors that do not
explicitly specify agent (getAgent() method returns null).channelSelectors - Selectors to try. If null, any channel that belongs to one of
the specified agents is accepted.channel - Channel to check.static boolean accept(List<String> agents, List<ChannelSelector> channelSelectors, String originPath)
agents - Acceptable agents (null means all) for selectors that do not
explicitly specify agent (getAgent() method returns null).channelSelectors - Selectors to try. If null, any channel that belongs to one of
the specified agents is accepted.originPath - Original channel path to check.static <T extends AgentChannel> List<T> filter(List<String> agents, List<ChannelSelector> channelSelectors, Collection<T> channels)
T - AgentChannel type.agents - Acceptable agents (null means all) for selectors that do not
explicitly specify agent (getAgent() method returns null).channelSelectors - Selectors to try. If null, any channel that belongs to one of
the specified agents is accepted.channels - List of candidate channels.static <T extends AgentChannel> List<T> filter(AgentChannelsFilter filter, Collection<T> channels)
List<String> getOriginChannels() and getAgents() methods.T - AgentChannel type.filter - Filter.channels - List of candidate channels.static List<String> filterPaths(List<String> agents, List<ChannelSelector> channelSelectors, Collection<String> paths)
agents - Acceptable agents (null means all) for selectors that do not
explicitly specify agent (getAgent() method returns null).channelSelectors - Selectors to try. If null, any channel that belongs to one of
the specified agents is accepted.paths - List of candidate paths.static List<String> filterPaths(AgentChannelsFilter filter, Collection<String> paths)
List<String> getOriginChannels() and getAgents() methods.
Attribute selectors are ignored by this method.filter - Filter.paths - List of candidate paths.static <T extends AgentChannel> List<T> filter(List<String> agents, List<ChannelSelector> channelSelectors, Collection<T> channels, List<T> out)
T - Type of input and output lists, subclass of AgentChannel.agents - channelSelectors - channels - out - String getAgent()
null if this selector might be applicable to multiple agents.default boolean match(AgentChannel channel)
channel - Channel to check.true if the channel satisfies the criteria of this selector.boolean match(String originPath)
originPath - Original channel path to check.true if the channel satisfies the criteria of this selector.Copyright © 2023 LSST. All rights reserved.