diff --git a/spring-integration-samples/oddeven/src/main/java/log4j.xml b/spring-integration-samples/oddeven/src/main/java/log4j.xml
new file mode 100644
index 0000000000..78268c06cc
--- /dev/null
+++ b/spring-integration-samples/oddeven/src/main/java/log4j.xml
@@ -0,0 +1,32 @@
+
+
+
- * See the 'cronOddEvenDemo.xml' configuration file for more detail. + * See the 'cronOddEvenDemo.xml' configuration file for more detail. The cron + * expression is based on the Fibonacci sequence. Feel free to modify it. * * @author Mark Fisher */ diff --git a/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/EvenLogger.java b/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/EvenLogger.java index 41840b16e4..b7494eb847 100644 --- a/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/EvenLogger.java +++ b/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/EvenLogger.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -23,6 +23,8 @@ import org.springframework.integration.annotation.MessageEndpoint; import org.springframework.integration.annotation.ServiceActivator; /** + * A POJO Service Activator that logs even numbers and the current time. + * * @author Mark Fisher * @author Marius Bogoevici */ diff --git a/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/IntervalOddEvenDemo.java b/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/IntervalOddEvenDemo.java index 7fba9686ed..c941d8fed1 100644 --- a/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/IntervalOddEvenDemo.java +++ b/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/IntervalOddEvenDemo.java @@ -19,9 +19,13 @@ package org.springframework.integration.samples.oddeven; import org.springframework.context.support.ClassPathXmlApplicationContext; /** - * Demonstrates a method-invoking inbound Channel Adapter with an - * Interval-based polling trigger followed by a simple method-invoking - * router. + * Demonstrates a method-invoking inbound Channel Adapter acting as a Polling + * Consumer with an interval-based trigger. That adapter is followed, + * downstream, by a simple method-invoking Message Filter that discards + * negative numbers to the "nullChannel". Next is a Content Based Router. The + * router sends to one of two channels based on whether the payload number is + * odd or even. Each of those two channels has an Event Driven Consumer ready + * to log the number and the current time. *
* See the 'intervalOddEvenDemo.xml' configuration file for more detail.
*
diff --git a/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/OddLogger.java b/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/OddLogger.java
index 7b6c2e6b3a..88f44a1829 100644
--- a/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/OddLogger.java
+++ b/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/OddLogger.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2009 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.
@@ -23,6 +23,8 @@ import org.springframework.integration.annotation.MessageEndpoint;
import org.springframework.integration.annotation.ServiceActivator;
/**
+ * A POJO Service Activator that logs odd numbers and the current time.
+ *
* @author Mark Fisher
* @author Marius Bogoevici
*/
diff --git a/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/ParityResolver.java b/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/ParityResolver.java
index 61d890f039..4f0d214cda 100644
--- a/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/ParityResolver.java
+++ b/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/ParityResolver.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2009 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.
@@ -17,15 +17,14 @@
package org.springframework.integration.samples.oddeven;
/**
+ * A POJO Content Based Router.
+ *
* @author Mark Fisher
*/
public class ParityResolver {
public String getParity(int i) {
- if (i % 2 == 0) {
- return "even";
- }
- return "odd";
+ return (i % 2 == 0) ? "even" : "odd";
}
}
diff --git a/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/PositiveChecker.java b/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/PositiveChecker.java
new file mode 100644
index 0000000000..fdffa43b0a
--- /dev/null
+++ b/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/PositiveChecker.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2002-2009 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;
+
+/**
+ * A POJO Message Filter.
+ *
+ * @author Mark Fisher
+ */
+public class PositiveChecker {
+
+ public boolean isPositive(int i) {
+ return i > 0;
+ }
+
+}
diff --git a/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/cronOddEvenDemo.xml b/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/cronOddEvenDemo.xml
index 6743bf291a..b313b52528 100644
--- a/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/cronOddEvenDemo.xml
+++ b/spring-integration-samples/oddeven/src/main/java/org/springframework/integration/samples/oddeven/cronOddEvenDemo.xml
@@ -18,7 +18,11 @@
-