Search in sources :

Example 26 with Parameter

use of nl.nn.adapterframework.parameters.Parameter in project iaf by ibissource.

the class EsbSoapWrapperPipe method retrievePhysicalDestinationFromSender.

public boolean retrievePhysicalDestinationFromSender(ISender sender) {
    if (sender != null && sender instanceof EsbJmsSender) {
        EsbJmsSender ejSender = (EsbJmsSender) sender;
        String physicalDestination = ejSender.getPhysicalDestinationShortName();
        if (physicalDestination == null) {
            physicalDestination = "?";
        }
        Parameter p = new Parameter();
        p.setName(PHYSICALDESTINATION);
        p.setValue(physicalDestination);
        addParameter(p);
        return true;
    }
    return false;
}
Also used : Parameter(nl.nn.adapterframework.parameters.Parameter)

Example 27 with Parameter

use of nl.nn.adapterframework.parameters.Parameter 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'");
    }
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) ParameterList(nl.nn.adapterframework.parameters.ParameterList) Parameter(nl.nn.adapterframework.parameters.Parameter) File(java.io.File) AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 28 with Parameter

use of nl.nn.adapterframework.parameters.Parameter 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);
}
Also used : ParameterList(nl.nn.adapterframework.parameters.ParameterList) Parameter(nl.nn.adapterframework.parameters.Parameter)

Example 29 with Parameter

use of nl.nn.adapterframework.parameters.Parameter 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();
}
Also used : ParameterList(nl.nn.adapterframework.parameters.ParameterList) Parameter(nl.nn.adapterframework.parameters.Parameter)

Example 30 with Parameter

use of nl.nn.adapterframework.parameters.Parameter in project iaf by ibissource.

the class SchedulerSender method configure.

public void configure() throws ConfigurationException {
    if (StringUtils.isEmpty(javaListener)) {
        throw new ConfigurationException("Property [serviceName] is empty");
    }
    if (StringUtils.isEmpty(cronExpressionPattern)) {
        throw new ConfigurationException("Property [cronExpressionPattern] is empty");
    }
    Parameter p = new Parameter();
    p.setName("_cronexpression");
    p.setPattern(cronExpressionPattern);
    addParameter(p);
    if (StringUtils.isNotEmpty(jobNamePattern)) {
        p = new Parameter();
        p.setName("_jobname");
        p.setPattern(jobNamePattern);
        addParameter(p);
    }
    super.configure();
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) Parameter(nl.nn.adapterframework.parameters.Parameter)

Aggregations

Parameter (nl.nn.adapterframework.parameters.Parameter)41 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)19 ParameterResolutionContext (nl.nn.adapterframework.parameters.ParameterResolutionContext)15 ParameterList (nl.nn.adapterframework.parameters.ParameterList)13 PipeRunException (nl.nn.adapterframework.core.PipeRunException)12 IOException (java.io.IOException)7 FixedQuerySender (nl.nn.adapterframework.jdbc.FixedQuerySender)7 ParameterException (nl.nn.adapterframework.core.ParameterException)6 PipeRunResult (nl.nn.adapterframework.core.PipeRunResult)6 ParameterValueList (nl.nn.adapterframework.parameters.ParameterValueList)5 LDAPConnection (com.unboundid.ldap.sdk.LDAPConnection)4 Map (java.util.Map)4 Test (org.junit.Test)3 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 LinkedHashMap (java.util.LinkedHashMap)2 LinkedList (java.util.LinkedList)2