use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.
the class AbstractXmlConfigHelper method parseSocketInterceptorConfig.
protected SocketInterceptorConfig parseSocketInterceptorConfig(final Node node) {
SocketInterceptorConfig socketInterceptorConfig = new SocketInterceptorConfig();
final NamedNodeMap atts = node.getAttributes();
final Node enabledNode = atts.getNamedItem("enabled");
final boolean enabled = enabledNode != null && getBooleanValue(getTextContent(enabledNode).trim());
socketInterceptorConfig.setEnabled(enabled);
for (Node n : childElements(node)) {
final String nodeName = cleanNodeName(n);
if ("class-name".equals(nodeName)) {
socketInterceptorConfig.setClassName(getTextContent(n).trim());
} else if ("properties".equals(nodeName)) {
fillProperties(n, socketInterceptorConfig.getProperties());
}
}
return socketInterceptorConfig;
}
use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.
the class XmlConfigBuilder method handleSecurityPermission.
private void handleSecurityPermission(Node node, PermissionType type) throws Exception {
SecurityConfig cfg = config.getSecurityConfig();
NamedNodeMap attrs = node.getAttributes();
Node nameNode = attrs.getNamedItem("name");
String name = nameNode != null ? getTextContent(nameNode) : "*";
Node principalNode = attrs.getNamedItem("principal");
String principal = principalNode != null ? getTextContent(principalNode) : "*";
PermissionConfig permConfig = new PermissionConfig(type, name, principal);
cfg.addClientPermissionConfig(permConfig);
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("endpoints".equals(nodeName)) {
handleSecurityPermissionEndpoints(child, permConfig);
} else if ("actions".equals(nodeName)) {
handleSecurityPermissionActions(child, permConfig);
}
}
}
use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.
the class XmlConfigBuilder method handleSecurityInterceptors.
private void handleSecurityInterceptors(Node node) throws Exception {
SecurityConfig cfg = config.getSecurityConfig();
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if ("interceptor".equals(nodeName)) {
NamedNodeMap attrs = child.getAttributes();
Node classNameNode = attrs.getNamedItem("class-name");
String className = getTextContent(classNameNode);
cfg.addSecurityInterceptorConfig(new SecurityInterceptorConfig(className));
}
}
}
use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.
the class XmlConfigBuilder method queryCachePredicateHandler.
private void queryCachePredicateHandler(Node childNode, QueryCacheConfig queryCacheConfig) {
NamedNodeMap predicateAttributes = childNode.getAttributes();
String predicateType = getTextContent(predicateAttributes.getNamedItem("type"));
String textContent = getTextContent(childNode);
PredicateConfig predicateConfig = new PredicateConfig();
if ("class-name".equals(predicateType)) {
predicateConfig.setClassName(textContent);
} else if ("sql".equals(predicateType)) {
predicateConfig.setSql(textContent);
}
queryCacheConfig.setPredicateConfig(predicateConfig);
}
use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.
the class XmlConfigBuilder method createQueueStoreConfig.
private QueueStoreConfig createQueueStoreConfig(Node node) {
QueueStoreConfig queueStoreConfig = new QueueStoreConfig();
NamedNodeMap atts = node.getAttributes();
for (int a = 0; a < atts.getLength(); a++) {
Node att = atts.item(a);
String value = getTextContent(att).trim();
if (att.getNodeName().equals("enabled")) {
queueStoreConfig.setEnabled(getBooleanValue(value));
}
}
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
if ("class-name".equals(nodeName)) {
queueStoreConfig.setClassName(getTextContent(n).trim());
} else if ("factory-class-name".equals(nodeName)) {
queueStoreConfig.setFactoryClassName(getTextContent(n).trim());
} else if ("properties".equals(nodeName)) {
fillProperties(n, queueStoreConfig.getProperties());
}
}
return queueStoreConfig;
}
Aggregations