// Tag interface
//-------------------------------------------------------------------------
public void doTag(XMLOutput output) throws Exception {
ConnectionContext messengerTag = (ConnectionContext) findAncestorWithClass( ConnectionContext.class );
if ( messengerTag == null ) {
throw new JellyException("<jms:destination> tag must be within a <jms:connection> or <jms:send> or <jms:receive> tag");
}
Messenger messenger = messengerTag.getConnection();
String subject = (name != null) ? name : getBodyText();
Destination destination = messenger.getDestination( subject );
if ( var != null ) {
context.setVariable( var, destination );
}
else {
MessageOperationTag tag = (MessageOperationTag) findAncestorWithClass( MessageOperationTag.class );
if ( tag == null ) {
throw new JellyException("<jms:destination> tag must be within a <jms:send> or <jms:receive> tag or the 'var' attribute should be specified");
}
tag.setDestination( destination );
}
}