INTSAMPLES-89 - Upgrade to Spring Integration 2.2 RC3

* Test samples
* Polish documentation
* Polish code

For reference see: https://jira.springsource.org/browse/INTSAMPLES-89
This commit is contained in:
Gunnar Hillert
2012-10-28 22:51:14 -04:00
parent 251e035a18
commit 3c9c91c847
93 changed files with 1666 additions and 1454 deletions

View File

@@ -3,14 +3,14 @@ Spring Integration Samples
# Introduction
Welcome to the Spring Integration Samples. To simplify your experience, Spring Integration Samples were split into 4 distinct categories:
Welcome to the **Spring Integration Samples** repository which provides **50+ samples** to help you learn [Spring Integration][]. To simplify your experience, the *Spring Integration* samples are split into 4 distinct categories:
* Basic
* Intermediate
* Advanced
* Applications
Inside of each category you'll find a 'README.md' which will contain a more detailed description of that category's specifics. Each sample also comes with its own 'readme.txt' file explaining details.
Inside of each category you'll find a **README.md** file, which will contain a more detailed description of that category. Each sample also comes with its own **README.md** file explaining further details, e.g. how to run the respective sample.
*Happy Integration!*
@@ -31,21 +31,26 @@ Below is a short description of each category.
This is a good place to get started. The samples here are technically motivated and demonstrate the bare minimum with regard to configuration and code to help you to get introduced to the basic concepts, API and configuration of Spring Integration. For example, if you are looking for an answer on how to wire a **Service Activator** to a **Channel** or how to apply a **Gateway** to your message exchange or how to get started with using the **MAIL** or **XML** module, this would be the right place to find a relevant sample. The bottom line is that this is a good starting point.
* **amqp** - demonstrates the functionality of the various **AMQP Adapters**
* **control-bus** - demonstrates the functionality of the **Control Bus**
* **feed** - demonstrates the functionality of the **Feed Adapter** (RSS/ATOM)
* **file** - demonstrates aspects of the various File Adapters (e.g. **File Inbound/Outbound Channel Adapters**, file **polling**)
* **ftp** - demonstrates the **FTP support** available with Spring Integration
* **helloworld** - very simple starting example illustrating a basic message flow (using **Channel**, **ServiceActivator**, **QueueChannel**)
* **http** - demonstrates request/reply communication when using a pair of **HTTP Inbound/Outbound gateways**
* **jms** - demonstrates **JMS** support available with Spring Integration
* **jmx** - demonstrates **JMX** support using a **JMX Attribute Polling Channel** and **JMX Operation Invoking Channel Adapter**
* **mail** - example showing **IMAP** and **POP3** support
* **amqp** - Demonstrates the functionality of the various **AMQP Adapters**
* **control-bus** - Demonstrates the functionality of the **Control Bus**
* **enricher** - This sample demonstrates how the Enricher components can be used
* **feed** - Demonstrates the functionality of the **Feed Adapter** (RSS/ATOM)
* **file** - Demonstrates aspects of the various File Adapters (e.g. **File Inbound/Outbound Channel Adapters**, file **polling**)
* **ftp** - Demonstrates the **FTP support** available with Spring Integration
* **helloworld** - Very simple starting example illustrating a basic message flow (using **Channel**, **ServiceActivator**, **QueueChannel**)
* **http** - Demonstrates request/reply communication when using a pair of **HTTP Inbound/Outbound gateways**
* **jdbc** - Illustrates the usage of the Jdbc Adapters, including object persistence and retrieval
* **jms** - Demonstrates **JMS** support available with Spring Integration
* **jmx** - Demonstrates **JMX** support using a **JMX Attribute Polling Channel** and **JMX Operation Invoking Channel Adapter**
* **jpa** - Shows the usage of the JPA Components can be used
* **mail** - Example showing **IMAP** and **POP3** support
* **mongodb** - Shows how to persist a Message payload to a **MongoDb** document store and how to read documents from **MongoDb**
* **oddeven** - Example combining the functionality of **Inbound Channel Adapter**, **Filter**, **Router** and **Poller**
* **jpa** - This sample illustrates how the JPA Components can be used
* **quote** - Example demoing core EIP support using **Channel Adapter (Inbound and Stdout)**, **Poller** with Interval Trigers, **Service Activator**
* **sftp** - demonstrating SFTP support using **SFTP Inbound / Outbound Channel Adapters**
* **tcp-client-server** - demonstrates socket communication using **TcpOutboundGateway**, **TcpInboundGateway** and also uses a **Gateway** and a **Service Activator**
* **sftp** - Demonstrating SFTP support using **SFTP Inbound / Outbound Channel Adapters**
* **tcp-amqp** - Demonstrates basic functionality of bridging the **Spring Integration TCP Adapters** with **Spring Integration AMQP Adapters**
* **tcp-client-server** - Demonstrates socket communication using **TcpOutboundGateway**, **TcpInboundGateway** and also uses a **Gateway** and a **Service Activator**
* **testing-examples** - A series of test cases that show techniques to **test** Spring Integration applications.
* **twitter** - Illustrates Twitter support using the **Twitter Inbound Channel Adapter**, **Twitter Inbound Search Channel Adapter**, **Twitter Outbound Channel Adapter**
* **ws-inbound-gateway** - Example showing basic functionality of the **Web Service Gateway**
@@ -58,36 +63,41 @@ This is a good place to get started. The samples here are technically motivated
This category targets developers who are already more familiar with the Spring Integration framework (past getting started), but need some more guidance while resolving more advanced technical problems that you have to deal with when switching to a Messaging architecture. For example, if you are looking for an answer on how to handle errors in various scenarios, or how to properly configure an **Aggregator** for the situations where some messages might not ever arrive for aggregation, or any other issue that goes beyond a basic understanding and configuration of a particular component to address "what else you can do?" types of problems, this would be the right place to find relevant examples.
* **async-gateway** - Usage example of an asynchronous **Gateway**
* **dynamic-poller** - Example shows usage of a **Poller** with a custom **Trigger** to change polling periods at runtime
* **async-gateway** - Example shows usage of an **Asynchronous Gateway**
* **errorhandling** - Demonstrates basic **Error Handling** capabilities of Spring Integration
* **file-processing** - Sample demonstrates how to wire a message flow to process files either sequentially (maintain the order) or concurrently (no order).
* **mail-attachments** - Demonstrates the processing of email attachments
* **monitoring** The project used in the *[Spring Integration Management and Monitoring Webinar](http://www.springsource.org/node/3598)* Also available on the *[SpringSourceDev YouTube Channel](http://www.youtube.com/SpringSourceDev)*
* **multipart-http** - Demonstrates the sending of HTTP multipart requests using Spring's **RestTemplate** and a Spring Integration **Http Outbound Gateway**
* **travel** - More sophisticated example showing the retrieval of weather (SOAP Web Service) and traffic (HTTP Service) reports using real services
* **tcp-client-server-multiplex** - Demonstrates the use of *Collaborating Channel Adapters*
* **stored-procedures-derby** Provides an example of the stored procedure Outbound Gateway using *[Apache Derby](http://db.apache.org/derby/)*
* **stored-procedures-oracle** Provides an example of the stored procedure Outbound Gateway using *ORACLE XE*
* **stored-procedures-postgresql** Provides an example of the stored procedure Outbound Gateway using *[PostgreSQL](http://www.postgresql.org/)*
* **rest-http** - This sample demonstrates how to send an HTTP request to a Spring Integration's HTTP service while utilizing Spring Integration's new HTTP Path usage. This sample also uses Spring Security for HTTP Basic authentication. With HTTP Path facility, the client program can send requests with URL Variables.
* **retry-and-more** Provides samples showing the application of MessageHandler Advice Chains to endpoints - retry, circuit breaker, expression evaluating
* **splitter-aggregator-reaper** A demonstration of implementing the Splitter and Aggregator *Enterprise Integration Patterns* (EIP) together. This sample also provides a concrete example of a [message store reaper][] in action.
* **stored-procedures-derby** Provides an example of the stored procedure Outbound Gateway using *[Apache Derby](http://db.apache.org/derby/)*
* **stored-procedures-ms** Provides an example of the stored procedure Outbound Gateway using *Microsoft SQL Server*
* **stored-procedures-oracle** Provides an example of the stored procedure Outbound Gateway using *ORACLE XE*
* **monitoring** The project used in the *[Spring Integration Management and Monitoring Webinar](http://www.springsource.org/node/3598)* Also available on the *[SpringSourceDev YouTube Channel](http://www.youtube.com/SpringSourceDev)*
* **retry-and-more** Provides samples showing the application of MessageHandler Advice Chains to endpoints - retry, circuit breaker, expression evaluating
* **tx-synch** Provides a sample demonstrating the use of transaction syncrhonization, renaming an input file to a different filename, depending on whether the transaction commits, or rolls back.
* **stored-procedures-postgresql** Provides an example of the stored procedure Outbound Gateway using *[PostgreSQL](http://www.postgresql.org/)*
* **tcp-client-server-multiplex** - Demonstrates the use of *Collaborating Channel Adapters*
* **travel** - More sophisticated example showing the retrieval of weather (SOAP Web Service) and traffic (HTTP Service) reports using real services
* **tx-synch** Provides a sample demonstrating the use of transaction synchronization, renaming an input file to a different filename, depending on whether the transaction commits, or rolls back.
## Advanced
This category targets advanced developers who are quite familiar with Spring Integration but are looking to address a specific custom need by extending the Spring Integration public API. For example, if you are looking for samples showing how to implement a custom **Channel** or **Consumer** (event-based or polling-based), or you are trying to figure out what is the most appropriate way to implement a custom **BeanParser** on top of the Spring Integration BeanParser hierarchy when implementing a custom namespace, this would be the right place to look. Here you can also find samples that will help you with adapter development. Spring Integration comes with an extensive library of adapters that allow you to connect remote systems with the Spring Integration messaging framework. However you might have a need to integrate with a system for which the core framework does not provide an adapter, so you have to implement your own. This category would include samples showing you how to implement various adapters.
* **advanced-testing-examples** - Example test cases that show advanced techniques to test Spring Integration applications
* **dynamic-ftp** - Demonstrates one technique for sending files to dynamic destinations.
## Applications
This category targets developers and architects who have a good understanding of Message-Driven architecture and Enterprise Integration Patterns, and have an above average understanding of Spring and Spring integration and who are looking for samples that address a particular business problem. In other words, the emphasis of samples in this category is '**business use cases**' and how they can be solved via a Messaging architecture and Spring Integration in particular. For example, if you are interested to see how a Loan Broker process or Travel Agent process could be implemented and automated via Spring Integration, this would be the right place to find these types of samples.
* **cafe** - Emulates a simple operation of a coffee shop combining various Spring Integration adapters (Including **Router** and **Splitter**) see [Appendix A of the reference documentation](http://static.springsource.org/spring-integration/docs/latest-ga/reference/html/samples.html) for more details
* **cafe** - Emulates a simple operation of a coffee shop combining various Spring Integration adapters (Including **Router** and **Splitter**) see [Appendix A of the reference documentation](http://static.springsource.org/spring-integration/docs/latest-ga/reference/html/samples.html) for more details. Implementations are provided for:
- AMQP
- JMS
- In memory channels
* **cafe-scripted** - Scripted implementation of the classic **cafe** sample application. Supports **JavaScript**, **Groovy**, **Ruby**, and **Python**.
* **loan-broker** - Simulates a simple banking application (Uses **Gateway**, **Chain**, **Header Enricher**, **Recipient List Router**, **Aggregator**) see [Appendix A of the reference documentation](http://static.springsource.org/spring-integration/docs/latest-ga/reference/html/samples.html) for more details
* **loanshark** This extension to the loan broker sample shows how to exchange messages between Spring Integration applications (and other technologies) using **UDP**.

View File

@@ -4,13 +4,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>advanced-testing-examples</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Advanced) - Advanced Testing Examples</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<spring.version>3.1.0.RELEASE</spring.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<spring.version>3.1.3.RELEASE</spring.version>
<log4j.version>1.2.16</log4j.version>
<junit.version>4.10</junit.version>
</properties>

View File

@@ -2,14 +2,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>dynamic-ftp</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Advanced) - Dynamic FTP Demo</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.framework.version>3.1.0.RELEASE</spring.framework.version>
<spring.integration.version>2.2.0.M1</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.framework.version>3.1.3.RELEASE</spring.framework.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -54,17 +54,18 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<includes>
<include>**/*Tests.java</include>

View File

@@ -26,7 +26,6 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.Message;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.MessageHandlingException;
import org.springframework.integration.MessagingException;
import org.springframework.integration.support.MessageBuilder;
@@ -50,14 +49,14 @@ public class FtpOutboundChannelAdapterSample {
channel.send(message);
} catch (MessagingException e) {
assertTrue(e.getCause().getCause() instanceof UnknownHostException);
assertEquals("host.for.cust1", e.getCause().getCause().getMessage());
assertTrue(e.getCause().getCause().getMessage().startsWith("host.for.cust1"));
}
// send another so we can see in the log we don't create the ac again.
try {
channel.send(message);
} catch (MessagingException e) {
assertTrue(e.getCause().getCause() instanceof UnknownHostException);
assertEquals("host.for.cust1", e.getCause().getCause().getMessage());
assertTrue(e.getCause().getCause().getMessage().startsWith("host.for.cust1"));
}
// send to a different customer; again, check the log to see a new ac is built
message = MessageBuilder.withPayload(file)
@@ -66,10 +65,10 @@ public class FtpOutboundChannelAdapterSample {
channel.send(message);
} catch (MessagingException e) {
assertTrue(e.getCause().getCause() instanceof UnknownHostException);
assertEquals("host.for.cust2", e.getCause().getCause().getMessage());
assertTrue(e.getCause().getCause().getMessage().startsWith("host.for.cust2"));
}
// send to a different customer; again, check the log to see a new ac is built
// send to a different customer; again, check the log to see a new ac is built
//and the first one created (cust1) should be closed and removed as per the max cache size restriction
message = MessageBuilder.withPayload(file)
.setHeader("customer", "cust3").build();
@@ -77,10 +76,10 @@ public class FtpOutboundChannelAdapterSample {
channel.send(message);
} catch (MessagingException e) {
assertTrue(e.getCause().getCause() instanceof UnknownHostException);
assertEquals("host.for.cust3", e.getCause().getCause().getMessage());
assertTrue(e.getCause().getCause().getMessage().startsWith("host.for.cust3"));
}
//send to cust1 again, since this one has been invalidated before, we should
//send to cust1 again, since this one has been invalidated before, we should
//see a new ac created (with ac of cust2 destroyed and removed)
message = MessageBuilder.withPayload(file)
.setHeader("customer", "cust1").build();

View File

@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>advanced-samples</artifactId>
<version>2.1.0.RELEASE</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Spring Integration Samples - Advanced</name>
<packaging>pom</packaging>

View File

@@ -4,13 +4,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>cafe-scripted</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Applications) - Cafe Sample (Scripted Implementation)</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<spring.version>3.1.0.RELEASE</spring.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<spring.version>3.1.3.RELEASE</spring.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
@@ -114,13 +114,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -6,7 +6,7 @@
<parent>
<artifactId>cafe</artifactId>
<groupId>org.springframework.integration.samples</groupId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
</parent>
<artifactId>cafe-amqp</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>cafe</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
</parent>
<artifactId>cafe-jms</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<artifactId>cafe</artifactId>
<groupId>org.springframework.integration.samples</groupId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
</parent>
<artifactId>cafe-si</artifactId>

View File

@@ -5,7 +5,7 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>cafe</artifactId>
<packaging>pom</packaging>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<prerequisites>
<maven>2.2.1</maven>
@@ -21,9 +21,9 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<spring.core.version>3.1.0.RELEASE</spring.core.version>
<log4j.version>1.2.16</log4j.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<spring.core.version>3.1.3.RELEASE</spring.core.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -70,10 +70,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>

View File

@@ -4,13 +4,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>loan-broker</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Applications) - Loan Broker</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<commons-logging.version>1.1.1</commons-logging.version>
<log4j.version>1.2.16</log4j.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -41,13 +41,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2012 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.
@@ -24,19 +24,21 @@ import org.springframework.integration.samples.loanbroker.domain.LoanRequest;
/**
* POJI Gateway that connects method invocations to the request-channel.
* This completely isolates the developer from Spring Integration API details.
*
*
* @author Oleg Zhurakousky
* @author Gunnar Hillert
*
*/
public interface LoanBrokerGateway {
/**
* Will return the best {@link LoanQuote} for the given request.
*/
public LoanQuote getBestLoanQuote(LoanRequest loanRequest);
LoanQuote getBestLoanQuote(LoanRequest loanRequest);
/**
* Will return all {@link LoanQuote}s for the given request.
*/
public List<LoanQuote> getAllLoanQuotes(LoanRequest loanRequest);
List<LoanQuote> getAllLoanQuotes(LoanRequest loanRequest);
}

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2002-2012 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.samples.loanbroker.loanshark.domain;
import java.util.ArrayList;
@@ -24,151 +39,163 @@ import flexjson.JSONSerializer;
@Entity
public class LoanShark {
private String name;
private String name;
private Long counter;
private Long counter;
private Double averageRate;
private Double averageRate;
public String toJson() {
return new JSONSerializer().exclude("*.class").serialize(this);
}
return new JSONSerializer().exclude("*.class").serialize(this);
}
public static LoanShark fromJsonToLoanShark(String json) {
return new JSONDeserializer<LoanShark>().use(null, LoanShark.class).deserialize(json);
}
return new JSONDeserializer<LoanShark>().use(null, LoanShark.class).deserialize(json);
}
public static String toJsonArray(Collection<LoanShark> collection) {
return new JSONSerializer().exclude("*.class").serialize(collection);
}
return new JSONSerializer().exclude("*.class").serialize(collection);
}
public static Collection<LoanShark> fromJsonArrayToLoanSharks(String json) {
return new JSONDeserializer<List<LoanShark>>().use(null, ArrayList.class).use("values", LoanShark.class).deserialize(json);
}
return new JSONDeserializer<List<LoanShark>>().use(null, ArrayList.class).use("values", LoanShark.class).deserialize(json);
}
@PersistenceContext
transient EntityManager entityManager;
transient EntityManager entityManager;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private Long id;
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private Long id;
@Version
@Column(name = "version")
private Integer version;
@Column(name = "version")
private Integer version;
public Long getId() {
return this.id;
}
return this.id;
}
public void setId(Long id) {
this.id = id;
}
this.id = id;
}
public Integer getVersion() {
return this.version;
}
return this.version;
}
public void setVersion(Integer version) {
this.version = version;
}
this.version = version;
}
@Transactional
public void persist() {
if (this.entityManager == null) this.entityManager = entityManager();
this.entityManager.persist(this);
}
public void persist() {
if (this.entityManager == null) {
this.entityManager = entityManager();
}
this.entityManager.persist(this);
}
@Transactional
public void remove() {
if (this.entityManager == null) this.entityManager = entityManager();
if (this.entityManager.contains(this)) {
this.entityManager.remove(this);
} else {
LoanShark attached = this.entityManager.find(this.getClass(), this.id);
this.entityManager.remove(attached);
}
}
public void remove() {
if (this.entityManager == null) {
this.entityManager = entityManager();
}
if (this.entityManager.contains(this)) {
this.entityManager.remove(this);
} else {
LoanShark attached = this.entityManager.find(this.getClass(), this.id);
this.entityManager.remove(attached);
}
}
@Transactional
public void flush() {
if (this.entityManager == null) this.entityManager = entityManager();
this.entityManager.flush();
}
public void flush() {
if (this.entityManager == null) {
this.entityManager = entityManager();
}
this.entityManager.flush();
}
@Transactional
public LoanShark merge() {
if (this.entityManager == null) this.entityManager = entityManager();
LoanShark merged = this.entityManager.merge(this);
this.entityManager.flush();
return merged;
}
public LoanShark merge() {
if (this.entityManager == null) {
this.entityManager = entityManager();
}
LoanShark merged = this.entityManager.merge(this);
this.entityManager.flush();
return merged;
}
public static final EntityManager entityManager() {
EntityManager em = new LoanShark().entityManager;
if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
return em;
}
EntityManager em = new LoanShark().entityManager;
if (em == null) {
throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
}
return em;
}
public static long countLoanSharks() {
return ((Number) entityManager().createQuery("select count(o) from LoanShark o").getSingleResult()).longValue();
}
return ((Number) entityManager().createQuery("select count(o) from LoanShark o").getSingleResult()).longValue();
}
@SuppressWarnings("unchecked")
public static List<LoanShark> findAllLoanSharks() {
return entityManager().createQuery("select o from LoanShark o").getResultList();
}
public static List<LoanShark> findAllLoanSharks() {
return entityManager().createQuery("select o from LoanShark o").getResultList();
}
public static LoanShark findLoanShark(Long id) {
if (id == null) return null;
return entityManager().find(LoanShark.class, id);
}
if (id == null) return null;
return entityManager().find(LoanShark.class, id);
}
@SuppressWarnings("unchecked")
public static List<LoanShark> findLoanSharkEntries(int firstResult, int maxResults) {
return entityManager().createQuery("select o from LoanShark o").setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
}
public static List<LoanShark> findLoanSharkEntries(int firstResult, int maxResults) {
return entityManager().createQuery("select o from LoanShark o").setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
}
public String getName() {
return this.name;
}
return this.name;
}
public void setName(String name) {
this.name = name;
}
this.name = name;
}
public Long getCounter() {
return this.counter;
}
return this.counter;
}
public void setCounter(Long counter) {
this.counter = counter;
}
this.counter = counter;
}
public Double getAverageRate() {
return this.averageRate;
}
return this.averageRate;
}
public void setAverageRate(Double averageRate) {
this.averageRate = averageRate;
}
this.averageRate = averageRate;
}
public static Query findLoanSharksByName(String name) {
if (name == null || name.length() == 0) throw new IllegalArgumentException("The name argument is required");
EntityManager em = LoanShark.entityManager();
Query q = em.createQuery("SELECT LoanShark FROM LoanShark AS loanshark WHERE loanshark.name = :name");
q.setParameter("name", name);
return q;
}
if (name == null || name.length() == 0) {
throw new IllegalArgumentException("The name argument is required");
}
EntityManager em = LoanShark.entityManager();
Query q = em.createQuery("SELECT LoanShark FROM LoanShark AS loanshark WHERE loanshark.name = :name");
q.setParameter("name", name);
return q;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Id: ").append(getId()).append(", ");
sb.append("Version: ").append(getVersion()).append(", ");
sb.append("Name: ").append(getName()).append(", ");
sb.append("Counter: ").append(getCounter()).append(", ");
sb.append("AverageRate: ").append(getAverageRate());
return sb.toString();
}
StringBuilder sb = new StringBuilder();
sb.append("Id: ").append(getId()).append(", ");
sb.append("Version: ").append(getVersion()).append(", ");
sb.append("Name: ").append(getName()).append(", ");
sb.append("Counter: ").append(getCounter()).append(", ");
sb.append("AverageRate: ").append(getAverageRate());
return sb.toString();
}
}

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2002-2012 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.samples.loanbroker.loanshark.web;
import javax.validation.Valid;
@@ -24,115 +39,115 @@ import org.springframework.web.bind.annotation.ResponseBody;
public class SharkController {
@RequestMapping(method = RequestMethod.POST)
public String create(@Valid LoanShark loanShark, BindingResult result, Model model) {
if (result.hasErrors()) {
model.addAttribute("loanShark", loanShark);
return "loansharks/create";
}
loanShark.persist();
return "redirect:/loansharks/" + loanShark.getId();
}
public String create(@Valid LoanShark loanShark, BindingResult result, Model model) {
if (result.hasErrors()) {
model.addAttribute("loanShark", loanShark);
return "loansharks/create";
}
loanShark.persist();
return "redirect:/loansharks/" + loanShark.getId();
}
@RequestMapping(params = "form", method = RequestMethod.GET)
public String createForm(Model model) {
model.addAttribute("loanShark", new LoanShark());
return "loansharks/create";
}
public String createForm(Model model) {
model.addAttribute("loanShark", new LoanShark());
return "loansharks/create";
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String show(@PathVariable("id") Long id, Model model) {
model.addAttribute("loanshark", LoanShark.findLoanShark(id));
model.addAttribute("itemId", id);
return "loansharks/show";
}
public String show(@PathVariable("id") Long id, Model model) {
model.addAttribute("loanshark", LoanShark.findLoanShark(id));
model.addAttribute("itemId", id);
return "loansharks/show";
}
@RequestMapping(method = RequestMethod.GET)
public String list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model model) {
if (page != null || size != null) {
int sizeNo = size == null ? 10 : size.intValue();
model.addAttribute("loansharks", LoanShark.findLoanSharkEntries(page == null ? 0 : (page.intValue() - 1) * sizeNo, sizeNo));
float nrOfPages = (float) LoanShark.countLoanSharks() / sizeNo;
model.addAttribute("maxPages", (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
} else {
model.addAttribute("loansharks", LoanShark.findAllLoanSharks());
}
return "loansharks/list";
}
public String list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model model) {
if (page != null || size != null) {
int sizeNo = size == null ? 10 : size.intValue();
model.addAttribute("loansharks", LoanShark.findLoanSharkEntries(page == null ? 0 : (page.intValue() - 1) * sizeNo, sizeNo));
float nrOfPages = (float) LoanShark.countLoanSharks() / sizeNo;
model.addAttribute("maxPages", (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
} else {
model.addAttribute("loansharks", LoanShark.findAllLoanSharks());
}
return "loansharks/list";
}
@RequestMapping(method = RequestMethod.PUT)
public String update(@Valid LoanShark loanShark, BindingResult result, Model model) {
if (result.hasErrors()) {
model.addAttribute("loanShark", loanShark);
return "loansharks/update";
}
loanShark.merge();
return "redirect:/loansharks/" + loanShark.getId();
}
public String update(@Valid LoanShark loanShark, BindingResult result, Model model) {
if (result.hasErrors()) {
model.addAttribute("loanShark", loanShark);
return "loansharks/update";
}
loanShark.merge();
return "redirect:/loansharks/" + loanShark.getId();
}
@RequestMapping(value = "/{id}", params = "form", method = RequestMethod.GET)
public String updateForm(@PathVariable("id") Long id, Model model) {
model.addAttribute("loanShark", LoanShark.findLoanShark(id));
return "loansharks/update";
}
public String updateForm(@PathVariable("id") Long id, Model model) {
model.addAttribute("loanShark", LoanShark.findLoanShark(id));
return "loansharks/update";
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public String delete(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model model) {
LoanShark.findLoanShark(id).remove();
model.addAttribute("page", (page == null) ? "1" : page.toString());
model.addAttribute("size", (size == null) ? "10" : size.toString());
return "redirect:/loansharks?page=" + ((page == null) ? "1" : page.toString()) + "&size=" + ((size == null) ? "10" : size.toString());
}
public String delete(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model model) {
LoanShark.findLoanShark(id).remove();
model.addAttribute("page", (page == null) ? "1" : page.toString());
model.addAttribute("size", (size == null) ? "10" : size.toString());
return "redirect:/loansharks?page=" + ((page == null) ? "1" : page.toString()) + "&size=" + ((size == null) ? "10" : size.toString());
}
@RequestMapping(params = { "find=ByName", "form" }, method = RequestMethod.GET)
public String findLoanSharksByNameForm(Model model) {
return "loansharks/findLoanSharksByName";
}
public String findLoanSharksByNameForm(Model model) {
return "loansharks/findLoanSharksByName";
}
@RequestMapping(params = "find=ByName", method = RequestMethod.GET)
public String findLoanSharksByName(@RequestParam("name") String name, Model model) {
model.addAttribute("loansharks", LoanShark.findLoanSharksByName(name).getResultList());
return "loansharks/list";
}
public String findLoanSharksByName(@RequestParam("name") String name, Model model) {
model.addAttribute("loansharks", LoanShark.findLoanSharksByName(name).getResultList());
return "loansharks/list";
}
Converter<LoanShark, String> getLoanSharkConverter() {
return new Converter<LoanShark, String>() {
public String convert(LoanShark loanShark) {
return new StringBuilder().append(loanShark.getName()).append(" ").append(loanShark.getCounter()).append(" ").append(loanShark.getAverageRate()).toString();
}
};
}
return new Converter<LoanShark, String>() {
public String convert(LoanShark loanShark) {
return new StringBuilder().append(loanShark.getName()).append(" ").append(loanShark.getCounter()).append(" ").append(loanShark.getAverageRate()).toString();
}
};
}
@InitBinder
void registerConverters(WebDataBinder binder) {
if (binder.getConversionService() instanceof GenericConversionService) {
GenericConversionService conversionService = (GenericConversionService) binder.getConversionService();
conversionService.addConverter(getLoanSharkConverter());
}
}
void registerConverters(WebDataBinder binder) {
if (binder.getConversionService() instanceof GenericConversionService) {
GenericConversionService conversionService = (GenericConversionService) binder.getConversionService();
conversionService.addConverter(getLoanSharkConverter());
}
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET, headers = "Accept=application/json")
@ResponseBody
public String showJson(@PathVariable("id") Long id) {
return LoanShark.findLoanShark(id).toJson();
}
@ResponseBody
public String showJson(@PathVariable("id") Long id) {
return LoanShark.findLoanShark(id).toJson();
}
@RequestMapping(method = RequestMethod.POST, headers = "Accept=application/json")
public ResponseEntity<String> createFromJson(@RequestBody String json) {
LoanShark.fromJsonToLoanShark(json).persist();
return new ResponseEntity<String>("LoanShark created", HttpStatus.CREATED);
}
public ResponseEntity<String> createFromJson(@RequestBody String json) {
LoanShark.fromJsonToLoanShark(json).persist();
return new ResponseEntity<String>("LoanShark created", HttpStatus.CREATED);
}
@RequestMapping(headers = "Accept=application/json")
@ResponseBody
public String listJson() {
return LoanShark.toJsonArray(LoanShark.findAllLoanSharks());
}
@ResponseBody
public String listJson() {
return LoanShark.toJsonArray(LoanShark.findAllLoanSharks());
}
@RequestMapping(value = "/jsonArray", method = RequestMethod.POST, headers = "Accept=application/json")
public ResponseEntity<String> createFromJsonArray(@RequestBody String json) {
for (LoanShark loanshark: LoanShark.fromJsonArrayToLoanSharks(json)) {
loanshark.persist();
}
return new ResponseEntity<String>("LoanShark created", HttpStatus.CREATED);
}
public ResponseEntity<String> createFromJsonArray(@RequestBody String json) {
for (LoanShark loanshark: LoanShark.fromJsonArrayToLoanSharks(json)) {
loanshark.persist();
}
return new ResponseEntity<String>("LoanShark created", HttpStatus.CREATED);
}
}

View File

@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>applications</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Spring Integration Samples - Applications</name>
<packaging>pom</packaging>

View File

@@ -4,16 +4,20 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>amqp</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Samples (Basic) - AMQP</name>
<url>http://www.springsource.org/spring-integration</url>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
@@ -29,7 +33,7 @@
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<version>2.9</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
@@ -44,7 +48,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -56,7 +60,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<version>1.2.1</version>
<configuration>
<mainClass>org.springframework.integration.samples.amqp.Main</mainClass>
</configuration>

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-amqp="http://www.springframework.org/schema/integration/amqp"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xmlns:int-stream="http://www.springframework.org/schema/integration/stream"
@@ -10,49 +9,51 @@
http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd
http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- From STDIN To RabbitMQ -->
<int-stream:stdin-channel-adapter id="consoleIn" channel="toRabbit" >
<int:poller fixed-delay="1000" max-messages-per-poll="1" />
</int-stream:stdin-channel-adapter>
<!-- From STDIN To RabbitMQ -->
<int:channel id="toRabbit" />
<int-stream:stdin-channel-adapter id="consoleIn"
channel="toRabbit">
<int:poller fixed-delay="1000" max-messages-per-poll="1" />
</int-stream:stdin-channel-adapter>
<int-amqp:outbound-channel-adapter channel="toRabbit"
amqp-template="amqpTemplate" exchange-name="si.test.exchange"
routing-key="si.test.binding"/>
<int:channel id="toRabbit" />
<!-- From RabbitMQ To STDOUT -->
<int-amqp:outbound-channel-adapter
channel="toRabbit" amqp-template="amqpTemplate" exchange-name="si.test.exchange"
routing-key="si.test.binding" />
<int-amqp:inbound-channel-adapter channel="fromRabbit"
queue-names="si.test.queue"
connection-factory="connectionFactory" />
<!-- From RabbitMQ To STDOUT -->
<int:channel id="fromRabbit">
<int:interceptors>
<int:wire-tap channel="loggingChannel"/>
</int:interceptors>
</int:channel>
<int-stream:stdout-channel-adapter id="consoleOut" channel="fromRabbit" append-newline="true"/>
<int:logging-channel-adapter id="loggingChannel" log-full-message="true" level="INFO"/>
<int-amqp:inbound-channel-adapter channel="fromRabbit"
queue-names="si.test.queue" connection-factory="connectionFactory" />
<!-- Infrastructure -->
<int:channel id="fromRabbit">
<int:interceptors>
<int:wire-tap channel="loggingChannel" />
</int:interceptors>
</int:channel>
<rabbit:connection-factory id="connectionFactory" />
<int-stream:stdout-channel-adapter id="consoleOut" channel="fromRabbit"
append-newline="true" />
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" />
<int:logging-channel-adapter id="loggingChannel" log-full-message="true"
level="INFO" />
<rabbit:admin connection-factory="connectionFactory" />
<!-- Infrastructure -->
<rabbit:queue name="si.test.queue" />
<rabbit:connection-factory id="connectionFactory" />
<rabbit:direct-exchange name="si.test.exchange">
<rabbit:bindings>
<rabbit:binding queue="si.test.queue" key="si.test.binding" />
</rabbit:bindings>
</rabbit:direct-exchange>
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" />
<rabbit:admin connection-factory="connectionFactory" />
<rabbit:queue name="si.test.queue" />
<rabbit:direct-exchange name="si.test.exchange">
<rabbit:bindings>
<rabbit:binding queue="si.test.queue" key="si.test.binding" />
</rabbit:bindings>
</rabbit:direct-exchange>
</beans>

View File

@@ -4,13 +4,18 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>control-bus</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Basic) - Control Bus</name>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -36,13 +41,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -4,16 +4,20 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>enricher</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Samples (Basic) - Enricher</name>
<url>http://www.springsource.org/spring-integration</url>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
@@ -29,7 +33,7 @@
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<version>2.9</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
@@ -44,7 +48,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -56,7 +60,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<version>1.2.1</version>
<configuration>
<mainClass>org.springframework.integration.samples.enricher.Main</mainClass>
</configuration>
@@ -96,7 +100,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.162</version>
<version>1.3.168</version>
</dependency>
</dependencies>

View File

@@ -1,14 +1,19 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>feed</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>feed</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Basic) - Feed Demo (RSS/ATOM)</name>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC2</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -34,13 +39,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -11,8 +11,8 @@
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC2</spring.integration.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>

View File

@@ -3,13 +3,18 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>ftp</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Basic) - FTP Demo</name>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.M1</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -22,7 +27,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
<version>2.4</version>
</dependency>
<!-- test-scoped dependencies -->
@@ -57,13 +62,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>

