1 4 5 package org.jfox.ejb.handler; 6 7 import java.lang.reflect.Method ; 8 import java.util.Iterator ; 9 import javax.ejb.EJBException ; 10 import javax.ejb.EnterpriseBean ; 11 import javax.ejb.MessageDrivenBean ; 12 13 import org.jfox.ejb.Bucket; 14 import org.jfox.ejb.MDBBucket; 15 import org.jfox.ejb.connector.EJBInvocation; 16 import org.jfox.jms.message.JMSMessage; 17 18 25 26 public class Z5_MDBHandler extends AbstractHandler { 27 28 public Object invokeHome(Bucket bucket, EJBInvocation invocation, Iterator iter) throws Exception { 29 throw new EJBException ("MessageDrivenBean has no EJBHome."); 30 } 31 32 public Object invokeBean(Bucket bucket, EJBInvocation invocation, Iterator iter) throws Exception { 33 Method method = invocation.getMethod(); 34 EnterpriseBean bean = invocation.getBean(); 35 if(method.getName().equals("onMessage")) { 36 Object [] args = invocation.getArgs(); 37 String sessionId = (String )args[0]; 38 JMSMessage msg = (JMSMessage)args[2]; 39 ((MDBBucket)bucket).onMessage(sessionId,(MessageDrivenBean )bean,msg); 40 return null; 41 } 42 else { 43 return method.invoke(bean, invocation.getArgs()); 44 } 45 } 46 47 public static void main(String [] args) { 48 49 } 50 } 51 | Popular Tags |