From 5dcf9cf6b972a324e8ef6159ae30614cc609a3a6 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Tue, 9 Oct 2007 14:44:50 +0000 Subject: [PATCH] added a plugin to support invocation of MessageListener classes as a bean in Camel; for more information see: http://cwiki.apache.org/CAMEL/activemq.html git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@583185 13f79535-47bb-0310-9956-ffa450edef68 --- .../component/ActiveMQMessageConverter.java | 74 ------------------- 1 file changed, 74 deletions(-) delete mode 100644 activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQMessageConverter.java diff --git a/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQMessageConverter.java b/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQMessageConverter.java deleted file mode 100644 index b41befcc13..0000000000 --- a/activemq-core/src/main/java/org/apache/activemq/camel/component/ActiveMQMessageConverter.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.activemq.camel.component; - -import org.apache.activemq.command.ActiveMQMessage; -import org.apache.activemq.command.*; -import org.apache.camel.Converter; -import org.apache.camel.Exchange; -import org.apache.camel.component.jms.JmsBinding; - -import javax.jms.MessageNotWriteableException; -import javax.jms.JMSException; -import java.io.Serializable; - -/** - * @version $Revision$ - */ -@Converter -public class ActiveMQMessageConverter { - private JmsBinding binding = new JmsBinding(); - - /** - * Converts the inbound message exchange to an ActiveMQ JMS message - * - * @return the ActiveMQ message - */ - @Converter - public ActiveMQMessage toMessage(Exchange exchange) throws JMSException { - ActiveMQMessage message = createActiveMQMessage(exchange); - getBinding().appendJmsProperties(message, exchange); - return message; - } - - private static ActiveMQMessage createActiveMQMessage(Exchange exchange) throws JMSException { - Object body = exchange.getIn().getBody(); - if (body instanceof String) { - ActiveMQTextMessage answer = new ActiveMQTextMessage(); - answer.setText((String) body); - return answer; - } else if (body instanceof Serializable) { - ActiveMQObjectMessage answer = new ActiveMQObjectMessage(); - answer.setObject((Serializable) body); - return answer; - } else { - return new ActiveMQMessage(); - } - - } - - // Properties - //------------------------------------------------------------------------- - public JmsBinding getBinding() { - return binding; - } - - public void setBinding(JmsBinding binding) { - this.binding = binding; - } -} \ No newline at end of file