1 16 17 package org.apache.taglibs.jms; 18 19 import javax.jms.JMSException ; 20 import javax.servlet.jsp.JspException ; 21 22 import org.apache.commons.messenger.Messenger; 23 import org.apache.commons.messenger.MessengerManager; 24 25 30 public class ConnectionTag extends AbstractTag implements ConnectionContext { 31 32 33 private String var; 34 35 36 private String name; 37 38 39 private Messenger connection; 40 41 public Messenger getConnection() { 44 return connection; 45 } 46 47 public int doStartTag() throws JspException { 50 try { 51 connection = MessengerManager.get( name ); 52 } 53 catch (JMSException e) { 54 throw new JspException ( "Could not find JMS Connection named: " + name + ". Reason: " + e, e ); 55 } 56 if ( var != null ) { 57 pageContext.setAttribute( var, connection ); 58 } 59 return EVAL_BODY_INCLUDE; 60 } 61 62 public void release() { 63 name = null; 64 var = null; 65 connection = null; 66 } 67 68 71 73 public void setName(String name) { 74 this.name = name; 75 } 76 77 79 public void setVar(String var) { 80 this.var = var; 81 } 82 } 83 | Popular Tags |