View File

@@ -4,7 +4,7 @@
xmlns:context="http://www.springframework.org/schema/context"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp"
xsi:schemaLocation="http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.1.xsd
xsi:schemaLocation="http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
@@ -29,12 +29,12 @@
command-options=""
expression="payload"
reply-channel="toSplitter"/>
<int:channel id="toSplitter">
<int:interceptors>
<int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:channel id="toSplitter">
<int:interceptors>
<int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:logging-channel-adapter id="logger" log-full-message="true"/>
@@ -45,25 +45,25 @@
session-factory="ftpSessionFactory"
request-channel="toGet"
reply-channel="toRemoveChannel"
command="get"
command="get"
command-options="-P"
expression="payload.remoteDirectory + '/' + payload.filename"/>
<int:channel id="toRemoveChannel">
<int:interceptors>
<int:wire-tap channel="logger2"/>
</int:interceptors>
</int:channel>
<int:channel id="toRemoveChannel">
<int:interceptors>
<int:wire-tap channel="logger2"/>
</int:interceptors>
</int:channel>
<int:logging-channel-adapter id="logger2" log-full-message="true"/>
<int:logging-channel-adapter id="logger2" log-full-message="true"/>
<int-ftp:outbound-gateway id="gatewayRM"
<int-ftp:outbound-gateway id="gatewayRM"
session-factory="ftpSessionFactory" cache-sessions="false"
expression="headers['file_remoteDirectory'] + '/' + headers['file_remoteFile']"
request-channel="toRemoveChannel"
command="rm"
reply-channel="aggregateResultsChannel"/>
<int:aggregator input-channel="aggregateResultsChannel"/>
<int:aggregator input-channel="aggregateResultsChannel"/>
</beans>

