001 /** 002 * 003 * Copyright 2004 Protique Ltd 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 * 017 **/ 018 package org.activemq.ra.jms; 019 020 import javax.jms.*; 021 022 /** 023 * A {@link Connection} implementation which can be used with the ActiveMQ JCA 024 * Resource Adapter to publish messages using the same JMS session that is used to dispatch 025 * messages. 026 * 027 * @version $Revision: 1.1.1.1 $ 028 */ 029 public class ConnectionProxy implements Connection, QueueConnection, TopicConnection { 030 private static final ConnectionMetaData metaData = new ConnectionProxyMetaData(); 031 032 public Session createSession(boolean transacted, int ackMode) throws JMSException { 033 // TODO we could decide to barf if someone passes in incompatible options 034 return new SessionProxy(); 035 } 036 037 public QueueSession createQueueSession(boolean transacted, int ackMode) throws JMSException { 038 // TODO we could decide to barf if someone passes in incompatible options 039 return new SessionProxy(); 040 } 041 042 public TopicSession createTopicSession(boolean transacted, int ackMode) throws JMSException { 043 // TODO we could decide to barf if someone passes in incompatible options 044 return new SessionProxy(); 045 } 046 047 public void start() throws JMSException { 048 // the JCA RA is in control of this 049 } 050 051 public void stop() throws JMSException { 052 // the JCA RA is in control of this 053 } 054 055 public void close() throws JMSException { 056 // the JCA RA is in control of this 057 } 058 059 public ConnectionMetaData getMetaData() throws JMSException { 060 return metaData; 061 } 062 063 public String getClientID() throws JMSException { 064 throw createNotSupported("getClientID()"); 065 } 066 067 public void setClientID(String s) throws JMSException { 068 throw createNotSupported("setClient()"); 069 } 070 071 public ExceptionListener getExceptionListener() throws JMSException { 072 throw createNotSupported("getExceptionListener()"); 073 } 074 075 public void setExceptionListener(ExceptionListener exceptionListener) throws JMSException { 076 throw createNotSupported("setExceptionListener()"); 077 } 078 079 public ConnectionConsumer createConnectionConsumer(Destination destination, String s, ServerSessionPool serverSessionPool, int i) throws JMSException { 080 throw createNotSupported("createConnectionConsumer()"); 081 } 082 083 public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String s, String s1, ServerSessionPool serverSessionPool, int i) throws JMSException { 084 throw createNotSupported("createDurableConnectionConsumer()"); 085 } 086 087 public ConnectionConsumer createConnectionConsumer(Queue queue, String s, ServerSessionPool serverSessionPool, int i) throws JMSException { 088 throw createNotSupported("createConnectionConsumer()"); 089 } 090 091 public ConnectionConsumer createConnectionConsumer(Topic topic, String s, ServerSessionPool serverSessionPool, int i) throws JMSException { 092 throw createNotSupported("createConnectionConsumer()"); 093 } 094 095 protected JMSException createNotSupported(String text) { 096 return new JMSException("Operation: " + text + " is not supported for this proxy JCA ResourceAdapter provider"); 097 } 098 }