Search in sources :

Example 1 with SimplePrefixLocalDataNameFilter

use of net.sourceforge.processdash.data.repository.SimplePrefixLocalDataNameFilter in project processdash by dtuma.

the class DefaultImportInstructionSpecProvider method scanForInstructions.

private void scanForInstructions() {
    Iterator keys = data.getKeys(null, new SimplePrefixLocalDataNameFilter(new PatternList(INSTRUCTIONS_DATANAME)));
    while (keys.hasNext()) {
        String dataName = (String) keys.next();
        if (!dataName.endsWith("/" + INSTRUCTIONS_DATANAME))
            continue;
        ListData l = ListData.asListData(data.getSimpleValue(dataName));
        if (l == null || !l.test())
            continue;
        for (int i = 1; i < l.size(); i += 2) {
            String id = l.get(i - 1).toString();
            if (cache.containsKey(id))
                continue;
            String spec = l.get(i).toString();
            Element specXml;
            try {
                specXml = parseSpec(spec).getDocumentElement();
            } catch (Exception e) {
                specXml = null;
            }
            cache.put(id, specXml);
        }
    }
}
Also used : SimplePrefixLocalDataNameFilter(net.sourceforge.processdash.data.repository.SimplePrefixLocalDataNameFilter) Element(org.w3c.dom.Element) Iterator(java.util.Iterator) PatternList(net.sourceforge.processdash.util.PatternList) IOException(java.io.IOException) SAXException(org.xml.sax.SAXException) ListData(net.sourceforge.processdash.data.ListData)

Aggregations

IOException (java.io.IOException)1 Iterator (java.util.Iterator)1 ListData (net.sourceforge.processdash.data.ListData)1 SimplePrefixLocalDataNameFilter (net.sourceforge.processdash.data.repository.SimplePrefixLocalDataNameFilter)1 PatternList (net.sourceforge.processdash.util.PatternList)1 Element (org.w3c.dom.Element)1 SAXException (org.xml.sax.SAXException)1