View File

@@ -4,30 +4,35 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>helloworld</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Basic) - Hello World Sample</name>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
<java.main.class>org.springframework.integration.samples.helloworld.HelloWorldApp</java.main.class>
</properties>
<profiles>
<profile>
<id>hello</id>
<properties>
<java.main.class>org.springframework.integration.samples.helloworld.HelloWorldApp</java.main.class>
</properties>
</profile>
<profile>
<id>poller</id>
<properties>
<java.main.class>org.springframework.integration.samples.helloworld.PollerApp</java.main.class>
</properties>
</profile>
<profile>
<id>hello</id>
<properties>
<java.main.class>org.springframework.integration.samples.helloworld.HelloWorldApp</java.main.class>
</properties>
</profile>
<profile>
<id>poller</id>
<properties>
<java.main.class>org.springframework.integration.samples.helloworld.PollerApp</java.main.class>
</properties>
</profile>
</profiles>
<dependencies>
@@ -53,19 +58,19 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<version>1.2.1</version>
<configuration>
<mainClass>${java.main.class}</mainClass>
</configuration>

View File

@@ -3,16 +3,21 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>http</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Basic) - HTTP Demo</name>
<packaging>war</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<spring.version>3.1.0.RELEASE</spring.version>
<commons-fileupload>1.2</commons-fileupload>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<spring.version>3.1.3.RELEASE</spring.version>
<commons-fileupload>1.2.2</commons-fileupload>
<commons-io>1.3.2</commons-io>
<log4j.version>1.2.16</log4j.version>
<log4j.version>1.2.17</log4j.version>
</properties>
<dependencies>
<dependency>
@@ -43,7 +48,7 @@
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.1</version>
<version>1.4.5</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
@@ -56,19 +61,19 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<version>1.2.1</version>
<configuration>
<mainClass>org.springframework.integration.samples.http.HttpClientDemo</mainClass>
</configuration>
@@ -76,7 +81,7 @@
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<version>6.1.26</version>
</plugin>
</plugins>
</build>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 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.
@@ -18,9 +18,11 @@ package org.springframework.integration.samples.http;
/**
* @author Oleg Zhurakousky
* @author Gunnar Hillert
*
*/
public interface RequestGateway {
public String echo(String request);
String echo(String request);
}

