From ff2534e659cef1de276e4ab77c8f78693af6d392 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Mon, 17 Dec 2007 01:45:34 +0000 Subject: [PATCH] Moved samples to the spring-integration-samples project --- .../integration/samples/oddeven/Counter.java | 44 ------------------- .../samples/oddeven/NumberLogger.java | 38 ---------------- .../samples/oddeven/OddEvenDemo.java | 33 -------------- .../samples/oddeven/oddEvenDemo.xml | 19 -------- .../integration/samples/quote/Quote.java | 39 ---------------- .../integration/samples/quote/QuoteDemo.java | 32 -------------- .../samples/quote/QuotePublisher.java | 38 ---------------- .../samples/quote/QuoteSubscriber.java | 31 ------------- .../integration/samples/quote/quoteDemo.xml | 20 --------- 9 files changed, 294 deletions(-) delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/Counter.java delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/NumberLogger.java delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/OddEvenDemo.java delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/oddEvenDemo.xml delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/samples/quote/Quote.java delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/samples/quote/QuoteDemo.java delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/samples/quote/QuotePublisher.java delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/samples/quote/QuoteSubscriber.java delete mode 100644 spring-integration-core/src/main/java/org/springframework/integration/samples/quote/quoteDemo.xml diff --git a/spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/Counter.java b/spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/Counter.java deleted file mode 100644 index c710a8b7ed..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/Counter.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2002-2007 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.integration.endpoint.annotation.MessageEndpoint; -import org.springframework.integration.endpoint.annotation.Polled; -import org.springframework.integration.handler.annotation.Router; - -/** - * @author Mark Fisher - */ -@MessageEndpoint -public class Counter { - - private volatile int count = 1; - - @Polled(period=3000) - public int getNumber() { - return count++; - } - - @Router - public String resolveChannel(int i) { - if (i % 2 == 0) { - return "even"; - } - return "odd"; - } - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/NumberLogger.java b/spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/NumberLogger.java deleted file mode 100644 index 4475fe22f9..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/NumberLogger.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2002-2007 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.integration.endpoint.annotation.Subscriber; -import org.springframework.stereotype.Component; - -/** - * @author Mark Fisher - */ -@Component -public class NumberLogger { - - @Subscriber(channel="even") - public void even(int i) { - System.out.println("even: " + i); - } - - @Subscriber(channel="odd") - public void odd(int i) { - System.out.println("odd: " + i); - } - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/OddEvenDemo.java b/spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/OddEvenDemo.java deleted file mode 100644 index a490f5f71c..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/OddEvenDemo.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2002-2007 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.AbstractApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -/** - * @author Mark Fisher - */ -public class OddEvenDemo { - - public static void main(String[] args) throws Exception { - AbstractApplicationContext context = new ClassPathXmlApplicationContext("oddEvenDemo.xml", OddEvenDemo.class); - context.start(); - System.in.read(); - } - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/oddEvenDemo.xml b/spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/oddEvenDemo.xml deleted file mode 100644 index bd899a335d..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/samples/oddeven/oddEvenDemo.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - diff --git a/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/Quote.java b/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/Quote.java deleted file mode 100644 index f655f02cf6..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/Quote.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2002-2007 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.quote; - -import java.math.BigDecimal; - -/** - * @author Mark Fisher - */ -public class Quote { - - private String ticker; - - private BigDecimal price; - - public Quote(String ticker, BigDecimal price) { - this.ticker = ticker; - this.price = price; - } - - public String toString() { - return ticker + ": " + price; - } - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/QuoteDemo.java b/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/QuoteDemo.java deleted file mode 100644 index e48bd03bd5..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/QuoteDemo.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2002-2007 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.quote; - -import org.springframework.context.support.AbstractApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -/** - * @author Mark Fisher - */ -public class QuoteDemo { - - public static void main(String[] args) throws Exception { - AbstractApplicationContext context = new ClassPathXmlApplicationContext("quoteDemo.xml", QuoteDemo.class); - context.start(); - System.in.read(); - } -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/QuotePublisher.java b/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/QuotePublisher.java deleted file mode 100644 index ded1769972..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/QuotePublisher.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2002-2007 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.quote; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.Random; - -import org.springframework.integration.endpoint.annotation.MessageEndpoint; -import org.springframework.integration.endpoint.annotation.Polled; - -/** - * @author Mark Fisher - */ -@MessageEndpoint(defaultOutput="quotes") -public class QuotePublisher { - - @Polled(period=300) - public Quote getQuote() { - BigDecimal price = new BigDecimal(new Random().nextDouble() * 100); - return new Quote("SOA", price.setScale(2, RoundingMode.HALF_EVEN)); - } - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/QuoteSubscriber.java b/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/QuoteSubscriber.java deleted file mode 100644 index cf7456b4bd..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/QuoteSubscriber.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2002-2007 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.quote; - -import org.springframework.integration.endpoint.annotation.Subscriber; - -/** - * @author Mark Fisher - */ -public class QuoteSubscriber { - - @Subscriber(channel="quotes") - public void log(Object o) { - System.out.println(o); - } - -} diff --git a/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/quoteDemo.xml b/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/quoteDemo.xml deleted file mode 100644 index cf66173db8..0000000000 --- a/spring-integration-core/src/main/java/org/springframework/integration/samples/quote/quoteDemo.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - -