From 778f53c733b9c9ed97b70c094d57bec430212c8d Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Mon, 10 Dec 2007 07:04:13 +0000 Subject: [PATCH] Added routing interface definitions. --- .../integration/router/Aggregator.java | 30 ++++++++++++++++++ .../router/ChannelNameResolver.java | 28 +++++++++++++++++ .../integration/router/ChannelResolver.java | 30 ++++++++++++++++++ .../integration/router/Resequencer.java | 31 +++++++++++++++++++ .../integration/router/RoutingBarrier.java | 30 ++++++++++++++++++ .../integration/router/Splitter.java | 30 ++++++++++++++++++ 6 files changed, 179 insertions(+) create mode 100644 spring-eai-core/src/main/java/org/springframework/integration/router/Aggregator.java create mode 100644 spring-eai-core/src/main/java/org/springframework/integration/router/ChannelNameResolver.java create mode 100644 spring-eai-core/src/main/java/org/springframework/integration/router/ChannelResolver.java create mode 100644 spring-eai-core/src/main/java/org/springframework/integration/router/Resequencer.java create mode 100644 spring-eai-core/src/main/java/org/springframework/integration/router/RoutingBarrier.java create mode 100644 spring-eai-core/src/main/java/org/springframework/integration/router/Splitter.java diff --git a/spring-eai-core/src/main/java/org/springframework/integration/router/Aggregator.java b/spring-eai-core/src/main/java/org/springframework/integration/router/Aggregator.java new file mode 100644 index 0000000000..ab4e882e8a --- /dev/null +++ b/spring-eai-core/src/main/java/org/springframework/integration/router/Aggregator.java @@ -0,0 +1,30 @@ +/* + * 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.router; + +import java.util.Collection; + +/** + * Base interface for aggregators. + * + * @author Mark Fisher + */ +public interface Aggregator { + + T aggregate(Collection t); + +} diff --git a/spring-eai-core/src/main/java/org/springframework/integration/router/ChannelNameResolver.java b/spring-eai-core/src/main/java/org/springframework/integration/router/ChannelNameResolver.java new file mode 100644 index 0000000000..2cf076b421 --- /dev/null +++ b/spring-eai-core/src/main/java/org/springframework/integration/router/ChannelNameResolver.java @@ -0,0 +1,28 @@ +/* + * 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.router; + +/** + * Strategy interface for content-based routing to a channel name. + * + * @author Mark Fisher + */ +public interface ChannelNameResolver { + + String resolve(T t); + +} diff --git a/spring-eai-core/src/main/java/org/springframework/integration/router/ChannelResolver.java b/spring-eai-core/src/main/java/org/springframework/integration/router/ChannelResolver.java new file mode 100644 index 0000000000..47d5938bb1 --- /dev/null +++ b/spring-eai-core/src/main/java/org/springframework/integration/router/ChannelResolver.java @@ -0,0 +1,30 @@ +/* + * 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.router; + +import org.springframework.integration.channel.MessageChannel; + +/** + * Strategy interface for content-based routing to a channel instance. + * + * @author Mark Fisher + */ +public interface ChannelResolver { + + MessageChannel resolve(T t); + +} diff --git a/spring-eai-core/src/main/java/org/springframework/integration/router/Resequencer.java b/spring-eai-core/src/main/java/org/springframework/integration/router/Resequencer.java new file mode 100644 index 0000000000..72dba380c4 --- /dev/null +++ b/spring-eai-core/src/main/java/org/springframework/integration/router/Resequencer.java @@ -0,0 +1,31 @@ +/* + * 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.router; + +import java.util.Collection; +import java.util.List; + +/** + * Base interface for resequencers. + * + * @author Mark Fisher + */ +public interface Resequencer { + + List resequence(Collection t); + +} diff --git a/spring-eai-core/src/main/java/org/springframework/integration/router/RoutingBarrier.java b/spring-eai-core/src/main/java/org/springframework/integration/router/RoutingBarrier.java new file mode 100644 index 0000000000..8941bd1184 --- /dev/null +++ b/spring-eai-core/src/main/java/org/springframework/integration/router/RoutingBarrier.java @@ -0,0 +1,30 @@ +/* + * 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.router; + +/** + * Base strategy interface for barriers. Defines the common requirement of + * routing scenarios that involve waiting for a particular condition to be + * satisfied, such as an {@link Aggregator} or {@link Resequencer}. + * + * @author Mark Fisher + */ +public interface RoutingBarrier { + + boolean checkCondition(T t); + +} diff --git a/spring-eai-core/src/main/java/org/springframework/integration/router/Splitter.java b/spring-eai-core/src/main/java/org/springframework/integration/router/Splitter.java new file mode 100644 index 0000000000..2d8510b766 --- /dev/null +++ b/spring-eai-core/src/main/java/org/springframework/integration/router/Splitter.java @@ -0,0 +1,30 @@ +/* + * 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.router; + +import java.util.Collection; + +/** + * Base interface for splitters. + * + * @author Mark Fisher + */ +public interface Splitter { + + Collection split(T t); + +}