Search in sources :

Example 86 with NamedNodeMap

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;
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) Node(org.w3c.dom.Node)

Example 87 with NamedNodeMap

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);
        }
    }
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) Node(org.w3c.dom.Node)

Example 88 with NamedNodeMap

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));
        }
    }
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) Node(org.w3c.dom.Node)

Example 89 with NamedNodeMap

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);
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap)

Example 90 with NamedNodeMap

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;
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) Node(org.w3c.dom.Node)

Aggregations

NamedNodeMap (org.w3c.dom.NamedNodeMap)993 Node (org.w3c.dom.Node)690 NodeList (org.w3c.dom.NodeList)339 Attr (org.w3c.dom.Attr)295 Element (org.w3c.dom.Element)238 Document (org.w3c.dom.Document)154 ArrayList (java.util.ArrayList)92 HashMap (java.util.HashMap)91 DocumentBuilder (javax.xml.parsers.DocumentBuilder)59 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)58 IOException (java.io.IOException)53 SAXException (org.xml.sax.SAXException)41 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)40 List (java.util.List)36 Map (java.util.Map)33 File (java.io.File)27 InputStream (java.io.InputStream)26 CMNamedNodeMap (org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap)25 DOMException (org.w3c.dom.DOMException)25 ByteArrayInputStream (java.io.ByteArrayInputStream)19