use of org.jgroups.conf.XmlNode in project JGroups by belaban.
the class RelayConfig method parseBridges.
protected static void parseBridges(SiteConfig site_config, XmlNode root) throws Exception {
List<XmlNode> children = root.getChildren();
if (children == null || children.isEmpty())
return;
for (XmlNode node : children) {
String node_name = node.getName();
match(BRIDGE, node_name);
Map<String, String> attrs = node.getAttributes();
if (attrs == null || attrs.isEmpty())
continue;
String name = attrs.get("name");
String config = attrs.get("config");
BridgeConfig bridge_config = new PropertiesBridgeConfig(name, config);
site_config.addBridge(bridge_config);
}
}
use of org.jgroups.conf.XmlNode in project JGroups by belaban.
the class RelayConfig method parse.
public static void parse(XmlNode root, final Map<String, SiteConfig> map) throws Exception {
match(RELAY_CONFIG, root.getName());
List<XmlNode> children = root.getChildren();
if (children == null || children.isEmpty())
return;
for (XmlNode node : children) {
match(SITES, node.getName());
parseSites(map, node);
}
}
use of org.jgroups.conf.XmlNode in project JGroups by belaban.
the class ForkConfig method parse.
public static Map<String, List<ProtocolConfiguration>> parse(XmlNode root) throws Exception {
match(FORK_STACKS, root.getName());
List<XmlNode> children = root.getChildren();
if (children == null || children.isEmpty())
return null;
Map<String, List<ProtocolConfiguration>> map = new HashMap<>();
for (XmlNode node : children) {
match(FORK_STACK, node.getName());
parseForkStack(map, node);
}
return map;
}
use of org.jgroups.conf.XmlNode in project JGroups by belaban.
the class ForkConfig method parseForkStack.
protected static void parseForkStack(final Map<String, List<ProtocolConfiguration>> map, XmlNode root) throws Exception {
List<XmlNode> children = root.getChildren();
if (children == null || children.isEmpty())
return;
Map<String, String> attributes = root.getAttributes();
String fork_stack_id = attributes.get(ID);
if (map.containsKey(fork_stack_id))
throw new IllegalStateException("duplicate fork-stack ID: \"" + fork_stack_id + "\"");
for (XmlNode node : children) {
List<ProtocolConfiguration> protocols = XmlConfigurator.parseProtocols(node);
map.put(fork_stack_id, protocols);
}
}
use of org.jgroups.conf.XmlNode in project JGroups by belaban.
the class RelayConfig method parseSites.
protected static void parseSites(final Map<String, SiteConfig> map, XmlNode root) throws Exception {
List<XmlNode> children = root.getChildren();
if (children == null || children.isEmpty())
return;
for (XmlNode node : children) {
match(SITE, node.getName());
Map<String, String> attrs = node.getAttributes();
if (attrs == null || attrs.isEmpty() || !attrs.containsKey("name"))
throw new IllegalStateException(String.format("site must have a name (attrs: %s)", attrs));
String site_name = attrs.get("name");
if (map.containsKey(site_name))
throw new Exception("Site \"" + site_name + "\" already defined");
SiteConfig site_config = new SiteConfig(site_name);
map.put(site_name, site_config);
parseBridgesAndForwards(site_config, node);
}
}
Aggregations