initial import
This commit is contained in:
21
.classpath
Normal file
21
.classpath
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
|
||||
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||
<attributes>
|
||||
<attribute name="owner.project.facets" value="java"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
38
.project
Normal file
38
.project
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>spring-integration-flow</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>spring-integration-core</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
30
.settings/com.springsource.sts.config.flow.prefs
Normal file
30
.settings/com.springsource.sts.config.flow.prefs
Normal file
@@ -0,0 +1,30 @@
|
||||
#Thu Jun 30 08:13:21 EDT 2011
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/cic-subflows/src/test/resources/FlowConfigTest-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1409" endstart\="1409" start\="1379" startend\="1409"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1484" endstart\="1470" start\="1417" startend\="1447"/>\n<bounds height\="124" width\="124" x\="19" y\="161"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/cic-subflows/src/test/resources/META-INF/spring/subflows/test-subflow-1-config.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="HeaderEnricherModelElement" type\="header-enricher">\n<structure end\="618" endstart\="596" start\="491" startend\="542"/>\n<bounds height\="124" width\="124" x\="163" y\="17"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="618" endstart\="596" start\="491" startend\="542"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/cic-subflows/src/test/resources/META-INF/spring/subflows/test-subflow-2-config.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="HeaderEnricherModelElement" type\="header-enricher">\n<structure end\="614" endstart\="592" start\="487" startend\="538"/>\n<bounds height\="124" width\="124" x\="163" y\="17"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="614" endstart\="592" start\="487" startend\="538"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/cic-subflows/src/test/resources/META-INF/spring/subflows/test-subflow-3-config.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="HeaderEnricherModelElement" type\="header-enricher">\n<structure end\="615" endstart\="593" start\="488" startend\="539"/>\n<bounds height\="124" width\="124" x\="163" y\="17"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="615" endstart\="593" start\="488" startend\="539"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/cic-subflows/src/test/resources/SubFlow1-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="HeaderEnricherModelElement" type\="header-enricher">\n<structure end\="1173" endstart\="1151" start\="1026" startend\="1109"/>\n<bounds height\="124" width\="124" x\="163" y\="17"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1211" endstart\="1211" start\="1177" startend\="1211"/>\n<bounds height\="124" width\="124" x\="307" y\="17"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="1173" endstart\="1151" start\="1026" startend\="1109"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/cic-subflows/src/test/resources/SubFlowConfigTest-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1431" endstart\="1431" start\="1406" startend\="1431"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1510" endstart\="1496" start\="1448" startend\="1473"/>\n<bounds height\="124" width\="124" x\="19" y\="161"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/cic-subflows/src/test/resources/SubFlowTest-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChainModelElement" type\="chain">\n<structure end\="892" endstart\="880" start\="489" startend\="546"/>\n<bounds height\="124" width\="124" x\="163" y\="159"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="961" endstart\="947" start\="900" startend\="925"/>\n<bounds height\="124" width\="124" x\="307" y\="207"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="892" endstart\="880" start\="489" startend\="546"/>\n<bounds height\="124" width\="124" x\="19" y\="159"/>\n</element>\n<element clazz\="ChainContainerElement" type\="chain">\n<structure end\="892" endstart\="880" start\="489" startend\="546"/>\n<bounds height\="178" width\="423" x\="307" y\="15"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-cic/src/test/resources/META-INF/spring/subflows/test-subflow-config.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="519" endstart\="519" start\="486" startend\="519"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-cic/src/test/resources/NamespaceTest-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChainModelElement" type\="chain">\n<structure end\="660" endstart\="648" start\="481" startend\="533"/>\n<bounds height\="124" width\="124" x\="163" y\="159"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="687" endstart\="687" start\="664" startend\="687"/>\n<bounds height\="124" width\="124" x\="307" y\="207"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="660" endstart\="648" start\="481" startend\="533"/>\n<bounds height\="124" width\="124" x\="19" y\="159"/>\n</element>\n<element clazz\="ChainContainerElement" type\="chain">\n<structure end\="660" endstart\="648" start\="481" startend\="533"/>\n<bounds height\="178" width\="279" x\="307" y\="15"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-cic/src/test/resources/SubFlow1-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="HeaderEnricherModelElement" type\="header-enricher">\n<structure end\="609" endstart\="587" start\="484" startend\="535"/>\n<bounds height\="124" width\="124" x\="163" y\="17"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="609" endstart\="587" start\="484" startend\="535"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-cic/src/test/resources/SubFlow2-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="HeaderEnricherModelElement" type\="header-enricher">\n<structure end\="609" endstart\="587" start\="484" startend\="535"/>\n<bounds height\="124" width\="124" x\="163" y\="17"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="609" endstart\="587" start\="484" startend\="535"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-cic/src/test/resources/SubFlowTest-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChainModelElement" type\="chain">\n<structure end\="717" endstart\="705" start\="483" startend\="540"/>\n<bounds height\="124" width\="124" x\="163" y\="159"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="786" endstart\="772" start\="725" startend\="750"/>\n<bounds height\="124" width\="124" x\="307" y\="207"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="717" endstart\="705" start\="483" startend\="540"/>\n<bounds height\="124" width\="124" x\="19" y\="159"/>\n</element>\n<element clazz\="ChainContainerElement" type\="chain">\n<structure end\="717" endstart\="705" start\="483" startend\="540"/>\n<bounds height\="178" width\="423" x\="307" y\="15"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/FlowClientNamespace2Test-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1028" endstart\="1014" start\="971" startend\="997"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/FlowClientNamespaceTest-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChainModelElement" type\="chain">\n<structure end\="1126" endstart\="1114" start\="953" startend\="1029"/>\n<bounds height\="124" width\="124" x\="163" y\="86"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1201" endstart\="1187" start\="1136" startend\="1169"/>\n<bounds height\="124" width\="124" x\="19" y\="207"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1272" endstart\="1258" start\="1206" startend\="1240"/>\n<bounds height\="124" width\="124" x\="307" y\="207"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="1126" endstart\="1114" start\="953" startend\="1029"/>\n<bounds height\="124" width\="124" x\="19" y\="63"/>\n</element>\n<element clazz\="ChainContainerElement" type\="chain">\n<structure end\="1126" endstart\="1114" start\="953" startend\="1029"/>\n<bounds height\="178" width\="279" x\="307" y\="15"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/FlowConfigTest-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1399" endstart\="1399" start\="1369" startend\="1399"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1474" endstart\="1460" start\="1407" startend\="1437"/>\n<bounds height\="124" width\="124" x\="19" y\="161"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/FlowWithErrorTest-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1237" endstart\="1223" start\="1180" startend\="1206"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1299" endstart\="1285" start\="1241" startend\="1268"/>\n<bounds height\="124" width\="124" x\="19" y\="161"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/FlowWithMissingReferencesTest-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph/>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/FlowWithReferencedBeanTest-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1277" endstart\="1263" start\="1220" startend\="1246"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/FlowWithReferencesTest-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1305" endstart\="1291" start\="1248" startend\="1274"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/META-INF/spring/integration/flows/subflow1-bean-config.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="2511" endstart\="2511" start\="2478" startend\="2511"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="2550" endstart\="2550" start\="2516" startend\="2550"/>\n<bounds height\="124" width\="124" x\="19" y\="161"/>\n</element>\n<element clazz\="HeaderEnricherModelElement" type\="header-enricher">\n<structure end\="2703" endstart\="2681" start\="2554" startend\="2639"/>\n<bounds height\="124" width\="124" x\="163" y\="17"/>\n</element>\n<element clazz\="HeaderEnricherModelElement" type\="header-enricher">\n<structure end\="2864" endstart\="2842" start\="2707" startend\="2794"/>\n<bounds height\="124" width\="124" x\="163" y\="161"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="2902" endstart\="2902" start\="2867" startend\="2902"/>\n<bounds height\="124" width\="124" x\="307" y\="17"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="2940" endstart\="2940" start\="2904" startend\="2940"/>\n<bounds height\="124" width\="124" x\="307" y\="161"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/META-INF/spring/integration/flows/subflow1-context-new.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="HeaderEnricherModelElement" type\="header-enricher">\n<structure end\="1168" endstart\="1146" start\="1021" startend\="1104"/>\n<bounds height\="124" width\="124" x\="163" y\="17"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1206" endstart\="1206" start\="1172" startend\="1206"/>\n<bounds height\="124" width\="124" x\="307" y\="17"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="1168" endstart\="1146" start\="1021" startend\="1104"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/META-INF/spring/integration/flows/subflow1-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1469" endstart\="1469" start\="1435" startend\="1469"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n<element clazz\="HeaderEnricherModelElement" type\="header-enricher">\n<structure end\="1628" endstart\="1606" start\="1473" startend\="1558"/>\n<bounds height\="124" width\="124" x\="163" y\="17"/>\n</element>\n<element clazz\="RouterModelElement" type\="router">\n<structure end\="1706" endstart\="1706" start\="1631" startend\="1706"/>\n<bounds height\="124" width\="124" x\="451" y\="17"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1742" endstart\="1742" start\="1709" startend\="1742"/>\n<bounds height\="124" width\="124" x\="19" y\="161"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1777" endstart\="1777" start\="1744" startend\="1777"/>\n<bounds height\="124" width\="124" x\="19" y\="305"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="1706" endstart\="1706" start\="1631" startend\="1706"/>\n<bounds height\="124" width\="124" x\="307" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/META-INF/spring/integration/flows/subflow2-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1535" endstart\="1535" start\="1500" startend\="1535"/>\n<bounds height\="124" width\="124" x\="307" y\="17"/>\n</element>\n<element clazz\="HeaderEnricherModelElement" type\="header-enricher">\n<structure end\="1832" endstart\="1810" start\="1538" startend\="1623"/>\n<bounds height\="124" width\="124" x\="163" y\="17"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="1832" endstart\="1810" start\="1538" startend\="1623"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/META-INF/spring/integration/flows/subflow3-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="2095" endstart\="2095" start\="2060" startend\="2095"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/META-INF/spring/integration/flows/subflow4-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ServiceActivatorModelElement" type\="service-activator">\n<structure end\="1778" endstart\="1754" start\="1568" startend\="1672"/>\n<bounds height\="124" width\="124" x\="163" y\="17"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1818" endstart\="1818" start\="1784" startend\="1818"/>\n<bounds height\="124" width\="124" x\="307" y\="17"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="1778" endstart\="1754" start\="1568" startend\="1672"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/META-INF/spring/integration/flows/subflow5-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ServiceActivatorModelElement" type\="service-activator">\n<structure end\="1856" endstart\="1856" start\="1746" startend\="1856"/>\n<bounds height\="124" width\="124" x\="163" y\="17"/>\n</element>\n<element clazz\="GatewayModelElement" type\="gateway">\n<structure end\="1991" endstart\="1991" start\="1859" startend\="1991"/>\n<bounds height\="124" width\="124" x\="19" y\="161"/>\n</element>\n<element clazz\="ServiceActivatorModelElement" type\="service-activator">\n<structure end\="2177" endstart\="2153" start\="1996" startend\="2071"/>\n<bounds height\="124" width\="124" x\="307" y\="17"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="2220" endstart\="2220" start\="2186" startend\="2220"/>\n<bounds height\="124" width\="124" x\="307" y\="161"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="1856" endstart\="1856" start\="1746" startend\="1856"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n<element clazz\="ImplicitChannelModelElement" type\="channel">\n<structure end\="2177" endstart\="2153" start\="1996" startend\="2071"/>\n<bounds height\="124" width\="124" x\="163" y\="161"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/MultiBridgeTest-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="BridgeModelElement" type\="bridge">\n<structure end\="535" endstart\="535" start\="474" startend\="535"/>\n<bounds height\="124" width\="124" x\="163" y\="17"/>\n</element>\n<element clazz\="BridgeModelElement" type\="bridge">\n<structure end\="598" endstart\="598" start\="537" startend\="598"/>\n<bounds height\="124" width\="124" x\="163" y\="161"/>\n</element>\n<element clazz\="BridgeModelElement" type\="bridge">\n<structure end\="661" endstart\="661" start\="600" startend\="661"/>\n<bounds height\="124" width\="124" x\="163" y\="305"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="903" endstart\="889" start\="664" startend\="689"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1146" endstart\="1132" start\="907" startend\="932"/>\n<bounds height\="124" width\="124" x\="19" y\="161"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1389" endstart\="1375" start\="1150" startend\="1175"/>\n<bounds height\="124" width\="124" x\="19" y\="305"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1448" endstart\="1434" start\="1392" startend\="1417"/>\n<bounds height\="124" width\="124" x\="307" y\="161"/>\n</element>\n</graph>
|
||||
//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/integration\:/spring-integration-flow/src/test/resources/NamespaceTest-context.xml=<?xml version\="1.0" encoding\="UTF-8"?>\n<graph>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1113" endstart\="1113" start\="1083" startend\="1113"/>\n<bounds height\="124" width\="124" x\="19" y\="17"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1178" endstart\="1164" start\="1116" startend\="1146"/>\n<bounds height\="124" width\="124" x\="19" y\="161"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1431" endstart\="1431" start\="1397" startend\="1431"/>\n<bounds height\="124" width\="124" x\="19" y\="305"/>\n</element>\n<element clazz\="ChannelModelElement" type\="channel">\n<structure end\="1499" endstart\="1485" start\="1434" startend\="1467"/>\n<bounds height\="124" width\="124" x\="19" y\="449"/>\n</element>\n</graph>
|
||||
eclipse.preferences.version=1
|
||||
77
.settings/org.eclipse.jdt.core.prefs
Normal file
77
.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,77 @@
|
||||
#Wed Jun 29 17:51:26 EDT 2011
|
||||
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.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
7
.settings/org.eclipse.wst.common.component
Normal file
7
.settings/org.eclipse.wst.common.component
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="spring-integration-flow">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
||||
5
.settings/org.eclipse.wst.common.project.facet.core.xml
Normal file
5
.settings/org.eclipse.wst.common.project.facet.core.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<installed facet="jst.utility" version="1.0"/>
|
||||
<installed facet="java" version="1.6"/>
|
||||
</faceted-project>
|
||||
8
.settings/org.maven.ide.eclipse.prefs
Normal file
8
.settings/org.maven.ide.eclipse.prefs
Normal file
@@ -0,0 +1,8 @@
|
||||
#Tue May 24 12:20:41 EDT 2011
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
fullBuildGoals=process-test-resources
|
||||
resolveWorkspaceProjects=true
|
||||
resourceFilterGoals=process-resources resources\:testResources
|
||||
skipCompilerPlugin=true
|
||||
version=1
|
||||
17
.springBeans
Normal file
17
.springBeans
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beansProjectDescription>
|
||||
<version>1</version>
|
||||
<pluginVersion><![CDATA[2.7.0.201106102322-M2]]></pluginVersion>
|
||||
<configSuffixes>
|
||||
<configSuffix><![CDATA[xml]]></configSuffix>
|
||||
</configSuffixes>
|
||||
<enableImports><![CDATA[false]]></enableImports>
|
||||
<configs>
|
||||
<config>src/test/resources/META-INF/spring/integration/flows/subflow1-context.xml</config>
|
||||
<config>src/test/resources/FlowConfigNamespaceTest-context.xml</config>
|
||||
<config>src/test/resources/FlowClientNamespaceTest-context.xml</config>
|
||||
<config>src/test/resources/ref-bean-config.xml</config>
|
||||
</configs>
|
||||
<configSets>
|
||||
</configSets>
|
||||
</beansProjectDescription>
|
||||
44
README
Normal file
44
README
Normal file
@@ -0,0 +1,44 @@
|
||||
Goals
|
||||
---------
|
||||
This component is exploring mechanisms to encapsulate a referenced Spring Integration message flow as a component.
|
||||
A flow is a Spring Integration message flow intended for reuse. A flow is accessed via logical "ports" which map
|
||||
to internal channels.
|
||||
|
||||
A flow may expose multiple inputs and multiple outputs. A port mapping is defined for each input and has multiple
|
||||
outputs associated with it. See src/test/resources/META-INF/spring/integration/flows/subflow1-context.xml, for example.
|
||||
|
||||
Generally, a message flow may behave like a router. For example, a flow may define
|
||||
a primary output and a discard output. Additionally, it may act like a delayer, providing no immediate response. Or it
|
||||
could act as an outbound channel adapter, providing no output.
|
||||
|
||||
The goal is to support these, and possibly other semantics. Additional goals are:
|
||||
- Encapsulation: the flow channels, and component should not be included the consumer application context. The consumer need
|
||||
not know how the flow is configured (i.e, it is contained in a jar).
|
||||
- Configuration: The flow may define optional or required properties to be provided by the consumer. The flow may define optional
|
||||
or required bean definitions provided by the consumer (e.g, a generic XML processor may require an OXM marshaller)
|
||||
- The flow should be self describing, in terms of ports, properties, and beans it exposes
|
||||
- It should be easy to implement or wrap an existing configuration as a flow and provide a better option than simple importing
|
||||
a spring configuration file and sending a message to one of its input channels
|
||||
|
||||
Usage
|
||||
-------
|
||||
The flow consumer instantiates a flow and defines one or more flow outbound gateways for each input port:
|
||||
|
||||
<int-flow:flow id="subflow1"/>
|
||||
|
||||
<int-flow:outbound-gateway flow="subflow1" input-channel="another-input"
|
||||
output-channel="another-output" input-port="gateway-input"/>
|
||||
|
||||
A message sent on the input-channel is delegated to the flow. The message on the output-channel is a response from one of the output
|
||||
ports. The output port name is contained in the response header 'flow.output.port'
|
||||
|
||||
Implementation
|
||||
----------------
|
||||
The flow element creates a Flow instance (eventually, configured with properties, referenced beans, etc.) The flow id is used to derive the flow's
|
||||
spring bean definition file by convention. This bean definition file will be used to create a standalone application context which must provide a
|
||||
FlowConfiguration containing the metadata about the exposed ports, beans, and properties.
|
||||
|
||||
Currently, all exposed outputs are bridged to a PublishSubscribeChannel which acts as a single 'flowOutputChannel'.
|
||||
Each flow outbound gateway instance is backed by a FlowMessageHandler that bridges the 'flow output channel to its own QueueChannel. This is
|
||||
analogous to a JMS topic. Each flow message handler sends the request message to the flow input channel corresponding to the input port and checks
|
||||
its queue for a response. A correlation id is used to match the response to the request.
|
||||
154
pom.xml
Normal file
154
pom.xml
Normal file
@@ -0,0 +1,154 @@
|
||||
<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">
|
||||
<!-- This POM is generated by the maven archetype cic-component-archetype.
|
||||
It includes a comprehensive set of dependencies for developing a CIC component.
|
||||
Please remove any dependencies that you do not need. If you require additional
|
||||
dependencies, the approved version should be inherited from the cic-parent
|
||||
POM. DO NOT DECLARE explicit dependency versions here. -->
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-flow</artifactId>
|
||||
<version>2.0.5.BUILD-SNAPSHOT</version>
|
||||
<name>Spring Integration Flow Support</name>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-test</artifactId>
|
||||
<version>2.0.5.BUILD-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-core</artifactId>
|
||||
<version>2.0.5.BUILD-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-asm</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-expression</artifactId>
|
||||
<version>${spring.framework.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<scope>test</scope>
|
||||
</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>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test-compile</id>
|
||||
<phase>test-compile</phase>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
|
||||
<classpath refid="maven.test.classpath" />
|
||||
</taskdef>
|
||||
<groovyc destdir="${project.build.testOutputDirectory}"
|
||||
srcdir="${basedir}/src/test/java/" listfiles="true">
|
||||
<classpath refid="maven.test.classpath" />
|
||||
</groovyc>
|
||||
</tasks>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF8</project.build.sourceEncoding>
|
||||
<spring.framework.version>3.1.0.M2</spring.framework.version>
|
||||
<maven.test.search.classdir>true</maven.test.search.classdir>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>http://maven.springframework.org/milestone</id>
|
||||
<url>http://maven.springframework.org/milestone</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</project>
|
||||
3
src/main/java/META-INF/MANIFEST.MF
Normal file
3
src/main/java/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.
|
||||
*/
|
||||
/**
|
||||
* @author David Turanski
|
||||
*/
|
||||
package org.springframework.integration.flow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ChannelNamePortConfiguration extends NamedResourceConfiguration implements FlowProviderPortConfiguration {
|
||||
|
||||
private PortMetadata inputPortMetadata;
|
||||
|
||||
public ChannelNamePortConfiguration(PortMetadata inputPortMetadata, List<PortMetadata> outputPortMetadataList) {
|
||||
super(outputPortMetadataList);
|
||||
this.inputPortMetadata = inputPortMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInputPortName() {
|
||||
return this.inputPortMetadata.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInputChannel() {
|
||||
return this.inputPortMetadata.getChannelName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInputPortDescription() {
|
||||
return this.inputPortMetadata.getDescription();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getOutputChannel(String portName) {
|
||||
PortMetadata portMetadata = (PortMetadata) find(portName);
|
||||
if (portMetadata != null) {
|
||||
return portMetadata.getChannelName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getOutputPortNames() {
|
||||
List<String> results = new ArrayList<String>();
|
||||
for (NamedResourceMetadata resourceMetadata : getConfiguredResources()) {
|
||||
PortMetadata portMetadata = (PortMetadata) resourceMetadata;
|
||||
results.add(portMetadata.getName());
|
||||
}
|
||||
/**
|
||||
* consistent with ClientPortConfiguration impl.
|
||||
*/
|
||||
|
||||
if (results.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.integration.flow.FlowProviderPortConfiguration#getOutputPortMetadata()
|
||||
*/
|
||||
@Override
|
||||
public List<NamedResourceMetadata> getOutputPortMetadata() {
|
||||
return Collections.unmodifiableList(super.getConfiguredResources());
|
||||
}
|
||||
}
|
||||
232
src/main/java/org/springframework/integration/flow/Flow.java
Normal file
232
src/main/java/org/springframework/integration/flow/Flow.java
Normal file
@@ -0,0 +1,232 @@
|
||||
package org.springframework.integration.flow;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.core.env.MutablePropertySources;
|
||||
import org.springframework.core.env.PropertiesPropertySource;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.channel.AbstractMessageChannel;
|
||||
import org.springframework.integration.channel.PublishSubscribeChannel;
|
||||
import org.springframework.integration.flow.config.FlowUtils;
|
||||
import org.springframework.integration.flow.interceptor.FlowInterceptor;
|
||||
import org.springframework.integration.support.channel.BeanFactoryChannelResolver;
|
||||
import org.springframework.integration.support.channel.ChannelResolver;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Encapsulates a message flow with inputs and outputs exposed via a message
|
||||
* port
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class Flow implements InitializingBean, BeanNameAware, ChannelResolver, BeanDefinitionRegistryPostProcessor {
|
||||
|
||||
protected Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private volatile ConfigurableApplicationContext flowContext;
|
||||
|
||||
private volatile FlowConfiguration flowConfiguration;
|
||||
|
||||
private volatile String[] configLocations;
|
||||
|
||||
private volatile String[] referencedBeanLocations;
|
||||
|
||||
private volatile Properties flowProperties;
|
||||
|
||||
private volatile String name;
|
||||
|
||||
private volatile ChannelResolver flowChannelResolver;
|
||||
|
||||
private volatile PublishSubscribeChannel flowOutputChannel;
|
||||
|
||||
private volatile boolean help;
|
||||
|
||||
public Flow() {
|
||||
|
||||
}
|
||||
|
||||
public Flow(String[] configLocations) {
|
||||
this.configLocations = configLocations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
|
||||
if (configLocations == null) {
|
||||
configLocations = new String[] { String.format(
|
||||
"classpath*:META-INF/spring/integration/flows/%s-context.xml", this.name) };
|
||||
}
|
||||
|
||||
if (referencedBeanLocations != null) {
|
||||
configLocations = (String[]) ArrayUtils.addAll(configLocations, referencedBeanLocations);
|
||||
}
|
||||
|
||||
logger.debug("instantiating flow context from configLocations ["
|
||||
+ StringUtils.arrayToCommaDelimitedString(configLocations) + "]");
|
||||
|
||||
Assert.notEmpty(configLocations, "configLocations cannot be empty");
|
||||
|
||||
flowContext = new ClassPathXmlApplicationContext(configLocations);
|
||||
|
||||
this.flowConfiguration = flowContext.getBean(FlowConfiguration.class);
|
||||
Assert.notNull(flowConfiguration, "flow context does not contain a flow configuration");
|
||||
|
||||
if (help) {
|
||||
System.out.println(displayFlowConfiguration());
|
||||
}
|
||||
|
||||
validatePortMapping();
|
||||
|
||||
this.flowChannelResolver = new BeanFactoryChannelResolver(flowContext);
|
||||
|
||||
addReferencedProperties();
|
||||
|
||||
}
|
||||
|
||||
public FlowConfiguration getFlowConfiguration() {
|
||||
return this.flowConfiguration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanName(String name) {
|
||||
this.name = name;
|
||||
|
||||
}
|
||||
|
||||
public String getBeanName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setReferencedBeanLocations(String[] referencedBeanLocations) {
|
||||
this.referencedBeanLocations = referencedBeanLocations;
|
||||
}
|
||||
|
||||
public void setProperties(Properties flowProperties) {
|
||||
this.flowProperties = flowProperties;
|
||||
}
|
||||
|
||||
public void setHelp(boolean help) {
|
||||
this.help = help;
|
||||
}
|
||||
|
||||
public PublishSubscribeChannel getFlowOutputChannel() {
|
||||
return flowOutputChannel;
|
||||
}
|
||||
|
||||
public void setFlowOutputChannel(PublishSubscribeChannel flowOutputChannel) {
|
||||
this.flowOutputChannel = flowOutputChannel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageChannel resolveChannelName(String channelName) {
|
||||
return flowChannelResolver.resolveChannelName(channelName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory arg0) throws BeansException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
|
||||
bridgeMessagingPorts(registry);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String displayFlowConfiguration() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("\nFlow configuration for [").append(this.getBeanName()).append("]:\n");
|
||||
sb.append("Port configuration:\n");
|
||||
for (FlowProviderPortConfiguration portConfiguration : this.getFlowConfiguration().getPortConfigurations()) {
|
||||
sb.append("\tinput port:").append(portConfiguration.getInputPortName()).append("\n\n\t")
|
||||
.append(portConfiguration.getInputPortDescription()).append("\n\n").append("\toutput ports:\n");
|
||||
|
||||
for (NamedResourceMetadata metadata : portConfiguration.getOutputPortMetadata()) {
|
||||
sb.append("\t\t").append(metadata.getName()).append("\t")
|
||||
.append(metadata.getDescription()).append("\n");
|
||||
}
|
||||
|
||||
NamedResourceConfiguration referencedBeansConfig = this.getFlowConfiguration()
|
||||
.getReferencedBeansConfiguration();
|
||||
if (referencedBeansConfig != null && !referencedBeansConfig.getConfiguredResources().isEmpty()) {
|
||||
sb.append("\nReferenced beans:\n");
|
||||
for (NamedResourceMetadata metadata : referencedBeansConfig.getConfiguredResources()) {
|
||||
sb.append("\t").append(metadata).append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
NamedResourceConfiguration propertiesConfig = this.getFlowConfiguration().getPropertiesConfiguration();
|
||||
if (propertiesConfig != null && !propertiesConfig.getConfiguredResources().isEmpty()) {
|
||||
sb.append("\nFlow properties:\n");
|
||||
for (NamedResourceMetadata metadata : propertiesConfig.getConfiguredResources()) {
|
||||
sb.append("\t").append(metadata).append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private void addReferencedProperties() {
|
||||
if (flowProperties != null) {
|
||||
|
||||
PropertySource<?> propertySource = new PropertiesPropertySource("flowProperties", flowProperties);
|
||||
NamedResourceConfiguration propertiesConfiguration = this.getFlowConfiguration()
|
||||
.getPropertiesConfiguration();
|
||||
if (propertiesConfiguration != null) {
|
||||
for (NamedResourceMetadata resource : propertiesConfiguration.getRequiredResources()) {
|
||||
Assert.isTrue(propertySource.containsProperty(resource.getName()), "Flow [" + this.name
|
||||
+ "] is missing required property [" + resource.getName() + "]");
|
||||
}
|
||||
}
|
||||
MutablePropertySources propertySources = flowContext.getEnvironment().getPropertySources();
|
||||
propertySources.addLast(propertySource);
|
||||
flowContext.refresh();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void validatePortMapping() {
|
||||
Assert.notEmpty(this.flowConfiguration.getPortConfigurations(),
|
||||
"flow configuration contains no port configurations");
|
||||
}
|
||||
|
||||
private void bridgeMessagingPorts(BeanDefinitionRegistry registry) {
|
||||
|
||||
/*
|
||||
* create a bridge for each target output port to the flow outputChannel
|
||||
*/
|
||||
for (FlowProviderPortConfiguration targetPortConfiguration : this.getFlowConfiguration()
|
||||
.getPortConfigurations()) {
|
||||
for (String outputPort : targetPortConfiguration.getOutputPortNames()) {
|
||||
String targetOutputChannelName = (String) targetPortConfiguration.getOutputChannel(outputPort);
|
||||
AbstractMessageChannel inputChannel = (AbstractMessageChannel) resolveChannelName(targetOutputChannelName);
|
||||
|
||||
inputChannel.addInterceptor(new FlowInterceptor(outputPort));
|
||||
|
||||
logger.debug("creating output bridge on [" + outputPort + "] inputChannelName = ["
|
||||
+ targetOutputChannelName + "] outputChannel = [" + this.flowOutputChannel + "]");
|
||||
FlowUtils.createBridge(inputChannel, this.flowOutputChannel, registry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class FlowConfiguration {
|
||||
|
||||
private final List<FlowProviderPortConfiguration> portConfigurations;
|
||||
|
||||
private volatile NamedResourceConfiguration propertiesConfiguration;
|
||||
|
||||
private volatile NamedResourceConfiguration referencedBeansConfiguration;
|
||||
|
||||
public FlowConfiguration(List<FlowProviderPortConfiguration> portConfigurations) {
|
||||
this.portConfigurations = portConfigurations;
|
||||
}
|
||||
|
||||
public FlowProviderPortConfiguration getConfigurationForInputPort(String inputPortName) {
|
||||
for (FlowProviderPortConfiguration pc : portConfigurations) {
|
||||
if (pc.getInputPortName().equals(inputPortName)) {
|
||||
return pc;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setPropertiesConfiguration(NamedResourceConfiguration propertiesConfiguration) {
|
||||
this.propertiesConfiguration = propertiesConfiguration;
|
||||
}
|
||||
|
||||
public void setReferenceedBeansConfiguration(NamedResourceConfiguration referencedBeansConfiguration) {
|
||||
this.setReferencedBeansConfiguration(referencedBeansConfiguration);
|
||||
}
|
||||
|
||||
public List<FlowProviderPortConfiguration> getPortConfigurations() {
|
||||
return portConfigurations;
|
||||
}
|
||||
|
||||
public NamedResourceConfiguration getPropertiesConfiguration() {
|
||||
return propertiesConfiguration;
|
||||
}
|
||||
|
||||
public void setReferencedBeansConfiguration(NamedResourceConfiguration referencedBeansConfiguration) {
|
||||
this.referencedBeansConfiguration = referencedBeansConfiguration;
|
||||
}
|
||||
|
||||
public NamedResourceConfiguration getReferencedBeansConfiguration() {
|
||||
return referencedBeansConfiguration;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public interface FlowProviderPortConfiguration extends PortConfiguration {
|
||||
public abstract String getInputPortDescription();
|
||||
public abstract List<NamedResourceMetadata> getOutputPortMetadata();
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class NamedResourceConfiguration {
|
||||
private final List<? extends NamedResourceMetadata> resourceMetadata;
|
||||
|
||||
public NamedResourceConfiguration(List<? extends NamedResourceMetadata> resourceMetadata) {
|
||||
this.resourceMetadata = resourceMetadata;
|
||||
}
|
||||
|
||||
public boolean isRequired(String namedResource) {
|
||||
for (NamedResourceMetadata metadata : resourceMetadata) {
|
||||
if (metadata.getName().equals(namedResource)) {
|
||||
return metadata.isRequired();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<NamedResourceMetadata> getConfiguredResources() {
|
||||
return Collections.unmodifiableList(resourceMetadata);
|
||||
}
|
||||
|
||||
public List<NamedResourceMetadata> getRequiredResources() {
|
||||
List<NamedResourceMetadata> requiredResources = new ArrayList<NamedResourceMetadata>();
|
||||
for (NamedResourceMetadata metadata : resourceMetadata) {
|
||||
if (metadata.isRequired()) {
|
||||
requiredResources.add(metadata);
|
||||
}
|
||||
}
|
||||
return requiredResources;
|
||||
}
|
||||
|
||||
public NamedResourceMetadata find(String name) {
|
||||
for (NamedResourceMetadata metadata : resourceMetadata) {
|
||||
if (metadata.getName().equals(name)) {
|
||||
return metadata;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class NamedResourceMetadata {
|
||||
private final String name;
|
||||
|
||||
private final String description;
|
||||
|
||||
private final boolean required;
|
||||
|
||||
public NamedResourceMetadata(String name, String description, boolean required) {
|
||||
Assert.hasText(name, "name is required");
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.required = required;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public boolean isRequired() {
|
||||
return required;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getName()).append("\t")
|
||||
.append(required? "required" : "optional")
|
||||
.append("\t")
|
||||
.append(getDescription());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public interface PortConfiguration {
|
||||
public String getInputPortName();
|
||||
|
||||
public Object getInputChannel();
|
||||
|
||||
public Collection<String> getOutputPortNames();
|
||||
|
||||
public Object getOutputChannel(String portName);
|
||||
// TODO: Do we need error channel?
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class PortMetadata extends NamedResourceMetadata {
|
||||
|
||||
private final String channelName;
|
||||
|
||||
public PortMetadata(String portName, String channelName) {
|
||||
this(portName, "", channelName);
|
||||
}
|
||||
|
||||
public PortMetadata(String portName, String description, String channelName) {
|
||||
super(portName, description, true);
|
||||
this.channelName = channelName;
|
||||
}
|
||||
|
||||
public String getChannelName() {
|
||||
return channelName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.config;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.config.AbstractSimpleMessageHandlerFactoryBean;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.core.PollableChannel;
|
||||
import org.springframework.integration.flow.Flow;
|
||||
import org.springframework.integration.flow.FlowProviderPortConfiguration;
|
||||
import org.springframework.integration.flow.handler.FlowMessageHandler;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class FlowMessageHandlerFactoryBean extends AbstractSimpleMessageHandlerFactoryBean implements
|
||||
InitializingBean, BeanDefinitionRegistryPostProcessor {
|
||||
|
||||
private volatile Flow flow;
|
||||
|
||||
private volatile String inputPortName;
|
||||
|
||||
private volatile long timeout;
|
||||
|
||||
private volatile PollableChannel flowReceiveChannel;
|
||||
|
||||
private volatile FlowProviderPortConfiguration flowConfiguration;
|
||||
|
||||
@Override
|
||||
protected MessageHandler createHandler() {
|
||||
|
||||
MessageChannel flowInputChannel = flow.resolveChannelName((String) flowConfiguration.getInputChannel());
|
||||
|
||||
FlowMessageHandler flowMessageHandler = new FlowMessageHandler(flowInputChannel, flowReceiveChannel, timeout);
|
||||
|
||||
return flowMessageHandler;
|
||||
}
|
||||
|
||||
public void setFlow(Flow flow) {
|
||||
this.flow = flow;
|
||||
}
|
||||
|
||||
public void setInputPortName(String inputPortName) {
|
||||
this.inputPortName = inputPortName;
|
||||
}
|
||||
|
||||
public void setTimeout(long timeout) {
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
public void setFlowOutputChannel(PollableChannel flowOutputChannel) {
|
||||
this.flowReceiveChannel = flowOutputChannel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
|
||||
bridgeMessagingPorts(registry);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void bridgeMessagingPorts(BeanDefinitionRegistry registry) {
|
||||
FlowUtils.createBridge(this.flow.getFlowOutputChannel(), this.flowReceiveChannel, registry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
this.flowConfiguration = null;
|
||||
if (this.inputPortName == null){
|
||||
Assert.isTrue(!(this.flow.getFlowConfiguration().getPortConfigurations().size() > 1),
|
||||
"flow [" + this.flow.getBeanName() +"] exposes multiple port configurations. Must specify an input port");
|
||||
|
||||
this.flowConfiguration = this.flow.getFlowConfiguration().getPortConfigurations().get(0);
|
||||
this.inputPortName = this.flowConfiguration.getInputPortName();
|
||||
}
|
||||
else {
|
||||
this.flowConfiguration = this.flow.getFlowConfiguration().getConfigurationForInputPort(
|
||||
this.inputPortName);
|
||||
}
|
||||
Assert.notEmpty(this.flowConfiguration.getOutputPortNames(), "flow [" + this.flow.getBeanName()
|
||||
+ "] has no configured output ports");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.config;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.config.ConsumerEndpointFactoryBean;
|
||||
import org.springframework.integration.handler.BridgeHandler;
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class FlowUtils {
|
||||
/*
|
||||
* create a bridge
|
||||
*/
|
||||
public static void createBridge(MessageChannel inputChannel, MessageChannel outputChannel,
|
||||
BeanDefinitionRegistry registry) {
|
||||
|
||||
BeanDefinitionBuilder handlerBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(BridgeHandler.class);
|
||||
|
||||
handlerBuilder.addPropertyValue("outputChannel", outputChannel);
|
||||
|
||||
AbstractBeanDefinition handlerBeanDefinition = handlerBuilder.getBeanDefinition();
|
||||
|
||||
BeanDefinitionBuilder consumerEndpointBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(ConsumerEndpointFactoryBean.class);
|
||||
|
||||
String handlerBeanName = registerBeanDefinition(handlerBeanDefinition, registry);
|
||||
consumerEndpointBuilder.addPropertyReference("handler", handlerBeanName);
|
||||
consumerEndpointBuilder.addPropertyValue("inputChannel", inputChannel);
|
||||
registerBeanDefinition(consumerEndpointBuilder.getBeanDefinition(), registry);
|
||||
}
|
||||
|
||||
public static String registerBeanDefinition(BeanDefinition beanDefinition, BeanDefinitionRegistry registry){
|
||||
String beanName = BeanDefinitionReaderUtils.generateBeanName(beanDefinition, registry);
|
||||
beanName = "flow."+ beanName;
|
||||
String strIndex = StringUtils.substringAfter(beanName,"#");
|
||||
int index = Integer.valueOf(strIndex);
|
||||
while (registry.isBeanNameInUse(beanName)){
|
||||
index++;
|
||||
beanName = beanName.replaceAll("#\\d$","#"+ (index));
|
||||
}
|
||||
registry.registerBeanDefinition(beanName, beanDefinition);
|
||||
return beanName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.config.xml;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
|
||||
import org.springframework.beans.factory.support.ManagedList;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.flow.ChannelNamePortConfiguration;
|
||||
import org.springframework.integration.flow.FlowConfiguration;
|
||||
import org.springframework.integration.flow.NamedResourceConfiguration;
|
||||
import org.springframework.integration.flow.NamedResourceMetadata;
|
||||
import org.springframework.integration.flow.PortMetadata;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class FlowConfigurationParser implements BeanDefinitionParser {
|
||||
|
||||
@Override
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
|
||||
List<Element> portMappings = DomUtils.getChildElementsByTagName(element, "port-mapping");
|
||||
List<Element> portMappingRefs = DomUtils.getChildElementsByTagName(element, "port-mapping-ref");
|
||||
|
||||
BeanDefinitionBuilder flowConfigurationBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(FlowConfiguration.class);
|
||||
|
||||
ManagedList<Object> portConfigList = new ManagedList<Object>();
|
||||
|
||||
for (Element el : portMappings) {
|
||||
|
||||
BeanDefinition portConfiguration = buildFlowProviderPortConfiguration(el, parserContext);
|
||||
portConfigList.add(portConfiguration);
|
||||
}
|
||||
|
||||
flowConfigurationBuilder.addConstructorArgValue(portConfigList);
|
||||
|
||||
|
||||
BeanDefinition referencedProperties = this.buildNamedResourceConfiguration(element, "referenced-property");
|
||||
|
||||
flowConfigurationBuilder.addPropertyValue("propertiesConfiguration", referencedProperties);
|
||||
|
||||
BeanDefinition referencedBeans = this.buildNamedResourceConfiguration(element, "referenced-bean");
|
||||
|
||||
flowConfigurationBuilder.addPropertyValue("referencedBeansConfiguration", referencedBeans);
|
||||
|
||||
BeanDefinitionReaderUtils.registerWithGeneratedName(flowConfigurationBuilder.getBeanDefinition(),
|
||||
parserContext.getRegistry());
|
||||
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private BeanDefinition buildFlowProviderPortConfiguration(Element el, ParserContext parserContext) {
|
||||
Element inputPortEl = DomUtils.getChildElementByTagName(el, "input-port");
|
||||
|
||||
BeanDefinitionBuilder portConfigurationBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(ChannelNamePortConfiguration.class);
|
||||
|
||||
BeanDefinition portMetadata = this.buildPortMetadata(el, inputPortEl);
|
||||
|
||||
portConfigurationBuilder.addConstructorArgValue(portMetadata);
|
||||
|
||||
List<Element> outputPortElements = DomUtils.getChildElementsByTagName(el, "output-port");
|
||||
ManagedList<Object> outputList = null;
|
||||
|
||||
if (outputPortElements != null) {
|
||||
|
||||
outputList = new ManagedList<Object>();
|
||||
for (Element outputPortEl : outputPortElements) {
|
||||
portMetadata = this.buildPortMetadata(el, outputPortEl);
|
||||
outputList.add(portMetadata);
|
||||
}
|
||||
}
|
||||
|
||||
portConfigurationBuilder.addConstructorArgValue(outputList);
|
||||
|
||||
return portConfigurationBuilder.getBeanDefinition();
|
||||
}
|
||||
|
||||
private BeanDefinition buildNamedResourceConfiguration(Element parent, String elementName) {
|
||||
ManagedList<Object> namedResourceList = new ManagedList<Object>();
|
||||
List<Element> namedResources = DomUtils.getChildElementsByTagName(parent, elementName);
|
||||
for (Element el : namedResources ) {
|
||||
BeanDefinitionBuilder namedResourceBuilder = BeanDefinitionBuilder.genericBeanDefinition(NamedResourceMetadata.class);
|
||||
boolean required = ("true".equals(el.getAttribute("required")));
|
||||
String name = el.getAttribute("id");
|
||||
String description = getChildElementText(el, "description", "");
|
||||
namedResourceBuilder.addConstructorArgValue(name);
|
||||
namedResourceBuilder.addConstructorArgValue(description);
|
||||
namedResourceBuilder.addConstructorArgValue(required);
|
||||
namedResourceList.add(namedResourceBuilder.getBeanDefinition());
|
||||
}
|
||||
BeanDefinitionBuilder namedResourceConfigurationBuilder = BeanDefinitionBuilder.genericBeanDefinition(NamedResourceConfiguration.class);
|
||||
namedResourceConfigurationBuilder.addConstructorArgValue(namedResourceList);
|
||||
return namedResourceConfigurationBuilder.getBeanDefinition();
|
||||
}
|
||||
|
||||
private String getChildElementText(Element parent, String elementName, String defaultValue ){
|
||||
String value = defaultValue;
|
||||
Element child = DomUtils.getChildElementByTagName(parent, elementName);
|
||||
if (child != null ) {
|
||||
value = child.getTextContent();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private BeanDefinition buildPortMetadata(Element element, Element portElement) {
|
||||
BeanDefinitionBuilder portMetadataBuilder = BeanDefinitionBuilder.genericBeanDefinition(PortMetadata.class);
|
||||
portMetadataBuilder.addConstructorArgValue(portElement.getAttribute("name"));
|
||||
String description = getChildElementText(portElement, "description", "");
|
||||
portMetadataBuilder.addConstructorArgValue(description);
|
||||
portMetadataBuilder.addConstructorArgValue(portElement.getAttribute("channel"));
|
||||
return portMetadataBuilder.getBeanDefinition();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.config.xml;
|
||||
|
||||
import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class FlowNamespaceHandler extends AbstractIntegrationNamespaceHandler {
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
registerBeanDefinitionParser("flow", new FlowParser());
|
||||
registerBeanDefinitionParser("outbound-gateway", new FlowOutboundGatewayParser());
|
||||
registerBeanDefinitionParser("flow-configuration", new FlowConfigurationParser());
|
||||
registerBeanDefinitionParser("port-mapping", new FlowProviderPortConfigurationParser());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.config.xml;
|
||||
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
import org.springframework.integration.config.xml.AbstractConsumerEndpointParser;
|
||||
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.springframework.integration.flow.config.FlowMessageHandlerFactoryBean;
|
||||
import org.springframework.integration.flow.config.FlowUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class FlowOutboundGatewayParser extends AbstractConsumerEndpointParser {
|
||||
|
||||
@Override
|
||||
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) {
|
||||
|
||||
BeanDefinitionBuilder flowHandlerBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(FlowMessageHandlerFactoryBean.class);
|
||||
String flowName = element.getAttribute("flow");
|
||||
flowHandlerBuilder.addPropertyReference("flow", flowName);
|
||||
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(flowHandlerBuilder, element, "input-port","inputPortName");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(flowHandlerBuilder, element, "timeout");
|
||||
|
||||
BeanDefinitionBuilder flowOutputChannelBuilder = BeanDefinitionBuilder.genericBeanDefinition(QueueChannel.class);
|
||||
String flowOutputChannelName =
|
||||
FlowUtils.registerBeanDefinition(flowOutputChannelBuilder.getBeanDefinition(), parserContext.getRegistry());
|
||||
|
||||
flowHandlerBuilder.addPropertyReference("flowOutputChannel", flowOutputChannelName);
|
||||
|
||||
return flowHandlerBuilder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.config.xml;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.integration.channel.PublishSubscribeChannel;
|
||||
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
|
||||
import org.springframework.integration.flow.Flow;
|
||||
import org.springframework.integration.flow.config.FlowUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class FlowParser implements BeanDefinitionParser {
|
||||
|
||||
@Override
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
BeanDefinitionBuilder flowBuilder = BeanDefinitionBuilder.genericBeanDefinition(Flow.class);
|
||||
String id = element.getAttribute("id");
|
||||
BeanDefinitionBuilder flowOutputChannelBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(PublishSubscribeChannel.class);
|
||||
String beanName = FlowUtils.registerBeanDefinition(flowOutputChannelBuilder.getBeanDefinition(),
|
||||
parserContext.getRegistry());
|
||||
flowBuilder.addPropertyReference("flowOutputChannel", beanName);
|
||||
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(flowBuilder, element, "referenced-bean-locations");
|
||||
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(flowBuilder, element, "properties");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(flowBuilder, element, "help");
|
||||
|
||||
BeanDefinition beanDefinition = flowBuilder.getBeanDefinition();
|
||||
parserContext.getRegistry().registerBeanDefinition(id, beanDefinition);
|
||||
|
||||
return beanDefinition;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.config.xml;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class FlowProviderPortConfigurationParser implements BeanDefinitionParser {
|
||||
|
||||
@Override
|
||||
public BeanDefinition parse(Element arg0, ParserContext arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.handler;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.MessagingException;
|
||||
import org.springframework.integration.core.PollableChannel;
|
||||
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
||||
import org.springframework.integration.message.ErrorMessage;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class FlowMessageHandler extends AbstractReplyProducingMessageHandler {
|
||||
|
||||
private static Log log = LogFactory.getLog(FlowMessageHandler.class);
|
||||
|
||||
private final MessageChannel flowInputChannel;
|
||||
|
||||
private final PollableChannel flowOutputChannel;
|
||||
|
||||
private final long timeout;
|
||||
|
||||
public FlowMessageHandler(MessageChannel flowInputChannel, PollableChannel flowOutputChannel, long timeout) {
|
||||
this.flowInputChannel = flowInputChannel;
|
||||
this.flowOutputChannel = flowOutputChannel;
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object handleRequestMessage(Message<?> requestMessage) {
|
||||
|
||||
UUID conversationId = requestMessage.getHeaders().getId();
|
||||
Map<String, Object> flowConversationIdHeader = Collections.singletonMap("flow.conversation.id",
|
||||
(Object) conversationId);
|
||||
|
||||
Message<?> message = MessageBuilder
|
||||
.fromMessage(requestMessage)
|
||||
.copyHeadersIfAbsent(flowConversationIdHeader)
|
||||
|
||||
.build();
|
||||
Message<?> response = null;
|
||||
|
||||
try {
|
||||
|
||||
flowInputChannel.send(message);
|
||||
|
||||
while ((response = flowOutputChannel.receive(timeout)) != null) {
|
||||
if (conversationId.equals(response.getHeaders().get("flow.conversation.id"))) {
|
||||
return response;
|
||||
} else {
|
||||
|
||||
if (response.getPayload() instanceof MessagingException) {
|
||||
MessagingException me = (MessagingException) response.getPayload();
|
||||
log.debug("failed message: " + me.getFailedMessage());
|
||||
if (conversationId.equals(me.getFailedMessage().getHeaders().get("flow.conversation.id"))) {
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (MessagingException me) {
|
||||
log.debug("caught exception - failed message: " + me.getFailedMessage());
|
||||
if (conversationId.equals(me.getFailedMessage().getHeaders().get("flow.conversation.id"))) {
|
||||
return new ErrorMessage(me);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.interceptor;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.channel.interceptor.ChannelInterceptorAdapter;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class FlowInterceptor extends ChannelInterceptorAdapter {
|
||||
private static Log log = LogFactory.getLog(FlowInterceptor.class);
|
||||
|
||||
private final String portName;
|
||||
|
||||
public FlowInterceptor(String portName) {
|
||||
this.portName = portName;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message<?> preSend(Message<?> message, MessageChannel channel) {
|
||||
|
||||
log.debug("flow interceptor " + this.hashCode() + " received a message from port " + portName + " on channel "
|
||||
+ channel);
|
||||
Map<String, Object> headersToCopy = Collections.singletonMap("flow.output.port", (Object) portName);
|
||||
return MessageBuilder.fromMessage(message).copyHeadersIfAbsent(headersToCopy).build();
|
||||
|
||||
}
|
||||
}
|
||||
1
src/main/resources/META-INF/spring.handlers
Normal file
1
src/main/resources/META-INF/spring.handlers
Normal file
@@ -0,0 +1 @@
|
||||
http\://www.springframework.org/schema/integration/flow=org.springframework.integration.flow.config.xml.FlowNamespaceHandler
|
||||
2
src/main/resources/META-INF/spring.schemas
Normal file
2
src/main/resources/META-INF/spring.schemas
Normal file
@@ -0,0 +1,2 @@
|
||||
http\://www.springframework.org/schema/integration/flow/spring-integration-flow-2.0.xsd=org/springframework/integration/flow/config/spring-integration-flow-2.0.xsd
|
||||
http\://www.springframework.org/schema/integration/flow/spring-integration-flow.xsd=org/springframework/integration/flow/config/spring-integration-flow-2.0.xsd
|
||||
4
src/main/resources/META-INF/spring.tooling
Normal file
4
src/main/resources/META-INF/spring.tooling
Normal file
@@ -0,0 +1,4 @@
|
||||
# Tooling related information for the integration flow namespace
|
||||
http\://www.springframework.org/schema/integration/flow@name=integration flow Namespace
|
||||
http\://www.springframework.org/schema/integration/flow@prefix=int-flow
|
||||
http\://www.springframework.org/schema/integration/flow@icon=org/springframework/integration/flow/config/spring-integration-flow.gif
|
||||
@@ -0,0 +1,180 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/integration/flow"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:tool="http://www.springframework.org/schema/tool"
|
||||
targetNamespace="http://www.springframework.org/schema/integration/flow"
|
||||
elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/tool" />
|
||||
|
||||
<xsd:element name="flow">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines an integration flow
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="id" type="xsd:string" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the referenced flow
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="properties" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
An optional reference to a properties object containing optional or required properties provided to configure the flow
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="referenced-bean-locations" type="xsd:string"
|
||||
use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
An optional list of config locations containing optional or required bean definitions referenced by the flow
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="help" type="xsd:boolean"
|
||||
use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Display port configuration discription
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
|
||||
|
||||
<xsd:element name="outbound-gateway">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="input-channel" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="output-channel" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="flow" type="xsd:string" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The name of the referenced flow]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="input-port" type="xsd:string" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
<![CDATA[
|
||||
The name of the input port]]>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="flow-configuration">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines a flow configuration (metadata exposed by the flow provider)
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:choice minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:element name="port-mapping-ref">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="bean" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="port-mapping" type="PortMappingType" />
|
||||
</xsd:choice>
|
||||
<xsd:element name="referenced-bean" minOccurs="0" maxOccurs="unbounded" type="NamedResourceType"/>
|
||||
<xsd:element name="referenced-property" minOccurs="0" maxOccurs="unbounded" type="NamedResourceType"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="port-mapping" type="PortMappingType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines an integration flow port mapping configuraiotn
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:complexType name="BasePortType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines an integration flow port binding
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
<xsd:attribute name="channel" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="FlowPortType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines an integration flow port binding
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="BasePortType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" minOccurs="0"
|
||||
maxOccurs="1" type="xsd:string" />
|
||||
</xsd:sequence>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="FlowOutputPortType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines an integration flow output port binding
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="FlowPortType">
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="PortMappingType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="input-port" minOccurs="1" maxOccurs="1"
|
||||
nillable="false" type="FlowPortType">
|
||||
</xsd:element>
|
||||
<xsd:element name="output-port" minOccurs="0" maxOccurs="unbounded" type="FlowOutputPortType"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="NamedResourceType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="description" type="xsd:string" minOccurs="0"/>
|
||||
</xsd:sequence>
|
||||
|
||||
<xsd:attribute name="required" type="xsd:boolean" default="false">
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="id" use="required" type="xsd:ID">
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
</xsd:schema>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 570 B |
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow
|
||||
import org.junit.Test
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
class NamedResourcesConfigurationTest {
|
||||
def resourceMetadataList = [
|
||||
new NamedResourceMetadata('resource1','describes resource1',true),
|
||||
new NamedResourceMetadata('resource2','describes resource2',false),
|
||||
new NamedResourceMetadata('resource3','describes resource3',true)
|
||||
]
|
||||
|
||||
@Test
|
||||
public void testGetRequired(){
|
||||
def namedResourceConfiguration = new NamedResourceConfiguration(resourceMetadataList);
|
||||
def required = namedResourceConfiguration.getRequiredResources()
|
||||
assert required.size() == 2
|
||||
required.each { assert it.required; assert namedResourceConfiguration.isRequired(it.name) }
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAll(){
|
||||
def namedResourceConfiguration = new NamedResourceConfiguration(resourceMetadataList);
|
||||
assert namedResourceConfiguration.getConfiguredResources().size() == 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.config.xml;
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class ExceptionBean {
|
||||
|
||||
public void exception() {
|
||||
throw new RuntimeException("exception");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.config.xml;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.core.PollableChannel;
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath:/FlowClientNamespaceTest-context.xml")
|
||||
public class FlowClientNamespaceTest {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("another-input")
|
||||
MessageChannel gatewayInput;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("another-output")
|
||||
PollableChannel gatewayOutput;
|
||||
|
||||
|
||||
@Test
|
||||
public void testGateway(){
|
||||
Message<String> msg = new GenericMessage<String>("hello");
|
||||
gatewayInput.send(msg);
|
||||
Message<?> reply = gatewayOutput.receive();
|
||||
assertNotNull(reply);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Qualifier("another-input2")
|
||||
MessageChannel gatewayInput2;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("another-output2")
|
||||
PollableChannel gatewayOutput2;
|
||||
|
||||
|
||||
@Test
|
||||
public void testOutboundGateway(){
|
||||
Message<String> msg1 = new GenericMessage<String>("hello");
|
||||
Message<String> msg2 = new GenericMessage<String>("world");
|
||||
Message<?> reply = null;
|
||||
|
||||
gatewayInput2.send(msg1);
|
||||
reply = gatewayOutput2.receive();
|
||||
assertNotNull(reply);
|
||||
assertEquals("gateway-output",reply.getHeaders().get("flow.output.port"));
|
||||
assertEquals("yeah!",reply.getHeaders().get("gateway"));
|
||||
|
||||
gatewayInput2.send(msg2);
|
||||
reply = gatewayOutput2.receive();
|
||||
assertNotNull(reply);
|
||||
assertEquals("gateway-discard",reply.getHeaders().get("flow.output.port"));
|
||||
assertEquals("yeah!",reply.getHeaders().get("gateway"));
|
||||
|
||||
gatewayInput2.send(msg1);
|
||||
reply = gatewayOutput2.receive();
|
||||
assertNotNull(reply);
|
||||
assertEquals("gateway-output",reply.getHeaders().get("flow.output.port"));
|
||||
assertEquals("yeah!",reply.getHeaders().get("gateway"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.config.xml;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.flow.FlowConfiguration;
|
||||
import org.springframework.integration.flow.FlowProviderPortConfiguration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath:/FlowConfigNamespaceTest-context.xml")
|
||||
public class FlowConfigNamespaceTest {
|
||||
@Autowired
|
||||
FlowConfiguration flowConfiguration;
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
assertNotNull(flowConfiguration.getPortConfigurations());
|
||||
assertEquals(2, flowConfiguration.getPortConfigurations().size());
|
||||
FlowProviderPortConfiguration pc0 = flowConfiguration.getPortConfigurations().get(0);
|
||||
assertEquals("input", pc0.getInputPortName());
|
||||
assertEquals("subflow-input", pc0.getInputChannel());
|
||||
assertEquals("", pc0.getInputPortDescription());
|
||||
assertEquals("subflow-output", pc0.getOutputChannel("output"));
|
||||
assertEquals(1, pc0.getOutputPortNames().size());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.config.xml;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
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.MessagingException;
|
||||
import org.springframework.integration.core.MessageHandler;
|
||||
import org.springframework.integration.core.PollableChannel;
|
||||
import org.springframework.integration.core.SubscribableChannel;
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
|
||||
public class FlowWithErrorTest {
|
||||
|
||||
@Test
|
||||
public void testExceptionThrown(){
|
||||
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/FlowWithErrorTest-context.xml");
|
||||
MessageChannel input = applicationContext.getBean("inputC",MessageChannel.class);
|
||||
PollableChannel output = applicationContext.getBean("outputC",PollableChannel.class);
|
||||
Message<String> msg = new GenericMessage<String>("hello");
|
||||
input.send(msg);
|
||||
|
||||
Message<?> reply = output.receive(100);
|
||||
assertNotNull(reply);
|
||||
assertTrue(reply.getPayload() instanceof MessagingException);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDirectCallWithErrorChannel(){
|
||||
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/META-INF/spring/integration/flows/subflow5-context.xml");
|
||||
MessageChannel input = applicationContext.getBean("subflow-input",MessageChannel.class);
|
||||
SubscribableChannel error = applicationContext.getBean("errorChannel",SubscribableChannel.class);
|
||||
|
||||
error.subscribe(new MessageHandler() {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message<?> message) throws MessagingException {
|
||||
assertTrue( message.getPayload() instanceof MessagingException );
|
||||
System.out.println("got error message");
|
||||
}
|
||||
});
|
||||
|
||||
Message<String> msg = new GenericMessage<String>("hello");
|
||||
assertTrue(input.send(msg));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testWithErrorChannel(){
|
||||
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/FlowWithErrorTest-context.xml");
|
||||
MessageChannel input = applicationContext.getBean("inputC1",MessageChannel.class);
|
||||
PollableChannel output = applicationContext.getBean("outputC1",PollableChannel.class);
|
||||
Message<String> msg = new GenericMessage<String>("hello");
|
||||
input.send(msg);
|
||||
|
||||
Message<?> reply = output.receive(100);
|
||||
assertNotNull(reply);
|
||||
assertTrue(reply.getPayload() instanceof MessagingException);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.config.xml;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
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.core.PollableChannel;
|
||||
import org.springframework.integration.message.GenericMessage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
|
||||
public class FlowWithReferencesTest {
|
||||
|
||||
@Test
|
||||
public void testReferencedBeanConfig(){
|
||||
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/FlowWithReferencesTest-context.xml");
|
||||
MessageChannel input = applicationContext.getBean("inputC",MessageChannel.class);
|
||||
PollableChannel output = applicationContext.getBean("outputC",PollableChannel.class);
|
||||
Message<String> msg = new GenericMessage<String>("hello");
|
||||
input.send(msg);
|
||||
Message<?> reply = output.receive();
|
||||
assertNotNull(reply);
|
||||
assertEquals("it works!",reply.getHeaders().get("refbean.value"));
|
||||
assertEquals("val1",reply.getHeaders().get("property.value.1"));
|
||||
assertEquals("undefined",reply.getHeaders().get("property.value.2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMissingPropertyReference() {
|
||||
try {
|
||||
new ClassPathXmlApplicationContext("classpath:/FlowWithMissingReferencesTest-context.xml");
|
||||
fail("should throw exception");
|
||||
} catch (BeanCreationException e) {
|
||||
if(!("Flow [subflow3] is missing required property [key1]".equals(e.getCause().getMessage() ) ) ) {
|
||||
e.printStackTrace();
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.flow.config.xml;
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class RefBean {
|
||||
private String value;
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
28
src/test/resources/FlowClientNamespaceTest-context.xml
Normal file
28
src/test/resources/FlowClientNamespaceTest-context.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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:int-flow="http://www.springframework.org/schema/integration/flow"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/flow http://www.springframework.org/schema/integration/flow/spring-integration-flow-2.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- Instantiate the flow (folded into its own application context) -->
|
||||
<int-flow:flow id="subflow1" />
|
||||
|
||||
<int-flow:outbound-gateway flow="subflow1" input-channel="another-input"
|
||||
output-channel="another-output" input-port="gateway-input"/>
|
||||
|
||||
<int:chain input-channel="another-input2" output-channel="another-output2">
|
||||
<int-flow:outbound-gateway flow="subflow1" input-port="gateway-input"/>
|
||||
</int:chain>
|
||||
|
||||
<int:channel id="another-output">
|
||||
<int:queue />
|
||||
</int:channel>
|
||||
|
||||
|
||||
<int:channel id="another-output2">
|
||||
<int:queue />
|
||||
</int:channel>
|
||||
|
||||
</beans>
|
||||
37
src/test/resources/FlowConfigNamespaceTest-context.xml
Normal file
37
src/test/resources/FlowConfigNamespaceTest-context.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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-flow="http://www.springframework.org/schema/integration/flow"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration/flow http://www.springframework.org/schema/integration/flow/spring-integration-flow-2.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
<int-flow:flow-configuration>
|
||||
|
||||
|
||||
<int-flow:port-mapping>
|
||||
<int-flow:input-port name="input" channel="subflow-input">
|
||||
<int-flow:description></int-flow:description>
|
||||
</int-flow:input-port>
|
||||
<int-flow:output-port name="output" channel="subflow-output">
|
||||
<int-flow:description></int-flow:description>
|
||||
</int-flow:output-port>
|
||||
</int-flow:port-mapping>
|
||||
|
||||
<int-flow:port-mapping-ref bean="portConfig1" />
|
||||
|
||||
<int-flow:port-mapping>
|
||||
<int-flow:input-port name="input2" channel="subflow-input2">
|
||||
<int-flow:description></int-flow:description>
|
||||
</int-flow:input-port>
|
||||
<int-flow:output-port name="output2" channel="subflow-output2">
|
||||
<int-flow:description></int-flow:description>
|
||||
</int-flow:output-port>
|
||||
</int-flow:port-mapping>
|
||||
|
||||
<int-flow:port-mapping-ref bean="portConfig2" />
|
||||
|
||||
</int-flow:flow-configuration>
|
||||
|
||||
<int-flow:port-mapping>
|
||||
<int-flow:input-port name="input2" channel="subflow-input2" />
|
||||
<int-flow:output-port name="output2" channel="subflow-output2"/>
|
||||
</int-flow:port-mapping>
|
||||
</beans>
|
||||
40
src/test/resources/FlowWithErrorTest-context.xml
Normal file
40
src/test/resources/FlowWithErrorTest-context.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?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:int-flow="http://www.springframework.org/schema/integration/flow"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/flow http://www.springframework.org/schema/integration/flow/spring-integration-flow-2.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">
|
||||
|
||||
|
||||
<int-flow:flow id="subflow4"/>
|
||||
|
||||
<int-flow:outbound-gateway
|
||||
flow="subflow4"
|
||||
input-port="input"
|
||||
input-channel="inputC"
|
||||
output-channel="outputC"/>
|
||||
|
||||
|
||||
<int-flow:flow id="subflow5"/>
|
||||
|
||||
<int-flow:outbound-gateway
|
||||
flow="subflow5"
|
||||
input-port="input"
|
||||
input-channel="inputC1"
|
||||
output-channel="outputC1"/>
|
||||
|
||||
<int:channel id="outputC">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<int:channel id="outputC1">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
|
||||
|
||||
</beans>
|
||||
19
src/test/resources/FlowWithMissingReferencesTest-context.xml
Normal file
19
src/test/resources/FlowWithMissingReferencesTest-context.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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:int-flow="http://www.springframework.org/schema/integration/flow"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/flow http://www.springframework.org/schema/integration/flow/spring-integration-flow-2.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">
|
||||
|
||||
<util:properties id="flowProperties">
|
||||
<prop key="key2">val1</prop>
|
||||
</util:properties>
|
||||
|
||||
<!-- Instantiate the flow -->
|
||||
<int-flow:flow id="subflow3" help="true" referenced-bean-locations="classpath:ref-bean-config.xml" properties="flowProperties"/>
|
||||
|
||||
</beans>
|
||||
29
src/test/resources/FlowWithReferencesTest-context.xml
Normal file
29
src/test/resources/FlowWithReferencesTest-context.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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:int-flow="http://www.springframework.org/schema/integration/flow"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/flow http://www.springframework.org/schema/integration/flow/spring-integration-flow-2.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">
|
||||
|
||||
<util:properties id="flowProperties">
|
||||
<prop key="key1">val1</prop>
|
||||
</util:properties>
|
||||
|
||||
<!-- Instantiate the flow -->
|
||||
<int-flow:flow id="subflow2" referenced-bean-locations="classpath:ref-bean-config.xml" properties="flowProperties"/>
|
||||
|
||||
<!-- input port not required if only one -->
|
||||
<int-flow:outbound-gateway
|
||||
flow="subflow2"
|
||||
input-channel="inputC"
|
||||
output-channel="outputC"/>
|
||||
|
||||
<int:channel id="outputC">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,75 @@
|
||||
<?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:util="http://www.springframework.org/schema/util"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="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/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
|
||||
|
||||
|
||||
|
||||
|
||||
<bean id="portConfig1" class="org.springframework.integration.flow.ChannelNamePortConfiguration">
|
||||
<constructor-arg name="inputPortMetadata">
|
||||
<bean class="org.springframework.integration.flow.PortMetadata">
|
||||
<constructor-arg name="portName" value="input"/>
|
||||
<constructor-arg name="channelName" value="subflow-input"/>
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg name="outputPortMetadataList">
|
||||
<util:list>
|
||||
<bean class="org.springframework.integration.flow.PortMetadata">
|
||||
<constructor-arg name="portName" value="output"/>
|
||||
<constructor-arg name="description" value="Default output port"/>
|
||||
<constructor-arg name="channelName" value="subflow-output"/>
|
||||
</bean>
|
||||
</util:list>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="portConfig2" class="org.springframework.integration.flow.ChannelNamePortConfiguration">
|
||||
<constructor-arg name="inputPortMetadata">
|
||||
<bean class="org.springframework.integration.flow.PortMetadata">
|
||||
<constructor-arg name="portName" value="gateway-input"/>
|
||||
<constructor-arg name="channelName" value="subflow-input2"/>
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<constructor-arg name="outputPortMetadataList">
|
||||
<util:list>
|
||||
<bean class="org.springframework.integration.flow.PortMetadata">
|
||||
<constructor-arg name="portName" value="gateway-output"/>
|
||||
<constructor-arg name="description" value="Gateway output port"/>
|
||||
<constructor-arg name="channelName" value="subflow-output2"/>
|
||||
</bean>
|
||||
</util:list>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.integration.flow.FlowConfiguration">
|
||||
<constructor-arg>
|
||||
<list>
|
||||
<ref bean="portConfig1"/>
|
||||
<ref bean="portConfig2"/>
|
||||
</list>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
|
||||
<int:channel id="subflow-input"/>
|
||||
<int:channel id="subflow-input2"/>
|
||||
|
||||
<int:header-enricher input-channel="subflow-input"
|
||||
output-channel="subflow-output">
|
||||
<int:header name="foo" value="foo" />
|
||||
</int:header-enricher>
|
||||
|
||||
<int:header-enricher input-channel="subflow-input2"
|
||||
output-channel="subflow-output2">
|
||||
<int:header name="gateway" value="yeah!" />
|
||||
</int:header-enricher>
|
||||
|
||||
<int:channel id="subflow-output" />
|
||||
<int:channel id="subflow-output2" />
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?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:util="http://www.springframework.org/schema/util"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-flow="http://www.springframework.org/schema/integration/flow"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
http://www.springframework.org/schema/integration/flow http://www.springframework.org/schema/integration/flow/spring-integration-flow-2.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
|
||||
|
||||
<int-flow:flow-configuration>
|
||||
<int-flow:port-mapping>
|
||||
<int-flow:input-port name="gateway-input"
|
||||
channel="subflow-input">
|
||||
<int-flow:description></int-flow:description>
|
||||
</int-flow:input-port>
|
||||
<int-flow:output-port name="gateway-output"
|
||||
channel="hello-output">
|
||||
<int-flow:description></int-flow:description>
|
||||
</int-flow:output-port>
|
||||
<int-flow:output-port name="gateway-discard"
|
||||
channel="world-output">
|
||||
<int-flow:description></int-flow:description>
|
||||
</int-flow:output-port>
|
||||
</int-flow:port-mapping>
|
||||
</int-flow:flow-configuration>
|
||||
|
||||
<int:channel id="subflow-input" />
|
||||
|
||||
<int:header-enricher input-channel="subflow-input"
|
||||
output-channel="subflow-router">
|
||||
<int:header name="gateway" value="yeah!" />
|
||||
</int:header-enricher>
|
||||
|
||||
<int:router input-channel="subflow-router" expression="payload+'-output'"/>
|
||||
|
||||
<int:channel id="hello-output" />
|
||||
<int:channel id="world-output" />
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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:util="http://www.springframework.org/schema/util"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-flow="http://www.springframework.org/schema/integration/flow"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
http://www.springframework.org/schema/integration/flow http://www.springframework.org/schema/integration/flow/spring-integration-flow-2.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
|
||||
|
||||
<!-- Need to set ignore-unresolvable true or provide defaults for required properties -->
|
||||
<context:property-placeholder ignore-unresolvable="true"/>
|
||||
|
||||
<int-flow:flow-configuration>
|
||||
<int-flow:port-mapping>
|
||||
<int-flow:input-port name="input" channel="subflow-input" />
|
||||
<int-flow:output-port name="output" channel="subflow-output" />
|
||||
</int-flow:port-mapping>
|
||||
<int-flow:referenced-bean id="refbean" required="true" />
|
||||
</int-flow:flow-configuration>
|
||||
|
||||
<int:channel id="subflow-output" />
|
||||
|
||||
<int:header-enricher input-channel="subflow-input"
|
||||
output-channel="subflow-output">
|
||||
<int:header name="refbean.value" value="#{refbean.value}" />
|
||||
<int:header name="property.value.1" value="${key1}"/>
|
||||
<int:header name="property.value.2" value="${key2:undefined}"/>
|
||||
</int:header-enricher>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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:util="http://www.springframework.org/schema/util"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-flow="http://www.springframework.org/schema/integration/flow"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
http://www.springframework.org/schema/integration/flow http://www.springframework.org/schema/integration/flow/spring-integration-flow-2.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
|
||||
|
||||
<!-- Need to set ignore-unresolvable true or provide defaults for required properties -->
|
||||
<context:property-placeholder ignore-unresolvable="true"/>
|
||||
|
||||
<int-flow:flow-configuration>
|
||||
<int-flow:port-mapping>
|
||||
<int-flow:input-port name="input" channel="subflow-input">
|
||||
<int-flow:description>This optionally describes the flow</int-flow:description>
|
||||
</int-flow:input-port>
|
||||
<int-flow:output-port name="output" channel="subflow-output">
|
||||
<int-flow:description>This describes the purpose/ necessary conditions for this output</int-flow:description>
|
||||
</int-flow:output-port>
|
||||
</int-flow:port-mapping>
|
||||
|
||||
<int-flow:referenced-property id="key1" required="true">
|
||||
<int-flow:description>This is an example of a required property</int-flow:description>
|
||||
</int-flow:referenced-property>
|
||||
<int-flow:referenced-property id="key2" required="false">
|
||||
<int-flow:description>This is an example of an optional property</int-flow:description>
|
||||
</int-flow:referenced-property>
|
||||
</int-flow:flow-configuration>
|
||||
|
||||
<int:channel id="subflow-output" />
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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:util="http://www.springframework.org/schema/util"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-flow="http://www.springframework.org/schema/integration/flow"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
http://www.springframework.org/schema/integration/flow http://www.springframework.org/schema/integration/flow/spring-integration-flow-2.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
|
||||
|
||||
<int-flow:flow-configuration>
|
||||
<int-flow:port-mapping>
|
||||
<int-flow:input-port name="input" channel="subflow-input">
|
||||
<int-flow:description>This optionally describes the flow</int-flow:description>
|
||||
</int-flow:input-port>
|
||||
<int-flow:output-port name="output" channel="subflow-output">
|
||||
<int-flow:description>This describes the purpose/ necessary conditions for this output</int-flow:description>
|
||||
</int-flow:output-port>
|
||||
</int-flow:port-mapping>
|
||||
</int-flow:flow-configuration>
|
||||
|
||||
|
||||
<!-- Throws exception -->
|
||||
<int:service-activator input-channel="subflow-input" output-channel="subflow-output" method="exception">
|
||||
<bean class="org.springframework.integration.flow.config.xml.ExceptionBean"/>
|
||||
</int:service-activator>
|
||||
|
||||
<int:channel id="subflow-output"/>
|
||||
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?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:util="http://www.springframework.org/schema/util"
|
||||
xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-flow="http://www.springframework.org/schema/integration/flow"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
http://www.springframework.org/schema/integration/flow http://www.springframework.org/schema/integration/flow/spring-integration-flow-2.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
|
||||
|
||||
<int-flow:flow-configuration>
|
||||
<int-flow:port-mapping>
|
||||
<int-flow:input-port name="input" channel="subflow-input">
|
||||
<int-flow:description>This optionally describes the flow</int-flow:description>
|
||||
</int-flow:input-port>
|
||||
<int-flow:output-port name="output" channel="subflow-output">
|
||||
<int-flow:description>This describes the purpose/ necessary conditions for this output</int-flow:description>
|
||||
</int-flow:output-port>
|
||||
|
||||
<int-flow:output-port name="error" channel="errorChannel">
|
||||
<int-flow:description>This describes the purpose/ necessary conditions for this output</int-flow:description>
|
||||
</int-flow:output-port>
|
||||
</int-flow:port-mapping>
|
||||
</int-flow:flow-configuration>
|
||||
|
||||
<int:service-activator
|
||||
input-channel="subflow-input"
|
||||
output-channel="subflow-output" ref="gateway"
|
||||
/>
|
||||
|
||||
<int:gateway id="gateway"
|
||||
default-request-channel="requestChannel"
|
||||
|
||||
error-channel="errorChannel"
|
||||
default-reply-timeout="1"/>
|
||||
|
||||
<int:service-activator input-channel="requestChannel" method="exception">
|
||||
<bean class="org.springframework.integration.flow.config.xml.ExceptionBean"/>
|
||||
</int:service-activator>
|
||||
|
||||
<int:channel id="subflow-output"/>
|
||||
|
||||
|
||||
</beans>
|
||||
28
src/test/resources/log4j.xml
Normal file
28
src/test/resources/log4j.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
|
||||
|
||||
<!-- Appenders -->
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="[%t] %-5p: %c - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Loggers -->
|
||||
<logger name="org.springframework">
|
||||
<level value="info" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.integration">
|
||||
<level value="debug" />
|
||||
</logger>
|
||||
|
||||
<!-- Root Logger -->
|
||||
<root>
|
||||
<priority value="info" />
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
||||
10
src/test/resources/ref-bean-config.xml
Normal file
10
src/test/resources/ref-bean-config.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?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">
|
||||
|
||||
<bean id="refbean" class="org.springframework.integration.flow.config.xml.RefBean">
|
||||
<property name="value" value="it works!"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user