public static String getAttr(NamedNodeMap attrs, String name) { return getAttr(attrs,name,null); }
public static String getAttr(Node node, String name, String missing_err) { return getAttr(node.getAttributes(), name, missing_err); }
public static String getAttr(Node nd, String name) { return getAttr(nd.getAttributes(), name); }
private Properties readProperties(Config cfg, Node node) throws XPathExpressionException { XPath xpath = cfg.getXPath(); NodeList props = (NodeList) xpath.evaluate("property", node, XPathConstants.NODESET); Properties properties = new Properties(); for (int i=0; i<props.getLength(); i++) { Node prop = props.item(i); properties.setProperty(DOMUtil.getAttr(prop, "name"), DOMUtil.getAttr(prop, "value")); } return properties; } private boolean isShutDown = false;
public PluginInfo(Node node, String err, boolean requireName, boolean requireClass) { type = node.getNodeName(); name = DOMUtil.getAttr(node, "name", requireName ? err : null); className = DOMUtil.getAttr(node, "class", requireClass ? err : null); initArgs = DOMUtil.childNodesToNamedList(node); attributes = unmodifiableMap(DOMUtil.toMap(node.getAttributes())); children = loadSubPlugins(node); }
for (int i=0; i<nodes.getLength(); i++) { Node node = nodes.item( i ); String qstr = DOMUtil.getAttr( node, "text", "missing query 'text'" ); for (int j=0; j<children.getLength(); j++) { Node child = children.item(j); String id = DOMUtil.getAttr( child, "id", "missing 'id'" ); String e = DOMUtil.getAttr( child, EXCLUDE, null ); if( e != null ) { if( Boolean.valueOf( e ) ) {
private void initLibs() { NodeList nodes = (NodeList) evaluate("lib", XPathConstants.NODESET); if (nodes==null || nodes.getLength()==0) return; log.info("Adding specified lib dirs to ClassLoader"); for (int i=0; i<nodes.getLength(); i++) { Node node = nodes.item(i); String baseDir = DOMUtil.getAttr(node, "dir"); String path = DOMUtil.getAttr(node, "path"); if (null != baseDir) { // :TODO: add support for a simpler 'glob' mutually eclusive of regex String regex = DOMUtil.getAttr(node, "regex"); FileFilter filter = (null == regex) ? null : new RegexFileFilter(regex); getResourceLoader().addToClassLoader(baseDir, filter); } else if (null != path) { getResourceLoader().addToClassLoader(path); } else { throw new RuntimeException ("lib: missing mandatory attributes: 'dir' or 'path'"); } } } }
String analyzerName = DOMUtil.getAttr(attrs,"class"); if (analyzerName != null) { return (Analyzer)loader.newInstance(analyzerName);
String name = DOMUtil.getAttr(attrs,"name","field definition"); log.trace("reading field def "+name); String type = DOMUtil.getAttr(attrs,"type","field " + name); NamedNodeMap attrs = node.getAttributes(); String source = DOMUtil.getAttr(attrs,"source","copyField definition"); String dest = DOMUtil.getAttr(attrs,"dest", "copyField definition"); String maxChars = DOMUtil.getAttr(attrs, "maxChars"); int maxCharsInt = CopyField.UNLIMITED; if (maxChars != null) {
Node node = nodes.item(i); try { String names = DOMUtil.getAttr(node, "name", null); List<String> aliases = StrUtils.splitSmart(names,','); String name = aliases.get(0); CoreDescriptor p = new CoreDescriptor(this, name, DOMUtil.getAttr(node, "instanceDir", null)); String opt = DOMUtil.getAttr(node, "config", null); if (opt != null) { p.setConfigName(opt); opt = DOMUtil.getAttr(node, "schema", null); if (opt != null) { p.setSchemaName(opt); opt = DOMUtil.getAttr(node, "properties", null); if (opt != null) { p.setPropertiesName(opt); opt = DOMUtil.getAttr(node, CoreAdminParams.DATA_DIR, null); if (opt != null) { p.setDataDir(opt);