use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class BisWrapperPipe method configure.
public void configure() throws ConfigurationException {
ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
String msg = getLogPrefix(null) + "The class [" + getClass().getName() + "] has been deprecated. Please change to EsbSoapWrapperPipe (not 1:1)";
configWarnings.add(log, msg);
super.configure();
if (StringUtils.isNotEmpty(getSoapHeaderSessionKey())) {
throw new ConfigurationException(getLogPrefix(null) + "soapHeaderSessionKey is not allowed");
}
if (StringUtils.isEmpty(getBisMessageHeaderSessionKey())) {
throw new ConfigurationException(getLogPrefix(null) + "messageHeaderSessionKey must be set");
}
if (isAddOutputNamespace() && StringUtils.isEmpty(outputNamespace)) {
throw new ConfigurationException(getLogPrefix(null) + "outputNamespace must be set when addOutputnamespace=true");
}
try {
if (StringUtils.isNotEmpty(getInputXPath())) {
String bodyMessageNd = StringUtils.isNotEmpty(getInputNamespaceDefs()) ? soapNamespaceDefs + "\n" + getInputNamespaceDefs() : soapNamespaceDefs;
String bodyMessageXe = StringUtils.isNotEmpty(getInputXPath()) ? soapBodyXPath + "/" + getInputXPath() : soapBodyXPath + "/*";
bodyMessageTp = TransformerPool.getInstance(XmlUtils.createXPathEvaluatorSource(bodyMessageNd, bodyMessageXe, "xml"));
}
String bisMessageHeaderNd = soapNamespaceDefs + "\n" + bisNamespaceDefs;
String bisMessageHeaderXe;
if (isBisMessageHeaderInSoapBody()) {
bisMessageHeaderXe = soapBodyXPath + "/" + bisMessageHeaderXPath;
} else {
bisMessageHeaderXe = soapHeaderXPath + "/" + bisMessageHeaderXPath;
}
bisMessageHeaderTp = TransformerPool.getInstance(XmlUtils.createXPathEvaluatorSource(bisMessageHeaderNd, bisMessageHeaderXe, "xml"));
bisMessageHeaderConversationIdTp = TransformerPool.getInstance(XmlUtils.createXPathEvaluatorSource(bisNamespaceDefs, bisMessageHeaderConversationIdXPath, "text"));
bisMessageHeaderExternalRefToMessageIdTp = TransformerPool.getInstance(XmlUtils.createXPathEvaluatorSource(bisNamespaceDefs, bisMessageHeaderExternalRefToMessageIdXPath, "text"));
String bisErrorNd = soapNamespaceDefs + "\n" + bisNamespaceDefs;
if (isBisResultInPayload()) {
bisErrorXe = soapBodyXPath + "/*/" + bisErrorXPath;
} else {
bisErrorXe = soapBodyXPath + "/" + bisErrorXPath;
}
bisErrorXe = bisErrorXe + " or string-length(" + soapBodyXPath + "/" + soapErrorXPath + ")>0";
bisErrorTp = TransformerPool.getInstance(XmlUtils.createXPathEvaluatorSource(bisErrorNd, bisErrorXe, "text"));
if (isRemoveOutputNamespaces()) {
String removeOutputNamespaces_xslt = XmlUtils.makeRemoveNamespacesXslt(true, false);
removeOutputNamespacesTp = TransformerPool.getInstance(removeOutputNamespaces_xslt);
}
if (isAddOutputNamespace()) {
String addOutputNamespace_xslt = XmlUtils.makeAddRootNamespaceXslt(getOutputNamespace(), true, false);
addOutputNamespaceTp = TransformerPool.getInstance(addOutputNamespace_xslt);
}
} catch (TransformerConfigurationException e) {
throw new ConfigurationException(getLogPrefix(null) + "cannot create transformer", e);
}
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class EsbJmsListener 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)) {
setForceMessageIdAsCorrelationId(true);
if (CACHE_CONSUMER.equals(getCacheMode())) {
boolean recovered = false;
ReceiverBase receiverBase = getReceiverBase();
if (receiverBase != null) {
recovered = (receiverBase.isRecover() || receiverBase.isRecoverAdapter());
}
if (!recovered) {
ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
configWarnings.add(log, "attribute [cacheMode] already has a default value [" + CACHE_CONSUMER + "]");
}
}
setCacheMode("CACHE_CONSUMER");
} else {
setUseReplyTo(false);
}
super.configure();
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class EsbSoapWrapperPipe method configure.
@Override
public void configure() throws ConfigurationException {
if (mode == Mode.REG) {
if (cmhVersion == 0) {
cmhVersion = 1;
} else if (cmhVersion < 0 || cmhVersion > 2) {
ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
String msg = getLogPrefix(null) + "cmhVersion [" + cmhVersion + "] for mode [" + mode.toString() + "] should be set to '1' or '2', assuming '1'";
configWarnings.add(log, msg);
cmhVersion = 1;
}
} else {
if (cmhVersion != 0) {
ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
String msg = getLogPrefix(null) + "cmhVersion [" + cmhVersion + "] for mode [" + mode.toString() + "] should not be set, assuming '0'";
configWarnings.add(log, msg);
cmhVersion = 0;
}
}
if ("wrap".equalsIgnoreCase(getDirection())) {
if (StringUtils.isEmpty(getSoapHeaderSessionKey())) {
setSoapHeaderSessionKey(DEFAULT_SOAP_HEADER_SESSION_KEY);
}
if (StringUtils.isEmpty(getSoapHeaderStyleSheet())) {
if (mode == Mode.BIS) {
setSoapHeaderStyleSheet("/xml/xsl/esb/bisSoapHeader.xsl");
} else {
setSoapHeaderStyleSheet("/xml/xsl/esb/soapHeader.xsl");
}
}
if (StringUtils.isEmpty(getSoapBodyStyleSheet())) {
if (mode == Mode.REG) {
setSoapBodyStyleSheet("/xml/xsl/esb/soapBody.xsl");
} else if (mode == Mode.BIS) {
setSoapBodyStyleSheet("/xml/xsl/esb/bisSoapBody.xsl");
}
}
stripDestination();
if (isAddOutputNamespace()) {
String ons = getOutputNamespaceBaseUri();
if (getMessagingLayer().equals("P2P") || (StringUtils.isNotEmpty(p2pAlias) && getMessagingLayer().equalsIgnoreCase(p2pAlias))) {
ons = ons + "/" + getBusinessDomain() + "/" + getApplicationName() + "/" + getApplicationFunction();
} else {
ons = ons + "/" + getBusinessDomain() + "/" + getServiceName() + (StringUtils.isEmpty(getServiceContext()) ? "" : "/" + getServiceContext()) + "/" + getServiceContextVersion() + "/" + getOperationName() + "/" + getOperationVersion();
}
setOutputNamespace(ons);
}
addParameters();
}
super.configure();
if (isUseFixedValues()) {
if (!ConfigurationUtils.stubConfiguration()) {
throw new ConfigurationException(getLogPrefix(null) + "returnFixedDate only allowed in stub mode");
}
}
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class IbisWebServiceSender method configure.
public void configure() throws ConfigurationException {
if (ibisInstance == null) {
ibisInstance = AppConstants.getInstance().getResolvedProperty("instance.name");
}
try {
proxy = new ServiceDispatcher_ServiceProxy();
proxy.setEndPoint(new URL(getEndPoint()));
} catch (MalformedURLException e) {
throw new ConfigurationException("IbisWebServiceSender cannot find URL from [" + getEndPoint() + "]", e);
}
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class JavaxValidationContext method getSchemaObject.
// protected String validate(Source source, IPipeLineSession session) throws XmlValidatorException, ConfigurationException, PipeRunException {
// init();
// String schemasId = schemasProvider.getSchemasId();
// if (schemasId == null) {
// schemasId = schemasProvider.getSchemasId(session);
// getSchemaObject(schemasId, schemasProvider.getSchemas(session));
// }
// Schema xsd = javaxSchemas.get(schemasId);
// try {
// Validator validator = xsd.newValidator();
// validator.setResourceResolver(new LSResourceResolver() {
// public LSInput resolveResource(String s, String s1, String s2, String s3, String s4) {
// System.out.println("--");
// return null;//To change body of implemented methods Settings | File Templates.
// }
// });
// validator.setErrorHandler(new ErrorHandler() {
// public void warning(SAXParseException e) throws SAXException {
// log.warn(e.getMessage());
// }
//
// public void error(SAXParseException e) throws SAXException {
// log.error(e.getMessage());
// }
//
// public void fatalError(SAXParseException e) throws SAXException {
// log.error(e.getMessage());
// }
// });
// //validator.setFeature("http://xml.org/sax/features/namespace-prefixes", true); /// DOESNT" WORK any more?
// validator.validate(source);
// } catch (SAXException e) {
// throw new XmlValidatorException(e.getClass() + " " + e.getMessage());
// } catch (IOException e) {
// throw new XmlValidatorException(e.getMessage(), e);
// }
// return XML_VALIDATOR_VALID_MONITOR_EVENT;
// }
/**
* Returns the {@link Schema} associated with this validator. This ia an XSD schema containing knowledge about the
* schema source as returned by {@link #getSchemaSources(List)}
* @throws ConfigurationException
*/
protected synchronized Schema getSchemaObject(String schemasId, List<nl.nn.adapterframework.validation.Schema> schemas) throws ConfigurationException {
Schema schema = javaxSchemas.get(schemasId);
if (schema == null) {
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
factory.setResourceResolver(new LSResourceResolver() {
public LSInput resolveResource(String s, String s1, String s2, String s3, String s4) {
return null;
}
});
try {
Collection<Source> sources = getSchemaSources(schemas);
schema = factory.newSchema(sources.toArray(new Source[sources.size()]));
javaxSchemas.put(schemasId, schema);
} catch (Exception e) {
throw new ConfigurationException("cannot read schema's [" + schemasId + "]", e);
}
}
return schema;
}
Aggregations