KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > ra > InboundConnectionProxy


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.ra;
19
20 import javax.jms.*;
21
22 import org.apache.activemq.ActiveMQConnectionMetaData;
23
24 /**
25  * A {@link Connection} implementation which can be used with the ActiveMQ JCA
26  * Resource Adapter to publish messages using the same JMS session that is used to dispatch
27  * messages.
28  *
29  * @version $Revision$
30  */

31 public class InboundConnectionProxy implements Connection, QueueConnection, TopicConnection {
32
33     public Session createSession(boolean transacted, int ackMode) throws JMSException {
34         // TODO we could decide to barf if someone passes in incompatible options
35
return new InboundSessionProxy();
36     }
37
38     public QueueSession createQueueSession(boolean transacted, int ackMode) throws JMSException {
39         // TODO we could decide to barf if someone passes in incompatible options
40
return new InboundSessionProxy();
41     }
42
43     public TopicSession createTopicSession(boolean transacted, int ackMode) throws JMSException {
44         // TODO we could decide to barf if someone passes in incompatible options
45
return new InboundSessionProxy();
46     }
47
48     public void start() throws JMSException {
49         // the JCA RA is in control of this
50
}
51
52     public void stop() throws JMSException {
53         // the JCA RA is in control of this
54
}
55
56     public void close() throws JMSException {
57         // the JCA RA is in control of this
58
}
59
60     public ConnectionMetaData getMetaData() throws JMSException {
61         return ActiveMQConnectionMetaData.INSTANCE;
62     }
63
64     public String JavaDoc getClientID() throws JMSException {
65         throw createNotSupported("getClientID()");
66     }
67
68     public void setClientID(String JavaDoc s) throws JMSException {
69         throw createNotSupported("setClient()");
70     }
71
72     public ExceptionListener getExceptionListener() throws JMSException {
73         throw createNotSupported("getExceptionListener()");
74     }
75
76     public void setExceptionListener(ExceptionListener exceptionListener) throws JMSException {
77         throw createNotSupported("setExceptionListener()");
78     }
79
80     public ConnectionConsumer createConnectionConsumer(Destination destination, String JavaDoc s, ServerSessionPool serverSessionPool, int i) throws JMSException {
81         throw createNotSupported("createConnectionConsumer()");
82     }
83
84     public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String JavaDoc s, String JavaDoc s1, ServerSessionPool serverSessionPool, int i) throws JMSException {
85         throw createNotSupported("createDurableConnectionConsumer()");
86     }
87
88     public ConnectionConsumer createConnectionConsumer(Queue queue, String JavaDoc s, ServerSessionPool serverSessionPool, int i) throws JMSException {
89         throw createNotSupported("createConnectionConsumer()");
90     }
91
92     public ConnectionConsumer createConnectionConsumer(Topic topic, String JavaDoc s, ServerSessionPool serverSessionPool, int i) throws JMSException {
93         throw createNotSupported("createConnectionConsumer()");
94     }
95
96     protected JMSException createNotSupported(String JavaDoc text) {
97         return new JMSException("Operation: " + text + " is not supported for this proxy JCA ResourceAdapter provider");
98     }
99 }
100
Popular Tags