added a working feed adapter that also maintains state using the metadata persister mechanism. INT-786

This commit is contained in:
Josh Long
2010-10-03 19:14:19 -07:00
parent d3a083ecdb
commit 75093c93b3
20 changed files with 1173 additions and 441 deletions

894
pom.xml
View File

@@ -1,429 +1,469 @@
<?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</groupId>
<artifactId>spring-integration</artifactId>
<name>Spring Integration</name>
<version>2.0.0.BUILD-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>spring-integration-parent</module>
<module>spring-integration-core</module>
<module>spring-integration-event</module>
<module>spring-integration-file</module>
<module>spring-integration-groovy</module>
<module>spring-integration-http</module>
<module>spring-integration-httpinvoker</module>
<module>spring-integration-ip</module>
<module>spring-integration-jdbc</module>
<module>spring-integration-jms</module>
<module>spring-integration-jmx</module>
<module>spring-integration-mail</module>
<module>spring-integration-rmi</module>
<module>spring-integration-security</module>
<module>spring-integration-stream</module>
<module>spring-integration-test</module>
<module>spring-integration-ws</module>
<module>spring-integration-xml</module>
<module>spring-integration-xmpp</module>
<module>spring-integration-ftp</module>
<module>spring-integration-sftp</module>
<module>spring-integration-twitter</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- dist.* properties are used by the antrun tasks below -->
<dist.id>spring-integration</dist.id>
<dist.name>Spring Integration</dist.name>
<dist.key>INT</dist.key>
<dist.version>${project.version}</dist.version>
<dist.finalName>${dist.id}-${dist.version}</dist.finalName>
<dist.fileName>${dist.finalName}.zip</dist.fileName>
<dist.filePath>target/${dist.fileName}</dist.filePath>
<dist.bucketName>dist.springframework.org</dist.bucketName>
<!-- these properties should be in ~/.m2/settings.xml
<dist.accessKey>s3 access key</dist.accessKey>
<dist.secretKey>s3 secret key</dist.secretKey>
-->
</properties>
<profiles>
<profile>
<id>snapshot</id>
<properties>
<dist.releaseType>snapshot</dist.releaseType>
</properties>
<distributionManagement>
<snapshotRepository>
<id>spring-snapshot</id>
<name>Spring Snapshot Repository</name>
<url>s3://maven.springframework.org/snapshot</url>
</snapshotRepository>
</distributionManagement>
</profile>
<profile>
<id>milestone</id>
<properties>
<dist.releaseType>milestone</dist.releaseType>
</properties>
<distributionManagement>
<repository>
<id>spring-milestone</id>
<name>Spring Milestone Repository</name>
<url>s3://maven.springframework.org/milestone</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>upload-dist</id>
<phase>deploy</phase>
<configuration>
<tasks>
<ant antfile="${basedir}/src/ant/upload-dist.xml">
<target name="upload-dist" />
</ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.springframework.build</groupId>
<artifactId>org.springframework.build.aws.ant</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>net.java.dev.jets3t</groupId>
<artifactId>jets3t</artifactId>
<version>0.7.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<properties>
<dist.releaseType>release</dist.releaseType>
</properties>
<distributionManagement>
<repository>
<id>spring-release</id>
<url>file://${java.io.tmpdir}/spring-integration-repo</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>upload-dist</id>
<phase>deploy</phase>
<configuration>
<tasks>
<ant antfile="${basedir}/src/ant/upload-dist.xml">
<target name="upload-dist" />
</ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.springframework.build</groupId>
<artifactId>org.springframework.build.aws.ant</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>net.java.dev.jets3t</groupId>
<artifactId>jets3t</artifactId>
<version>0.7.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>staging</id>
<distributionManagement>
<site>
<id>spring-site-staging</id>
<url>file:///${java.io.tmpdir}/spring-integration/docs/${project.version}</url>
</site>
<repository>
<id>spring-milestone-staging</id>
<url>file:///${java.io.tmpdir}/spring-integration/milestone</url>
</repository>
<snapshotRepository>
<id>spring-snapshot-staging</id>
<url>file:///${java.io.tmpdir}/spring-integration/snapshot</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
<distributionManagement>
<!-- see 'staging' profile for dry-run deployment settings -->
<!-- see 'snapshot', 'milestone' and 'release' profiles for respective repository settings -->
<downloadUrl>http://static.springframework.org/spring-integration/site/downloads/releases.html</downloadUrl>
<site>
<id>static.springframework.org</id>
<url>scp://cbeams@static.springframework.org/var/www/domains/springframework.org/static/htdocs/spring-integration/sites/${project.version}</url>
</site>
</distributionManagement>
<build>
<extensions>
<extension>
<!-- available only in the springframework maven repository. see <repositories> section below -->
<groupId>org.springframework.build.aws</groupId>
<artifactId>org.springframework.build.aws.maven</artifactId>
<version>3.0.0.RELEASE</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>com.agilejava.docbkx</groupId>
<artifactId>docbkx-maven-plugin</artifactId>
<version>2.0.6</version>
<executions>
<execution>
<goals>
<goal>generate-html</goal>
<goal>generate-pdf</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.docbook</groupId>
<artifactId>docbook-xml</artifactId>
<version>4.4</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<configuration>
<includes>index.xml</includes>
<xincludeSupported>true</xincludeSupported>
<foCustomization>${project.basedir}/src/docbkx/resources/xsl/fopdf.xsl</foCustomization>
<!-- original spring-build fopdf xsl
<foCustomization>src/docbkx/resources/xsl/pdf/fopdf.xsl</foCustomization> -->
<htmlStylesheet>css/html.css</htmlStylesheet>
<!-- produce single-page html output -->
<chunkedOutput>false</chunkedOutput>
<htmlCustomization>${project.basedir}/src/docbkx/resources/xsl/html.xsl</htmlCustomization>
<!-- produce multi-page html output
<chunkedOutput>false</chunkedOutput>
<htmlCustomization>${project.basedir}/src/docbkx/resources/xsl/html_chunk.xsl</htmlCustomization> -->
<entities>
<entity>
<name>version</name>
<value>${pom.version}</value>
</entity>
</entities>
<postProcess>
<copy todir="${project.basedir}/target/site/reference">
<fileset dir="${project.basedir}/target/docbkx">
<include name="**/*.html" />
<include name="**/*.pdf" />
</fileset>
</copy>
<copy todir="${project.basedir}/target/site/reference/html">
<fileset dir="${project.basedir}/src/docbkx/resources">
<include name="**/*.css" />
<include name="**/*.png" />
<include name="**/*.gif" />
<include name="**/*.jpg" />
</fileset>
</copy>
<move file="${project.basedir}/target/site/reference/pdf/index.pdf"
tofile="${project.basedir}/target/site/reference/pdf/spring-integration-reference.pdf"
failonerror="false" />
</postProcess>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>aggregate</id>
<goals>
<goal>aggregate</goal>
</goals>
<phase>package</phase>
<configuration>
<aggregate>true</aggregate>
<breakiterator>true</breakiterator>
<header>Spring Integration</header>
<source>1.5</source>
<quiet>true</quiet>
<javadocDirectory>${project.basedir}/src/main/javadoc</javadocDirectory>
<overview>${project.basedir}/src/main/javadoc/overview.html</overview>
<stylesheetfile>${project.basedir}/src/main/javadoc/spring-javadoc.css</stylesheetfile>
<!-- copies doc-files subdirectory which contains image resources -->
<docfilessubdirs>true</docfilessubdirs>
<groups>
<group>
<title>Spring Integration Core</title>
<packages>org.springframework.integration:org.springframework.integration.*</packages>
</group>
<group>
<title>Spring Integration Event Support</title>
<packages>org.springframework.integration.event:org.springframework.integration.event.*</packages>
</group>
<group>
<title>Spring Integration File Support</title>
<packages>org.springframework.integration.file:org.springframework.integration.file.*</packages>
</group>
<group>
<title>Spring Integration FTP Support</title>
<packages>org.springframework.integration.ftp:org.springframework.integration.ftp.*</packages>
</group>
<group>
<title>Spring Integration Groovy Support</title>
<packages>org.springframework.integration.groovy:org.springframework.integration.groovy.*</packages>
</group>
<group>
<title>Spring Integration HTTP Support</title>
<packages>org.springframework.integration.http:org.springframework.integration.http.*</packages>
</group>
<group>
<title>Spring Integration HttpInvoker Support</title>
<packages>org.springframework.integration.httpinvoker:org.springframework.integration.httpinvoker.*</packages>
</group>
<group>
<title>Spring Integration JDBC Support</title>
<packages>org.springframework.integration.jdbc:org.springframework.integration.jdbc.*</packages>
</group>
<group>
<title>Spring Integration JMS Support</title>
<packages>org.springframework.integration.jms:org.springframework.integration.jms.*</packages>
</group>
<group>
<title>Spring Integration JMX Support</title>
<packages>org.springframework.integration.control:org.springframework.integration.jmx:org.springframework.integration.jmx.*</packages>
</group>
<group>
<title>Spring Integration Mail Support</title>
<packages>org.springframework.integration.mail:org.springframework.integration.mail.*</packages>
</group>
<group>
<title>Spring Integration RMI Support</title>
<packages>org.springframework.integration.rmi:org.springframework.integration.rmi.*</packages>
</group>
<group>
<title>Spring Integration Web Services Support</title>
<packages>org.springframework.integration.ws:org.springframework.integration.ws.*</packages>
</group>
<group>
<title>Spring Integration Security Support</title>
<packages>org.springframework.integration.security:org.springframework.integration.security.*</packages>
</group>
<group>
<title>Spring Integration SFTP Support</title>
<packages>org.springframework.integration.sftp:org.springframework.integration.sftp.*</packages>
</group>
<group>
<title>Spring Integration Stream Support</title>
<packages>org.springframework.integration.stream:org.springframework.integration.stream.*</packages>
</group>
<group>
<title>Spring Integration TCP/UDP Support</title>
<packages>org.springframework.integration.ip:org.springframework.integration.ip.*</packages>
</group>
<group>
<title>Spring Integration Test Support</title>
<packages>org.springframework.integration.test:org.springframework.integration.test.*</packages>
</group>
<group>
<title>Spring Integration Twitter Support</title>
<packages>org.springframework.integration.twitter:org.springframework.integration.twitter.*</packages>
</group>
<group>
<title>Spring Integration XML Support</title>
<packages>org.springframework.integration.xml:org.springframework.integration.xml.*</packages>
</group>
<group>
<title>Spring Integration XMPP Support</title>
<packages>org.springframework.integration.xmpp:org.springframework.integration.xmpp.*</packages>
</group>
</groups>
<links>
<link>http://static.springframework.org/spring/docs/3.0.3.RELEASE/javadoc-api</link>
<link>http://static.springsource.org/spring-integration/sites/${project.version}/apidocs</link>
<link>http://java.sun.com/javase/6/docs/api</link>
</links>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!--
run `mvn package assembly:assembly` to trigger assembly creation.
see http://www.sonatype.com/books/mvnref-book/reference/assemblies-set-dist-assemblies.html
-->
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<inherited>false</inherited>
<executions>
<execution>
<id>distribution</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>${project.basedir}/src/assembly/distribution.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!--
depend explicitly on 2.0 in order to pick up the new
release:update-versions goal
-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>repository.springframework.maven.release</id>
<name>Spring Framework Maven Release Repository</name>
<url>http://maven.springframework.org/release</url>
</repository>
<repository>
<id>repository.springframework.maven.milestone</id>
<name>Spring Framework Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
</repository>
<repository>
<!-- necessary for org.springframework.build.aws.maven dependency -->
<id>repository.source.maven.release</id>
<name>SpringSource Maven Release Repository</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
</repositories>
<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</groupId>
<artifactId>spring-integration</artifactId>
<name>Spring Integration</name>
<version>2.0.0.BUILD-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>spring-integration-parent</module>
<module>spring-integration-core</module>
<module>spring-integration-event</module>
<module>spring-integration-file</module>
<module>spring-integration-feed</module>
<module>spring-integration-groovy</module>
<module>spring-integration-http</module>
<module>spring-integration-httpinvoker</module>
<module>spring-integration-ip</module>
<module>spring-integration-jdbc</module>
<module>spring-integration-jms</module>
<module>spring-integration-jmx</module>
<module>spring-integration-mail</module>
<module>spring-integration-rmi</module>
<module>spring-integration-security</module>
<module>spring-integration-stream</module>
<module>spring-integration-test</module>
<module>spring-integration-ws</module>
<module>spring-integration-xml</module>
<module>spring-integration-xmpp</module>
<module>spring-integration-ftp</module>
<module>spring-integration-sftp</module>
<module>spring-integration-twitter</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- dist.* properties are used by the antrun tasks below -->
<dist.id>spring-integration</dist.id>
<dist.name>Spring Integration</dist.name>
<dist.key>INT</dist.key>
<dist.version>${project.version}</dist.version>
<dist.finalName>${dist.id}-${dist.version}</dist.finalName>
<dist.fileName>${dist.finalName}.zip</dist.fileName>
<dist.filePath>target/${dist.fileName}</dist.filePath>
<dist.bucketName>dist.springframework.org</dist.bucketName>
<!-- these properties should be in ~/.m2/settings.xml
<dist.accessKey>s3 access key</dist.accessKey>
<dist.secretKey>s3 secret key</dist.secretKey>
-->
</properties>
<profiles>
<profile>
<id>snapshot</id>
<properties>
<dist.releaseType>snapshot</dist.releaseType>
</properties>
<distributionManagement>
<snapshotRepository>
<id>spring-snapshot</id>
<name>Spring Snapshot Repository</name>
<url>s3://maven.springframework.org/snapshot</url>
</snapshotRepository>
</distributionManagement>
</profile>
<profile>
<id>milestone</id>
<properties>
<dist.releaseType>milestone</dist.releaseType>
</properties>
<distributionManagement>
<repository>
<id>spring-milestone</id>
<name>Spring Milestone Repository</name>
<url>s3://maven.springframework.org/milestone</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>upload-dist</id>
<phase>deploy</phase>
<configuration>
<tasks>
<ant antfile="${basedir}/src/ant/upload-dist.xml">
<target name="upload-dist"/>
</ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.springframework.build</groupId>
<artifactId>org.springframework.build.aws.ant</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>net.java.dev.jets3t</groupId>
<artifactId>jets3t</artifactId>
<version>0.7.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<properties>
<dist.releaseType>release</dist.releaseType>
</properties>
<distributionManagement>
<repository>
<id>spring-release</id>
<url>file://${java.io.tmpdir}/spring-integration-repo</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>upload-dist</id>
<phase>deploy</phase>
<configuration>
<tasks>
<ant antfile="${basedir}/src/ant/upload-dist.xml">
<target name="upload-dist"/>
</ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.springframework.build</groupId>
<artifactId>org.springframework.build.aws.ant</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>net.java.dev.jets3t</groupId>
<artifactId>jets3t</artifactId>
<version>0.7.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>staging</id>
<distributionManagement>
<site>
<id>spring-site-staging</id>
<url>file:///${java.io.tmpdir}/spring-integration/docs/${project.version}</url>
</site>
<repository>
<id>spring-milestone-staging</id>
<url>file:///${java.io.tmpdir}/spring-integration/milestone</url>
</repository>
<snapshotRepository>
<id>spring-snapshot-staging</id>
<url>file:///${java.io.tmpdir}/spring-integration/snapshot</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
<distributionManagement>
<!-- see 'staging' profile for dry-run deployment settings -->
<!-- see 'snapshot', 'milestone' and 'release' profiles for respective repository settings -->
<downloadUrl>http://static.springframework.org/spring-integration/site/downloads/releases.html</downloadUrl>
<site>
<id>static.springframework.org</id>
<url>
scp://cbeams@static.springframework.org/var/www/domains/springframework.org/static/htdocs/spring-integration/sites/${project.version}
</url>
</site>
</distributionManagement>
<build>
<extensions>
<extension>
<!-- available only in the springframework maven repository. see <repositories> section below -->
<groupId>org.springframework.build.aws</groupId>
<artifactId>org.springframework.build.aws.maven</artifactId>
<version>3.0.0.RELEASE</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>com.agilejava.docbkx</groupId>
<artifactId>docbkx-maven-plugin</artifactId>
<version>2.0.6</version>
<executions>
<execution>
<goals>
<goal>generate-html</goal>
<goal>generate-pdf</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.docbook</groupId>
<artifactId>docbook-xml</artifactId>
<version>4.4</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<configuration>
<includes>index.xml</includes>
<xincludeSupported>true</xincludeSupported>
<foCustomization>${project.basedir}/src/docbkx/resources/xsl/fopdf.xsl</foCustomization>
<!-- original spring-build fopdf xsl
<foCustomization>src/docbkx/resources/xsl/pdf/fopdf.xsl</foCustomization> -->
<htmlStylesheet>css/html.css</htmlStylesheet>
<!-- produce single-page html output -->
<chunkedOutput>false</chunkedOutput>
<htmlCustomization>${project.basedir}/src/docbkx/resources/xsl/html.xsl</htmlCustomization>
<!-- produce multi-page html output
<chunkedOutput>false</chunkedOutput>
<htmlCustomization>${project.basedir}/src/docbkx/resources/xsl/html_chunk.xsl</htmlCustomization> -->
<entities>
<entity>
<name>version</name>
<value>${pom.version}</value>
</entity>
</entities>
<postProcess>
<copy todir="${project.basedir}/target/site/reference">
<fileset dir="${project.basedir}/target/docbkx">
<include name="**/*.html"/>
<include name="**/*.pdf"/>
</fileset>
</copy>
<copy todir="${project.basedir}/target/site/reference/html">
<fileset dir="${project.basedir}/src/docbkx/resources">
<include name="**/*.css"/>
<include name="**/*.png"/>
<include name="**/*.gif"/>
<include name="**/*.jpg"/>
</fileset>
</copy>
<move file="${project.basedir}/target/site/reference/pdf/index.pdf"
tofile="${project.basedir}/target/site/reference/pdf/spring-integration-reference.pdf"
failonerror="false"/>
</postProcess>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>aggregate</id>
<goals>
<goal>aggregate</goal>
</goals>
<phase>package</phase>
<configuration>
<aggregate>true</aggregate>
<breakiterator>true</breakiterator>
<header>Spring Integration</header>
<source>1.5</source>
<quiet>true</quiet>
<javadocDirectory>${project.basedir}/src/main/javadoc</javadocDirectory>
<overview>${project.basedir}/src/main/javadoc/overview.html</overview>
<stylesheetfile>${project.basedir}/src/main/javadoc/spring-javadoc.css</stylesheetfile>
<!-- copies doc-files subdirectory which contains image resources -->
<docfilessubdirs>true</docfilessubdirs>
<groups>
<group>
<title>Spring Integration Core</title>
<packages>org.springframework.integration:org.springframework.integration.*
</packages>
</group>
<group>
<title>Spring Integration Event Support</title>
<packages>
org.springframework.integration.event:org.springframework.integration.event.*
</packages>
</group>
<group>
<title>Spring Integration File Support</title>
<packages>
org.springframework.integration.file:org.springframework.integration.file.*
</packages>
</group>
<group>
<title>Spring Integration FTP Support</title>
<packages>org.springframework.integration.ftp:org.springframework.integration.ftp.*
</packages>
</group>
<group>
<title>Spring Integration Groovy Support</title>
<packages>
org.springframework.integration.groovy:org.springframework.integration.groovy.*
</packages>
</group>
<group>
<title>Spring Integration HTTP Support</title>
<packages>
org.springframework.integration.http:org.springframework.integration.http.*
</packages>
</group>
<group>
<title>Spring Integration HttpInvoker Support</title>
<packages>
org.springframework.integration.httpinvoker:org.springframework.integration.httpinvoker.*
</packages>
</group>
<group>
<title>Spring Integration JDBC Support</title>
<packages>
org.springframework.integration.jdbc:org.springframework.integration.jdbc.*
</packages>
</group>
<group>
<title>Spring Integration JMS Support</title>
<packages>org.springframework.integration.jms:org.springframework.integration.jms.*
</packages>
</group>
<group>
<title>Spring Integration JMX Support</title>
<packages>
org.springframework.integration.control:org.springframework.integration.jmx:org.springframework.integration.jmx.*
</packages>
</group>
<group>
<title>Spring Integration Mail Support</title>
<packages>
org.springframework.integration.mail:org.springframework.integration.mail.*
</packages>
</group>
<group>
<title>Spring Integration RMI Support</title>
<packages>org.springframework.integration.rmi:org.springframework.integration.rmi.*
</packages>
</group>
<group>
<title>Spring Integration Web Services Support</title>
<packages>org.springframework.integration.ws:org.springframework.integration.ws.*
</packages>
</group>
<group>
<title>Spring Integration Security Support</title>
<packages>
org.springframework.integration.security:org.springframework.integration.security.*
</packages>
</group>
<group>
<title>Spring Integration SFTP Support</title>
<packages>
org.springframework.integration.sftp:org.springframework.integration.sftp.*
</packages>
</group>
<group>
<title>Spring Integration Stream Support</title>
<packages>
org.springframework.integration.stream:org.springframework.integration.stream.*
</packages>
</group>
<group>
<title>Spring Integration TCP/UDP Support</title>
<packages>org.springframework.integration.ip:org.springframework.integration.ip.*
</packages>
</group>
<group>
<title>Spring Integration Test Support</title>
<packages>
org.springframework.integration.test:org.springframework.integration.test.*
</packages>
</group>
<group>
<title>Spring Integration Twitter Support</title>
<packages>
org.springframework.integration.twitter:org.springframework.integration.twitter.*
</packages>
</group>
<group>
<title>Spring Integration XML Support</title>
<packages>org.springframework.integration.xml:org.springframework.integration.xml.*
</packages>
</group>
<group>
<title>Spring Integration XMPP Support</title>
<packages>
org.springframework.integration.xmpp:org.springframework.integration.xmpp.*
</packages>
</group>
</groups>
<links>
<link>http://static.springframework.org/spring/docs/3.0.3.RELEASE/javadoc-api</link>
<link>http://static.springsource.org/spring-integration/sites/${project.version}/apidocs
</link>
<link>http://java.sun.com/javase/6/docs/api</link>
</links>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!--
run `mvn package assembly:assembly` to trigger assembly creation.
see http://www.sonatype.com/books/mvnref-book/reference/assemblies-set-dist-assemblies.html
-->
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<inherited>false</inherited>
<executions>
<execution>
<id>distribution</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>${project.basedir}/src/assembly/distribution.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!--
depend explicitly on 2.0 in order to pick up the new
release:update-versions goal
-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>repository.springframework.maven.release</id>
<name>Spring Framework Maven Release Repository</name>
<url>http://maven.springframework.org/release</url>
</repository>
<repository>
<id>repository.springframework.maven.milestone</id>
<name>Spring Framework Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
</repository>
<repository>
<!-- necessary for org.springframework.build.aws.maven dependency -->
<id>repository.source.maven.release</id>
<name>SpringSource Maven Release Repository</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
</repositories>
</project>

