1 7 package org.jboss.jms.client.jvm; 8 9 import javax.jms.JMSException ; 10 import javax.naming.NamingException ; 11 import javax.naming.Reference ; 12 import javax.naming.StringRefAddr ; 13 14 import org.jboss.aop.advice.Interceptor; 15 import org.jboss.jms.client.ConnectionDelegate; 16 import org.jboss.jms.client.ImplementationDelegate; 17 import org.jboss.jms.client.JBossConnectionFactory; 18 import org.jboss.jms.client.container.ClientContainerFactory; 19 import org.jboss.jms.client.container.FactoryInterceptor; 20 import org.jboss.jms.server.MessageBroker; 21 import org.jboss.jms.server.container.Client; 22 import org.jboss.jms.server.container.ServerConnectionInterceptor; 23 import org.jboss.jms.server.container.ServerContainerFactory; 24 import org.jboss.jms.server.container.ServerFactoryInterceptor; 25 26 32 public class JVMImplementation 33 implements ImplementationDelegate 34 { 35 37 39 40 private MessageBroker broker; 41 42 44 46 public JVMImplementation(MessageBroker broker) 47 { 48 this.broker = broker; 49 } 50 51 53 55 public ConnectionDelegate createConnection(String userName, String password) throws JMSException 56 { 57 Client client = new Client(broker); 58 Interceptor[] serverInterceptors = new Interceptor[] 59 { 60 ServerFactoryInterceptor.singleton, 61 ServerConnectionInterceptor.singleton 62 }; 63 ConnectionDelegate delegate = ServerContainerFactory.getConnectionContainer(this, serverInterceptors, client.getMetaData()); 64 65 Interceptor[] clientInterceptors = new Interceptor[] 66 { 67 FactoryInterceptor.singleton 68 }; 69 return ClientContainerFactory.getConnectionContainer(this, delegate, clientInterceptors, null); 70 } 71 72 public Reference getReference() throws NamingException 73 { 74 return new Reference 75 ( 76 JBossConnectionFactory.class.getName(), 77 new StringRefAddr ("dummy", "dummy"), 78 JVMImplementationFactory.class.getName(), 79 null 80 ); 81 } 82 83 85 87 89 91 } 92 | Popular Tags |