if (!step.orderSteps()) { valid = false; logger.trace(MessageFormatter.nodeMessage(node, "Checking step order for " + getName())); if (getExtensionAttribute(cx_depend) != null || getExtensionAttribute(cx_depends) != null || getExtensionAttribute(cx_dependson) != null) { throw new XProcException(getNode(), "The correct spelling of the depends-on attribute is cx:depends-on."); String dependsOn = getExtensionAttribute(XProcConstants.cx_depends_on); if (dependsOn != null) { Step step = env.visibleStep(dependsOn); if (step == null) { throw new XProcException(getNode(), "The value of cx:depends-on must be the name of an in-scope step: " + dependsOn); addDependency(dependsOn); if (binding.getBindingType() == Binding.PIPE_NAME_BINDING) { PipeNameBinding pipe = (PipeNameBinding) binding; logger.trace(MessageFormatter.nodeMessage(node, getName() + " input " + input.getPort() + " depends on " + pipe.getStep())); addDependency(pipe.getStep()); if (binding.getBindingType() == Binding.PIPE_NAME_BINDING) { PipeNameBinding pipe = (PipeNameBinding) binding; logger.trace(MessageFormatter.nodeMessage(node, getName() + " param depends on " + pipe.getStep())); addDependency(pipe.getStep()); if (binding.getBindingType() == Binding.PIPE_NAME_BINDING) {
for (Input input : decl.inputs()) { declInputs.put(input.getPort(), input); for (Input input : inputs()) { position++; for (Parameter param : parameters()) { position++; Input input = getInput(portName); if (input == null) { logger.trace(MessageFormatter.nodeMessage(node, "Added " + portName + " input to " + getName())); input = new Input(runtime, node); input.setPort(portName); addInput(input); } else { input.setParameterInput(dinput.getParameterInput()); for (Output output : decl.outputs()) { declOutputs.put(output.getPort(), output); Output output = getOutput(portName); if (output == null) { logger.trace(MessageFormatter.nodeMessage(node, "Added " + portName + " output to " + getName())); output = new Output(runtime, node); output.setPort(portName); addOutput(output);
protected void augmentOptions() { Step decl = declaration; if (decl == null) { throw new UnsupportedOperationException("Unexpected step type: " + getType()); } Hashtable<QName,Option> declOptions = new Hashtable<QName,Option> (); for (Option option : decl.options()) { declOptions.put(option.getName(), option); } // Add any options that have default values... for (QName oname : declOptions.keySet()) { Option doption = declOptions.get(oname); Option option = getOption(oname); if (option == null) { if (doption.getSelect() != null || doption.getBinding().size() != 0) { addOption(doption); } } else { option.setType(doption.getType(), doption.getNode()); // copy the type over } } }
if (XProcConstants.p_pipeline.equals(step.getType()) || XProcConstants.p_declare_step.equals(step.getType())) { sig.add(XProcConstants.p_import); sig.add(XProcConstants.p_input); sig.add(XProcConstants.p_serialization); allowVariables = true; allowPrimary = XProcConstants.p_declare_step.equals(step.getType()); // Not on p:pipeline } else if (XProcConstants.p_for_each.equals(step.getType())) { sig.add(XProcConstants.p_iteration_source); sig.add(XProcConstants.p_output); allowVariables = true; allowPrimary = true; } else if (XProcConstants.cx_until_unchanged.equals(step.getType())) { sig.add(XProcConstants.p_iteration_source); sig.add(XProcConstants.p_output); allowVariables = true; allowPrimary = true; } else if (XProcConstants.p_viewport.equals(step.getType())) { sig.add(XProcConstants.p_viewport_source); sig.add(XProcConstants.p_output); allowVariables = true; allowPrimary = true; } else if (XProcConstants.p_choose.equals(step.getType())) { sig.add(XProcConstants.p_xpath_context); allowVariables = true;
logger.trace(MessageFormatter.nodeMessage(node, "Check bindings for " + input.getPort() + " on " + getName())); Step pipeline = getPipeline(); Input paramsin = null; int count = 0; for (Input pinput : pipeline.inputs()) { if (pinput.getParameterInput()) { count++; } else { valid = false; error("Parameter input " + input.getPort() + " unbound on " + getType() + " step named " + getName() + " and no default binding available.", XProcConstants.staticError(55)); binding.setStep(pipeline.getName()); binding.setPort(paramsin.getPort()); input.addBinding(binding); port = substep.getDefaultOutput(); } else if (isPipelineCall()) { String stepName = port.getStep().getName(); String portName = port.getPort(); error("Input " + input.getPort() + " unbound on " + getType() + " step named " + getName() + " and no default binding available.", XProcConstants.staticError(32)); if ("error".equals(pipe.getPort()) && XProcConstants.p_catch.equals(fromstep.getType())) { catchErrors = true; } else { if (XProcConstants.NS_XPROC.equals(fromstep.getType().getNamespaceURI())
protected boolean checkOptionBinding(EndPoint endpoint, boolean defEmpty) { boolean valid = true; logger.trace(MessageFormatter.nodeMessage(node, "Check bindings for " + endpoint + " on " + getName())); } else { valid = false; error("" + endpoint + " unbound on " + getType() + " step named " + getName() + " and no default readable port.", XProcConstants.staticError(32)); String stepName = port.getStep().getName(); String portName = port.getPort(); if (output == null) { Step fromstep = env.visibleStep(pipe.getStep()); if ("error".equals(pipe.getPort()) && XProcConstants.p_catch.equals(fromstep.getType())) { catchErrors = true; } else { error("Unreadable port: " + pipe.getPort() + " on " + pipe.getStep(), XProcConstants.staticError(22)); valid = false; if (output == null) { fromstep = env.visibleStep(pipe.getStep()); if ("error".equals(pipe.getPort()) && XProcConstants.p_catch.equals(fromstep.getType())) { catchErrors = true; newBindings.add(new ErrorBinding(fromstep.getXProc(), fromstep.getNode())); } else { newBindings.add(binding);
Step step = new Step(runtime, node, stepType, stepName); step.setDeclaration(decl); step.parent = parent; option.setName(new QName("", aname.getLocalName())); option.setSelect("'" + attr.getStringValue().replace("'", "''") + "'"); option.addNamespaceBinding(new NamespaceBinding(step.getXProc(),node)); step.addOption(option); step.addExtensionAttribute(attr);
Step atomicReplacement = new Step(runtime, step.getNode(),step.getDeclaredType(),step.getName()); atomicReplacement.setDeclaration(step); input.addBinding(pnb); atomicReplacement.addInput(input); atomicReplacement.addOutput(output);
private void parseParameterValueNode(XProcStep impl, XdmNode pnode) { Parameter p = new Parameter(step.getXProc(),pnode); String port = p.getPort(); String name = pnode.getAttributeValue(_name); if (child.getNodeKind() == XdmNodeKind.ELEMENT) { if (!child.getNodeName().equals(cx_item)) { throw XProcException.dynamicError(18, step.getNode(), "Element not allowed: " + child.getNodeName());
String jobId = props.getProperty("JOB_ID"); if (jobId != null) { ((XProcMessageListenerAggregator) pipeline.xpipe.getStep().getXProc() .getMessageListener()).add(new EventBusMessageListener(eventBusProvider, jobId));
if (XProcConstants.p_pipeline.equals(step.getType()) || XProcConstants.p_declare_step.equals(step.getType())) { sig.add(XProcConstants.p_import); sig.add(XProcConstants.p_input); sig.add(XProcConstants.p_serialization); allowVariables = true; allowPrimary = XProcConstants.p_declare_step.equals(step.getType()); // Not on p:pipeline } else if (XProcConstants.p_for_each.equals(step.getType())) { sig.add(XProcConstants.p_iteration_source); sig.add(XProcConstants.p_output); allowVariables = true; allowPrimary = true; } else if (XProcConstants.cx_until_unchanged.equals(step.getType())) { sig.add(XProcConstants.p_iteration_source); sig.add(XProcConstants.p_output); allowVariables = true; allowPrimary = true; } else if (XProcConstants.p_viewport.equals(step.getType())) { sig.add(XProcConstants.p_viewport_source); sig.add(XProcConstants.p_output); allowVariables = true; allowPrimary = true; } else if (XProcConstants.p_choose.equals(step.getType())) { sig.add(XProcConstants.p_xpath_context); allowVariables = true;
logger.trace(MessageFormatter.nodeMessage(node, "Check bindings for " + input.getPort() + " on " + getName())); Step pipeline = getPipeline(); Input paramsin = null; int count = 0; for (Input pinput : pipeline.inputs()) { if (pinput.getParameterInput()) { count++; } else { valid = false; error("Parameter input " + input.getPort() + " unbound on " + getType() + " step named " + getName() + " and no default binding available.", XProcConstants.staticError(55)); binding.setStep(pipeline.getName()); binding.setPort(paramsin.getPort()); input.addBinding(binding); port = substep.getDefaultOutput(); } else if (isPipelineCall()) { String stepName = port.getStep().getName(); String portName = port.getPort(); error("Input " + input.getPort() + " unbound on " + getType() + " step named " + getName() + " and no default binding available.", XProcConstants.staticError(32)); if ("error".equals(pipe.getPort()) && XProcConstants.p_catch.equals(fromstep.getType())) { catchErrors = true; } else { if (XProcConstants.NS_XPROC.equals(fromstep.getType().getNamespaceURI())
protected boolean checkOptionBinding(EndPoint endpoint, boolean defEmpty) { boolean valid = true; logger.trace(MessageFormatter.nodeMessage(node, "Check bindings for " + endpoint + " on " + getName())); } else { valid = false; error("" + endpoint + " unbound on " + getType() + " step named " + getName() + " and no default readable port.", XProcConstants.staticError(32)); String stepName = port.getStep().getName(); String portName = port.getPort(); if (output == null) { Step fromstep = env.visibleStep(pipe.getStep()); if ("error".equals(pipe.getPort()) && XProcConstants.p_catch.equals(fromstep.getType())) { catchErrors = true; } else { error("Unreadable port: " + pipe.getPort() + " on " + pipe.getStep(), XProcConstants.staticError(22)); valid = false; if (output == null) { fromstep = env.visibleStep(pipe.getStep()); if ("error".equals(pipe.getPort()) && XProcConstants.p_catch.equals(fromstep.getType())) { catchErrors = true; newBindings.add(new ErrorBinding(fromstep.getXProc(), fromstep.getNode())); } else { newBindings.add(binding);
Step step = new Step(runtime, node, stepType, stepName); step.setDeclaration(decl); step.parent = parent; option.setName(new QName("", aname.getLocalName())); option.setSelect("'" + attr.getStringValue().replace("'", "''") + "'"); option.addNamespaceBinding(new NamespaceBinding(step.getXProc(),node)); step.addOption(option); step.addExtensionAttribute(attr);
Step atomicReplacement = new Step(runtime, step.getNode(),step.getDeclaredType(),step.getName()); atomicReplacement.setDeclaration(step); input.addBinding(pnb); atomicReplacement.addInput(input); atomicReplacement.addOutput(output);
private void parseParameterValueNode(XProcStep impl, XdmNode pnode) { Parameter p = new Parameter(step.getXProc(),pnode); String port = p.getPort(); String name = pnode.getAttributeValue(_name); if (child.getNodeKind() == XdmNodeKind.ELEMENT) { if (!child.getNodeName().equals(cx_item)) { throw XProcException.dynamicError(18, step.getNode(), "Element not allowed: " + child.getNodeName());
Parameter p = new Parameter(step.getXProc(),pnode); String port = p.getPort(); String name = pnode.getAttributeValue(_name);
if (!step.orderSteps()) { valid = false; logger.trace(MessageFormatter.nodeMessage(node, "Checking step order for " + getName())); if (getExtensionAttribute(cx_depend) != null || getExtensionAttribute(cx_depends) != null || getExtensionAttribute(cx_dependson) != null) { throw new XProcException(getNode(), "The correct spelling of the depends-on attribute is cx:depends-on."); String dependsOn = getExtensionAttribute(XProcConstants.cx_depends_on); if (dependsOn != null) { Step step = env.visibleStep(dependsOn); if (step == null) { throw new XProcException(getNode(), "The value of cx:depends-on must be the name of an in-scope step: " + dependsOn); addDependency(dependsOn); if (binding.getBindingType() == Binding.PIPE_NAME_BINDING) { PipeNameBinding pipe = (PipeNameBinding) binding; logger.trace(MessageFormatter.nodeMessage(node, getName() + " input " + input.getPort() + " depends on " + pipe.getStep())); addDependency(pipe.getStep()); if (binding.getBindingType() == Binding.PIPE_NAME_BINDING) { PipeNameBinding pipe = (PipeNameBinding) binding; logger.trace(MessageFormatter.nodeMessage(node, getName() + " param depends on " + pipe.getStep())); addDependency(pipe.getStep()); if (binding.getBindingType() == Binding.PIPE_NAME_BINDING) {
for (Input input : decl.inputs()) { declInputs.put(input.getPort(), input); for (Input input : inputs()) { position++; for (Parameter param : parameters()) { position++; Input input = getInput(portName); if (input == null) { logger.trace(MessageFormatter.nodeMessage(node, "Added " + portName + " input to " + getName())); input = new Input(runtime, node); input.setPort(portName); addInput(input); } else { input.setParameterInput(dinput.getParameterInput()); for (Output output : decl.outputs()) { declOutputs.put(output.getPort(), output); Output output = getOutput(portName); if (output == null) { logger.trace(MessageFormatter.nodeMessage(node, "Added " + portName + " output to " + getName())); output = new Output(runtime, node); output.setPort(portName); addOutput(output);
protected void augmentOptions() { Step decl = declaration; if (decl == null) { throw new UnsupportedOperationException("Unexpected step type: " + getType()); } Hashtable<QName,Option> declOptions = new Hashtable<QName,Option> (); for (Option option : decl.options()) { declOptions.put(option.getName(), option); } // Add any options that have default values... for (QName oname : declOptions.keySet()) { Option doption = declOptions.get(oname); Option option = getOption(oname); if (option == null) { if (doption.getSelect() != null || doption.getBinding().size() != 0) { addOption(doption); } } else { option.setType(doption.getType(), doption.getNode()); // copy the type over } } }