From 22bd5f1b3e0cf3f2ac5ddfec1363f45a4a1f73ed Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Wed, 8 Oct 2008 03:01:32 +0000 Subject: [PATCH] Removed some unused classes and moved AsyncMessage to the sandbox (with AsyncMessageChannelTemplate). --- .../MessageEndpointReplyException.java | 58 ------------ .../integration/endpoint/MessagingBridge.java | 41 --------- .../integration/message/AsyncMessage.java | 90 ------------------- 3 files changed, 189 deletions(-) delete mode 100644 org.springframework.integration/src/main/java/org/springframework/integration/endpoint/MessageEndpointReplyException.java delete mode 100644 org.springframework.integration/src/main/java/org/springframework/integration/endpoint/MessagingBridge.java delete mode 100644 org.springframework.integration/src/main/java/org/springframework/integration/message/AsyncMessage.java diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/MessageEndpointReplyException.java b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/MessageEndpointReplyException.java deleted file mode 100644 index 7341447778..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/MessageEndpointReplyException.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.endpoint; - -import org.springframework.integration.message.Message; -import org.springframework.integration.message.MessageDeliveryException; - -/** - * An Exception that indicates a failure occurred while a Message Endpoint - * was attempting to send a reply message. The Exception provides access to - * both the reply message and the original request message. - * - * @author Mark Fisher - */ -public class MessageEndpointReplyException extends MessageDeliveryException { - - private final Message requestMessage; - - - public MessageEndpointReplyException(Message undeliveredMessage, Message requestMessage) { - super(undeliveredMessage); - this.requestMessage = requestMessage; - } - - public MessageEndpointReplyException(Message undeliveredMessage, Message requestMessage, String description) { - super(undeliveredMessage, description); - this.requestMessage = requestMessage; - } - - public MessageEndpointReplyException(Message undeliveredMessage, Message requestMessage, String description, Throwable cause) { - super(undeliveredMessage, description, cause); - this.requestMessage = requestMessage; - } - - - public Message getOriginalRequestMessage() { - return this.requestMessage; - } - - public Message getUndeliveredReplyMessage() { - return this.getFailedMessage(); - } - -} diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/MessagingBridge.java b/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/MessagingBridge.java deleted file mode 100644 index a5a5d1dfe9..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/endpoint/MessagingBridge.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.endpoint; - -import org.springframework.integration.message.Message; -import org.springframework.integration.message.MessageConsumer; -import org.springframework.util.Assert; - -/** - * @author Mark Fisher - */ -public class MessagingBridge extends AbstractMessageConsumer { - - private final MessageConsumer consumer; - - - public MessagingBridge(MessageConsumer consumer) { - Assert.notNull(consumer, "consumer must not be null"); - this.consumer = consumer; - } - - @Override - protected void onMessageInternal(Message message) { - this.consumer.onMessage(message); - } - -} diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/message/AsyncMessage.java b/org.springframework.integration/src/main/java/org/springframework/integration/message/AsyncMessage.java deleted file mode 100644 index 58399c6ae5..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/message/AsyncMessage.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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.message; - -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import org.springframework.integration.message.Message; -import org.springframework.integration.message.MessageHeaders; -import org.springframework.integration.message.MessagingException; - -/** - * A Message wrapper for asynchronous operations. Implements both - * Message and Future so that simple blocking invocations on the - * Message (e.g. {@link #getPayload()}) are still allowed, while - * timeout-aware methods such as {@link #get(long, TimeUnit)} - * are also supported. - * - * @author Mark Fisher - */ -public class AsyncMessage implements Future>, Message { - - private final Future> future; - - - public AsyncMessage(Future> future) { - this.future = future; - } - - - public boolean cancel(boolean mayInterruptIfRunning) { - return this.future.cancel(mayInterruptIfRunning); - } - - public Message get() throws InterruptedException, ExecutionException { - return this.future.get(); - } - - public Message get(long timeout, TimeUnit unit) - throws InterruptedException, ExecutionException, TimeoutException { - return this.future.get(timeout, unit); - } - - public boolean isCancelled() { - return this.future.isCancelled(); - } - - public boolean isDone() { - return this.future.isDone(); - } - - public T getPayload() { - try { - return this.future.get().getPayload(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - return null; - } catch (ExecutionException e) { - throw new MessagingException("failure occurred in AsyncMessage", e); - } - } - - public MessageHeaders getHeaders() { - try { - return this.future.get().getHeaders(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - return null; - } catch (ExecutionException e) { - throw new MessagingException("failure occurred in AsyncMessage", e); - } - } - -}