View File

@@ -125,6 +125,7 @@ public abstract class IntegrationObjectSupport implements BeanNameAware, NamedCo
}
if (this.metadataPersister == null) {
PropertiesBasedMetadataPersister mp = new PropertiesBasedMetadataPersister();
try {
mp.afterPropertiesSet();
}

View File

@@ -16,12 +16,6 @@ import java.util.concurrent.Executor;
* Implementation of {@link org.springframework.integration.context.metadata.MetadataPersister} that knows how to write metadata
* to a {@link java.util.Properties} instance.
*
*
*
* TODO could this perhaps participate or at least be aware of our transaction synchronization mechanism? IE: no guarantees, but we at least try to write on commit()s?
*
*
*
* @author Josh Long
*/
public class PropertiesBasedMetadataPersister implements MetadataPersister<String>, InitializingBean {
@@ -87,10 +81,6 @@ public class PropertiesBasedMetadataPersister implements MetadataPersister<Strin
private File buildFileFromUniqueName() {
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
if ((this.uniqueName == null) || this.uniqueName.trim().equals("")) {
this.uniqueName = UUID.randomUUID().toString();
}
String un = this.uniqueName + ".properties";
return new File(tmpDir, un);
@@ -137,7 +127,7 @@ public class PropertiesBasedMetadataPersister implements MetadataPersister<Strin
try {
fileOutputStream = new FileOutputStream (cachedLocationOfPropertiesFile);
pro.store(fileOutputStream, (this.uniqueName == null) ? "" : this.uniqueName);
pro.store(fileOutputStream, this.uniqueName);
} finally {
if (fileOutputStream != null) {
fileOutputStream.close();
@@ -158,6 +148,12 @@ public class PropertiesBasedMetadataPersister implements MetadataPersister<Strin
public void afterPropertiesSet() throws Exception {
synchronized (this.monitor) {
if ((this.uniqueName == null) || this.uniqueName.trim().equals("")) {
this.uniqueName = UUID.randomUUID().toString();
}
if ((this.locationOfPropertiesOnDisk == null) && (this.uniqueName == null)) {
throw new RuntimeException("you must either specify a property file Resource or a uniqueName that can be used in generated a path that will be input into creating a Resource");
}

View File

@@ -0,0 +1,68 @@
<?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>
<parent>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-parent</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<relativePath>../spring-integration-parent/pom.xml</relativePath>
</parent>
<artifactId>spring-integration-feed</artifactId>
<name>Spring Integration Feed Support</name>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId><artifactId>commons-lang</artifactId><version>2.5</version>
</dependency>
<dependency>
<groupId>net.java.dev.rome</groupId>
<artifactId>rome-fetcher</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>net.java.dev.rome</groupId>
<artifactId>rome</artifactId>
<version>1.0.0</version>
</dependency>
<!-- test-scoped dependencies -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-test</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,25 @@
/*
* Copyright 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.feed;
/**
* Provides a place to store the header keys for {@link FeedReaderMessageSource}
*
* @author Josh Long
*/
public class FeedConstants {
static public final String FEED_URL = "FEED_URL";
}

View File

@@ -0,0 +1,167 @@
package org.springframework.integration.feed;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import org.springframework.context.Lifecycle;
import org.springframework.integration.Message;
import org.springframework.integration.context.IntegrationObjectSupport;
import org.springframework.integration.context.metadata.MetadataPersister;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.util.Assert;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
/**
* this is a slightly different use case than {@link org.springframework.integration.feed.FeedReaderMessageSource}.
* This returns which entries are added, which is a more nuanced use case requiring some of our own caching.
* <em>NB:</em> this does <strong>not</strong> somehow detect entry removal from a feed.
*
* @author Josh Long
* @author Mario Gray
*/
public class FeedEntryReaderMessageSource extends IntegrationObjectSupport implements MessageSource<SyndEntry>, Lifecycle {
private volatile ConcurrentLinkedQueue<SyndEntry> entries;
private volatile MetadataPersister persister;
private volatile FeedReaderMessageSource feedReaderMessageSource;
private final Object monitor = new Object();
private String feedMetadataIdKey;
private String feedUrl;
private volatile boolean running;
public boolean isRunning() {
return running;
}
public void setRunning(boolean running) {
this.running = running;
}
// private Queue<SyndEntry> entries;
private volatile long lastTime = -1;
public FeedEntryReaderMessageSource() {
// this.entries = new ConcurrentSkipListSet<SyndEntry>(new MyComparator());
this.entries = new ConcurrentLinkedQueue<SyndEntry>();
}
public void start() {
this.feedReaderMessageSource.start();
this.setRunning(true);
}
private long sortId(SyndEntry entry) {
return entry.getPublishedDate().getTime();
}
@Override
protected void onInit() throws Exception {
this.persister = this.getRequiredMetadataPersister();
Assert.notNull(this.feedUrl, "the feedUrl can't be null");
this.feedReaderMessageSource = new FeedReaderMessageSource();
this.feedReaderMessageSource.setFeedUrl(this.feedUrl);
this.feedReaderMessageSource.setBeanFactory(this.getBeanFactory());
this.feedReaderMessageSource.setBeanName(this.getComponentName());
this.feedReaderMessageSource.afterPropertiesSet();
// setup persistence of metadata
this.feedMetadataIdKey = FeedEntryReaderMessageSource.class.getName() + "#" + feedUrl;
String lastTime = (String) this.persister.read(this.feedMetadataIdKey);
if (lastTime != null && !lastTime.trim().equalsIgnoreCase("")) {
this.lastTime = Long.parseLong(lastTime);
}
}
public void stop() {
this.feedReaderMessageSource.stop();
this.setRunning(false);
}
public Message<SyndEntry> receive() {
SyndEntry se = receiveSyndEntry();
if (se == null) {
return null;
}
return MessageBuilder.withPayload(se).build();
}
int longToCompare(long l) {
if (l < -1) return -1;
if (l > 1) return 1;
return 0;
}
private Comparator<SyndEntry> syndEntryComparator = new Comparator<SyndEntry>() {
public int compare(SyndEntry syndEntry, SyndEntry syndEntry1) {
long x = sortId(syndEntry) - sortId(syndEntry1);
return longToCompare(x);
}
};
@SuppressWarnings("unchecked")
public SyndEntry receiveSyndEntry() {
synchronized (this.monitor) { // priority goes to the backlog
SyndEntry nextUp = pollAndCache();
if (nextUp != null) {
return nextUp;
}
// otherwise, fill the backlog up
SyndFeed syndFeed = this.feedReaderMessageSource.receiveSyndFeed();
if (syndFeed != null) {
List<SyndEntry> feedEntries = (List<SyndEntry>) syndFeed.getEntries();
if (null != feedEntries) {
Collections.sort(feedEntries, syndEntryComparator);
for (SyndEntry se : feedEntries) {
System.out.println("se: " + se.getPublishedDate().getTime());
long sort = this.sortId(se);
if (sort > this.lastTime)
entries.add(se);
}
}
}
return pollAndCache();
}
}
private SyndEntry pollAndCache() {
SyndEntry next = this.entries.poll();
if (null == next) return null;
this.lastTime = sortId(next);
this.persister.write(this.feedMetadataIdKey, this.lastTime + "");
return next;
}
public String getFeedUrl() {
return feedUrl;
}
public void setFeedUrl(final String feedUrl) {
this.feedUrl = feedUrl;
}
class MyComparator implements Comparator<SyndEntry> {
public int compare(final SyndEntry syndEntry, final SyndEntry syndEntry1) {
long val = sortId(syndEntry) - sortId(syndEntry1);
if (val > 0) return 1;
if (val < 0) return -1;
return 0;
}
}
}

View File

@@ -0,0 +1,163 @@
package org.springframework.integration.feed;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.fetcher.FetcherEvent;
import com.sun.syndication.fetcher.FetcherListener;
import com.sun.syndication.fetcher.impl.FeedFetcherCache;
import com.sun.syndication.fetcher.impl.HashMapFeedInfoCache;
import com.sun.syndication.fetcher.impl.HttpURLFeedFetcher;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.Lifecycle;
import org.springframework.integration.Message;
import org.springframework.integration.context.IntegrationObjectSupport;
import org.springframework.integration.context.metadata.MetadataPersister;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.util.Assert;
import java.net.URL;
import java.util.concurrent.ConcurrentLinkedQueue;
/**
* The idea behind this class is that {@link org.springframework.integration.core.MessageSource#receive()} will only
* return a {@link SyndFeed} when the event listener tells us that a feed has been updated. If we can ascertain that
* it's been updated, then we can add the item to the {@link java.util.Queue} implementation.
*
* @author Josh Long
* @author Mario Gray
*/
public class FeedReaderMessageSource extends IntegrationObjectSupport
implements InitializingBean, Lifecycle, MessageSource<SyndFeed> {
private volatile boolean running;
private volatile String feedUrl;
private volatile URL feedURLObject;
private volatile FeedFetcherCache fetcherCache;
private volatile HttpURLFeedFetcher fetcher;
private volatile ConcurrentLinkedQueue<SyndFeed> syndFeeds;
private volatile MyFetcherListener myFetcherListener;
public FeedReaderMessageSource() {
syndFeeds = new ConcurrentLinkedQueue<SyndFeed>();
}
private volatile MetadataPersister persister;
@Override
protected void onInit() throws Exception {
this.persister = this.getRequiredMetadataPersister();
myFetcherListener = new MyFetcherListener();
fetcherCache = HashMapFeedInfoCache.getInstance();
fetcher = new HttpURLFeedFetcher(fetcherCache);
// fetcher.set
fetcher.addFetcherEventListener(myFetcherListener);
Assert.notNull(this.feedUrl, "the feedURL can't be null");
feedURLObject = new URL(this.feedUrl);
/*
String id = FeedReaderMessageSource.class.getName() + "#" + feedUrl;
StringBuffer stringBuffer = new StringBuffer();
for (char c : id.toCharArray())
if (Character.isDigit(c) || Character.isLetter(c))
stringBuffer.append(c);
id = stringBuffer.toString();
this.feedMetadataIdKey = id;
long lastTimeNo = -1;
String lastTime = (String) this.persister.read(this.feedMetadataIdKey);
if (lastTime != null && !lastTime.trim().equalsIgnoreCase("")) {
lastTimeNo = Long.parseLong(lastTime);
this.lastTime = lastTimeNo;
}*/
}
private volatile long lastTime = -1;
public void start() {
this.running = true;
}
public void stop() {
this.running = false;
}
private String feedMetadataIdKey;
private final Object syndFeedMonitor = new Object();
public SyndFeed receiveSyndFeed() {
SyndFeed returnedSyndFeed = null;
try {
synchronized (syndFeedMonitor) {
fetcher.retrieveFeed(this.feedURLObject);
logger.debug("attempted to retrieve feed '" + this.feedUrl + "'");
returnedSyndFeed = syndFeeds.poll(); // there wont be things whose pub date is < than the lastTime
if (null == returnedSyndFeed) {
logger.debug("no feeds updated, return null!");
return null;
}
// so its OK to update the lastTime
//
/* this.lastTime = sortId(returnedSyndFeed);if (null != this.persister)
this.persister.write(this.feedMetadataIdKey, this.lastTime + "");
*/
}
} catch (Throwable e) {
logger.debug("Exception thrown when trying to retrive feed at url '" + this.feedURLObject + "'", e);
}
return returnedSyndFeed;
}
public Message<SyndFeed> receive() {
SyndFeed syndFeed = this.receiveSyndFeed();
if (null == syndFeed) {
return null;
}
return MessageBuilder.withPayload(syndFeed).setHeader(FeedConstants.FEED_URL, this.feedURLObject).build();
}
public boolean isRunning() {
return this.running;
}
public String getFeedUrl() {
return feedUrl;
}
public void setFeedUrl(final String feedUrl) {
this.feedUrl = feedUrl;
}
class MyFetcherListener implements FetcherListener {
/**
* @see com.sun.syndication.fetcher.FetcherListener#fetcherEvent(com.sun.syndication.fetcher.FetcherEvent)
*/
public void fetcherEvent(final FetcherEvent event) {
String eventType = event.getEventType();
if (FetcherEvent.EVENT_TYPE_FEED_POLLED.equals(eventType)) {
logger.debug("\tEVENT: Feed Polled. URL = " + event.getUrlString());
} else if (FetcherEvent.EVENT_TYPE_FEED_RETRIEVED.equals(eventType)) {
logger.debug("\tEVENT: Feed Retrieved. URL = " + event.getUrlString());
// if (sortId(event.getFeed()) > lastTime) // its true if the lastTime is -1 || N
syndFeeds.add(event.getFeed());
} else if (FetcherEvent.EVENT_TYPE_FEED_UNCHANGED.equals(eventType)) {
logger.debug("\tEVENT: Feed Unchanged. URL = " + event.getUrlString());
}
}
}
}

View File

@@ -0,0 +1,43 @@
package org.springframework.integration.feed.config;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.config.xml.AbstractPollingInboundChannelAdapterParser;
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
import org.springframework.integration.feed.FeedEntryReaderMessageSource;
import org.springframework.integration.feed.FeedReaderMessageSource;
import org.w3c.dom.Element;
/**
* Handles parsing the configuration for the feed inbound channel adapter.
*
* @author Josh Long
*/
public class FeedMessageSourceBeanDefinitionParser extends AbstractPollingInboundChannelAdapterParser {
private String packageName = FeedReaderMessageSource.class.getPackage().getName();
@Override
protected String parseSource(final Element element, final ParserContext parserContext) {
String pftoe = (element.getAttribute("prefer-updated-feed-to-entries"));
pftoe = pftoe == null ? "false" : pftoe.trim().toLowerCase();
boolean preferFeed = pftoe.equalsIgnoreCase(Boolean.TRUE.toString().toLowerCase());
String className = this.packageName + "." + (preferFeed ?
FeedReaderMessageSource.class.getSimpleName() :
FeedEntryReaderMessageSource.class.getSimpleName()
);
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(className);
builder.addPropertyValue("feedUrl", element.getAttribute("feed"));
if (!preferFeed) {
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "backlog-cache-size", "maximumBacklogCacheSize");
}
return BeanDefinitionReaderUtils.registerWithGeneratedName(builder.getBeanDefinition(), parserContext.getRegistry());
}
}

View File

@@ -0,0 +1,40 @@
package org.springframework.integration.feed.config;
/*
* Copyright 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.
*/
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
/**
* This is a rather tricky one. I've decided it's best to not get cute about it and to expose *one*
* <em>inbound-channel-adapter</em>. The adapter will let the user pick which type of updated object they'd like to
* return. By default it'll return new {@link com.sun.syndication.feed.synd.SyndEntry} objects (which represent
* individual, new entries in a given feed). One adapter will return updated {@link
* com.sun.syndication.feed.synd.SyndFeed} objects, or it can return updated {@link
* com.sun.syndication.feed.synd.SyndEntry} objects.
*
* @author Josh Long
*/
public class FeedNamespaceHandler extends NamespaceHandlerSupport {
public void init() {
registerBeanDefinitionParser("inbound-channel-adapter", new FeedMessageSourceBeanDefinitionParser());
}
}

View File

@@ -0,0 +1 @@
http\://www.springframework.org/schema/integration/feed=org.springframework.integration.feed.config.FeedNamespaceHandler

View File

@@ -0,0 +1,2 @@
http\://www.springframework.org/schema/integration/feed/spring-integration-feed-2.0.xsd=org/springframework/integration/feed/config/spring-integration-feed-2.0.xsd
http\://www.springframework.org/schema/integration/feed/spring-integration-feed.xsd=org/springframework/integration/feed/config/spring-integration-feed-2.0.xsd

View File

@@ -0,0 +1,4 @@
# Tooling related information for the integration feed namespace
http\://www.springframework.org/schema/integration/feed@name=integration feed Namespace
http\://www.springframework.org/schema/integration/feed@prefix=int-feed
http\://www.springframework.org/schema/integration/feed@icon=org/springframework/integration/feed/config/spring-integration-feed.gif

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.springframework.org/schema/integration/feed"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:tool="http://www.springframework.org/schema/tool"
xmlns:integration="http://www.springframework.org/schema/integration"
targetNamespace="http://www.springframework.org/schema/integration/feed"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:import namespace="http://www.springframework.org/schema/beans"/>
<xsd:import namespace="http://www.springframework.org/schema/integration"
schemaLocation="http://www.springframework.org/schema/integration/spring-integration-2.0.xsd"/>
<xsd:element name="inbound-channel-adapter">
<xsd:annotation>
<xsd:documentation><![CDATA[
This adapter takes a feed URL (either RSS or ATOM) and responds to updates.
Depending on whether you've set the prefer-updated-feeds-to-entries attribute
or not, you will recieve <code>SyndFeed</code> or <code>SyndEntry</code> objects.
]]></xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="channel" use="required" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="backlog-cache-size" type="xsd:int"/>
<xsd:attribute name="feed" type="xsd:string" use="required"/>
<!--
<xsd:attribute name="prefer-updated-feed-to-entries" type="xsd:boolean"/>
-->
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -0,0 +1,36 @@
package org.springframework.integration.feed;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
public class TestFeedEventDelivery {
@Test
public void testDeliveryOfFeed() throws Exception {
Thread.sleep(1000 * 60);
}
/* public static void main(String[] args) throws Throwable {
String siweb = "http://twitter.com/statuses/public_timeline.atom"; //http://localhost:8080/siweb/foo.atom";
FeedEntryReaderMessageSource feedEntryReaderMessageSource = new FeedEntryReaderMessageSource();
feedEntryReaderMessageSource.setFeedUrl(siweb);
feedEntryReaderMessageSource.afterPropertiesSet();
feedEntryReaderMessageSource.start();
while (true) {
Message<SyndEntry> entryMessage = feedEntryReaderMessageSource.receive();
if (entryMessage != null) {
SyndEntry entry = entryMessage.getPayload();
System.out.println((entry.getTitle() + "=" + entry.getUri()));
}
Thread.sleep(1000);
}
}
*/
}

View File

@@ -0,0 +1,25 @@
package org.springframework.integration.feed;
import com.sun.syndication.feed.synd.SyndEntry;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.springframework.integration.Message;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.stereotype.Component;
@Component
public class FeedDeliveryEventServiceActivator {
@ServiceActivator
public void activate(Message<SyndEntry> evtMsg) throws Exception {
SyndEntry syndEntry = evtMsg.getPayload();
System.out.println( "Publishing new SyndEntry " + syndEntry.getUri() +":"+
syndEntry.getPublishedDate().toString()+ ":"+ syndEntry.getPublishedDate().getTime());
// System.out.println( syndEntry.toString());
// System.out.println("Delivery! " + ToStringBuilder.reflectionToString(evtMsg));
}
}

View File

@@ -0,0 +1,36 @@
<?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:feed="http://www.springframework.org/schema/integration/feed"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:context="http://www.springframework.org/schema/context"
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/integration/feed http://www.springframework.org/schema/integration/feed/spring-integration-feed.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="activator" class="org.springframework.integration.feed.FeedDeliveryEventServiceActivator"/>
<!--
this will keep state in /tmp/feedDemo.properties and not deliver anything until the feed has an updated pub date
to see the feed again, rm /tmp/feedDemo.properties
-->
<bean id="metadataPersister" class="org.springframework.integration.context.metadata.PropertiesBasedMetadataPersister">
<property name="uniqueName" value="feedDemo"/>
</bean>
<!--http://twitter.com/statuses/public_timeline.atom
-->
<feed:inbound-channel-adapter channel="feedChanges" feed="http://feeds.bbci.co.uk/news/rss.xml" >
<int:poller fixed-rate="10000"/>
</feed:inbound-channel-adapter>
<int:channel id="feedChanges"/>
<int:service-activator input-channel="feedChanges" ref="activator" />
</beans>

View File

@@ -0,0 +1,17 @@
Bundle-SymbolicName: org.springframework.integration.ftp
Bundle-Name: Spring Integration SFTP Support
Bundle-Vendor: SpringSource
Bundle-ManifestVersion: 2
Import-Template:
org.apache.commons.logging;version="[1.1.1, 2.0.0)",
org.apache.commons.lang.*;version="[2.5.0, 3.0.0)",
org.apache.commons.net.*;version="[2.0.0, 3.0.0)",
org.springframework.integration.*;version="[2.0.0, 2.0.1)",
org.springframework.scheduling.*;version="[3.0.3, 4.0.0)",
org.springframework.beans.*;version="[3.0.3, 4.0.0)",
org.springframework.context;version="[3.0.3, 4.0.0)",
org.springframework.core.*;version="[3.0.3, 4.0.0)",
org.springframework.util;version="[3.0.3, 4.0.0)",
org.jivesoftware.*;version="[3.1.0, 4.0.0)",
javax.*;version="0",
org.w3c.dom.*;version="0"

View File

@@ -7,7 +7,6 @@
<version>2.0.0.BUILD-SNAPSHOT</version>
<relativePath>../spring-integration-parent/pom.xml</relativePath>
</parent>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-file</artifactId>
<name>Spring Integration File Support</name>
<packaging>jar</packaging>
@@ -20,6 +19,10 @@
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
</dependency>
<!-- test-scoped dependencies -->
<dependency>
<groupId>cglib</groupId>
@@ -43,11 +46,12 @@
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-test</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -136,7 +136,17 @@
<artifactId>spring-aspects</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<!-- <dependency>
<groupId>rome</groupId>
<artifactId>rome</artifactId>
</dependency>
<dependency>
<groupId>rome</groupId>
<artifactId>rome-fetcher</artifactId>
<version></version>
</dependency>
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework.version}</version>