private void setParametersOnPipeline(XPipeline pipeline, String port, Map<QName, String> parameters) { if ("*".equals(port)) { for (QName name : parameters.keySet()) { pipeline.setParameter(name, new RuntimeValue(parameters.get(name))); } } else { for (QName name : parameters.keySet()) { pipeline.setParameter(port, name, new RuntimeValue(parameters.get(name))); } } }
private void setParametersOnPipeline(XPipeline pipeline, String port, Map<QName, String> parameters) { if ("*".equals(port)) { for (QName name : parameters.keySet()) { pipeline.setParameter(name, new RuntimeValue(parameters.get(name))); } } else { for (QName name : parameters.keySet()) { pipeline.setParameter(port, name, new RuntimeValue(parameters.get(name))); } } }
private XdmNode expandXIncludes(XdmNode doc) { logger.trace(MessageFormatter.nodeMessage(doc, "Starting expandXIncludes")); ProcessMatch matcher = new ProcessMatch(runtime, this); matcherStack.push(matcher); matcher.match(doc, new RuntimeValue("/|*", step.getNode())); XdmNode result = matcher.getResult(); matcher = matcherStack.pop(); return result; }
private XdmNode expandXIncludes(XdmNode doc) { logger.trace(MessageFormatter.nodeMessage(doc, "Starting expandXIncludes")); ProcessMatch matcher = new ProcessMatch(runtime, this); matcherStack.push(matcher); matcher.match(doc, new RuntimeValue("/|*", step.getNode())); XdmNode result = matcher.getResult(); matcher = matcherStack.pop(); return result; }
public XdmNode fixup(XdmNode node) { matcher = new ProcessMatch(runtime, this); matcher.match(node, new RuntimeValue("*", step.getNode())); XdmNode fixed = matcher.getResult(); return fixed; }
public XdmNode fixup(XdmNode node) { matcher = new ProcessMatch(runtime, this); matcher.match(node, new RuntimeValue("*", step.getNode())); XdmNode fixed = matcher.getResult(); return fixed; }
@Override protected Representation post(Representation entity, Variant variant) { String id = (String) getRequest().getAttributes().get("id"); if (!getPipelines().containsKey(id)) { return badRequest(Status.CLIENT_ERROR_NOT_FOUND, "no pipeline: " + pipelineUri(id), variant.getMediaType()); } PipelineConfiguration pipeconfig = getPipelines().get(id); XPipeline xpipeline = pipeconfig.pipeline; HashMap<QName,String> options = convertForm(getQuery()); String message = "Options added: "; boolean first = true; for (QName name : options.keySet()) { RuntimeValue value = new RuntimeValue(options.get(name), null, null); xpipeline.passOption(name, value); pipeconfig.setOption(name, options.get(name)); if (!first) { message += ", "; } message += name; first = false; } return okResponse(message, variant.getMediaType(), Status.SUCCESS_ACCEPTED); } }
@Override protected Representation post(Representation entity, Variant variant) { String id = (String) getRequest().getAttributes().get("id"); if (!getPipelines().containsKey(id)) { return badRequest(Status.CLIENT_ERROR_NOT_FOUND, "no pipeline: " + pipelineUri(id), variant.getMediaType()); } PipelineConfiguration pipeconfig = getPipelines().get(id); XPipeline xpipeline = pipeconfig.pipeline; HashMap<QName,String> options = convertForm(getQuery()); String message = "Options added: "; boolean first = true; for (QName name : options.keySet()) { RuntimeValue value = new RuntimeValue(options.get(name), null, null); xpipeline.passOption(name, value); pipeconfig.setOption(name, options.get(name)); if (!first) { message += ", "; } message += name; first = false; } return okResponse(message, variant.getMediaType(), Status.SUCCESS_ACCEPTED); } }
RuntimeValue value = new RuntimeValue(params.get(name), null, null); xpipeline.setParameter(port, name, value); pipeconfig.setParameter(name, params.get(name));
public void run() throws SaxonApiException { super.run(); all = getOption(_all, false); relative = getOption(_relative, true); if (all && relative) { throw XProcException.stepError(58); } matcher = new ProcessMatch(runtime, this); matcher.match(source.read(), new RuntimeValue("*", step.getNode())); XdmNode doc = matcher.getResult(); result.write(doc); }
public void run() throws SaxonApiException { super.run(); all = getOption(_all, false); relative = getOption(_relative, true); if (all && relative) { throw XProcException.stepError(58); } matcher = new ProcessMatch(runtime, this); matcher.match(source.read(), new RuntimeValue("*", step.getNode())); XdmNode doc = matcher.getResult(); result.write(doc); }
RuntimeValue value = new RuntimeValue(null, nodes, null, null); xpipeline.setParameter(port, qname, value); pipeconfig.setGVParameter(qname);
public void run() throws SaxonApiException { super.run(); if (getOption(_from) != null) { from = getOption(_from).getString(); } else { from = ""; } if (getOption(_to) != null) { to = getOption(_to).getString(); } else { to = ""; } applyTo = getOption(_apply_to, "all"); if (XMLConstants.XML_NS_URI.equals(from) || XMLConstants.XML_NS_URI.equals(to) || XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(from) || XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(to)) { throw XProcException.stepError(14); } if (from.equals(to)) { result.write(source.read()); } else { matcher = new ProcessMatch(runtime, this); matcher.match(source.read(), new RuntimeValue("*", step.getNode())); result.write(matcher.getResult()); } if (source.moreDocuments()) { throw XProcException.dynamicError(6, "Reading source on " + getStep().getName()); } }
public void run() throws SaxonApiException { super.run(); if (getOption(_from) != null) { from = getOption(_from).getString(); } else { from = ""; } if (getOption(_to) != null) { to = getOption(_to).getString(); } else { to = ""; } applyTo = getOption(_apply_to, "all"); if (XMLConstants.XML_NS_URI.equals(from) || XMLConstants.XML_NS_URI.equals(to) || XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(from) || XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(to)) { throw XProcException.stepError(14); } if (from.equals(to)) { result.write(source.read()); } else { matcher = new ProcessMatch(runtime, this); matcher.match(source.read(), new RuntimeValue("*", step.getNode())); result.write(matcher.getResult()); } if (source.moreDocuments()) { throw XProcException.dynamicError(6, "Reading source on " + getStep().getName()); } }
public void run() throws SaxonApiException { if (step.getNode().getNodeName().equals(XProcConstants.p_document_template)) { logger.trace(MessageFormatter.nodeMessage(step.getNode(), "The template step should be named p:template, the name p:document-template is deprecated.")); } super.run(); if (source.documentCount() > 1) { throw XProcException.stepError(68); } context = source.read(); matcher = new ProcessMatch(runtime, this); matcher.match(template.read(), new RuntimeValue("node()", step.getNode())); result.write(matcher.getResult()); }
RuntimeValue value = new RuntimeValue(null, nodes, null, null); xpipeline.passOption(qname, value); pipeconfig.setGVOption(qname);
RuntimeValue value = new RuntimeValue(null, nodes, null, null); xpipeline.passOption(qname, value); pipeconfig.setGVOption(qname);
public void run() throws SaxonApiException { if (step.getNode().getNodeName().equals(XProcConstants.p_document_template)) { logger.trace(MessageFormatter.nodeMessage(step.getNode(), "The template step should be named p:template, the name p:document-template is deprecated.")); } super.run(); if (source.documentCount() > 1) { throw XProcException.stepError(68); } context = source.read(); matcher = new ProcessMatch(runtime, this); matcher.match(template.read(), new RuntimeValue("node()", step.getNode())); result.write(matcher.getResult()); }
private Viewport readViewport(Step parent, XdmNode node) { QName name = node.getNodeName(); if (!XProcConstants.p_viewport.equals(name)) { throw new UnsupportedOperationException("Can't parse " + name + " as a pipeline!"); } checkAttributes(node, new String[] { "name", "match" }, false); String stepName = checkNCName(node.getAttributeValue(_name)); RuntimeValue match = new RuntimeValue(node.getAttributeValue(new QName("match")), node); Viewport step = new Viewport(runtime, node, stepName); checkExtensionAttributes(node, step); step.setParentDecl((DeclareStep) parent); step.parent = parent; step.setMatch(match); Vector<XdmNode> rest = readSignature(step); if (rest == null) { throw XProcException.staticError(15, node, "A p:viewport must contain a subpipeline."); } for (XdmNode substepNode : rest) { Step substep = readStep(step, substepNode); step.addStep(substep); } step.checkPrimaryIO(); return step; }
private Viewport readViewport(Step parent, XdmNode node) { QName name = node.getNodeName(); if (!XProcConstants.p_viewport.equals(name)) { throw new UnsupportedOperationException("Can't parse " + name + " as a pipeline!"); } checkAttributes(node, new String[] { "name", "match" }, false); String stepName = checkNCName(node.getAttributeValue(_name)); RuntimeValue match = new RuntimeValue(node.getAttributeValue(new QName("match")), node); Viewport step = new Viewport(runtime, node, stepName); checkExtensionAttributes(node, step); step.setParentDecl((DeclareStep) parent); step.parent = parent; step.setMatch(match); Vector<XdmNode> rest = readSignature(step); if (rest == null) { throw XProcException.staticError(15, node, "A p:viewport must contain a subpipeline."); } for (XdmNode substepNode : rest) { Step substep = readStep(step, substepNode); step.addStep(substep); } step.checkPrimaryIO(); return step; }