moved org.springframework.integration.samples module to spring-integration-samples

This commit is contained in:
Mark Fisher
2009-07-02 18:48:31 +00:00
parent 5af238327b
commit 9b7e97b058
101 changed files with 3 additions and 5 deletions

View File

@@ -0,0 +1,32 @@
/*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.samples.oddeven;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author Mark Fisher
*/
public class Counter {
private final AtomicInteger count = new AtomicInteger();
public int next() {
return count.incrementAndGet();
}
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.samples.oddeven;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @author Mark Fisher
*/
public class CronOddEvenDemo {
public static void main(String[] args) {
new ClassPathXmlApplicationContext("cronOddEvenDemo.xml", CronOddEvenDemo.class);
}
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.samples.oddeven;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.ServiceActivator;
/**
* @author Mark Fisher
* @author Marius Bogoevici
*/
@MessageEndpoint
public class EvenLogger {
@ServiceActivator
public void log(int i) {
System.out.println("even: " + i + " at " + new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date()));
}
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.samples.oddeven;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @author Mark Fisher
*/
public class IntervalOddEvenDemo {
public static void main(String[] args) {
new ClassPathXmlApplicationContext("intervalOddEvenDemo.xml", IntervalOddEvenDemo.class);
}
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.samples.oddeven;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.ServiceActivator;
/**
* @author Mark Fisher
* @author Marius Bogoevici
*/
@MessageEndpoint
public class OddLogger {
@ServiceActivator
public void log(int i) {
System.out.println("odd: " + i + " at " + new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date()));
}
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright 2002-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.samples.oddeven;
/**
* @author Mark Fisher
*/
public class ParityResolver {
public String getParity(int i) {
if (i % 2 == 0) {
return "even";
}
return "odd";
}
}

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<annotation-config/>
<channel id="even"/>
<channel id="odd"/>
<inbound-channel-adapter id="numbers" ref="counter" method="next">
<poller max-messages-per-poll="1">
<cron-trigger expression="1,2,3,5,8,13,21,34,55 * * * * ?"/>
</poller>
</inbound-channel-adapter>
<router ref="parityResolver" method="getParity" input-channel="numbers"/>
<service-activator ref="oddLogger" input-channel="odd"/>
<service-activator ref="evenLogger" input-channel="even"/>
<beans:bean id="counter" class="org.springframework.integration.samples.oddeven.Counter"/>
<beans:bean id="parityResolver" class="org.springframework.integration.samples.oddeven.ParityResolver"/>
<beans:bean id="oddLogger" class="org.springframework.integration.samples.oddeven.OddLogger"/>
<beans:bean id="evenLogger" class="org.springframework.integration.samples.oddeven.EvenLogger"/>
</beans:beans>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<annotation-config/>
<channel id="even"/>
<channel id="odd"/>
<inbound-channel-adapter id="numbers" ref="counter" method="next">
<poller max-messages-per-poll="1">
<interval-trigger interval="3" time-unit="SECONDS"/>
</poller>
</inbound-channel-adapter>
<router ref="parityResolver" method="getParity" input-channel="numbers"/>
<service-activator ref="oddLogger" input-channel="odd"/>
<service-activator ref="evenLogger" input-channel="even"/>
<beans:bean id="counter" class="org.springframework.integration.samples.oddeven.Counter"/>
<beans:bean id="parityResolver" class="org.springframework.integration.samples.oddeven.ParityResolver"/>
<beans:bean id="oddLogger" class="org.springframework.integration.samples.oddeven.OddLogger"/>
<beans:bean id="evenLogger" class="org.springframework.integration.samples.oddeven.EvenLogger"/>
</beans:beans>