public String getToolUsage() { return toolspec.getAnnotation(); }
public String getDetailedUsage(String id) { String result = null; Element element = toolspec.getElementById(id); List<Element> annotations = DOMUtils.findAllElementsByTagNameNS(element, Tool.TOOL_SPEC_PUBLIC_ID, "annotation"); if ((annotations != null) && (!annotations.isEmpty())) { result = annotations.get(0).getFirstChild().getNodeValue(); } return result; }
public List<String> getOutstreamIds() { List<String> res = new ArrayList<>(); Element streams = getStreams(); if (streams != null) { List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(streams, Tool.TOOL_SPEC_PUBLIC_ID, "outstream"); for (Element elem : elemList) { res.add(elem.getAttribute("id")); } } return Collections.unmodifiableList(res); }
spec = new ToolSpec(toolspecStream, false);
Element usage = toolspec.getUsage(); List<Element> usageForms = toolspec.getUsageForms(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Found " + usageForms.size()
public String getUsage() throws TransformerException, IOException { // REVISIT: style usage document into a form more readily output as a // usage message try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream in = getClass().getResourceAsStream("usage.xsl")) { toolspec.transform(in, baos); return baos.toString(); } }
public Tool getHandler() throws ToolException { if (!hasHandler()) { return null; } if (handler == null) { String handlerClz = doc.getDocumentElement().getAttribute("handler"); try { handler = (Tool)Class.forName(handlerClz).newInstance(); } catch (Exception ex) { Message message = new Message("FAIL_TO_INSTANTIATE_HANDLER", LOG, handlerClz); throw new ToolException(message, ex); } } return handler; }
public List<Element> getUsageForms() { return DOMUtils.findAllElementsByTagNameNS(getUsage(), Tool.TOOL_SPEC_PUBLIC_ID, "form"); }
public String[] getParameters(String name) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Getting parameters for " + name); } List<Object> result = new ArrayList<>(); if (values != null) { for (Element el : values) { if (el.getAttribute("name").equals(name)) { if (el.hasChildNodes()) { result.add(el.getFirstChild().getNodeValue()); } else { result.add("true"); } } } } if (result.isEmpty()) { String def = toolspec.getParameterDefault(name); if (def != null) { result.add(def); } } return result.toArray(new String[0]); }
spec = new ToolSpec(toolspecStream, false);
Element usage = toolspec.getUsage(); List<Element> usageForms = toolspec.getUsageForms(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Found " + usageForms.size()
public String getUsage() throws TransformerException, IOException { // REVISIT: style usage document into a form more readily output as a // usage message try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream in = getClass().getResourceAsStream("usage.xsl")) { toolspec.transform(in, baos); return baos.toString(); } }
public Tool getHandler(ClassLoader loader) throws ToolException { if (!hasHandler()) { return null; } if (handler == null) { String handlerClz = doc.getDocumentElement().getAttribute("handler"); try { handler = (Tool)Class.forName(handlerClz, true, loader).newInstance(); } catch (Exception ex) { Message message = new Message("FAIL_TO_INSTANTIATE_HANDLER", LOG, handlerClz); throw new ToolException(message, ex); } } return handler; }
public List<Element> getUsageForms() { return DOMUtils.findAllElementsByTagNameNS(getUsage(), Tool.TOOL_SPEC_PUBLIC_ID, "form"); }
public String[] getParameters(String name) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Getting parameters for " + name); } List<Object> result = new ArrayList<>(); if (values != null) { for (Element el : values) { if (el.getAttribute("name").equals(name)) { if (el.hasChildNodes()) { result.add(el.getFirstChild().getNodeValue()); } else { result.add("true"); } } } } if (result.isEmpty()) { String def = toolspec.getParameterDefault(name); if (def != null) { result.add(def); } } return result.toArray(new String[0]); }
container = cons.newInstance( new Object[] { new ToolSpec(toolspecStream, validate) }); } catch (Exception ex) {
public String getDetailedUsage() throws TransformerException, IOException { // REVISIT: style usage document into a form more readily output as a // usage message try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream is = getClass().getResourceAsStream("detailedUsage.xsl")) { toolspec.transform(is, baos); return baos.toString(); } }
public List<String> getOutstreamIds() { List<String> res = new ArrayList<>(); Element streams = getStreams(); if (streams != null) { List<Element> elemList = DOMUtils.findAllElementsByTagNameNS(streams, Tool.TOOL_SPEC_PUBLIC_ID, "outstream"); for (Element elem : elemList) { res.add(elem.getAttribute("id")); } } return Collections.unmodifiableList(res); }
public String getDetailedUsage(String id) { String result = null; Element element = toolspec.getElementById(id); List<Element> annotations = DOMUtils.findAllElementsByTagNameNS(element, Tool.TOOL_SPEC_PUBLIC_ID, "annotation"); if ((annotations != null) && (!annotations.isEmpty())) { result = annotations.get(0).getFirstChild().getNodeValue(); } return result; }
public Tool getHandler() throws ToolException { if (!hasHandler()) { return null; } if (handler == null) { String handlerClz = doc.getDocumentElement().getAttribute("handler"); try { handler = (Tool)Class.forName(handlerClz).newInstance(); } catch (Exception ex) { Message message = new Message("FAIL_TO_INSTANTIATE_HANDLER", LOG, handlerClz); throw new ToolException(message, ex); } } return handler; }