View File

@@ -1,23 +1,19 @@
Spring Integration - JDBC Sample
================================
# Overview
## Overview
This sample provides example of how the Jdbc Adapters can be used.
This sample provides example of how the JDBC Adapters can be used.
The example presented covers the following use cases
* Find a Person detail from the database based on the name provided
* Create a new Person record in the table
The first example demonstrates the use of outbound gateway to search for a person record using the
spring integration's jdbc outbound gateway
The first example demonstrates the use of *Outbound Gateway* to search for a person record using *Spring Integration*'s *JDBC Outbound Gateway*.
The second example on other hand demonstrates how the jdbc outbound gateway be used to create a new
Person record and then return the newly created Person record.
This example demonstrates how to make use of the sql parameter source factory to extract
the required values to be inserted/updated/selected in the query provided.
The second example on other hand demonstrates how the *JDBC Outbound Gateway* can be used to create a new *Person* record and then return the newly created *Person* record. This example demonstrates how to make use of the sql parameter source factory to extract the required values to be inserted/updated/selected in the query provided.
# Getting Started
## Getting Started
You can run the application by either
@@ -26,18 +22,18 @@ You can run the application by either
- mvn package
- mvn exec:java
Make an appropriate choice for searching a Person or creating a Person
Make an appropriate choice for searching a Person or creating a Person.
For creating the person record, select the appropriate steps as prompted by the application
For creating the person record, select the appropriate steps as prompted by the application.
On creation of Person records, you may choose the option of selecting the created person records and view their details
On creation of *Person* records, you may choose the option of selecting the created person records and view their details.
#Some details about the sample "Person Outbound Gateway"
## Details
We use the outbound gateway to insert records in a Person table based on the values contained
in the message payload that is received over the channel to the adapter.
The following are used to configure the gateway
The following are used to configure the *Gateway*:
* The request and reply channels
* The data source for the database
@@ -47,7 +43,7 @@ The following are used to configure the gateway
* Optional reply SQL Parameter source factory
* RowMapper if you intend to map the ResultSet to your custom object
The following sequence of events happen when we invoke the createPerson method on the gateway
The following sequence of events happen when we invoke the *createPerson* method on the *Gateway*:
* The parameter of type Person is sent as a payload of a message over the reply-channel
* The outbound gateway reads this message and extracts the payload
@@ -61,10 +57,12 @@ The following sequence of events happen when we invoke the createPerson method o
* The Person object is then sent as a payload of the Message over the reply channel.
* The Person payload is extracted from the Message and returned to the calling application.
For executing the program and see the results, execute the junit test case
org.springframework.integration.samples.jdbc.OutboundGatewayTest
## Running the Sample
# Resources
For executing the program and see the results, execute the junit test case
**org.springframework.integration.samples.jdbc.OutboundGatewayTest**
## Resources
For help please take a look at the Spring Integration documentation:

View File

@@ -4,16 +4,20 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>jdbc</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Samples (Basic) - JDBC</name>
<url>http://www.springsource.org/spring-integration</url>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
@@ -29,7 +33,7 @@
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<version>2.9</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
@@ -44,7 +48,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -56,7 +60,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<version>1.2.1</version>
<configuration>
<mainClass>org.springframework.integration.samples.jdbc.Main</mainClass>
</configuration>
@@ -102,7 +106,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.162</version>
<version>1.3.168</version>
</dependency>
</dependencies>
</project>

View File

