use of nl.nn.adapterframework.parameters.Parameter in project iaf by ibissource.
the class CmisHttpInvoker method getInstance.
private CmisHttpSender getInstance(BindingSession session) throws SenderException, ConfigurationException {
if (sender == null) {
log.debug("creating new CmisHttpInvoker");
sender = new CmisHttpSender();
sender.open();
sender.setUrlParam("url");
// Auth
if (session.get(SessionParameter.USER) != null)
sender.setUserName((String) session.get(SessionParameter.USER));
if (session.get(SessionParameter.PASSWORD) != null)
sender.setPassword((String) session.get(SessionParameter.PASSWORD));
// Proxy
if (session.get("proxyHost") != null) {
sender.setProxyHost((String) session.get("proxyHost"));
if (session.get("proxyPort") != null)
sender.setProxyPort(Integer.parseInt((String) session.get("proxyPort")));
if (session.get("proxyUserName") != null)
sender.setProxyUserName((String) session.get("proxyUserName"));
if (session.get("proxyPassword") != null)
sender.setProxyPassword((String) session.get("proxyPassword"));
}
// SSL
if (session.get("certificateUrl") != null)
sender.setCertificate((String) session.get("certificateUrl"));
if (session.get("certificatePassword") != null)
sender.setCertificatePassword((String) session.get("certificatePassword"));
if (session.get("keystoreType") != null)
sender.setKeystoreType((String) session.get("keystoreType"));
if (session.get("keyManagerAlgorithm") != null)
sender.setKeyManagerAlgorithm((String) session.get("keyManagerAlgorithm"));
if (session.get("truststoreUrl") != null)
sender.setTruststore((String) session.get("truststoreUrl"));
if (session.get("truststorePassword") != null)
sender.setTruststorePassword((String) session.get("truststorePassword"));
if (session.get("truststoreType") != null)
sender.setTruststoreType((String) session.get("truststoreType"));
if (session.get("trustManagerAlgorithm") != null)
sender.setTrustManagerAlgorithm((String) session.get("trustManagerAlgorithm"));
// SSL+
if (session.get("isAllowSelfSignedCertificates") != null) {
boolean isAllowSelfSignedCertificates = Boolean.parseBoolean((String) session.get("isAllowSelfSignedCertificates"));
sender.setAllowSelfSignedCertificates(isAllowSelfSignedCertificates);
}
if (session.get("isVerifyHostname") != null) {
boolean isVerifyHostname = Boolean.parseBoolean((String) session.get("isVerifyHostname"));
sender.setVerifyHostname(isVerifyHostname);
}
if (session.get("isIgnoreCertificateExpiredException") != null) {
boolean isIgnoreCertificateExpiredException = Boolean.parseBoolean((String) session.get("isIgnoreCertificateExpiredException"));
sender.setIgnoreCertificateExpiredException(isIgnoreCertificateExpiredException);
}
// Add parameters
Parameter parameter = new Parameter();
parameter.setName("writer");
parameter.setSessionKey("writer");
sender.addParameter(parameter);
Parameter urlParam = new Parameter();
urlParam.setName("url");
urlParam.setSessionKey("url");
sender.addParameter(urlParam);
// timeouts
int connectTimeout = session.get(SessionParameter.CONNECT_TIMEOUT, -1);
int readTimeout = session.get(SessionParameter.READ_TIMEOUT, -1);
int timeout = Math.max(connectTimeout, readTimeout);
if (timeout >= 0) {
sender.setTimeout(timeout);
}
sender.configure();
}
return sender;
}
use of nl.nn.adapterframework.parameters.Parameter in project iaf by ibissource.
the class EsbJmsSender method configure.
public void configure() throws ConfigurationException {
if (getMessageProtocol() == null) {
throw new ConfigurationException(getLogPrefix() + "messageProtocol must be set");
}
if (!getMessageProtocol().equalsIgnoreCase(REQUEST_REPLY) && !getMessageProtocol().equalsIgnoreCase(FIRE_AND_FORGET)) {
throw new ConfigurationException(getLogPrefix() + "illegal value for messageProtocol [" + getMessageProtocol() + "], must be '" + REQUEST_REPLY + "' or '" + FIRE_AND_FORGET + "'");
}
if (getMessageProtocol().equalsIgnoreCase(REQUEST_REPLY)) {
setDeliveryMode(MODE_NON_PERSISTENT);
setMessageTimeToLive(getTimeOut());
setReplyTimeout((int) getTimeOut());
setSynchronous(true);
} else {
if (getReplyTo() != null) {
throw new ConfigurationException(getLogPrefix() + "replyToName [" + getReplyTo() + "] must not be set for messageProtocol [" + getMessageProtocol() + "]");
}
}
if (StringUtils.isEmpty(getSoapAction()) && (paramList == null || paramList.findParameter("SoapAction") == null)) {
Parameter p = new Parameter();
p.setName("SoapAction");
p.setStyleSheetName("/xml/xsl/esb/soapAction.xsl");
p.setXslt2(true);
p.setRemoveNamespaces(true);
addParameter(p);
}
super.configure();
}
use of nl.nn.adapterframework.parameters.Parameter in project iaf by ibissource.
the class EsbSoapWrapperPipe method retrievePhysicalDestinationFromListener.
public boolean retrievePhysicalDestinationFromListener(IListener listener) throws JmsException {
if (listener != null && listener instanceof EsbJmsListener) {
EsbJmsListener ejListener = (EsbJmsListener) listener;
if (!ejListener.isSynchronous()) {
return false;
}
String physicalDestination = ejListener.getPhysicalDestinationShortName(true);
// incorrectly
if (physicalDestination == null) {
physicalDestination = "?";
} else {
int pos = physicalDestination.lastIndexOf(".");
pos++;
if (pos > 0 && pos < physicalDestination.length()) {
String pds = physicalDestination.substring(0, pos);
String paradigm = physicalDestination.substring(pos);
if (paradigm.equals("Request") || paradigm.equals("Solicit")) {
physicalDestination = pds + "Response";
} else {
physicalDestination = pds + "?";
}
} else {
physicalDestination = physicalDestination + ".?";
}
}
Parameter p = new Parameter();
p.setName(PHYSICALDESTINATION);
p.setValue(physicalDestination);
addParameter(p);
return true;
}
return false;
}
use of nl.nn.adapterframework.parameters.Parameter in project iaf by ibissource.
the class EsbSoapWrapperPipe method stripDestination.
private void stripDestination() throws ConfigurationException {
ParameterList parameterList = getParameterList();
Parameter pd = parameterList.findParameter(DESTINATION);
Parameter ppd = parameterList.findParameter(PHYSICALDESTINATION);
String destination = null;
if (isRetrievePhysicalDestination()) {
if (ppd != null) {
destination = ppd.getValue();
} else if (pd != null) {
destination = pd.getValue();
}
} else {
if (pd != null) {
destination = pd.getValue();
}
}
Parameter p;
if (StringUtils.isNotEmpty(destination)) {
if (destination.startsWith("ESB.") || destination.startsWith("P2P.") || (StringUtils.isNotEmpty(esbAlias) && destination.startsWith(esbAlias + ".")) || (StringUtils.isNotEmpty(p2pAlias) && destination.startsWith(p2pAlias + "."))) {
// In case the messaging layer is ESB, the destination syntax is:
// Destination = [MessagingLayer].[BusinessDomain].[ServiceLayer].[ServiceName].[ServiceContext].[ServiceContextVersion].[OperationName].[OperationVersion].[Paradigm]
// In case the messaging layer is P2P, the destination syntax is:
// Destination = [MessagingLayer].[BusinessDomain].[ApplicationName].[ApplicationFunction].[Paradigm]
boolean p2p = false;
boolean esbDestinationWithoutServiceContext = false;
StringTokenizer st = new StringTokenizer(destination, ".");
int count = 0;
while (st.hasMoreTokens()) {
count++;
String str = st.nextToken();
p = new Parameter();
switch(count) {
case 1:
if (str.equals("P2P") || (StringUtils.isNotEmpty(p2pAlias) && str.equalsIgnoreCase(p2pAlias))) {
p2p = true;
} else {
esbDestinationWithoutServiceContext = isEsbDestinationWithoutServiceContext(destination);
}
p.setName(MESSAGINGLAYER);
break;
case 2:
p.setName(BUSINESSDOMAIN);
break;
case 3:
if (p2p) {
p.setName(APPLICATIONNAME);
} else {
p.setName(SERVICELAYER);
}
break;
case 4:
if (p2p) {
p.setName(APPLICATIONFUNCTION);
} else {
p.setName(SERVICENAME);
}
break;
case 5:
if (p2p) {
p.setName(PARADIGM);
} else {
if (esbDestinationWithoutServiceContext) {
p.setName(SERVICECONTEXTVERSION);
} else {
p.setName(SERVICECONTEXT);
}
}
break;
case 6:
if (esbDestinationWithoutServiceContext) {
p.setName(OPERATIONNAME);
} else {
p.setName(SERVICECONTEXTVERSION);
}
break;
case 7:
if (esbDestinationWithoutServiceContext) {
p.setName(OPERATIONVERSION);
} else {
p.setName(OPERATIONNAME);
}
break;
case 8:
if (esbDestinationWithoutServiceContext) {
p.setName(PARADIGM);
} else {
p.setName(OPERATIONVERSION);
}
break;
case 9:
if (esbDestinationWithoutServiceContext) {
// not possible
} else {
p.setName(PARADIGM);
}
break;
default:
}
p.setValue(str);
addParameter(p);
}
} else {
p = new Parameter();
p.setName(MESSAGINGLAYER);
p.setValue("P2P");
addParameter(p);
//
p = new Parameter();
p.setName(BUSINESSDOMAIN);
p.setValue("?");
addParameter(p);
//
p = new Parameter();
p.setName(APPLICATIONNAME);
p.setValue("?");
addParameter(p);
//
p = new Parameter();
p.setName(APPLICATIONFUNCTION);
p.setValue(destination.replaceAll("\\W", "_"));
addParameter(p);
//
p = new Parameter();
p.setName(PARADIGM);
p.setValue("?");
addParameter(p);
}
}
}
use of nl.nn.adapterframework.parameters.Parameter in project iaf by ibissource.
the class EsbSoapWrapperPipe method addParameters.
private void addParameters() {
ParameterList parameterList = getParameterList();
Parameter p;
String paradigm = null;
p = parameterList.findParameter(PARADIGM);
if (p != null) {
paradigm = p.getValue();
}
if (parameterList.findParameter(FROMID) == null) {
p = new Parameter();
p.setName(FROMID);
p.setValue(AppConstants.getInstance().getProperty("instance.name", ""));
addParameter(p);
}
if (mode != Mode.BIS) {
if (parameterList.findParameter(CPAID) == null) {
p = new Parameter();
p.setName(CPAID);
p.setSessionKey(getSoapHeaderSessionKey());
p.setXpathExpression("MessageHeader/HeaderFields/CPAId");
p.setRemoveNamespaces(true);
p.setDefaultValue("n/a");
addParameter(p);
}
}
if (parameterList.findParameter(CONVERSATIONID) == null) {
p = new Parameter();
p.setName(CONVERSATIONID);
p.setSessionKey(getSoapHeaderSessionKey());
p.setXpathExpression("MessageHeader/HeaderFields/ConversationId");
p.setRemoveNamespaces(true);
if (isUseFixedValues()) {
p.setPattern("{fixedhostname}_{fixeduid}");
} else {
p.setPattern("{hostname}_{uid}");
}
p.setDefaultValueMethods("pattern");
addParameter(p);
}
if (parameterList.findParameter(MESSAGEID) == null) {
p = new Parameter();
p.setName(MESSAGEID);
if (isUseFixedValues()) {
p.setPattern("{fixedhostname}_{fixeduid}");
} else {
p.setPattern("{hostname}_{uid}");
}
addParameter(p);
}
if (parameterList.findParameter(EXTERNALREFTOMESSAGEID) == null) {
p = new Parameter();
p.setName(EXTERNALREFTOMESSAGEID);
p.setSessionKey(getSoapHeaderSessionKey());
if (mode == Mode.BIS) {
p.setXpathExpression("MessageHeader/HeaderFields/MessageId");
} else {
p.setXpathExpression("MessageHeader/HeaderFields/ExternalRefToMessageId");
}
p.setRemoveNamespaces(true);
addParameter(p);
}
if (mode != Mode.BIS) {
if (parameterList.findParameter(CORRELATIONID) == null) {
if (paradigm != null && paradigm.equals("Response")) {
p = new Parameter();
p.setName(CORRELATIONID);
p.setSessionKey(getSoapHeaderSessionKey());
p.setXpathExpression("MessageHeader/HeaderFields/MessageId");
p.setRemoveNamespaces(true);
addParameter(p);
}
}
}
if (parameterList.findParameter(TIMESTAMP) == null) {
p = new Parameter();
p.setName(TIMESTAMP);
if (isUseFixedValues()) {
p.setPattern("{fixeddate,date,yyyy-MM-dd'T'HH:mm:ss}");
} else {
p.setPattern("{now,date,yyyy-MM-dd'T'HH:mm:ss}");
}
addParameter(p);
}
if (parameterList.findParameter(FIXRESULTNAMESPACE) == null) {
p = new Parameter();
p.setName(FIXRESULTNAMESPACE);
p.setValue(String.valueOf(isFixResultNamespace()));
addParameter(p);
}
if (parameterList.findParameter(TRANSACTIONID) == null) {
p = new Parameter();
p.setName(TRANSACTIONID);
p.setSessionKey(getSoapHeaderSessionKey());
p.setXpathExpression("MessageHeader/HeaderFields/TransactionId");
p.setRemoveNamespaces(true);
addParameter(p);
}
p = new Parameter();
p.setName(MODE);
p.setValue(getMode());
addParameter(p);
p = new Parameter();
p.setName(CMHVERSION);
p.setValue(String.valueOf(getCmhVersion()));
addParameter(p);
}
Aggregations