diff --git a/basic/feed/.classpath b/basic/feed/.classpath new file mode 100644 index 00000000..caf88e10 --- /dev/null +++ b/basic/feed/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/basic/feed/.gitignore b/basic/feed/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/basic/feed/.gitignore @@ -0,0 +1 @@ +/target diff --git a/basic/feed/.project b/basic/feed/.project new file mode 100644 index 00000000..944a8349 --- /dev/null +++ b/basic/feed/.project @@ -0,0 +1,23 @@ + + + feed + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/basic/feed/.settings/com.springsource.sts.config.flow.prefs b/basic/feed/.settings/com.springsource.sts.config.flow.prefs new file mode 100644 index 00000000..cb923c95 --- /dev/null +++ b/basic/feed/.settings/com.springsource.sts.config.flow.prefs @@ -0,0 +1,3 @@ +#Thu Nov 18 11:26:44 EST 2010 +//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/feed/src/test/resources/META-INF/spring/integration/FeedInboundChannelAdapterSample-context.xml=\n\n\n\n\n\n +eclipse.preferences.version=1 diff --git a/basic/feed/.settings/org.eclipse.jdt.core.prefs b/basic/feed/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..4b36b986 --- /dev/null +++ b/basic/feed/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,13 @@ +#Thu Nov 18 11:17:08 EST 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/basic/feed/.settings/org.maven.ide.eclipse.prefs b/basic/feed/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 00000000..547f6c78 --- /dev/null +++ b/basic/feed/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Thu Nov 18 11:16:31 EST 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/basic/feed/pom.xml b/basic/feed/pom.xml new file mode 100644 index 00000000..48299f8e --- /dev/null +++ b/basic/feed/pom.xml @@ -0,0 +1,63 @@ + + 4.0.0 + org.springframework.integration.samples + feed + 2.0.0 + Feed Demo (RSS/ATOM) + jar + + 2.0.0.BUILD-SNAPSHOT + 1.2.16 + 4.7 + + + + org.springframework.integration + spring-integration-feed + ${spring.integration.version} + + + 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/basic/feed/readme.txt b/basic/feed/readme.txt new file mode 100644 index 00000000..d27a4cab --- /dev/null +++ b/basic/feed/readme.txt @@ -0,0 +1,21 @@ +This example demonstrates the following aspects of the FEED (RSS/ATOM) support available with Spring Integration: +1. FEED Inbound Channel Adapter (receives news feeds) + + + #### INBOUND CHANNEL ADAPTER #### + +To run INBOUND CHANNEL ADAPTER sample execute FeedInboundChannelAdapterSample test and you'll receive the feed entries for the +given URL. Feel free to plug in your own URL +The output should look similar to this: +===== +Thu Nov 18 01:28:54 EST 2010 - Rangel awaits House sanctions +Thu Nov 18 05:43:11 EST 2010 - Tweet lands woman in China labor camp +Thu Nov 18 06:13:24 EST 2010 - Bird flu is back in Hong Kong +Thu Nov 18 07:09:17 EST 2010 - Computer worm called 'game changer' +Thu Nov 18 08:00:11 EST 2010 - Murkowski declares victory in Alaska +Thu Nov 18 08:50:04 EST 2010 - Family awaits hanging verdict for mom +Thu Nov 18 09:14:20 EST 2010 - Suspect bag on Germany-bound plane +Thu Nov 18 09:47:15 EST 2010 - Zakaria: How serious is this deficit? +Thu Nov 18 09:51:15 EST 2010 - Two former Madoff employees arrested +Thu Nov 18 11:15:22 EST 2010 - WikiLeaks founder wanted in rape case +===== diff --git a/basic/feed/src/test/java/org/springframework/integration/samples/feed/FeedInboundChannelAdapterSample.java b/basic/feed/src/test/java/org/springframework/integration/samples/feed/FeedInboundChannelAdapterSample.java new file mode 100644 index 00000000..0fc024ce --- /dev/null +++ b/basic/feed/src/test/java/org/springframework/integration/samples/feed/FeedInboundChannelAdapterSample.java @@ -0,0 +1,50 @@ +/* + * Copyright 2002-2010 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.feed; + +import org.junit.Test; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.integration.Message; +import org.springframework.integration.core.PollableChannel; + +import com.sun.syndication.feed.synd.SyndEntry; + +/** + * @author Oleg Zhurakousky + * + */ +public class FeedInboundChannelAdapterSample { + + @SuppressWarnings("unchecked") + @Test + public void runDemo(){ + ApplicationContext ac = + new ClassPathXmlApplicationContext("META-INF/spring/integration/FeedInboundChannelAdapterSample-context.xml"); + PollableChannel feedChannel = ac.getBean("feedChannel", PollableChannel.class); + for (int i = 0; i < 10; i++) { + Message message = (Message) feedChannel.receive(1000); + if (message != null){ + SyndEntry entry = message.getPayload(); + System.out.println(entry.getPublishedDate() + " - " + entry.getTitle()); + } + else { + break; + } + } + } +} diff --git a/basic/feed/src/test/resources/META-INF/spring/integration/FeedInboundChannelAdapterSample-context.xml b/basic/feed/src/test/resources/META-INF/spring/integration/FeedInboundChannelAdapterSample-context.xml new file mode 100644 index 00000000..e4fd33a5 --- /dev/null +++ b/basic/feed/src/test/resources/META-INF/spring/integration/FeedInboundChannelAdapterSample-context.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/basic/feed/src/test/resources/log4j.properties b/basic/feed/src/test/resources/log4j.properties new file mode 100644 index 00000000..d0b3fb0d --- /dev/null +++ b/basic/feed/src/test/resources/log4j.properties @@ -0,0 +1,8 @@ +log4j.rootCategory=WARN, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L - %m%n + +log4j.category.org.springframework=WARN +log4j.category.org.springframework.integration=INFO