use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.
the class XmlConfigBuilder method handleSet.
private void handleSet(Node node) {
Node attName = node.getAttributes().getNamedItem("name");
String name = getTextContent(attName);
SetConfig sConfig = new SetConfig();
sConfig.setName(name);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
String value = getTextContent(n).trim();
if ("max-size".equals(nodeName)) {
sConfig.setMaxSize(getIntegerValue("max-size", value));
} else if ("backup-count".equals(nodeName)) {
sConfig.setBackupCount(getIntegerValue("backup-count", value));
} else if ("async-backup-count".equals(nodeName)) {
sConfig.setAsyncBackupCount(getIntegerValue("async-backup-count", value));
} else if ("item-listeners".equals(nodeName)) {
for (Node listenerNode : childElements(n)) {
if ("item-listener".equals(cleanNodeName(listenerNode))) {
NamedNodeMap attrs = listenerNode.getAttributes();
boolean incValue = getBooleanValue(getTextContent(attrs.getNamedItem("include-value")));
String listenerClass = getTextContent(listenerNode);
sConfig.addItemListenerConfig(new ItemListenerConfig(listenerClass, incValue));
}
}
} else if ("statistics-enabled".equals(nodeName)) {
sConfig.setStatisticsEnabled(getBooleanValue(value));
}
}
this.config.addSetConfig(sConfig);
}
use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.
the class XmlConfigBuilder method handleTcpIp.
private void handleTcpIp(Node node) {
NamedNodeMap atts = node.getAttributes();
JoinConfig join = config.getNetworkConfig().getJoin();
TcpIpConfig tcpIpConfig = join.getTcpIpConfig();
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
String value = getTextContent(att).trim();
if (att.getNodeName().equals("enabled")) {
tcpIpConfig.setEnabled(getBooleanValue(value));
} else if (att.getNodeName().equals("connection-timeout-seconds")) {
tcpIpConfig.setConnectionTimeoutSeconds(getIntegerValue("connection-timeout-seconds", value));
}
}
Set<String> memberTags = new HashSet<String>(Arrays.asList("interface", "member", "members"));
for (Node n : childElements(node)) {
String value = getTextContent(n).trim();
if (cleanNodeName(n).equals("member-list")) {
handleMemberList(n);
} else if (cleanNodeName(n).equals("required-member")) {
if (tcpIpConfig.getRequiredMember() != null) {
throw new InvalidConfigurationException("Duplicate required-member" + " definition found in XML configuration. ");
}
tcpIpConfig.setRequiredMember(value);
} else if (memberTags.contains(cleanNodeName(n))) {
tcpIpConfig.addMember(value);
}
}
}
use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.
the class XmlConfigBuilder method handleInterfaces.
private void handleInterfaces(Node node) {
NamedNodeMap atts = node.getAttributes();
InterfacesConfig interfaces = config.getNetworkConfig().getInterfaces();
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
if ("enabled".equals(att.getNodeName())) {
String value = att.getNodeValue();
interfaces.setEnabled(getBooleanValue(value));
}
}
for (Node n : childElements(node)) {
if ("interface".equals(lowerCaseInternal(cleanNodeName(n)))) {
String value = getTextContent(n).trim();
interfaces.addInterface(value);
}
}
}
use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.
the class XmlConfigBuilder method handleManagementCenterConfig.
private void handleManagementCenterConfig(Node node) {
NamedNodeMap attrs = node.getAttributes();
Node enabledNode = attrs.getNamedItem("enabled");
boolean enabled = enabledNode != null && getBooleanValue(getTextContent(enabledNode));
Node intervalNode = attrs.getNamedItem("update-interval");
int interval = intervalNode != null ? getIntegerValue("update-interval", getTextContent(intervalNode)) : ManagementCenterConfig.UPDATE_INTERVAL;
String url = getTextContent(node);
ManagementCenterConfig managementCenterConfig = config.getManagementCenterConfig();
managementCenterConfig.setEnabled(enabled);
managementCenterConfig.setUpdateInterval(interval);
managementCenterConfig.setUrl("".equals(url) ? null : url);
}
use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.
the class XmlConfigBuilder method handleAWS.
private void handleAWS(Node node) {
JoinConfig join = config.getNetworkConfig().getJoin();
NamedNodeMap atts = node.getAttributes();
AwsConfig awsConfig = join.getAwsConfig();
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
String value = getTextContent(att).trim();
if ("enabled".equals(lowerCaseInternal(att.getNodeName()))) {
awsConfig.setEnabled(getBooleanValue(value));
} else if (att.getNodeName().equals("connection-timeout-seconds")) {
awsConfig.setConnectionTimeoutSeconds(getIntegerValue("connection-timeout-seconds", value));
}
}
for (Node n : childElements(node)) {
String value = getTextContent(n).trim();
if ("secret-key".equals(cleanNodeName(n))) {
awsConfig.setSecretKey(value);
} else if ("access-key".equals(cleanNodeName(n))) {
awsConfig.setAccessKey(value);
} else if ("region".equals(cleanNodeName(n))) {
awsConfig.setRegion(value);
} else if ("host-header".equals(cleanNodeName(n))) {
awsConfig.setHostHeader(value);
} else if ("security-group-name".equals(cleanNodeName(n))) {
awsConfig.setSecurityGroupName(value);
} else if ("tag-key".equals(cleanNodeName(n))) {
awsConfig.setTagKey(value);
} else if ("tag-value".equals(cleanNodeName(n))) {
awsConfig.setTagValue(value);
} else if ("iam-role".equals(cleanNodeName(n))) {
awsConfig.setIamRole(value);
}
}
}
Aggregations