diff --git a/spring-integration-samples/loan-broker/.classpath b/spring-integration-samples/loan-broker/.classpath
new file mode 100644
index 0000000000..96489ff1c9
--- /dev/null
+++ b/spring-integration-samples/loan-broker/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-integration-samples/loan-broker/.project b/spring-integration-samples/loan-broker/.project
new file mode 100644
index 0000000000..be2565f916
--- /dev/null
+++ b/spring-integration-samples/loan-broker/.project
@@ -0,0 +1,29 @@
+
+
+ loan-broker
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.maven.ide.eclipse.maven2Builder
+
+
+
+
+ org.springframework.ide.eclipse.core.springbuilder
+
+
+
+
+
+ org.springframework.ide.eclipse.core.springnature
+ org.eclipse.jdt.core.javanature
+ org.maven.ide.eclipse.maven2Nature
+
+
diff --git a/spring-integration-samples/loan-broker/pom.xml b/spring-integration-samples/loan-broker/pom.xml
new file mode 100644
index 0000000000..46ce34a182
--- /dev/null
+++ b/spring-integration-samples/loan-broker/pom.xml
@@ -0,0 +1,96 @@
+
+ 4.0.0
+ loan.broker
+ loan.broker
+ 0.0.1-SNAPSHOT
+
+
+ org.springframework.integration
+ org.springframework.integration
+ 2.0.0.BUILD-20100312044142
+
+
+ org.springframework
+ org.springframework.spring-library
+ libd
+ 3.0.1.RELEASE
+
+
+ org.junit
+ com.springsource.org.junit
+ 4.7.0
+
+
+ org.apache.commons
+ com.springsource.org.apache.commons.logging
+ 1.1.1
+
+
+ org.mockito
+ com.springsource.org.mockito
+ 1.8.0
+
+
+ org.apache.log4j
+ com.springsource.org.apache.log4j
+ 1.2.15
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ org.junit:com.springsource.org.junit
+
+
+
+
+
+
+
+ com.springsource.repository.bundles.release
+ EBR Spring Release Repository
+ http://repository.springsource.com/maven/bundles/release
+
+
+ com.springsource.repository.bundles.external
+ EBR External Release Repository
+ http://repository.springsource.com/maven/bundles/external
+
+
+ org.springframework.maven.milestone
+ Maven Central Compatible Spring Milestone Repository
+ http://maven.springframework.org/milestone
+
+
+ com.springsource.repository.bundles.milestone
+ EBR Spring Milestone Repository
+ http://repository.springsource.com/maven/bundles/milestone
+
+
+ org.springframework.maven.snapshot
+ Maven Central Compatible Spring Snapshot Repository
+ http://maven.springframework.org/snapshot
+
+
+ com.springsource.repository.bundles.snapshot
+ EBR Spring Snapshot Repository
+ http://repository.springsource.com/maven/bundles/snapshot
+
+
+ com.springsource.repository.libraries.release
+ SpringSource Enterprise Bundle Repository - SpringSource Library Releases
+ http://repository.springsource.com/maven/libraries/release
+
+
+
+ com.springsource.repository.libraries.external
+ SpringSource Enterprise Bundle Repository - External Library Releases
+ http://repository.springsource.com/maven/libraries/external
+
+
+
\ No newline at end of file
diff --git a/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/BanksChannelSelector.java b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/BanksChannelSelector.java
new file mode 100644
index 0000000000..561bbe8d07
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/BanksChannelSelector.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.loanbroker;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.springframework.expression.EvaluationContext;
+import org.springframework.expression.Expression;
+import org.springframework.expression.ExpressionParser;
+import org.springframework.expression.spel.standard.SpelExpressionParser;
+import org.springframework.expression.spel.support.StandardEvaluationContext;
+import org.springframework.integration.core.Message;
+
+/**
+ * Will select channel names from the map of banks based on provided SpEL expression.
+ * For example:
+ * headers['CREDIT_SCORE'].score > 780 ? #banks.?[value.equals('premier')].keySet()
+ * : #banks.?[value.equals('secondary')].keySet()
+ *
+ * The above SpEL expression upon evaluation will return the list of premier bank
+ * channels if customer's credit score is above 780.
+ *
+ * @author Oleg Zhurakousky
+ *
+ */
+public class BanksChannelSelector {
+ private static Logger logger = Logger.getLogger(BanksChannelSelector.class);
+ private Map bankChannelPool;
+ private String routingExpression;
+ /**
+ *
+ * @param bankChannelPool
+ */
+ public BanksChannelSelector(Map bankChannelPool){
+ this.bankChannelPool = bankChannelPool;
+ }
+ /**
+ *
+ * @param message
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public Set selectBankChannels(Message> message) {
+ EvaluationContext context = new StandardEvaluationContext(message);
+
+ context.setVariable("banks", bankChannelPool);
+ ExpressionParser parser = new SpelExpressionParser();
+ Expression expression = parser.parseExpression(routingExpression);
+ Set bankChannels = (Set) expression.getValue(context);
+ logger.debug("Selected bank channels: " + bankChannels);
+ return bankChannels;
+ }
+ /**
+ * @param routingExpression
+ */
+ public void setRoutingExpression(String routingExpression) {
+ this.routingExpression = routingExpression;
+ }
+}
diff --git a/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/LoanBrokerGateway.java b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/LoanBrokerGateway.java
new file mode 100644
index 0000000000..c2ebc64f5e
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/LoanBrokerGateway.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.loanbroker;
+
+import java.util.List;
+
+import org.springframework.integration.loanbroker.domain.LoanQuote;
+import org.springframework.integration.loanbroker.domain.LoanRequest;
+
+/**
+ * POJI Gateway which connects method invocations to the request-channel
+ * completely isolating SI developer from SI API details.
+ *
+ * @author Oleg Zhurakousky
+ *
+ */
+public interface LoanBrokerGateway {
+ /**
+ * Will return the best {@link LoanQuote}
+ *
+ * @param loanRequest
+ * @return
+ */
+ public LoanQuote getLoanQuote(LoanRequest loanRequest);
+ /**
+ * Will return all {@link LoanQuote}s
+ * @param loanRequest
+ * @return
+ */
+ public List getAllLoanQuotes(LoanRequest loanRequest);
+}
diff --git a/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/LoanQuoteAggregator.java b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/LoanQuoteAggregator.java
new file mode 100644
index 0000000000..6620e8c081
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/LoanQuoteAggregator.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.loanbroker;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.springframework.integration.core.Message;
+import org.springframework.integration.loanbroker.domain.LoanQuote;
+
+/**
+ * Will aggregate {@link LoanQuote}s based on the value of the 'RESPONSE_TYPE' message header.
+ * The value of 'RESPONSE_TYPE' header is set by 'header-enricher' and is based on the type of
+ * {@link LoanBrokerGateway} method that was invoked by the client.
+ * Will return the best {@link LoanQuote} if 'RESPONSE_TYPE' header value is 'BEST' else it will return
+ * all quotes.
+ *
+ * @author Oleg Zhurakousky
+ *
+ */
+public class LoanQuoteAggregator {
+ /**
+ * @param messages
+ * @return
+ */
+ @SuppressWarnings({ "unused", "unchecked" })
+ private Object aggregateQuotes(List> messages) {
+
+ ArrayList payloads = new ArrayList(messages.size());
+ for (Message> message : messages) {
+ payloads.add(message.getPayload());
+ }
+ String responceType = (String) messages.get(0).getHeaders().get("RESPONSE_TYPE");
+ if (responceType.equals("ALL")) {
+ return payloads;
+ } else {
+ Collections.sort(payloads);
+ return payloads.get(0);
+ }
+ }
+}
diff --git a/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/demo/LoanBrokerDemo.java b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/demo/LoanBrokerDemo.java
new file mode 100644
index 0000000000..d051b99aa0
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/demo/LoanBrokerDemo.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.loanbroker.demo;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.integration.loanbroker.LoanBrokerGateway;
+import org.springframework.integration.loanbroker.domain.Customer;
+import org.springframework.integration.loanbroker.domain.LoanQuote;
+import org.springframework.integration.loanbroker.domain.LoanRequest;
+
+/**
+ * @author Oleg Zhurakousky
+ *
+ */
+public class LoanBrokerDemo {
+ private static Logger logger = Logger.getLogger(LoanBrokerDemo.class);
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("loan-broker-config.xml");
+ LoanBrokerGateway broker = ac.getBean("loanBrokerGateway", LoanBrokerGateway.class);
+ LoanRequest loanRequest = new LoanRequest();
+ loanRequest.setCustomer(new Customer());
+
+ LoanQuote loan = broker.getLoanQuote(loanRequest);
+ logger.info("\n********* Best Quote: " + loan);
+
+ List loanQuotes = broker.getAllLoanQuotes(loanRequest);
+ logger.info("\n********* All Quotes: ");
+ for (LoanQuote loanQuote : loanQuotes) {
+ logger.info(loanQuote);
+ }
+
+ ac.close();
+ }
+
+}
diff --git a/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/Address.java b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/Address.java
new file mode 100644
index 0000000000..0f70b52e0e
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/Address.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.loanbroker.domain;
+
+/**
+ * @author Oleg Zhurakousky
+ *
+ */
+public class Address {
+ private String street;
+ private String zip;
+ private String city;
+ private String state;
+ public String getStreet() {
+ return street;
+ }
+ public void setStreet(String street) {
+ this.street = street;
+ }
+ public String getZip() {
+ return zip;
+ }
+ public void setZip(String zip) {
+ this.zip = zip;
+ }
+ public String getCity() {
+ return city;
+ }
+ public void setCity(String city) {
+ this.city = city;
+ }
+ public String getState() {
+ return state;
+ }
+ public void setState(String state) {
+ this.state = state;
+ }
+}
diff --git a/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/CreditScore.java b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/CreditScore.java
new file mode 100644
index 0000000000..4875da975f
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/CreditScore.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.loanbroker.domain;
+/**
+ * @author Oleg Zhurakousky
+ *
+ */
+public class CreditScore {
+ private final int score;
+ private String creditHistory;
+
+ public CreditScore(int score){
+ this.score = score;
+ }
+
+ public String getCreditHistory() {
+ return creditHistory;
+ }
+
+ public void setCreditHistory(String creditHistory) {
+ this.creditHistory = creditHistory;
+ }
+
+ public int getScore() {
+ return score;
+ }
+
+}
diff --git a/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/Customer.java b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/Customer.java
new file mode 100644
index 0000000000..4b23fa9842
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/Customer.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.loanbroker.domain;
+
+
+/**
+ * @author Oleg Zhurakousky
+ *
+ */
+public class Customer {
+
+ private String fname;
+ private String lname;
+ private Address address;
+
+ public String getFname() {
+ return fname;
+ }
+ public void setFname(String fname) {
+ this.fname = fname;
+ }
+ public String getLname() {
+ return lname;
+ }
+ public void setLname(String lname) {
+ this.lname = lname;
+ }
+ public Address getAddress() {
+ return address;
+ }
+ public void setAddress(Address address) {
+ this.address = address;
+ }
+}
diff --git a/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/LoanQuote.java b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/LoanQuote.java
new file mode 100644
index 0000000000..958d4edce6
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/LoanQuote.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.loanbroker.domain;
+
+import java.text.DecimalFormat;
+import java.util.Date;
+
+/**
+ * @author Oleg Zhurakousky
+ *
+ */
+public class LoanQuote implements Comparable{
+
+ private String lender;
+ private Date quoteDate;
+ private Date expirationDate;
+ private double loanAmount;
+ private int loanTerm;
+ private float rate;
+
+ public String getLender() {
+ return lender;
+ }
+ public void setLender(String lender) {
+ this.lender = lender;
+ }
+ public Date getQuoteDate() {
+ return quoteDate;
+ }
+ public void setQuoteDate(Date quoteDate) {
+ this.quoteDate = quoteDate;
+ }
+ public Date getExpirationDate() {
+ return expirationDate;
+ }
+ public void setExpirationDate(Date expirationDate) {
+ this.expirationDate = expirationDate;
+ }
+ public double getLoanAmount() {
+ return loanAmount;
+ }
+ public void setLoanAmount(double loanAmount) {
+ this.loanAmount = loanAmount;
+ }
+ public int getLoanTerm() {
+ return loanTerm;
+ }
+ public void setLoanTerm(int loanTerm) {
+ this.loanTerm = loanTerm;
+ }
+ public float getRate() {
+ return rate;
+ }
+ public void setRate(float rate) {
+ this.rate = rate;
+ }
+
+ public String toString(){
+ return "\n====== Loan Quote =====\n" +
+ "Lender: " + lender + "\n" +
+ "Loan amount: " + new DecimalFormat("$###,###.###").format(loanAmount) + "\n" +
+ "Quotation Date: " + quoteDate + "\n" +
+ "Expiration Date: " + expirationDate + "\n" +
+ "Term: " + loanTerm + " years" + "\n" +
+ "Rate: " + rate + "%\n" +
+ "=======================\n";
+
+ }
+
+ public int compareTo(LoanQuote loanQuote) {
+ if (loanQuote.rate > this.rate){
+ return 1;
+ } else if (loanQuote.rate < this.rate){
+ return -1;
+ }
+ return 0;
+ }
+}
diff --git a/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/LoanRequest.java b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/LoanRequest.java
new file mode 100644
index 0000000000..fda57d4e0a
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/domain/LoanRequest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.loanbroker.domain;
+
+
+/**
+ * @author Oleg Zhurakousky
+ *
+ */
+public class LoanRequest {
+
+ private Customer customer;
+ private float loanAmount;
+ public Customer getCustomer() {
+ return customer;
+ }
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+ public float getLoanAmount() {
+ return loanAmount;
+ }
+ public void setLoanAmount(float loanAmount) {
+ this.loanAmount = loanAmount;
+ }
+}
diff --git a/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/stubs/BankStub.java b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/stubs/BankStub.java
new file mode 100644
index 0000000000..46148356bd
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/stubs/BankStub.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.loanbroker.stubs;
+
+import java.util.Calendar;
+import java.util.Random;
+
+import org.springframework.integration.loanbroker.domain.LoanQuote;
+import org.springframework.integration.loanbroker.domain.LoanRequest;
+
+/**
+ * @author Oleg Zhurakousky
+ *
+ */
+public class BankStub {
+
+ /**
+ *
+ * @param loanRequest
+ * @return
+ */
+ public LoanQuote quote(LoanRequest loanRequest){
+ Calendar calendar = Calendar.getInstance();
+ LoanQuote loanQuote = new LoanQuote();
+ Random random = new Random();
+ loanQuote.setQuoteDate(calendar.getTime());
+ calendar.add(Calendar.DAY_OF_YEAR, random.nextInt(25));
+ loanQuote.setExpirationDate(calendar.getTime());
+ loanQuote.setRate(random.nextFloat() + 5);
+ loanQuote.setLoanTerm(10 + random.nextInt(10));
+ loanQuote.setLoanAmount(250000 + random.nextInt(40000));
+ loanQuote.setLender("StubBank-" + random.nextInt(30));
+ return loanQuote;
+ }
+}
diff --git a/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/stubs/CreditBureauStub.java b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/stubs/CreditBureauStub.java
new file mode 100644
index 0000000000..75b24812ec
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/java/org/springframework/integration/loanbroker/stubs/CreditBureauStub.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2002-2008 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.integration.loanbroker.stubs;
+
+import java.util.Random;
+
+import org.apache.log4j.Logger;
+import org.springframework.integration.loanbroker.domain.CreditScore;
+import org.springframework.integration.loanbroker.domain.LoanRequest;
+
+/**
+ * @author Oleg Zhurakousky
+ *
+ */
+public class CreditBureauStub {
+ private static Logger logger = Logger.getLogger(CreditBureauStub.class);
+ /**
+ *
+ * @param loanRequest
+ * @return
+ */
+ public CreditScore getCreditScore(LoanRequest loanRequest){
+ Random random = new Random();
+ int creditScore = 750 + random.nextInt(100);
+ logger.info("Credit Score: " + creditScore);
+ return new CreditScore(creditScore);
+ }
+}
diff --git a/spring-integration-samples/loan-broker/src/main/resources/bank-channel-mappings-config.xml b/spring-integration-samples/loan-broker/src/main/resources/bank-channel-mappings-config.xml
new file mode 100644
index 0000000000..6f4e66e685
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/resources/bank-channel-mappings-config.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-integration-samples/loan-broker/src/main/resources/loan-broker-config.xml b/spring-integration-samples/loan-broker/src/main/resources/loan-broker-config.xml
new file mode 100644
index 0000000000..a121535631
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/resources/loan-broker-config.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ headers['CREDIT_SCORE'].score > 780 ? #banks.?[value.equals('premier')].keySet()
+ : #banks.?[value.equals('secondary')].keySet()
+
+
+
+
diff --git a/spring-integration-samples/loan-broker/src/main/resources/log4j.xml b/spring-integration-samples/loan-broker/src/main/resources/log4j.xml
new file mode 100644
index 0000000000..0b9e8ee789
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/resources/log4j.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-integration-samples/loan-broker/src/main/resources/stub-services-config.xml b/spring-integration-samples/loan-broker/src/main/resources/stub-services-config.xml
new file mode 100644
index 0000000000..a1b56f109d
--- /dev/null
+++ b/spring-integration-samples/loan-broker/src/main/resources/stub-services-config.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+