
META-INF.spring.camel-context.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <!-- Unless explicitly acquired and licensed from Licensor under another license, the contents of this file are subject to the Reciprocal Public License ("RPL") Version 1.5, or subsequent versions as allowed by the RPL, and You may not copy or use this file in either source code or executable form, except in compliance with the terms and conditions of the RPL All software distributed under the RPL is provided strictly on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND LICENSOR HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT, OR NON-INFRINGEMENT. See the RPL for specific language governing rights and limitations under the RPL. http://opensource.org/licenses/RPL-1.5 Copyright 2012-2017 Open Justice Broker Consortium --> <!-- Configures the Camel Context--> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:ctx="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:lexpd="http://usdoj.gov/leisp/lexs/publishdiscover/3.1" xmlns:ext="http://ojbc.org/IEPD/Extensions/IncidentReportRequest/1.0" xsi:schemaLocation=" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd "> <!-- needed cxf imports --> <import resource="classpath:META-INF/cxf/cxf.xml"/> <camel:camelContext xmlns="http://camel.apache.org/schema/spring" id="Incident_Report_Request_Service_Intermediary"> <endpoint id="incidentReportRequestFederatedServiceEndpoint" uri="cxf:bean:incidentReportRequestFederatedService?dataFormat=PAYLOAD&loggingFeatureEnabled=${personQuery.incidentReport.personQueryIntermediaryCxflogging}" /> <endpoint id="incidentReportResultsFederatedServiceEndpoint" uri="cxf:bean:incidentReportResultsFederatedService?dataFormat=PAYLOAD&loggingFeatureEnabled=${personQuery.incidentReport.personQueryIntermediaryCxflogging}&allowStreaming=false" /> <endpoint id="incidentReportRequestFederatedServiceAdapterEndpoint" uri="cxf:bean:incidentReportRequestFederatedServiceAdapter?dataFormat=PAYLOAD&loggingFeatureEnabled=${personQuery.incidentReport.personQueryIntermediaryCxflogging}" /> <endpoint id="presentIncidentReportResultsServiceEndpoint" uri="cxf:bean:presentIncidentReportResultsFederatedService?dataFormat=PAYLOAD&loggingFeatureEnabled=${personQuery.incidentReport.personQueryIntermediaryCxflogging}&allowStreaming=false" /> <!-- Federated Search Request Handler--> <camel:route> <camel:from uri="incidentReportRequestFederatedServiceEndpoint" /> <!-- Get the WS-Addressing ID, set Camel header: federatedQueryRequestGUID --> <camel:to uri="bean:messageProcessor?method=processRequestPayload" /> <camel:choice> <camel:when> <camel:simple>${properties:federatedQuery.incidentReport.dbAuditLog} == 'true'</camel:simple> <camel:doTry> <camel:to uri="bean:sqlLoggingProcessor?method=logExchange"/> <doCatch> <exception>java.lang.Exception</exception> <camel:log message="logging returned exception, handling and continuing: ${exception.message}"/> </doCatch> </camel:doTry> </camel:when> </camel:choice> <camel:choice> <camel:when> <camel:simple>${properties:personQuery.dbEnancedAuditLog} == 'true'</camel:simple> <camel:doTry> <camel:to uri="bean:queryRequestSQLLoggingProcessor?method=auditPersonQueryRequest"/> <doCatch> <exception>java.lang.Exception</exception> <camel:log message="logging returned exception, handling and continuing: ${exception.message}"/> </doCatch> </camel:doTry> </camel:when> </camel:choice> <camel:choice> <camel:when> <camel:method bean="accessControlProcessor" method="authorize" /> <camel:log message="access control returned true, access message: ${in.headers.accessControlResponseMessage}"/> </camel:when> <camel:otherwise> <camel:log message="access control returned false, access message: ${in.headers.accessControlResponseMessage}"/> </camel:otherwise> </camel:choice> <!-- Get the SAML Token from the request message and put into OJB SAML Map --> <camel:to uri="bean:camelSAMLTokenProcessor?method=retrieveSAMLTokenFromMessage"/> <!-- Perform Xpath query to get list of systems to call and set as Camel Header --> <!-- Change this XPath to match what you need --> <camel:setHeader headerName="federatedQueryEndpointsNodeList"> <camel:xpath>//ext:SourceSystemNameText</camel:xpath> </camel:setHeader> <camel:log message="endpoints: ${header.federatedQueryEndpointsNodeList}" /> <camel:setHeader headerName="operationName"><constant>SubmitIncidentIdentiferIncidentReportRequest</constant></camel:setHeader> <camel:setHeader headerName="operationNamespace"><constant>http://ojbc.org/Services/WSDL/IncidentReportRequestService/1.0</constant></camel:setHeader> <!-- Since this is a query, we only call one endpoint --> <camel:setHeader headerName="adapterURI"> <camel:xpath resultType="java.lang.String">//ext:SourceSystemNameText</camel:xpath> </camel:setHeader> <!-- Add the reply to address to the map using the federated query guid as the key --> <camel:to uri="bean:wsAddressingReplyToManager?method=putReplyToAddress"/> <!-- Call method to populate federated query map and create federatedQueryRecipientListHeader (comma seperated camel endpoint list)--> <camel:to uri="bean:federatedQueryMessageProcessor?method=processSystemName" /> <!-- Set search request as message body header. We will split on the source system name and will need the original request --> <camel:setHeader headerName="requestMessageBody"> <camel:simple resultType="org.w3c.dom.Document">${body}</camel:simple> </camel:setHeader> <!-- This wiretap will start the message timer. There were anamolies with having it as part of the Recipient List --> <camel:wireTap uri="direct:startFederatedQueryTimer"/> <camel:log message="Timer started"/> <camel:split onPrepareRef="prepareFederateQueryMessage" parallelProcessing="false"> <camel:xpath>//ext:SourceSystemNameText</camel:xpath> <camel:log message="This is the split body: ${body}. This is the webservice endpoint to call: ${in.headers.webServiceEndpointToCall}" loggingLevel="DEBUG"/> <camel:recipientList> <camel:header>webServiceEndpointToCall</camel:header> </camel:recipientList> </camel:split> </camel:route> <camel:route> <from uri="direct:startFederatedQueryTimer"/> <setBody> <constant>START_QUERY_TIMER</constant> </setBody> <camel:to uri="direct:aggregateFederatedQuery" /> </camel:route> <!-- Incident Results Handler Route --> <camel:route> <camel:from uri="incidentReportResultsFederatedServiceEndpoint" /> <camel:choice> <camel:when> <camel:simple>${properties:federatedQuery.incidentReport.dbAuditLog} == 'true'</camel:simple> <camel:doTry> <camel:to uri="bean:sqlLoggingProcessor?method=logExchange"/> <doCatch> <exception>java.lang.Exception</exception> <camel:log message="logging returned exception, handling and continuing: ${exception.message}"/> </doCatch> </camel:doTry> </camel:when> </camel:choice> <camel:log message="Entering Incident Report Results Handler"></camel:log> <camel:setHeader headerName="searchProfile"> <camel:constant>{http://ojbc.org/Services/WSDL/IncidentReportRequestService/1.0}SubmitIncidentIdentiferIncidentReportRequest-DPS</camel:constant> </camel:setHeader> <camel:to uri="bean:federatedQueryMessageProcessor?method=processFederatedResponse" /> <camel:log message="Calling Aggregator" /> <camel:to uri="direct:aggregateFederatedQuery" /> </camel:route> <camel:route> <from uri="direct:aggregateFederatedQuery" /> <log message="In aggregator with correlation id: ${in.header.federatedQueryRequestGUID}"/> <aggregate groupExchanges="true" eagerCheckCompletion="true"> <correlationExpression> <camel:header>federatedQueryRequestGUID</camel:header> </correlationExpression> <completionTimeout> <camel:simple>${properties:personQuery.incidentReport.personQueryIntermediaryFederatedQueryTimeout}</camel:simple> </completionTimeout> <completionSize> <header>federatedQueryNumberOfEndpointsRequested</header> </completionSize> <log message="completed by $simple{property.CamelAggregatedCompletedBy}, completion size $simple{property.CamelAggregatedSize}, aggregation key $simple{property.CamelAggregatedCorrelationKey}. Timeout for aggregation set at: {{personQuery.incidentReport.personQueryIntermediaryFederatedQueryTimeout}}"></log> <to uri="bean:federatedQueryResponseAggregator?method=aggregateGroupMessagesString" /> <log message="This is the completed aggregated body: ${body}" loggingLevel="DEBUG"/> <camel:to uri="direct:processFederatedResponse"/> </aggregate> </camel:route> <!-- Process aggregated federated responses here --> <camel:route> <camel:from uri="direct:processFederatedResponse"/> <!-- This line remove the OJBWrapper element that the aggregator adds, This XPath works because we only have one response --> <camel:setBody><xpath>/OJBAggregateResponseWrapper/*[1]</xpath></camel:setBody> <camel:to uri="bean:wsAddressingReplyToManager?method=getReplyToAddress"/> <camel:to uri="bean:wsAddressingReplyToManager?method=removeReplyToAddress"/> <camel:to uri="bean:WSAddressingEndpointProcessor?method=processReplyToAddress" /> <camel:choice> <camel:when> <camel:simple>${in.headers.recipientListReplyToEndpoint} != ''</camel:simple> <camel:to uri="bean:messageProcessor?method=prepareNewExchangeResponseMessage"/> <camel:setHeader headerName="operationName"> <constant>ReportIncident</constant> </camel:setHeader> <camel:setHeader headerName="operationNamespace"> <constant>http://ojbc.org/Services/WSDL/IncidentReportingService/1.0</constant> </camel:setHeader> <camel:log message="About to send incident report response message to ${in.headers.recipientListReplyToEndpoint}" /> <camel:recipientList> <camel:header>recipientListReplyToEndpoint</camel:header> </camel:recipientList> </camel:when> <camel:otherwise> <camel:log message="Unable to find endpoint for replyTo address: ${in.headers.WSAddressingReplyTo}"/> </camel:otherwise> </camel:choice> </camel:route> </camel:camelContext> <!-- Spring Beans --> <util:map map-class="java.util.HashMap" id="federatedQueryManager" /> <bean id="federatedQueryResponseAggregator" class="org.ojbc.util.fedquery.processor.FederatedQueryResponseHandlerAggregator"> <property name="federatedQueryManager"> <ref bean="federatedQueryManager" /> </property> </bean> <bean id="messageProcessor" class="org.ojbc.util.camel.processor.MessageProcessor" /> <!-- Used to retrieve and persist SAML tokens --> <bean id="camelSAMLTokenProcessor" class="org.ojbc.util.camel.security.saml.CamelSAMLTokenProcessor"> <property name="OJBSamlMap" ref="ojbSamlMap"/> </bean> <bean id="ojbSamlMap" class="org.ojbc.util.camel.security.saml.OJBSamlMap" /> <bean id="prepareFederateQueryMessage" class="org.ojbc.util.fedquery.processor.PrepareFederatedQueryMessage"> <property name="exchangeDestinationLookupStrategy" ref="exchangeDestinationLookupStrategy"/> </bean> <bean id="federatedQueryMessageProcessor" class="org.ojbc.util.fedquery.processor.FederatedQueryMessageProcessor"> <property name="federatedQueryManager"> <ref bean="federatedQueryManager" /> </property> </bean> <bean class="org.ojbc.util.camel.security.saml.OJBSamlCallbackHandler" id="ojbSamlCallbackHandler"> <property name="OJBSamlMap" ref="ojbSamlMap"/> </bean> <bean id="accessControlProcessor" class="org.ojbc.util.camel.processor.accesscontrol.AccessControlProcessor" /> <bean id="wsAddressingReplyToManager" class="org.ojbc.util.fedquery.processor.WSAddressingReplyToManager"> <property name="wsAddressingEndpointProcessor" ref="WSAddressingEndpointProcessor"/> </bean> <bean id="WSAddressingEndpointProcessor" class="org.ojbc.util.camel.processor.WSAddressingEndpointProcessor"> <property name ="endpointReplyToMap" ref="wsAddressReplyToEndpointMap"/> </bean> </beans>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy