}
// matchers
Configuration child = components.getChild("matchers",false);
if (child != null) {
final DefaultServiceSelector matcherSelector = new DefaultServiceSelector();
m_defaultMatcher = child.getAttribute("default");
final Configuration[] matchers = child.getChildren("matcher");
for (int i = 0; i < matchers.length; i++) {
String name = matchers[i].getAttribute("name");
String src = matchers[i].getAttribute("src");
Matcher matcher = (Matcher) createComponent(src, matchers[i]);
matcherSelector.put(name, matcher);
}
matcherSelector.makeReadOnly();
if (!matcherSelector.isSelectable(m_defaultMatcher)) {
throw new ConfigurationException("Default matcher is not defined.");
}
m_manager.put(Matcher.ROLE+"Selector", matcherSelector);
}
// selectors
child = components.getChild("selectors",false);
if (child != null) {
final DefaultServiceSelector selectorSelector = new DefaultServiceSelector();
m_defaultSelector = child.getAttribute("default");
final Configuration[] selectors = child.getChildren("selector");
for (int i = 0; i < selectors.length; i++) {
String name = selectors[i].getAttribute("name");
String src = selectors[i].getAttribute("src");
Selector selector = (Selector) createComponent(src,selectors[i]);
selectorSelector.put(name,selector);
}
selectorSelector.makeReadOnly();
if (!selectorSelector.isSelectable(m_defaultSelector)) {
throw new ConfigurationException("Default selector is not defined.");
}
m_manager.put(Selector.ROLE+"Selector",selectorSelector);
}
// actions
child = components.getChild("actions",false);
if (child != null) {
final DefaultServiceSelector actionSelector = new DefaultServiceSelector();
m_defaultAction = child.getAttribute("default");
final Configuration[] actions = child.getChildren("action");
for (int i = 0; i < actions.length; i++) {
String name = actions[i].getAttribute("name");
String src = actions[i].getAttribute("src");
Action action = (Action) createComponent(src,actions[i]);
actionSelector.put(name,action);
}
actionSelector.makeReadOnly();
if (!actionSelector.isSelectable(m_defaultAction)) {
throw new ConfigurationException("Default action is not defined.");
}
m_manager.put(Action.ROLE+"Selector",actionSelector);
}