From 9fdd28287fe3c4f663536684d9b91e0405d3f4d1 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Fri, 17 Sep 2010 13:54:18 -0400 Subject: [PATCH] INT-1380, added mail sample, modified POM to Log4J 1.2.16 to avoid transient dependencies on artifacts that are nowehere to be found --- case-studies/cafe/pom.xml | 19 ++++- case-studies/loan-broker/pom.xml | 2 +- cook-books/async-gateway/pom.xml | 21 +++++- cook-books/errorhandling/pom.xml | 19 ++++- cook-books/multipart-http/pom.xml | 19 ++++- getting-started/file/pom.xml | 19 ++++- getting-started/helloworld/pom.xml | 19 ++++- getting-started/jms/pom.xml | 17 +++++ getting-started/jmx/pom.xml | 21 +++++- getting-started/mail/.classpath | 10 +++ getting-started/mail/.gitignore | 1 + getting-started/mail/.project | 29 ++++++++ .../com.springsource.sts.config.flow.prefs | 3 + .../mail/.settings/org.eclipse.jdt.core.prefs | 13 ++++ .../.settings/org.maven.ide.eclipse.prefs | 9 +++ getting-started/mail/.springBeans | 14 ++++ getting-started/mail/pom.xml | 74 +++++++++++++++++++ getting-started/mail/readme.txt | 26 +++++++ .../integration/mail-imap-idle-config.xml | 29 ++++++++ .../imapidle/GmailImapIdleAdapterTest.java | 31 ++++++++ .../mail/src/test/resources/log4j.xml | 28 +++++++ getting-started/oddeven/pom.xml | 19 ++++- getting-started/quote/pom.xml | 19 ++++- getting-started/ws-inbound-gateway/pom.xml | 19 ++++- getting-started/ws-outbound-gateway/pom.xml | 21 +++++- getting-started/xml/pom.xml | 19 ++++- 26 files changed, 504 insertions(+), 16 deletions(-) create mode 100644 getting-started/mail/.classpath create mode 100644 getting-started/mail/.gitignore create mode 100644 getting-started/mail/.project create mode 100644 getting-started/mail/.settings/com.springsource.sts.config.flow.prefs create mode 100644 getting-started/mail/.settings/org.eclipse.jdt.core.prefs create mode 100644 getting-started/mail/.settings/org.maven.ide.eclipse.prefs create mode 100644 getting-started/mail/.springBeans create mode 100644 getting-started/mail/pom.xml create mode 100644 getting-started/mail/readme.txt create mode 100644 getting-started/mail/src/main/resources/META-INF/spring/integration/mail-imap-idle-config.xml create mode 100644 getting-started/mail/src/test/java/org/springframework/integration/samples/mail/imapidle/GmailImapIdleAdapterTest.java create mode 100644 getting-started/mail/src/test/resources/log4j.xml diff --git a/case-studies/cafe/pom.xml b/case-studies/cafe/pom.xml index a0f34e38..15843f82 100644 --- a/case-studies/cafe/pom.xml +++ b/case-studies/cafe/pom.xml @@ -8,7 +8,7 @@ Spring Integration Cafe Sample 2.0.0.M7 - 1.2.15 + 1.2.16 4.7 @@ -49,4 +49,21 @@ + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + diff --git a/case-studies/loan-broker/pom.xml b/case-studies/loan-broker/pom.xml index 7be09d82..a6f70203 100644 --- a/case-studies/loan-broker/pom.xml +++ b/case-studies/loan-broker/pom.xml @@ -9,7 +9,7 @@ 2.0.0.M7 1.1.1 - 1.2.15 + 1.2.16 4.7 diff --git a/cook-books/async-gateway/pom.xml b/cook-books/async-gateway/pom.xml index 266d9adf..9c1cd634 100644 --- a/cook-books/async-gateway/pom.xml +++ b/cook-books/async-gateway/pom.xml @@ -3,12 +3,12 @@ 4.0.0 org.springframework.integration.samples async-gateway - 2.0.0 + 2.0.0 Async Gateway Demo jar 2.0.0.M7 - 1.2.15 + 1.2.16 4.7 @@ -44,4 +44,21 @@ + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + diff --git a/cook-books/errorhandling/pom.xml b/cook-books/errorhandling/pom.xml index b0d0fb9b..cda3c1f0 100644 --- a/cook-books/errorhandling/pom.xml +++ b/cook-books/errorhandling/pom.xml @@ -8,7 +8,7 @@ 2.0.0 2.0.0.M7 - 1.2.15 + 1.2.16 4.7 @@ -49,4 +49,21 @@ + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + diff --git a/cook-books/multipart-http/pom.xml b/cook-books/multipart-http/pom.xml index 636a9c62..45b90112 100644 --- a/cook-books/multipart-http/pom.xml +++ b/cook-books/multipart-http/pom.xml @@ -11,7 +11,7 @@ 3.0.3.RELEASE 1.2 1.3.2 - 1.2.15 + 1.2.16 @@ -55,4 +55,21 @@ + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + diff --git a/getting-started/file/pom.xml b/getting-started/file/pom.xml index 7abdcf79..eee07fda 100644 --- a/getting-started/file/pom.xml +++ b/getting-started/file/pom.xml @@ -9,7 +9,7 @@ jar 2.0.0.M7 - 1.2.15 + 1.2.16 4.7 @@ -45,4 +45,21 @@ + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + diff --git a/getting-started/helloworld/pom.xml b/getting-started/helloworld/pom.xml index 7506815a..6befbc9a 100644 --- a/getting-started/helloworld/pom.xml +++ b/getting-started/helloworld/pom.xml @@ -9,7 +9,7 @@ jar 2.0.0.M7 - 1.2.15 + 1.2.16 4.7 @@ -45,4 +45,21 @@ + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + \ No newline at end of file diff --git a/getting-started/jms/pom.xml b/getting-started/jms/pom.xml index 0d15f61f..2a948714 100644 --- a/getting-started/jms/pom.xml +++ b/getting-started/jms/pom.xml @@ -43,4 +43,21 @@ + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + diff --git a/getting-started/jmx/pom.xml b/getting-started/jmx/pom.xml index bc3219d4..e2b34e0a 100644 --- a/getting-started/jmx/pom.xml +++ b/getting-started/jmx/pom.xml @@ -9,7 +9,7 @@ jar 2.0.0.M7 - 1.2.15 + 1.2.16 4.7 @@ -27,7 +27,7 @@ log4j log4j ${log4j.version} - + junit @@ -50,4 +50,21 @@ + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + \ No newline at end of file diff --git a/getting-started/mail/.classpath b/getting-started/mail/.classpath new file mode 100644 index 00000000..96489ff1 --- /dev/null +++ b/getting-started/mail/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/getting-started/mail/.gitignore b/getting-started/mail/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/getting-started/mail/.gitignore @@ -0,0 +1 @@ +/target diff --git a/getting-started/mail/.project b/getting-started/mail/.project new file mode 100644 index 00000000..7339021d --- /dev/null +++ b/getting-started/mail/.project @@ -0,0 +1,29 @@ + + + mail + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/getting-started/mail/.settings/com.springsource.sts.config.flow.prefs b/getting-started/mail/.settings/com.springsource.sts.config.flow.prefs new file mode 100644 index 00000000..7c05b8b9 --- /dev/null +++ b/getting-started/mail/.settings/com.springsource.sts.config.flow.prefs @@ -0,0 +1,3 @@ +#Fri Sep 17 13:46:16 EDT 2010 +//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/mail/src/main/resources/META-INF/spring/integration/mail-imap-idle-config.xml=\n\n\n\n\n\n\n\n\n\n +eclipse.preferences.version=1 diff --git a/getting-started/mail/.settings/org.eclipse.jdt.core.prefs b/getting-started/mail/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..c0e0608b --- /dev/null +++ b/getting-started/mail/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,13 @@ +#Fri Sep 17 09:58:59 EDT 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/getting-started/mail/.settings/org.maven.ide.eclipse.prefs b/getting-started/mail/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 00000000..58a89658 --- /dev/null +++ b/getting-started/mail/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Fri Sep 17 09:56:05 EDT 2010 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/getting-started/mail/.springBeans b/getting-started/mail/.springBeans new file mode 100644 index 00000000..0e9f29f3 --- /dev/null +++ b/getting-started/mail/.springBeans @@ -0,0 +1,14 @@ + + + 1 + + + + + + + src/main/resources/META-INF/spring/integration/mail-imap-idle-config.xml + + + + diff --git a/getting-started/mail/pom.xml b/getting-started/mail/pom.xml new file mode 100644 index 00000000..195d02a6 --- /dev/null +++ b/getting-started/mail/pom.xml @@ -0,0 +1,74 @@ + + 4.0.0 + org.springframework.integration.samples + mail + Spring Integration IMAP IDLE Sample + 2.0.0 + + 2.0.0.M7 + 1.2.16 + 4.7 + + + + org.springframework.integration + spring-integration-mail + ${spring.integration.version} + + + javax.activation + activation + 1.1.1 + true + + + javax.mail + mail + 1.4.1 + + + log4j + log4j + ${log4j.version} + + + + junit + junit + ${junit.version} + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + -Xlint:all + true + false + + + + + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + + \ No newline at end of file diff --git a/getting-started/mail/readme.txt b/getting-started/mail/readme.txt new file mode 100644 index 00000000..0ece10d1 --- /dev/null +++ b/getting-started/mail/readme.txt @@ -0,0 +1,26 @@ +This example demonstrates the following aspects of the Mail support available with Spring Integration: +1. IMAP IDLE Channel Adapter (with sample GMail configuration) + +Simply change configuration file (src/main/resources/META-INF/spring/integration/mail-imap-idle-config.xml) +to point to your existing GMail account (replace userid and password) and run the GmailImapIdleAdapterTest. +Once started start sending emails to your account. You'll see that adapter will receive messages and will +publish them to a channel specified by 'channel' attribute. + +Make sure you enable your GMail account for IMAP/POP3 access. + +You should see the output similar to this: + +DEBUG: org.springframework.integration.mail.ImapMailReceiver - connecting to store [imaps://:*****@imap.gmail.com:993/inbox] +DEBUG: org.springframework.integration.mail.ImapMailReceiver - opening folder [imaps://:*****@imap.gmail.com:993/inbox] +INFO : org.springframework.integration.mail.ImapMailReceiver - attempting to receive mail from folder [INBOX] + +Send a Message and you will see: + +DEBUG: org.springframework.integration.mail.ImapMailReceiver - found 2 new messages +DEBUG: org.springframework.integration.mail.ImapIdleChannelAdapter - received 2 mail messages +INFO : org.springframework.integration.samples.mail.imapidle.GmailImapIdleAdapterTest - Message: [Payload=javax.mail.internet.MimeMessage@1f00aff5][Headers={$timestamp=1284745370451, $id=9dfd4b30-2d15-4905-9301-f39aa4073ea0}] +INFO : org.springframework.integration.samples.mail.imapidle.GmailImapIdleAdapterTest - Message: [Payload=javax.mail.internet.MimeMessage@66200db9][Headers={$timestamp=1284745370452, $id=4b8322ba-f469-4afc-af4f-1332a94b735b}] +DEBUG: org.springframework.integration.mail.ImapIdleChannelAdapter - waiting for mail +DEBUG: org.springframework.integration.mail.ImapMailReceiver - opening folder [imaps://:*****@imap.gmail.com:993/inbox] + +You can experiment with various attributes of the adapter (e.g., should-delete-messages, should-mark-messages-as-read etc...) diff --git a/getting-started/mail/src/main/resources/META-INF/spring/integration/mail-imap-idle-config.xml b/getting-started/mail/src/main/resources/META-INF/spring/integration/mail-imap-idle-config.xml new file mode 100644 index 00000000..7b6b019c --- /dev/null +++ b/getting-started/mail/src/main/resources/META-INF/spring/integration/mail-imap-idle-config.xml @@ -0,0 +1,29 @@ + + + + + + + + + javax.net.ssl.SSLSocketFactory + false + imaps + false + + + diff --git a/getting-started/mail/src/test/java/org/springframework/integration/samples/mail/imapidle/GmailImapIdleAdapterTest.java b/getting-started/mail/src/test/java/org/springframework/integration/samples/mail/imapidle/GmailImapIdleAdapterTest.java new file mode 100644 index 00000000..01d542c9 --- /dev/null +++ b/getting-started/mail/src/test/java/org/springframework/integration/samples/mail/imapidle/GmailImapIdleAdapterTest.java @@ -0,0 +1,31 @@ +/** + * + */ +package org.springframework.integration.samples.mail.imapidle; + +import org.apache.log4j.Logger; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.integration.Message; +import org.springframework.integration.MessagingException; +import org.springframework.integration.channel.DirectChannel; +import org.springframework.integration.core.MessageHandler; + +/** + * @author Oleg Zhurakousky + * + */ +public class GmailImapIdleAdapterTest { + private static Logger logger = Logger.getLogger(GmailImapIdleAdapterTest.class); + + + public static void main (String[] args) throws Exception { + ApplicationContext ac = new ClassPathXmlApplicationContext("/META-INF/spring/integration/mail-imap-idle-config.xml"); + DirectChannel inputChannel = ac.getBean("recieveChannel", DirectChannel.class); + inputChannel.subscribe(new MessageHandler() { + public void handleMessage(Message message) throws MessagingException { + logger.info("Message: " + message); + } + }); + } +} diff --git a/getting-started/mail/src/test/resources/log4j.xml b/getting-started/mail/src/test/resources/log4j.xml new file mode 100644 index 00000000..4e5a8dc5 --- /dev/null +++ b/getting-started/mail/src/test/resources/log4j.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/getting-started/oddeven/pom.xml b/getting-started/oddeven/pom.xml index a9524409..565b80ec 100644 --- a/getting-started/oddeven/pom.xml +++ b/getting-started/oddeven/pom.xml @@ -9,7 +9,7 @@ jar 2.0.0.M7 - 1.2.15 + 1.2.16 4.7 @@ -45,4 +45,21 @@ + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + diff --git a/getting-started/quote/pom.xml b/getting-started/quote/pom.xml index 4fa6ed7f..66b86d3d 100644 --- a/getting-started/quote/pom.xml +++ b/getting-started/quote/pom.xml @@ -9,7 +9,7 @@ jar 2.0.0.M7 - 1.2.15 + 1.2.16 4.7 @@ -45,4 +45,21 @@ + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + diff --git a/getting-started/ws-inbound-gateway/pom.xml b/getting-started/ws-inbound-gateway/pom.xml index 0b8dba86..cb47490f 100644 --- a/getting-started/ws-inbound-gateway/pom.xml +++ b/getting-started/ws-inbound-gateway/pom.xml @@ -10,7 +10,7 @@ 2.0.0.M7 3.0.3.RELEASE - 1.2.15 + 1.2.16 4.7 @@ -56,4 +56,21 @@ + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + diff --git a/getting-started/ws-outbound-gateway/pom.xml b/getting-started/ws-outbound-gateway/pom.xml index d9b040c9..d3face5e 100644 --- a/getting-started/ws-outbound-gateway/pom.xml +++ b/getting-started/ws-outbound-gateway/pom.xml @@ -5,11 +5,11 @@ org.springframework.integration.samples ws-outbound-gateway Spring Integration WS Outbound Gateway Sample - 2.0.0 + 2.0.0 jar 2.0.0.M7 - 1.2.15 + 1.2.16 4.7 1.3 1.1.1 @@ -62,4 +62,21 @@ + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + \ No newline at end of file diff --git a/getting-started/xml/pom.xml b/getting-started/xml/pom.xml index ec401621..3ad5d303 100644 --- a/getting-started/xml/pom.xml +++ b/getting-started/xml/pom.xml @@ -9,7 +9,7 @@ jar 2.0.0.M7 - 1.2.15 + 1.2.16 4.7 @@ -45,4 +45,21 @@ + + + repository.springframework.maven.release + Spring Framework Maven Release Repository + http://maven.springframework.org/release + + + repository.springframework.maven.milestone + Spring Framework Maven Milestone Repository + http://maven.springframework.org/milestone + + + repository.springframework.maven.snapshot + Spring Framework Maven Snapshot Repository + http://maven.springframework.org/snapshot + + \ No newline at end of file