INT-1380 added file sample

This commit is contained in:
Oleg Zhurakousky
2010-09-16 15:33:57 -04:00
parent 78c1209332
commit 65ea2289bf
341 changed files with 9286 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
<?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="%-5p: %c - %m%n" />
</layout>
</appender>
<!-- Loggers -->
<logger name="org.springframework">
<level value="warn" />
</logger>
<logger name="org.springframework.integration">
<level value="warn" />
</logger>
<logger name="org.springframework.integration.xml">
<level value="warn" />
</logger>
<!-- Root Logger -->
<root>
<priority value="warn" />
<appender-ref ref="console" />
</root>
</log4j:configuration>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sb="http://www.example.org/orders"
xmlns:bb="http://www.example.org/orders-bigbooks">
<xsl:template match="/sb:orderItem" >
<bb:bigBooksOrder>
<bb:order>
<bb:purchaser>smallbooks</bb:purchaser>
<bb:quantity>5</bb:quantity>
<bb:isbn>
<xsl:value-of select="./sb:isbn/text()"/>
</bb:isbn>
</bb:order>
</bb:bigBooksOrder>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<order xmlns="http://www.example.org/orders">
<orderItem>
<isbn>0321200683</isbn>
<quantity>2</quantity>
</orderItem>
<orderItem>
<isbn>1590596439</isbn>
<quantity>1</quantity>
</orderItem>
</order>

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:si-xml="http://www.springframework.org/schema/integration/xml"
xmlns:si="http://www.springframework.org/schema/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/xml
http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<si:channel id="ordersChannel" />
<si:channel id="stockCheckerChannel" />
<si:channel id="orderRoutingChannel" />
<si:channel id="warehouseDispatchChannel" />
<si:channel id="outOfStockChannel" />
<si:channel id="resupplyOrderChannel" />
<!-- map of namespace prefix to URI -->
<util:map id="orderNamespaceMap">
<entry key="orderNs" value="http://www.example.org/orders" />
<entry key="productNs" value="http://www.example.org/prodcuts" />
</util:map>
<!-- split the inbound order into a number of orderItem documents that can be processed separately -->
<si-xml:xpath-splitter id="orderItemSplitter" input-channel="ordersChannel" output-channel="stockCheckerChannel" create-documents="true">
<si-xml:xpath-expression expression="/orderNs:order/orderNs:orderItem" namespace-map="orderNamespaceMap" />
</si-xml:xpath-splitter>
<!-- if each order -->
<si:service-activator input-channel="stockCheckerChannel" output-channel="orderRoutingChannel">
<bean class="org.springframework.integration.samples.xml.StockChecker">
<constructor-arg ref="selectIsbnXpath" />
</bean>
</si:service-activator>
<si-xml:xpath-expression id="selectIsbnXpath" namespace-map="orderNamespaceMap" expression="/orderNs:orderItem/orderNs:isbn/text()" />
<!-- if in stock route to the warehouse else route to the out of stock channel -->
<si-xml:xpath-router id="instockRouter" channel-resolver="mapChannelResolver"
input-channel="orderRoutingChannel" resolution-required="true">
<si-xml:xpath-expression expression="/orderNs:orderItem/@in-stock" namespace-map="orderNamespaceMap" />
</si-xml:xpath-router>
<bean id="mapChannelResolver" class="org.springframework.integration.channel.MapBasedChannelResolver">
<property name="channelMap">
<map>
<entry key="true" value-ref="warehouseDispatchChannel" />
<entry key="false" value-ref="outOfStockChannel" />
</map>
</property>
</bean>
<!-- dispatch order if in stock -->
<si:outbound-channel-adapter method="dispatch" channel="warehouseDispatchChannel">
<bean class="org.springframework.integration.samples.xml.WarehouseDispatch" />
</si:outbound-channel-adapter>
<!-- convert the order item to a format that can be understood by BigBooks the wholesaler -->
<si-xml:xslt-transformer input-channel="outOfStockChannel" output-channel="resupplyOrderChannel"
xsl-resource="classpath:org/springframework/integration/samples/xml/bigBooksSupplierTransformer.xsl"/>
<!-- send the resupply order -->
<si:outbound-channel-adapter method="orderResupply" channel="resupplyOrderChannel">
<bean class="org.springframework.integration.samples.xml.ExternalResupply" />
</si:outbound-channel-adapter>
</beans>