1 7 package org.jboss.jms.server.container; 8 9 import org.jboss.aop.joinpoint.Invocation; 10 import org.jboss.aop.joinpoint.MethodInvocation; 11 import org.jboss.aop.metadata.SimpleMetaData; 12 import org.jboss.jms.destination.JBossDestination; 13 import org.jboss.jms.server.BrowserEndpointFactory; 14 import org.jboss.jms.server.DeliveryEndpointFactory; 15 import org.jboss.jms.server.MessageBroker; 16 import org.jboss.util.id.GUID; 17 18 24 public class Client 25 { 26 28 30 31 private MessageBroker broker; 32 33 35 public static Client getClient(Invocation invocation) 36 { 37 return (Client) invocation.getMetaData("JMS", "Client"); 38 } 39 40 42 public Client(MessageBroker broker) 43 { 44 this.broker = broker; 45 } 46 47 49 public SimpleMetaData createSession(MethodInvocation invocation) 50 { 51 return getMetaData(); 52 } 53 54 public SimpleMetaData createBrowser(MethodInvocation invocation) 55 { 56 SimpleMetaData result = getMetaData(); 57 58 JBossDestination destination = (JBossDestination) invocation.getArguments()[0]; 59 String selector = (String ) invocation.getArguments()[1]; 60 BrowserEndpointFactory endpointFactory = broker.getBrowserEndpointFactory(destination, selector); 61 result.addMetaData("JMS", "BrowserEndpointFactory", endpointFactory); 62 return result; 63 } 64 65 public SimpleMetaData createConsumer(MethodInvocation invocation) 66 { 67 return getMetaData(); 68 } 69 70 public SimpleMetaData createProducer(MethodInvocation invocation) 71 { 72 SimpleMetaData result = getMetaData(); 73 74 JBossDestination destination = (JBossDestination) invocation.getArguments()[0]; 75 DeliveryEndpointFactory endpointFactory = broker.getDeliveryEndpointFactory(destination); 76 result.addMetaData("JMS", "DeliveryEndpointFactory", endpointFactory); 77 return result; 78 } 79 80 public SimpleMetaData getMetaData() 81 { 82 SimpleMetaData result = new SimpleMetaData(); 83 result.addMetaData("JMS", "Client", this); 84 result.addMetaData("JMS", "OID", GUID.asString()); 85 return result; 86 } 87 88 90 92 94 96 } 97 | Popular Tags |