use of nl.nn.adapterframework.parameters.ParameterList in project iaf by ibissource.
the class FxfWrapperPipe method configure.
@Override
public void configure() throws ConfigurationException {
setRemoveOutputNamespaces(true);
if ("wrap".equalsIgnoreCase(getDirection())) {
ParameterList parameterList = getParameterList();
Parameter parameter = parameterList.findParameter(DESTINATION);
if (parameter == null) {
parameter = new Parameter();
parameter.setName(DESTINATION);
parameter.setValue("ESB.Infrastructure.US.Transfer.FileTransfer.1.StartTransfer." + retrieveStartTransferVersion() + ".Action");
parameterList.add(parameter);
}
}
super.configure();
AppConstants appConstants = AppConstants.getInstance();
if ("wrap".equalsIgnoreCase(getDirection())) {
instanceName = appConstants.getResolvedProperty("instance.name");
if (StringUtils.isEmpty(instanceName)) {
throw new ConfigurationException("instance.name not available");
}
instanceNameLowerCase = appConstants.getResolvedProperty("instance.name.lc");
if (StringUtils.isEmpty(instanceNameLowerCase)) {
throw new ConfigurationException("instance.name.lc not available");
}
environment = appConstants.getResolvedProperty("otap.stage");
if (StringUtils.isEmpty(environment) || environment.length() < 1) {
throw new ConfigurationException("otap.stage not available");
}
environment = environment.substring(0, 1);
if (StringUtils.isEmpty(getFlowId())) {
throw new ConfigurationException("attribute flowId must be specified");
} else if (getFlowId().length() < 3) {
throw new ConfigurationException("attribute flowId too short");
}
} else {
if (!StringUtils.isEmpty(getFlowId())) {
throw new ConfigurationException("attribute flowId must not be specified");
}
fxfDir = appConstants.getResolvedProperty("fxf.dir");
if (fxfDir == null) {
throw new ConfigurationException("property fxf.dir has not been initialised");
} else if (!new File(fxfDir).isDirectory()) {
throw new ConfigurationException("fxf.dir '" + fxfDir + "' doesn't exist or is not a directory");
}
transferFlowIdTp = TransformerPool.configureTransformer0(getLogPrefix(null), classLoader, null, "/OnCompletedTransferNotify_Action/TransferFlowId", null, "text", false, getParameterList(), true);
clientFilenameTp = TransformerPool.configureTransformer0(getLogPrefix(null), classLoader, null, "/OnCompletedTransferNotify_Action/ClientFilename", null, "text", false, getParameterList(), true);
}
if (!getFxfVersion().equals("3.1") && !getFxfVersion().equals("3.2")) {
throw new ConfigurationException("illegal value for fxfVersion [" + getFxfVersion() + "], must be '3.1' or '3.2'");
}
}
use of nl.nn.adapterframework.parameters.ParameterList in project iaf by ibissource.
the class XslErrorMessageFormatter method format.
@Override
public String format(String message, Throwable t, INamedObject location, String originalMessage, String messageId, long receivedTime) {
String result = super.format(message, t, location, originalMessage, messageId, receivedTime);
if (StringUtils.isNotEmpty(getStyleSheet()) || StringUtils.isNotEmpty(getXpathExpression())) {
try {
Transformer errorTransformer;
if (StringUtils.isNotEmpty(getStyleSheet())) {
errorTransformer = XmlUtils.createTransformer(ClassUtils.getResourceURL(this, styleSheet));
} else {
String xpath = getXpathExpression();
// if (StringUtils.isEmpty(xpath)) {
// xpath="/errorMessage/@message";
// }
errorTransformer = XmlUtils.createTransformer(XmlUtils.createXPathEvaluatorSource(xpath));
}
ParameterList params = getParameterList();
if (params != null) {
try {
params.configure();
} catch (ConfigurationException e) {
log.error("exception while configuring parameters", e);
}
ParameterResolutionContext prc = new ParameterResolutionContext(message, new PipeLineSessionBase());
Map<String, Object> parametervalues = null;
try {
parametervalues = prc.getValueMap(params);
} catch (ParameterException e) {
log.error("got exception extracting parameters", e);
}
XmlUtils.setTransformerParameters(errorTransformer, parametervalues);
}
result = XmlUtils.transformXml(errorTransformer, result);
} catch (IOException e) {
log.error(" cannot retrieve [" + styleSheet + "]", e);
} catch (javax.xml.transform.TransformerConfigurationException te) {
log.error("got error creating transformer from file [" + styleSheet + "]", te);
} catch (Exception tfe) {
log.error("could not transform [" + result + "] using stylesheet [" + styleSheet + "]", tfe);
}
} else
log.warn("no stylesheet defined for XslErrorMessageFormatter");
return result;
}
use of nl.nn.adapterframework.parameters.ParameterList in project iaf by ibissource.
the class ApiSoapWrapperPipe method addParameters.
private void addParameters() {
ParameterList parameterList = getParameterList();
Parameter p;
if (parameterList.findParameter(CONVERSATIONID) == null) {
p = new Parameter();
p.setName(CONVERSATIONID);
p.setSessionKey(getSoapHeaderSessionKey());
p.setXpathExpression("MessageHeader/HeaderFields/ConversationId");
p.setRemoveNamespaces(true);
// only forward the existing ConversationId, don't create a new one
// p.setPattern("{hostname}_{uid}");
// p.setDefaultValueMethods("pattern");
addParameter(p);
}
if (parameterList.findParameter(FROM_IN) == null) {
p = new Parameter();
p.setName(FROM_IN);
p.setSessionKey(getSoapHeaderSessionKey());
p.setXpathExpression("MessageHeader/From");
addParameter(p);
}
p = new Parameter();
p.setName(FROM_OUT);
p.setValue(AppConstants.getInstance().getProperty("instance.name", ""));
addParameter(p);
}
use of nl.nn.adapterframework.parameters.ParameterList in project iaf by ibissource.
the class JdbcQuerySenderBase method adjustParamList.
private String adjustParamList(ParameterList paramList, String message) throws SenderException {
if (log.isDebugEnabled()) {
log.debug(getLogPrefix() + "Adjusting list of parameters [" + paramListToString(paramList) + "]");
}
StringBuffer buffer = new StringBuffer();
int startPos = message.indexOf(UNP_START);
if (startPos == -1)
return message;
char[] messageChars = message.toCharArray();
int copyFrom = 0;
ParameterList oldParamList = new ParameterList();
oldParamList = (ParameterList) paramList.clone();
paramList.clear();
while (startPos != -1) {
buffer.append(messageChars, copyFrom, startPos - copyFrom);
int nextStartPos = message.indexOf(UNP_START, startPos + UNP_START.length());
if (nextStartPos == -1) {
nextStartPos = message.length();
}
int endPos = message.indexOf(UNP_END, startPos + UNP_START.length());
if (endPos == -1 || endPos > nextStartPos) {
log.warn(getLogPrefix() + "Found a start delimiter without an end delimiter at position [" + startPos + "] in [" + message + "]");
buffer.append(messageChars, startPos, nextStartPos - startPos);
copyFrom = nextStartPos;
} else {
String namedParam = message.substring(startPos + UNP_START.length(), endPos);
Parameter param = oldParamList.findParameter(namedParam);
if (param != null) {
paramList.add(param);
buffer.append("?");
copyFrom = endPos + UNP_END.length();
} else {
log.warn(getLogPrefix() + "Parameter [" + namedParam + "] is not found");
buffer.append(messageChars, startPos, nextStartPos - startPos);
copyFrom = nextStartPos;
}
}
startPos = message.indexOf(UNP_START, copyFrom);
}
buffer.append(messageChars, copyFrom, messageChars.length - copyFrom);
if (log.isDebugEnabled()) {
log.debug(getLogPrefix() + "Adjusted list of parameters [" + paramListToString(paramList) + "]");
}
return buffer.toString();
}
use of nl.nn.adapterframework.parameters.ParameterList in project iaf by ibissource.
the class RecordXmlTransformer method configure.
@Override
public void configure() throws ConfigurationException {
super.configure();
ParameterList params = getParameterList();
if (params != null) {
try {
params.configure();
} catch (ConfigurationException e) {
throw new ConfigurationException("while configuring parameters", e);
}
}
if (StringUtils.isNotEmpty(getStyleSheetName()) || StringUtils.isNotEmpty(getXpathExpression())) {
transformerPool = TransformerPool.configureTransformer(ClassUtils.nameOf(this) + " [" + getName() + "] ", classLoader, getNamespaceDefs(), getXpathExpression(), getStyleSheetName(), getOutputType(), !isOmitXmlDeclaration(), getParameterList());
}
}
Aggregations