public void run() throws SaxonApiException { super.run(); String value = getOption(_value).getString(); QName algorithm = getOption(_algorithm).getQName(); String version = null; if (getOption(_version) != null) { version = getOption(_version).getString(); } if (_crc.equals(algorithm)) { hash = HashUtils.crc(value.getBytes(), version); } else if (_md.equals(algorithm)) { hash = HashUtils.md(value.getBytes(), version); } else if (_sha.equals(algorithm)) { hash = HashUtils.sha(value.getBytes(), version); } else if (_hmac.equals(algorithm)) { hash = HashUtils.hmac(value.getBytes(), params.get(_accessKey)); } else { throw XProcException.dynamicError(36); } matcher = new ProcessMatch(runtime, this); matcher.match(source.read(), getOption(_match)); if (source.moreDocuments()) { throw XProcException.dynamicError(6, "Reading source on " + getStep().getName()); } result.write(matcher.getResult()); }
public void run() throws SaxonApiException { super.run(); String value = getOption(_value).getString(); QName algorithm = getOption(_algorithm).getQName(); String version = null; if (getOption(_version) != null) { version = getOption(_version).getString(); } if (_crc.equals(algorithm)) { hash = crc(value, version); } else if (_md.equals(algorithm)) { hash = md(value, version); } else if (_sha.equals(algorithm)) { hash = sha(value, version); } else if (_hmac.equals(algorithm)) { hash = hmac(value, params.get(_accessKey)); } else { throw XProcException.dynamicError(36); } matcher = new ProcessMatch(runtime, this); matcher.match(source.read(), getOption(_match)); if (source.moreDocuments()) { throw XProcException.dynamicError(6, "Reading source on " + getStep().getName()); } result.write(matcher.getResult()); }