@@ -80,14 +80,15 @@ public final class Main {
System.out.print("Enter you choice: ");
while (true) {
final String input = scanner.nextLine();
if("1".equals(input.trim()))
if("1".equals(input.trim())) {
getPersonDetails(scanner, personService);
else if("2".equals(input.trim()))
} else if("2".equals(input.trim())) {
createPersonDetails(scanner,personService);
else if("q".equals(input.trim()))
} else if("q".equals(input.trim())) {
break;
else
} else {
System.out.println("Invalid choice\n\n");
}
System.out.println("Please enter a choice and press <enter>: ");
System.out.println("\t1. Find person details");

View File

@@ -4,24 +4,29 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>jms</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Basic) - JMS</name>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<activemq.version>5.5.1</activemq.version>
<slf4j.version>1.6.4</slf4j.version>
<junit.version>4.10</junit.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<activemq.version>5.7.0</activemq.version>
<slf4j.version>1.7.2</slf4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
@@ -38,33 +43,33 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>3.1.0.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>3.1.3.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jms</artifactId>
<version>${spring.integration.version}</version>
</dependency>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jms</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-stream</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
</dependencies>
<build>
@@ -72,13 +77,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2012 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.
@@ -16,18 +16,7 @@
package org.springframework.integration.samples.jms;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import junit.framework.Assert;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.MessageChannel;
import org.springframework.integration.support.MessageBuilder;
/**
* A simple bootstrap main() method for starting a pair of JMS Channel
@@ -39,6 +28,7 @@ import org.springframework.integration.support.MessageBuilder;
* See the configuration in the three XML files that are referenced below.
*
* @author Mark Fisher
* @author Gunnar Hillert
*/
public class ChannelAdapterDemo {

View File

@@ -5,12 +5,17 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>jmx</artifactId>
<name>Samples (Basic) - JMX</name>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -41,13 +46,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -11,18 +11,18 @@
<url>http://www.springsource.org/spring-integration</url>
<prerequisites>
<maven>2.2.0</maven>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.M2</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
<openjpa.version>2.2.0</openjpa.version>
<eclipselink.version>2.3.2</eclipselink.version>
<hibernate.version>4.0.1.Final</hibernate.version>
<spring-instrument.version>3.1.1.RELEASE</spring-instrument.version>
<spring-instrument.version>3.1.3.RELEASE</spring-instrument.version>
</properties>
<repositories>
@@ -49,7 +49,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -117,7 +117,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
<version>1.7.2</version>
</dependency>
<!-- Embedded Database -->
@@ -125,7 +125,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.162</version>
<version>1.3.168</version>
</dependency>
<!-- Persistence Provider -->

View File

@@ -4,11 +4,16 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>mail</artifactId>
<name>Samples (Basic) - Mail Demo (IMAP + POP3)</name>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -26,7 +31,7 @@
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.4</version>
<version>1.4.5</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
@@ -45,13 +50,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -1,82 +1,68 @@
<h3>MongoDb Outbound Channel Adapter</h3>
MongoDb Outbound Channel Adapter allows you to write the Message payload to a MongoDb document store.
Spring Integration - MongoDb Sample
================================
You can see the simplest configuration of the MongoDb Channel Adapter below:
### MongoDb Outbound Channel Adapter
````
<int-mongodb:outbound-channel-adapter id="deafultAdapter"/>
````
The *MongoDb Outbound Channel Adapter* allows you to write the Message payload to a MongoDb document store. You can see the simplest configuration of the MongoDb Channel Adapter below:
It will be initialized with the default instance of the <strong>MongoDbFactory</strong> (the default bean name is 'mongoDbFactory') otherwise you can provide its
reference via <strong>mongodb-factory</strong> attribute.
<int-mongodb:outbound-channel-adapter id="deafultAdapter"/>
Now you can run the <strong>MongoDbOutboundAdapterDemo</strong>. After running it open terminal window and start MongoDb CLI
It will be initialized with the default instance of the **MongoDbFactory** (the default bean name is 'mongoDbFactory') otherwise you can provide its
reference via **mongodb-factory** attribute.
````
$> mongo
````
Now you can run the **MongoDbOutboundAdapterDemo**. After running it open terminal window and start MongoDb CLI
$ mongo
Once in MongoDb CLI type a query:
````
> db.data.find({})
````
> db.data.find({})
And you should see the 3 document entries we just created:
````
{ "_id" : ObjectId("505ff83d03649ed6881d066b"), "_class" : "org.springframework.integration.samples.mongodb.domain.Person", "fname" : "John", "lname" : "Doe", "address" : { "street" : "3401 Hillview Ave", "city" : "Palo Alto", "zip" : "94304", "state" : "CA" } }
{ "_id" : ObjectId("505ff83d03649ed6881d066c"), "_class" : "org.springframework.integration.samples.mongodb.domain.Person", "fname" : "Josh", "lname" : "Doe", "address" : { "street" : "123 Main st", "city" : "San Francisco", "zip" : "94115", "state" : "CA" } }
{ "_id" : ObjectId("505ff83d03649ed6881d066d"), "_class" : "org.springframework.integration.samples.mongodb.domain.Person", "fname" : "Jane", "lname" : "Doe", "address" : { "street" : "2323 Market st", "city" : "Philadelphia", "zip" : "19152", "state" : "PA" } }
````
Note that our entries were represented by a very simple Java Beans style objects which were converted into JSON string using default converters.
Let's try to complicate the issue slightly. We are going to try to store a simple coma delimited String in our <strong>MongoDbOutboundAdapterDemo().runSimpleComplexAdapter()</strong> demo:
{ "_id" : ObjectId("505ff83d03649ed6881d066b"), "_class" : "org.springframework.integration.samples.mongodb.domain.Person", "fname" : "John", "lname" : "Doe", "address" : { "street" : "3401 Hillview Ave", "city" : "Palo Alto", "zip" : "94304", "state" : "CA" } }
{ "_id" : ObjectId("505ff83d03649ed6881d066c"), "_class" : "org.springframework.integration.samples.mongodb.domain.Person", "fname" : "Josh", "lname" : "Doe", "address" : { "street" : "123 Main st", "city" : "San Francisco", "zip" : "94115", "state" : "CA" } }
{ "_id" : ObjectId("505ff83d03649ed6881d066d"), "_class" : "org.springframework.integration.samples.mongodb.domain.Person", "fname" : "Jane", "lname" : "Doe", "address" : { "street" : "2323 Market st", "city" : "Philadelphia", "zip" : "19152", "state" : "PA" } }
````
messageChannel.send(new GenericMessage<String>("John Dow, Palo Alto, 3401 Hillview Ave, 94304, CA"));
````
Note that our entries were represented by a very simple Java Beans style objects which were converted into JSON string using default converters. Let's try to complicate the issue slightly. We are going to try to store a simple coma delimited String in our **MongoDbOutboundAdapterDemo().runSimpleComplexAdapter()** demo:
messageChannel.send(new GenericMessage<String>("John Dow, Palo Alto, 3401 Hillview Ave, 94304, CA"));
As you can see we are sending a Message with the String payload which represents a person. Executing this code will result in:
````
Caused by: java.lang.IllegalArgumentException: can't serialize class java.lang.Character
````
That is because MongoDb attempts to convert the underlying string using default set of converters that are based on Java Beans convention.
In any case that is not what we are looking for in this case anyway since we want to store this object as a document with each field represented individually so we need to parse this string into a set of fields first. To do so we will apply a custom <strong>MongoConverter</strong>. Modify the sample configuration of <strong>simpleAdapterWithConverter</strong> to add a reference to an already configured converter.
````
<int-mongodb:outbound-channel-adapter id="adapterWithConverter"
Caused by: java.lang.IllegalArgumentException: can't serialize class java.lang.Character
That is because MongoDb attempts to convert the underlying string using default set of converters that are based on Java Beans convention.
In any case that is not what we are looking for in this case anyway since we want to store this object as a document with each field represented individually so we need to parse this string into a set of fields first. To do so we will apply a custom **MongoConverter**. Modify the sample configuration of **simpleAdapterWithConverter** to add a reference to an already configured converter.
<int-mongodb:outbound-channel-adapter id="adapterWithConverter"
mongo-converter="stringConverter"/>
````
Run the demo again and you'll see that it will succeed this time and you should see the stored object as:
````
{ "_id" : ObjectId("505ffeac0364f8a92337657e"), "fname" : "John", "lname" : "Dow", "address" : { "city" : "Palo Alto", "street" : "3401 Hillview Ave", "zip" : "94304", "state" : "CA" } }
````
{ "_id" : ObjectId("505ffeac0364f8a92337657e"), "fname" : "John", "lname" : "Dow", "address" : { "city" : "Palo Alto", "street" : "3401 Hillview Ave", "zip" : "94304", "state" : "CA" } }
This time the conversion is done using a provided converter and you can see in the StringConverter.write(..) method that all that we are doing is parsing the input String and adding its data as an individual fields to an instance of the DBObject.
For even more complex scenarios you can also bootstrap the adapter with the custom instance of the <strong>MongoTemplate</strong>, but its out of scope of this blog.
For even more complex scenarios you can also bootstrap the adapter with the custom instance of the **MongoTemplate**, but its out of scope of this blog.
<h3>MongoDb Inbound Channel Adapter</h3>
MongoDb Inbound Channel Adapter allows you to read documents from the MongoDb and send them as Message payloads downstream.
### MongoDb Inbound Channel Adapter<
This simple example shows you how to read the documents stored in the MongoDb. For this example we'll use data stored by the MongoDb Outbound Channel Adapter discussed in the previous section.
MongoDb Inbound Channel Adapter allows you to read documents from the MongoDb and send them as Message payloads downstream. This simple example shows you how to read the documents stored in the MongoDb. For this example we'll use data stored by the MongoDb Outbound Channel Adapter discussed in the previous section.
As you can see from the example below, the configuration of MongoDb Inbound Channel Adapter is very similar to any other polling Inbound Channel Adapter.
````
<int-mongodb:inbound-channel-adapter id="simpleInboundAdapter" channel="splittingChannel"
<int-mongodb:inbound-channel-adapter id="simpleInboundAdapter" channel="splittingChannel"
query="{address.state : 'CA'}">
<int:poller fixed-rate="60000" max-messages-per-poll="1"/>
</int-mongodb:inbound-channel-adapter>
````
</int-mongodb:inbound-channel-adapter>
Notice the <strong>query</strong> attribute which allows you to provide JSON queries represented as simple String. For more information on MongoDb queries please refer to <a href="http://www.mongodb.org/display/DOCS/Querying">MongoDb documentation</a>
In the above case we are selecting all documents where <i>state</i> element of the <i>address</i> element is <b>'CA'</b>. As you may have guessed the MongoDb Inbound Channel Adapter returns List by default, so you can easily configure a very basic splitter downstream (as in this example) to process one message at the time. Run the <strong>MongoDbInboundAdapterDemo</strong> and you should see the results in the console:
Notice the **query** attribute which allows you to provide JSON queries represented as simple String. For more information on MongoDb queries please refer to [MongoDb documentation](http://www.mongodb.org/display/DOCS/Querying)
In the above case we are selecting all documents where *state* element of the *address* element is **'CA'**. As you may have guessed the MongoDb Inbound Channel Adapter returns List by default, so you can easily configure a very basic splitter downstream (as in this example) to process one message at the time. Run the **MongoDbInboundAdapterDemo** and you should see the results in the console:
````
04:37:30.720 WARN . . . { "_id" : { "$oid" : "50601bca0364063859066bcd"} , "_class" : "org.springframework.integration.samples.mongodb.domain.Person" , "fname" : "John" , "lname" : "Doe" , "address" : { "street" : "3401 Hillview Ave" , "city" : "Palo Alto" , "zip" : "94304" , "state" : "CA"}}
04:37:30.722 WARN . . . { "_id" : { "$oid" : "50601bca0364063859066bce"} , "_class" : "org.springframework.integration.samples.mongodb.domain.Person" , "fname" : "Josh" , "lname" : "Doe" , "address" : { "street" : "123 Main st" , "city" : "San Francisco" , "zip" : "94115" , "state" : "CA"}}
````
However, if you know that your query can only return a single result you can avoid returning List by configuring <strong>expect-single-result</strong> attribute setting its value to 'true'.
04:37:30.720 WARN . . . { "_id" : { "$oid" : "50601bca0364063859066bcd"} , "_class" : "org.springframework.integration.samples.mongodb.domain.Person" , "fname" : "John" , "lname" : "Doe" , "address" : { "street" : "3401 Hillview Ave" , "city" : "Palo Alto" , "zip" : "94304" , "state" : "CA"}}
04:37:30.722 WARN . . . { "_id" : { "$oid" : "50601bca0364063859066bce"} , "_class" : "org.springframework.integration.samples.mongodb.domain.Person" , "fname" : "Josh" , "lname" : "Doe" , "address" : { "street" : "123 Main st" , "city" : "San Francisco" , "zip" : "94115" , "state" : "CA"}}
Also, you may wish to do some post-processing to the successfully processed data that was read from the MongoDb.
For example; you may want to move or remove a document after its been processed.
You can do this using Transaction Synchronization feature that was added with Spring Integration 2.2 and which will be discussed in the next blog in this series expected in a few days (from Gary Russell). However the impatient once can get more details now by reading MongoDb Inbound Channel Adapter section of the reference manual <a href="http://static.springsource.org/spring-integration/docs/2.2.0.RC1/reference/htmlsingle/#mongodb-inbound-channel-adapter">http://static.springsource.org/spring-integration/docs/2.2.0.RC1/reference/htmlsingle/#mongodb-inbound-channel-adapter</a>
However, if you know that your query can only return a single result you can avoid returning List by configuring **expect-single-result** attribute setting its value to *true*.
Also, you may wish to do some post-processing to the successfully processed data that was read from the MongoDb. For example; you may want to move or remove a document after its been processed.
You can do this using Transaction Synchronization feature that was added with *Spring Integration 2.2* and which will be discussed in the next blog in this series expected in a few days (from Gary Russell). However the impatient once can get more details now by reading MongoDb Inbound Channel Adapter section of the reference manual [http://static.springsource.org/spring-integration/docs/2.2.0.RC3/reference/htmlsingle/#mongodb-inbound-channel-adapter](http://static.springsource.org/spring-integration/docs/2.2.0.RC3/reference/htmlsingle/#mongodb-inbound-channel-adapter).

View File

@@ -4,16 +4,20 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>mongodb</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Samples (Basic) - MongoDb</name>
<url>http://www.springsource.org/spring-integration</url>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC1</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
@@ -29,7 +33,7 @@
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<version>2.9</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
@@ -44,7 +48,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -56,49 +60,12 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<version>1.2.1</version>
<configuration>
<mainClass>org.springframework.integration.samples.jdbc.Main</mainClass>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<versionRange>
[2.3.2,)
</versionRange>
<goals>
<goal>testCompile</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>

View File

@@ -11,13 +11,13 @@
<mongo:db-factory id="mongoDbFactory" dbname="test"/>
<int-mongodb:outbound-channel-adapter id="deafultAdapter" />
<int-mongodb:outbound-channel-adapter id="adapterWithConverter"/>
<int-mongodb:outbound-channel-adapter id="adapterWithConverter" mongo-converter="stringConverter"/>
<!-- mongo-converter="stringConverter" -->
<bean id="stringConverter" class="org.springframework.integration.samples.mongodb.util.StringConverter">
<constructor-arg ref="mongoDbFactory"/>
<constructor-arg>

View File

@@ -1,77 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>oddeven</artifactId>
<name>Samples (Basic) - Odd-Even Sample</name>
<version>2.1.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<junit.version>4.10</junit.version>
</properties>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>oddeven</artifactId>
<name>Samples (Basic) - Odd-Even Sample</name>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<profiles>
<profile>
<id>cron</id>
<properties>
<java.main.class>org.springframework.integration.samples.oddeven.CronOddEvenDemo</java.main.class>
</properties>
</profile>
<profile>
<id>interval</id>
<properties>
<java.main.class>org.springframework.integration.samples.oddeven.IntervalOddEvenDemoTestApp</java.main.class>
</properties>
</profile>
</profiles>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<dependencies>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- test-scoped dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>${java.main.class}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>cron</id>
<properties>
<java.main.class>org.springframework.integration.samples.oddeven.CronOddEvenDemo</java.main.class>
</properties>
</profile>
<profile>
<id>interval</id>
<properties>
<java.main.class>org.springframework.integration.samples.oddeven.IntervalOddEvenDemoTestApp</java.main.class>
</properties>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- test-scoped dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>${java.main.class}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>repo.springsource.org.milestone</id>

View File

@@ -5,7 +5,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-2.1.xsd">
http://www.springframework.org/schema/integration/spring-integration.xsd">
<annotation-config/>

View File

@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>basic-samples</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Spring Integration Samples - Basic</name>
<packaging>pom</packaging>

View File

@@ -4,14 +4,14 @@ Quote Sample
This example demonstrates the following aspects of the CORE EIP support available with Spring Integration:
1. Channel Adapter (Inbound and Stdout)
2. Poller with Interval Trigers
2. Poller with Interval Triggers
3. Service Activator
It is a very simple example that introduces you to the Channel adapters and Pollers.
It is a very simple example that introduces you to Channel adapters and Pollers.
Messages are simply being emitted by the Poller (interval based) triggering **nextTicker()** method of *TickerStream* class and sent to a **tickers** channel from which they are retrieved by the *TickerStream* service.
Messages are simply being emitted by the *Poller* (interval based) triggering the **nextTicker()** method of the *TickerStream* class and are then sent to a **tickers** channel, from which they are retrieved by the *TickerStream* service.
*TickerStream* service generates random ticker symbols sending them to the **quotes** channel from which they are retrieved by the *QuoteService* (annotation based Service Activator). *QuoteService* generates random quotes sending them to the *Stdout Channel Adapter* where they are printed to a console.
The *TickerStream* service generates random ticker symbols, sending them to the **quotes** channel, from which they are retrieved by the *QuoteService* (annotation based Service Activator). The *QuoteService* generates random quotes, sending them to the *Stdout Channel Adapter*, where they are printed to the console.
To execute sample simply run **QuoteDemoTest**. You should see the output similar to this:

View File

@@ -5,12 +5,15 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>quote</artifactId>
<name>Samples (Basic) - Quote Sample</name>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -36,13 +39,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -68,4 +68,4 @@ This sample uses a property **private.keyfile** to point to the location of your
>$ chmod 600 ~/.ssh/authorized_keys
* Then edit **authorized_keys** file and paste in the contents of the public key file **sftp_rsa.pub**.
* Move your private key file **sftp_rsa** to META-INF/keys directory
* Move your private key file **sftp_rsa** to the directory **/src/test/resources/META-INF/keys/** directory.

View File

@@ -3,13 +3,16 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>sftp</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Basic) - SFTP Demo</name>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -35,13 +38,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -20,10 +20,10 @@
<property name="port" value="22"/>
<property name="user" value="${user}"/>
</bean>
<int-sftp:inbound-channel-adapter id="sftpInbondAdapter"
channel="receiveChannel"
session-factory="sftpSessionFactory"
channel="receiveChannel"
session-factory="sftpSessionFactory"
local-directory="file:local-dir"
remote-directory="<<SPECIFY REMOTE DIRECTORY (e.g., /{workspace}/samples/basic/sftp/remote-target-dir)>>"
auto-create-local-directory="true"
@@ -31,9 +31,9 @@
filename-regex=".*\.txt$">
<int:poller fixed-rate="1000" max-messages-per-poll="1"/>
</int-sftp:inbound-channel-adapter>
<int:channel id="receiveChannel">
<int:queue/>
</int:channel>
</beans>

View File

@@ -47,7 +47,7 @@
expression="headers['file_remoteDirectory'] + '/' + headers['file_remoteFile']"
request-channel="toRm"
command="rm"/>
<int:aggregator input-channel="aggregateResultsChannel"/>
</beans>

View File

@@ -10,7 +10,7 @@
http://www.springframework.org/schema/integration/sftp http://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd">
<context:property-placeholder location="classpath:user.properties"/>
<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<property name="host" value="localhost"/>
<property name="privateKey" value="classpath:META-INF/keys/sftp_rsa"/>
@@ -18,13 +18,13 @@
<property name="port" value="22"/>
<property name="user" value="${user}"/>
</bean>
<int:channel id="inputChannel"/>
<int-sftp:outbound-channel-adapter id="sftpOutboundAdapter"
session-factory="sftpSessionFactory"
channel="inputChannel"
remote-filename-generator-expression="payload.getName() + '_foo'"
remote-directory="<SPECIFY REMOTE DIRECTORY (e.g., /{workspace}/samples/basic/sftp/remote-target-dir)>"/>
</beans>

View File

@@ -5,7 +5,7 @@ Spring Integration - TCP-AMQP Sample
This sample demonstrates basic functionality of bridging **Spring Integration TCP Adapters** with **Spring Integration AMQP Adapters**.
Once the application is started, you enter some text in a telnet session and the data is written to an AMQP queue, which is then consumed and the result echoed to a netcat session.
Once the application is started, you enter some text in a telnet session and the data is written to an AMQP queue, which is then consumed and the result echoed to a [netcat][] session.
telnet->tcp-inbound-adapter->rabbit->tcp-outbound-adapter->netcat
@@ -16,6 +16,14 @@ netcat: http://en.wikipedia.org/wiki/Netcat
# How to Run the Sample
## Start netcat
In a terminal window start [netcat][], listening on port *11112*:
netcat -l -p 11112
## Start the Application
If you imported the example into your IDE, you can just run class **org.springframework.integration.samples.tcpamqp.Main**. For example in [SpringSource Tool Suite](http://www.springsource.com/developer/sts) (STS) do:
* Right-click on Main class --> Run As --> Java Application
@@ -24,15 +32,13 @@ Alternatively, you can start the sample from the command line ([Maven](http://ma
* mvn exec:java
In another terminal start netcat, listening on port 11112
## Run Telnet
netcat -l 11112
In another terminat, telnet to localhost:11111
In another terminal window, telnet to localhost:11111
telnet localhost 11111
Data typed into the telnet terminal will be echoed to the netcat terminal, via the rabbit queue.
Data typed into the telnet terminal will be echoed to the [netcat][] terminal, via the rabbit queue.
# Used Spring Integration components
@@ -52,3 +58,5 @@ Some further resources:
* RabbitMQ - [http://www.rabbitmq.com/](http://www.rabbitmq.com/)
* Spring AMQP - [http://www.springsource.org/spring-amqp](http://www.springsource.org/spring-amqp)
[netcat]: http://en.wikipedia.org/wiki/Netcat

View File

@@ -1,21 +1,26 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>tcp-amqp</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>tcp-amqp</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Samples (Basic) - TCP-AMQP</name>
<url>http://www.springsource.org/spring-integration</url>
<name>Samples (Basic) - TCP-AMQP</name>
<url>http://www.springsource.org/spring-integration</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<slf4j.version>1.6.4</slf4j.version>
<junit.version>4.10</junit.version>
</properties>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.amqp.version>1.1.3.RELEASE</spring.amqp.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<slf4j.version>1.6.4</slf4j.version>
<junit.version>4.10</junit.version>
</properties>
<repositories>
<repository>
@@ -25,109 +30,109 @@
</repository>
</repositories>
<build>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
<additionalBuildcommands>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>org.springframework.integration.samples.tcpamqp.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
<additionalBuildcommands>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>org.springframework.integration.samples.tcpamqp.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependencies>
<!-- Testing -->
<!-- Testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- Spring Integration -->
<!-- Spring Integration -->
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-amqp</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-amqp</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-groovy</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-groovy</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-ip</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
<version>1.0.1.BUILD-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-ip</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
<version>${spring.amqp.version}</version>
</dependency>
<!-- Logging -->
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
</dependencies>
</dependencies>
</project>

View File

@@ -20,7 +20,7 @@
<int:channel id="toRabbit" />
<int-amqp:outbound-channel-adapter channel="toRabbit"
amqp-template="amqpTemplate" exchange-name="si.test.exchange"
amqp-template="amqpTemplate" exchange-name="si.test.exchange"
routing-key="si.test.binding"/>
<!-- From RabbitMQ To STDOUT -->
@@ -29,26 +29,26 @@
queue-names="si.test.queue"
connection-factory="connectionFactory" />
<int:channel id="fromRabbit" />
<int:channel id="fromRabbit" />
<int-ip:tcp-connection-factory id="client" type="client" host="localhost" port="11112"/>
<int-ip:tcp-outbound-channel-adapter channel="fromRabbit" connection-factory="client"/>
<!-- Infrastructure -->
<int-ip:tcp-outbound-channel-adapter channel="fromRabbit" connection-factory="client"/>
<rabbit:connection-factory id="connectionFactory" />
<!-- Infrastructure -->
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" />
<rabbit:connection-factory id="connectionFactory" />
<rabbit:admin connection-factory="connectionFactory" />
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" />
<rabbit:queue name="si.test.queue" />
<rabbit:admin connection-factory="connectionFactory" />
<rabbit:direct-exchange name="si.test.exchange">
<rabbit:bindings>
<rabbit:binding queue="si.test.queue" key="si.test.binding" />
</rabbit:bindings>
</rabbit:direct-exchange>
<rabbit:queue name="si.test.queue" />
<rabbit:direct-exchange name="si.test.exchange">
<rabbit:bindings>
<rabbit:binding queue="si.test.queue" key="si.test.binding" />
</rabbit:bindings>
</rabbit:direct-exchange>
</beans>

View File

@@ -1,17 +1,19 @@
TCP Sample
==========
This is a place to get started with the Transmission Control Protocol (TCP). It demonstrates a simple message flow represented by the diagram below:
This is a place to get started with the [Transmission Control Protocol][] (TCP). It demonstrates a simple message flow represented by the diagram below:
Gateway -> Channel -> TcpOutboundGateway -> <===Socket===> -> TcpInboundGateway -> Channel -> ServiceActivator
The service returns a response which the inbound gateway sends back over the socket to the outbound gateway and the result is returned to the client that invoked the original SimpleGateway method.
The service returns a response which the *Inbound Gateway* sends back over the socket to the *Outbound Gateway* and the result is returned to the client that invoked the original **SimpleGateway** method.
To run sample simply execute a test case in **org.springframework.integration.samples.tcpclientservice** package.
## Running the Sample
Note that the test case includes an alternative configuration that uses the in-built conversion service and the channel dataType attribute, instead of explicit transformers, to convert from byte arrays to Strings.
To run sample simply execute a test case in the **org.springframework.integration.samples.tcpclientserver** package.
Simply change the @ContextConfiguration to switch between the two techniques. In addition, a simple telnet server is provided; see **TelnetServer** in src/main/java. Run this class as a Java application and then use telnet to connect to the service (**telnet localhost 11111**).
Note that the test case includes an alternative configuration that uses the built-in *conversion service* and the channel *dataType* attribute, instead of explicit *Transformers*, to convert from byte arrays to Strings.
Simply change the *@ContextConfiguration* to switch between the two techniques. In addition, a simple telnet server is provided; see **TelnetServer** in *src/main/java*. Run this class as a Java application and then use `telnet` to connect to the service (**telnet localhost 11111**).
Messages sent will be returned, preceded by 'echo:'.
@@ -28,7 +30,7 @@ Messages sent will be returned, preceded by 'echo:'.
telnet> quit
Connection closed.
Note that the test case also demonstrates error handling on an inbound gateway using direct channels. If the payload is 'FAIL', the EchoService throws an exception. The gateway is configured with an error-channel attribute. Messages sent to that channel are consumed by a transformer that concatenates the inbound message payload with the message text from the thrown exception, returning **FAIL:Failure Demonstration** over the TCP socket.
>Note that the test case also demonstrates error handling on an inbound gateway using direct channels. If the payload is 'FAIL', the EchoService throws an exception. The gateway is configured >with an error-channel attribute. Messages sent to that channel are consumed by a transformer that concatenates the inbound message payload with the message text from the thrown exception, >returning **FAIL:Failure Demonstration** over the TCP socket.
This can also be demonstrated with the telnet client thus...
@@ -47,8 +49,10 @@ This can also be demonstrated with the telnet client thus...
telnet> quit
Connection closed.
A third option exists for converting a stream of bytes to a domain object or message payload. You can hook up different serializers/deserializers at the connection factory which will apply the conversions right when the stream comes in to the gateway and right when it goes out.
A third option exists for converting a stream of bytes to a domain object or message payload. You can hook up different serializers/deserializers at the connection factory which will apply the conversions right when the stream comes in to the *Gateway* and right when it goes out.
See **TcpServerConnectionDeserializeTest** for using a simple (comes with spring) Stx/Etx serializer.
See **TcpServerCustomSerializerTest** for creating and using your own serializers
See **TcpServerCustomSerializerTest** for creating and using your own serializers
[Transmission Control Protocol]: http://en.wikipedia.org/wiki/Transmission_Control_Protocol

View File

@@ -4,14 +4,17 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>tcp-client-server</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Basic) - TCP Client Server Sample</name>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>3.1.0.RELEASE</spring.version>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>3.1.3.RELEASE</spring.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -47,25 +50,24 @@
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -4,14 +4,17 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>testing-examples</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Basic) - Testing Examples</name>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<spring.version>3.1.0.RELEASE</spring.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<spring.version>3.1.3.RELEASE</spring.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -67,62 +70,62 @@
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<artifactId>spring-expression</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<artifactId>spring-expression</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>src/test/java</directory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
<testResource>
<directory>src/test/resources</directory>
<includes>
<include>**/*</include>
</includes>
</testResource>
<testResource>
<directory>src/test/java</directory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
<testResource>
<directory>src/test/resources</directory>
<includes>
<include>**/*</include>
</includes>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.11</version>
<configuration>
<includes>
<include>**/*Tests.java</include>
</includes>
</configuration>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<includes>
<include>**/*Tests.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
@@ -133,4 +136,4 @@
<url>https://repo.springsource.org/libs-milestone</url>
</repository>
</repositories>
</project>
</project>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 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.
@@ -19,11 +19,12 @@ import java.util.List;
/**
* @author Gary Russell
* @author Gunnar Hillert
* @since 2.0.2
*
*/
public interface WeatherAndTraffic {
public List<String> getByZip(String zip);
List<String> getByZip(String zip);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 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.
@@ -20,11 +20,13 @@ import org.springframework.integration.file.FileHeaders;
/**
* @author Gary Russell
* @author Gunnar Hillert
*
* @since 2.0.2
*
*/
public interface VoidGateway {
public void process(String thing, @Header(FileHeaders.FILENAME) String fileName);
}

View File

@@ -7,23 +7,23 @@ This example demonstrates the following aspects of the Twitter support available
2. Twitter Inbound Search Channel Adapter - allows you to receive HOME status updates
3. Twitter Outboud Channel Adapter - allows send status updates
In order to run this sample you need to configure OAuth and set the values in the OAuth properties.
In order to run this sample you need to configure [OAuth][] and set the values in the [OAuth][] properties.
To use OAuth authentication/authorization with Twitter you must create new Application on Twitter Developers site.
Follow the directions below to create a new application and obtain consumer keys and access token:
To use [OAuth][] authentication/authorization with Twitter you must create a new Application on the Twitter Developers site.
Follow the directions below to create a new application and obtain the consumer keys and the access token:
* Go to http://dev.twitter.com/
* Click on 'Create an app' link and fill out all required fields on the form provided;
* Set 'Application Type' to 'Client' and depending on the nature of your application
* Select 'Default Access Type' as 'Read & Write' or 'Read-only'
* Go to [http://dev.twitter.com/](http://dev.twitter.com/)
* Log in to your account
* Go to *My applications*.
* Click on 'Create a new application' link and fill out all required fields on the form provided;
* Submit the form.
* If everything is successful you'll be presented with the 'Consumer Key' and 'Consumer Secret'.
* Copy both values in the safe place.
* On the same page you should see 'My Access Token' button on the side bar (right).
* Copy both values to a safe place.
* On the same page you should see 'My Access Token' button on bottom of the page.
* Click on it and you'll be presented with two more values: 'Access Token' and 'Access Token Secret'.
* Copy these values in a safe place as well.
* Copy these values to a safe place as well.
When done fill out **oauth.properties** file so it looks similar to this.
When done, fill out **oauth.properties** file so it looks similar to this.
twitter.oauth.consumerKey=4XzBPabcJQxyBzzzH3TrRQ
twitter.oauth.consumerSecret=ab2piKdMfPu8bVa3ab6DAIvIWEVZyMDL0RSEN2I8
@@ -32,5 +32,7 @@ When done fill out **oauth.properties** file so it looks similar to this.
NOTE: the above values are not real ;)
Now you ready to execute samples. Just run each sample and look for the output produced by the inbound adapters (**TwitterSearchSample.java** and **TwitterTimelineUpdateSample.java**)
Now you are ready to execute the samples. Just run each sample and look for the output produced by the inbound adapters (**TwitterSearchSample.java** and **TwitterTimelineUpdateSample.java**)
The outbound adapter sample (**TwitterSendUpdatesSample.java**) will not produce any output. Instead within seconds you should see your tweet.
[OAuth]: http://en.wikipedia.org/wiki/OAuth

View File

@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>twitter</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Basic) - Twitter Demo</name>
<packaging>jar</packaging>
@@ -12,8 +12,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.3.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -41,11 +41,11 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -1,9 +1,9 @@
Web Service Inbound Gateway Sample
==================================
This sample demonstrates a barebones *inbound Web Service Gateway*. Take a look at **web.xml** in the WEB-INF directory where the Spring Web Services Message-dispatching Servlet is defined. Then have a look at the **spring-ws-config.xml** file (also in the WEB-INF directory) where the Spring WS EndpointMapping is defined. Finally view the Spring Integration configuration in the **inbound-gateway-config.xml** file within the **org.springframework.integration.samples.ws** package where the actual gateway is defined along with a channel and service-activator.
This sample demonstrates a barebones *inbound Web Service Gateway*. Take a look at **web.xml** in the **WEB-INF** directory where the [Spring Web Services][] Message-dispatching Servlet is defined. Then have a look at the **spring-ws-config.xml** file (also in the **WEB-INF** directory) where the Spring WS EndpointMapping is defined. Finally, view the *Spring Integration* configuration in the **inbound-gateway-config.xml** file within the **org.springframework.integration.samples.ws** package where the actual *Gateway* is defined along with a *Channel* and *Service Activator*.
To use the gateway, you can run the tests that are located within the **src/test/java** directory. One is for standalone testing of the gateway itself, while the other tests the gateway running on a web server. The latter uses Spring Web Services' client-side support. Alternatively, you can simply start the server, and then send invocations with any standalone HTTP client testing tool. The request format should be similar to the following and should be POSTed to the service URL (e.g. http://localhost:8080/ws-inbound-gateway/echoservice):
To use the *Gateway*, you can run the tests that are located within the **src/test/java** directory. One is for standalone testing of the gateway itself, while the other tests the *Gateway* running on a web server. The latter uses [Spring Web Services][]' client-side support. Alternatively, you can simply start the server, and then send invocations with any standalone HTTP client testing tool. The request format should be similar to the following and should be *POST*ed to the service URL (e.g. http://localhost:8080/ws-inbound-gateway/echoservice):
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
@@ -11,3 +11,5 @@ To use the gateway, you can run the tests that are located within the **src/test
<echoRequest xmlns="http://www.springframework.org/spring-ws/samples/echo">hello</echoRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
[Spring Web Services]: http://www.springsource.org/spring-web-services

View File

@@ -5,13 +5,16 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>ws-inbound-gateway</artifactId>
<name>Samples (Basic) - WS Inbound Gateway Sample</name>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>war</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<spring.version>3.1.0.RELEASE</spring.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<spring.version>3.1.3.RELEASE</spring.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -47,13 +50,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -1,20 +1,26 @@
WS Outbound Gateway Sample
==========================
This example demonstrates the following aspects of the WS support available with Spring Integration:
This example demonstrates the following aspects of the Web Services (WS) support available with *Spring Integration*:
1. WS Outbound Gateway
2. Content Enricher
3. Composed Message Processor
A very simple example that show you how easy it is to invoke a SOAP based service using Spring Integration.
A very simple example that show you how easy it is to invoke a service based on the [Simple Object Access Protocol][] (SOAP) using *Spring Integration*.
* A Message is simply sent to a channel, where it is retrieved by a *Chain* which consists of a *Header Enricher* and a *WS Outbound Gateway*.
* The *Header Enricher* enriches the Message with the SOAP action header.
* The *WS Outbound Gateway* converts the Message to a SOAP request and sends it to a remote service, which converts a temperature from
Fahrenheit to Celsius and the result is printed to the console.
* A *Message* is sent to a *Channel*, where it is retrieved by a *Chain* which consists of a *Header Enricher* and a *WS Outbound Gateway*.
* The *Header Enricher* enriches the *Message* with the SOAP action header.
* The *WS Outbound Gateway* converts the *Message* to a SOAP request and sends it to a remote service, which converts a temperature from
Fahrenheit (90F) to Celsius (32.2C) and the result is printed to the console:
````
<?xml version="1.0" encoding="UTF-8"?><FahrenheitToCelsiusResponse xmlns="http://tempuri.org/"><FahrenheitToCelsiusResult>32.2222222222222</FahrenheitToCelsiusResult></FahrenheitToCelsiusResponse>````
## Running the Sample
To run the sample simply execute **WebServiceDemoTestApp** in package *org.springframework.integration.samples.ws*. You can also execute that class using the [Exec Maven Plugin](http://mojo.codehaus.org/exec-maven-plugin/):
$ mvn clean package exec:java
[Simple Object Access Protocol]: http://en.wikipedia.org/wiki/SOAP

View File

@@ -5,14 +5,17 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>ws-outbound-gateway</artifactId>
<name>Samples (Basic) - WS Outbound Gateway Sample</name>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
<saaj.version>1.3</saaj.version>
<saaj.version>1.3.19</saaj.version>
<javax-activation.version>1.1.1</javax-activation.version>
</properties>
<dependencies>
@@ -53,23 +56,23 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>org.springframework.integration.samples.ws.WebServiceDemoTestApp</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>org.springframework.integration.samples.ws.WebServiceDemoTestApp</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<repositories>

View File

@@ -1,14 +1,16 @@
XML Sample
==========
This example demonstrates the following aspects of the XML support available with Spring Integration:
This example demonstrates the following aspects of the [Extensible Markup Language][] (XML) support available with *Spring Integration*:
1. XPath Splitter - to split an order with multiple items into several order messages for separate processing.
2. XPath Router - to route messages according to the evaluation of an XPath expression which tests to see if the order item is in stock.
3. XPath Expression - which tests to see if the order item is in stock
3. XSLT Transformer - to transform the payload of the order message into a resupply message where the order item is found to be out of stock.
1. [XPath][] Splitter - to split an order with multiple items into several order messages for separate processing.
2. [XPath][] Router - to route messages according to the evaluation of an [XPath][] expression which tests to see if the order item is in stock.
3. [XPath][] Expression - which tests to see if the order item is in stock
3. [XSLT][] Transformer - to transform the payload of the order message into a resupply message where the order item is found to be out of stock.
To run the sample execute class **org.springframework.integration.samples.xml.BookOrderProcessingTestApp**. With Maven you can run the sample by executing:
## Running the Sample
To run the sample, execute the class **org.springframework.integration.samples.xml.BookOrderProcessingTestApp**. Alternatively, you can run the sample using [Maven][] by executing:
$ mvn clean package exec:java
@@ -31,4 +33,8 @@ You should see the following output:
<bb:isbn>1590596439</bb:isbn>
</bb:order>
</bb:bigBooksOrder>
[Extensible Markup Language]: http://en.wikipedia.org/wiki/XML
[Maven]: http://maven.apache.org/
[XPath]: http://en.wikipedia.org/wiki/XPath
[XSLT]: http://en.wikipedia.org/wiki/XSLT

View File

@@ -5,12 +5,15 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>xml</artifactId>
<name>Samples (Basic) - XML Sample</name>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -36,23 +39,23 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>org.springframework.integration.samples.xml.BookOrderProcessingTestApp</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>org.springframework.integration.samples.xml.BookOrderProcessingTestApp</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<repositories>

View File

@@ -1,7 +1,7 @@
XMPP Sample
===========
This example was prepared for testing with GoogleTalk and demonstrates the following aspects of the *Extensible Messaging and Presence Protocol* (XMPP) support available with Spring Integration:
This example was prepared for testing with [Google Talk][] and demonstrates the following aspects of the [Extensible Messaging and Presence Protocol][] (XMPP) support available with *Spring Integration*:
1. XMPP Inbound Channel Adapter - receive instant messages.
2. XMPP Outboud Channel Adapter - send instant messages.
@@ -16,4 +16,7 @@ Everything there was already preset. The only 3 properties you need to provide v
You'll also need to test it with your friend or have two Google accounts setup.
To test **SendInstantMessageSample.java**, first log on to the account identified via **send.to.user** property and make sure that that account is in your buddy list. Then run the demo.
To test **ReceiveInstantMessageSample.java**, first log on to the account identified via **send.to.user** property. Then run the demo. When demo class is started you'll see on GoggleTalk that your buddy (ReceiveInstantMessageSample.java) has just signed on. Now you can send a message from GoogleTalk and see it appear ion the console.
To test **ReceiveInstantMessageSample.java**, first log on to the account identified via **send.to.user** property. Then run the demo. Now any instant messages sent to your account appear in the console.
[Google Talk]: http://www.google.com/talk/
[Extensible Messaging and Presence Protocol]: http://en.wikipedia.org/wiki/Extensible_Messaging_and_Presence_Protocol

View File

@@ -2,13 +2,18 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>xmpp</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Basic) - XMPP Demo</name>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -34,13 +39,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -8,18 +8,18 @@
xmlns:context="http://www.springframework.org/schema/context"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-xmpp="http://www.springframework.org/schema/integration/xmpp">
<context:property-placeholder location="classpath:xmpp.properties"/>
<int-xmpp:xmpp-connection id="googleTalkConnection"
user="${user.login}"
password="${user.password}"
host="${user.host}"
service-name="${user.service}"
port="${user.port}"/>
user="${user.login}"
password="${user.password}"
host="${user.host}"
service-name="${user.service}"
port="${user.port}"/>
<int-xmpp:inbound-channel-adapter channel="imOutChannel" xmpp-connection="googleTalkConnection"/>
<int:logging-channel-adapter id="imOutChannel"/>
</beans>

View File

@@ -8,24 +8,24 @@
xmlns:context="http://www.springframework.org/schema/context"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-xmpp="http://www.springframework.org/schema/integration/xmpp">
<context:property-placeholder location="classpath:xmpp.properties"/>
<int-xmpp:xmpp-connection id="googleTalkConnection"
user="${user.login}"
password="${user.password}"
host="${user.host}"
service-name="${user.service}"
port="${user.port}"/>
<int:channel id="toUserChannel"/>
<int-xmpp:header-enricher input-channel="toUserChannel" output-channel="imChannel">
<int-xmpp:chat-to value="${send.to.user}"/>
</int-xmpp:header-enricher>
<int:channel id="imChannel"/>
user="${user.login}"
password="${user.password}"
host="${user.host}"
service-name="${user.service}"
port="${user.port}"/>
<int:channel id="toUserChannel"/>
<int-xmpp:header-enricher input-channel="toUserChannel" output-channel="imChannel">
<int-xmpp:chat-to value="${send.to.user}"/>
</int-xmpp:header-enricher>
<int:channel id="imChannel"/>
<int-xmpp:outbound-channel-adapter channel="imChannel" xmpp-connection="googleTalkConnection"/>
</beans>

View File

@@ -12,7 +12,7 @@
<!-- Loggers -->
<logger name="org.springframework.integration">
<level value="warn" />
<level value="info" />
</logger>
<logger name="org.springframework.integration.samples">

View File

@@ -7,7 +7,7 @@
<version>1.0.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<name>xquery</name>
<name>Samples (Basic) - XQuery Sample</name>
<url>http://www.springsource.org/spring-integration</url>
<prerequisites>
@@ -16,7 +16,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC2</spring.integration.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>

View File

@@ -3,13 +3,18 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>async-gateway</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Intermediate) - Async Gateway Demo</name>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -35,13 +40,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -1,65 +1,69 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>dynamic-poller</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>dynamic-poller</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<name>dynamic-poller</name>
<url>http://www.springsource.org/spring-integration</url>
<name>dynamic-poller</name>
<url>http://www.springsource.org/spring-integration</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<junit.version>4.10</junit.version>
<java.main.class>org.springframework.integration.samples.poller.Main</java.main.class>
</properties>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<dependencies>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- test-scoped dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>${java.main.class}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
<java.main.class>org.springframework.integration.samples.poller.Main</java.main.class>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- test-scoped dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>${java.main.class}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>repo.springsource.org.milestone</id>
@@ -67,4 +71,4 @@
<url>https://repo.springsource.org/libs-milestone</url>
</repository>
</repositories>
</project>
</project>

View File

@@ -1,21 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:task="http://www.springframework.org/schema/task">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:task="http://www.springframework.org/schema/task">
<int:inbound-channel-adapter expression="new java.text.SimpleDateFormat('yyyy-MM-dd HH:mm:ss.SSS').format(new java.util.Date())" channel="logger">
<int:poller max-messages-per-poll="1" trigger="dynamicTrigger" />
</int:inbound-channel-adapter>
<int:inbound-channel-adapter
expression="new java.text.SimpleDateFormat('yyyy-MM-dd HH:mm:ss.SSS').format(new java.util.Date())"
channel="logger">
<int:poller max-messages-per-poll="1" trigger="dynamicTrigger" />
</int:inbound-channel-adapter>
<bean id="dynamicTrigger" class="org.springframework.integration.samples.poller.DynamicPeriodicTrigger">
<constructor-arg name="period" value="5000"/>
</bean>
<bean id="dynamicTrigger"
class="org.springframework.integration.samples.poller.DynamicPeriodicTrigger">
<constructor-arg name="period" value="5000" />
</bean>
<int:logging-channel-adapter id="logger" logger-name="org.springframework.integration.samples.poller"/>
<int:logging-channel-adapter id="logger"
logger-name="org.springframework.integration.samples.poller" />
<task:executor id="executor" queue-capacity="20" pool-size="5-20"/>
<task:executor id="executor" queue-capacity="20"
pool-size="5-20" />
</beans>

View File

@@ -5,11 +5,16 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>errorhandling</artifactId>
<name>Samples (Intermediate) - Error Handling Sample</name>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -40,13 +45,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -2,15 +2,20 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>file-processing</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Intermediate) - File Processing</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<dependencies>
<dependency>
<groupId>org.springframework.integration</groupId>
@@ -34,13 +39,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -8,7 +8,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC1</spring.integration.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
@@ -53,7 +53,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.1.1.RELEASE</version>
<version>3.1.3.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@@ -1,26 +1,26 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.sample</groupId>
<artifactId>monitoring</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>war</packaging>
<groupId>org.springframework.integration.sample</groupId>
<artifactId>monitoring</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>war</packaging>
<name>monitoring</name>
<url>http://www.springsource.org/spring-integration</url>
<name>monitoring</name>
<url>http://www.springsource.org/spring-integration</url>
<prerequisites>
<maven>2.2.0</maven>
</prerequisites>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC1</spring.integration.version>
<org.springframework-version>3.1.1.RELEASE</org.springframework-version>
<log4j.version>1.2.16</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<org.springframework-version>3.1.3.RELEASE</org.springframework-version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<repositories>
<repository>
@@ -30,90 +30,90 @@
</repository>
</repositories>
<build>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
<additionalBuildcommands>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<wtpversion>1.5</wtpversion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
<additionalBuildcommands>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<wtpversion>1.5</wtpversion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependencies>
<!-- Testing -->
<!-- Testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- Spring -->
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- Spring Integration -->
<!-- Spring Integration -->
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jmx</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jmx</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-twitter</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-twitter</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-groovy</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-groovy</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<!-- Logging -->
<!-- Logging -->
<dependency>
<groupId>log4j</groupId>
@@ -121,24 +121,24 @@
<version>${log4j.version}</version>
</dependency>
<!-- Servlet -->
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</project>

View File

@@ -3,32 +3,32 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>multipart-http</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Intermediate) - HTTP Multipart Demo</name>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<spring.version>3.1.0.RELEASE</spring.version>
<commons-fileupload>1.2</commons-fileupload>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<spring.version>3.1.3.RELEASE</spring.version>
<commons-fileupload>1.2.2</commons-fileupload>
<commons-io>1.3.2</commons-io>
<log4j.version>1.2.16</log4j.version>
<log4j.version>1.2.17</log4j.version>
</properties>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<dependencies>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-http</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.codehaus.jackson</groupId> -->
<!-- <artifactId>jackson-core-asl</artifactId> -->
<!-- <version>1.8.1</version> -->
<!-- </dependency> -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.2</version>
<version>1.9.10</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
@@ -63,13 +63,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -1,5 +1,17 @@
/**
*
/*
* Copyright 2002-2012 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.samples.multipart;
@@ -9,9 +21,10 @@ import org.springframework.http.HttpStatus;
/**
* @author ozhurakousky
* @author Gunnar Hillert
*
*/
public interface MultipartRequestGateway {
public HttpStatus postMultipartRequest(Map<String, Object> multipartRequest);
HttpStatus postMultipartRequest(Map<String, Object> multipartRequest);
}

View File

@@ -5,10 +5,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>intermediate-samples</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Spring Integration Samples - Intermediate</name>
<packaging>pom</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<modules>
<module>async-gateway</module>
<module>errorhandling</module>

View File

@@ -1,15 +1,21 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>rest-http</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<packaging>war</packaging>
<name>Spring Integration Rest HTTP Path Usage Demo</name>
<description>Spring Integration Rest HTTP Path Usage Demo</description>
<properties>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<spring.version>3.1.0.RELEASE</spring.version>
<spring.security.version>3.1.0.RELEASE</spring.security.version>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>rest-http</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>war</packaging>
<name>Spring Integration Rest HTTP Path Usage Demo</name>
<description>Spring Integration Rest HTTP Path Usage Demo</description>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<spring.version>3.1.3.RELEASE</spring.version>
<spring.security.version>3.1.3.RELEASE</spring.security.version>
<commons-fileupload>1.2</commons-fileupload>
<commons-io>1.3.2</commons-io>
<log4j.version>1.2.16</log4j.version>
@@ -17,116 +23,116 @@
<junit.version>4.8.1</junit.version>
<jasypt.version>1.7</jasypt.version>
<cglib.version>2.2</cglib.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-http</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.8.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-http</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.8.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<scope>compile</scope>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<scope>compile</scope>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<scope>compile</scope>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>${jasypt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>${cglib.version}</version>
<scope>runtime</scope>
</dependency>
<!-- Servlet dependency -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${javax.servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<scope>compile</scope>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<scope>compile</scope>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>${jasypt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>${cglib.version}</version>
<scope>runtime</scope>
</dependency>
<!-- Servlet dependency -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${javax.servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -136,35 +142,38 @@
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>clean</id>
<configuration>
<target>
<echo>Copying jaxb.index to classes folder</echo>
</target>
<target>
<copy todir="${project.basedir}/target/classes/org/springframework/integration/samples/rest/domain" overwrite="true">
<fileset dir="${project.basedir}/src/main/java/org/springframework/integration/samples/rest/domain">
<include name="**/jaxb.index"/>
<version>1.6</version>
<executions>
<execution>
<id>clean</id>
<configuration>
<target>
<echo>Copying jaxb.index to classes folder</echo>
</target>
<target>
<copy
todir="${project.basedir}/target/classes/org/springframework/integration/samples/rest/domain"
overwrite="true">
<fileset
dir="${project.basedir}/src/main/java/org/springframework/integration/samples/rest/domain">
<include name="**/jaxb.index" />
</fileset>
</copy>
</target>
</configuration>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</target>
</configuration>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
@@ -174,4 +183,4 @@
<url>https://repo.springsource.org/libs-milestone</url>
</repository>
</repositories>
</project>
</project>

View File

@@ -4,14 +4,19 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>retry-and-more</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Intermediate) - Retry and More</name>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.framework.version>3.1.2.RELEASE</spring.framework.version>
<spring.integration.version>2.2.0.RC1</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.framework.version>3.1.3.RELEASE</spring.framework.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
@@ -41,11 +46,11 @@
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
</dependency>
<!-- test-scoped dependencies -->
<dependency>
<groupId>org.springframework</groupId>
@@ -63,30 +68,30 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>${java.main.class}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>${java.main.class}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>repo.springsource.org.milestone</id>
<name>Spring Framework Maven Milestone Repository</name>
<url>https://repo.springsource.org/libs-milestone</url>
</repository>
</repositories>
<repositories>
<repository>
<id>repo.springsource.org.milestone</id>
<name>Spring Framework Maven Milestone Repository</name>
<url>https://repo.springsource.org/libs-milestone</url>
</repository>
</repositories>
</project>

View File

@@ -4,16 +4,20 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>derby-stored-procedures</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Samples (Intermediate) - Stored Procedures Derby</name>
<url>http://www.springsource.org/spring-integration</url>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
@@ -29,7 +33,7 @@
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<version>2.9</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
@@ -44,7 +48,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
@@ -56,7 +60,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<version>1.2.1</version>
<configuration>
<mainClass>org.springframework.integration.Main</mainClass>
</configuration>
@@ -100,7 +104,7 @@
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.8.2.2</version>
<version>10.9.1.0</version>
</dependency>
</dependencies>

View File

@@ -17,7 +17,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC2</spring.integration.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>

View File

@@ -4,16 +4,20 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>oracle-stored-procedures</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Samples (Intermediate) - Stored Procedures Oracle</name>
<url>http://www.springsource.org/spring-integration</url>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
@@ -44,7 +48,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>

View File

@@ -16,7 +16,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC2</spring.integration.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>

View File

@@ -33,7 +33,7 @@ import org.springframework.integration.service.CoffeeService;
* @since 2.2
*
*/
public final class Main {
public class Main {
private static final Logger LOGGER = Logger.getLogger(Main.class);

View File

@@ -7,7 +7,7 @@
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/jdbc http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
http://www.springframework.org/schema/integration/jdbc file:///Users/hillert/dev/git/spring-integration/spring-integration-jdbc/src/main/resources/org/springframework/integration/jdbc/config/spring-integration-jdbc-2.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
@@ -49,7 +49,16 @@
row-mapper="org.springframework.integration.support.CoffeBeverageMapper" />
</int-jdbc:stored-proc-outbound-gateway>
<int-jdbc:stored-proc-inbound-channel-adapter data-source="dataSource" ignore-column-meta-data="true"
channel="loggit" expect-single-result="true" stored-procedure-name="FIND_ALL_COFFEE_BEVERAGES">
<int-jdbc:returning-resultset name="ref" row-mapper="org.springframework.integration.support.CoffeBeverageMapper"/>
</int-jdbc:stored-proc-inbound-channel-adapter>
<int:logging-channel-adapter id="loggit" log-full-message="true"/>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<int:poller default="true" fixed-rate="5000"><int:transactional/></int:poller>
</beans>

View File

@@ -4,14 +4,19 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>tcp-client-server-multiplex</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Intermediate) - TCP Client Server Multiplexing Sample</name>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>3.1.0.RELEASE</spring.version>
<spring.integration.version>2.1.0.RELEASE</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>3.1.3.RELEASE</spring.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
<dependencies>
@@ -48,13 +53,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
</plugins>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2012 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.
@@ -17,11 +17,12 @@ package org.springframework.integration.samples.tcpclientserver;
/**
* @author Gary Russell
* @author Gunnar Hillert
* @since 2.1
*
*/
public interface SimpleGateway {
public String send(String text);
String send(String text);
}

View File

@@ -4,13 +4,18 @@
<groupId>org.springframework.integration.samples</groupId>
<artifactId>travel</artifactId>
<name>Samples (Intermediate) - Travel Services</name>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.integration.version>2.2.0.RC2</spring.integration.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
<spring.version>3.1.2.RELEASE</spring.version>
<spring.version>3.1.3.RELEASE</spring.version>
<java.main.class>org.springframework.integration.samples.travel.Main</java.main.class>
</properties>
<dependencies>
@@ -58,7 +63,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>

View File

@@ -25,8 +25,8 @@ package org.springframework.integration.samples.travel;
*/
public interface TravelGateway {
public String getWeatherByCity(City city);
String getWeatherByCity(City city);
public String getTrafficByCity(City city);
String getTrafficByCity(City city);
}

View File

@@ -4,14 +4,19 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration.samples</groupId>
<artifactId>tx-synch</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<name>Samples (Intermediate) - Transaction Synchronization</name>
<packaging>jar</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.framework.version>3.1.2.RELEASE</spring.framework.version>
<spring.integration.version>2.2.0.RC1</spring.integration.version>
<log4j.version>1.2.16</log4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.framework.version>3.1.3.RELEASE</spring.framework.version>
<spring.integration.version>2.2.0.RC3</spring.integration.version>
<log4j.version>1.2.17</log4j.version>
<junit.version>4.10</junit.version>
</properties>
@@ -42,20 +47,20 @@
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.166</version>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.166</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
</dependency>
<!-- test-scoped dependencies -->
<dependency>
<groupId>org.springframework</groupId>
@@ -73,30 +78,30 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>2.5.1</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>false</showDeprecation>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>${java.main.class}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>${java.main.class}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>repo.springsource.org.milestone</id>
<name>Spring Framework Maven Milestone Repository</name>
<url>https://repo.springsource.org/libs-snapshot</url>
</repository>
</repositories>
<repositories>
<repository>
<id>repo.springsource.org.milestone</id>
<name>Spring Framework Maven Milestone Repository</name>
<url>https://repo.springsource.org/libs-snapshot</url>
</repository>
</repositories>
</project>

View File

@@ -10,6 +10,10 @@
<url>http://www.springsource.org/spring-integration</url>
<packaging>pom</packaging>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<modules>
<module>basic</module>
<module>intermediate</module>