You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by mo...@apache.org on 2003/01/26 07:24:48 UTC

cvs commit: jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms ConnectionContext.java ConnectionTag.java DestinationTag.java MapEntryTag.java MapMessageTag.java MessageOperationTag.java MessageTag.java ObjectMessageTag.java OnMessageTag.java PropertyTag.java ReceiveTag.java SendTag.java StopwatchTag.java SubscribeTag.java TextMessageTag.java

morgand     2003/01/25 22:24:48

  Modified:    jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms
                        ConnectionContext.java ConnectionTag.java
                        DestinationTag.java MapEntryTag.java
                        MapMessageTag.java MessageOperationTag.java
                        MessageTag.java ObjectMessageTag.java
                        OnMessageTag.java PropertyTag.java ReceiveTag.java
                        SendTag.java StopwatchTag.java SubscribeTag.java
                        TextMessageTag.java
  Log:
  converted jms taglib from Exception to JellyTagException
  
  Revision  Changes    Path
  1.2       +5 -5      jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/ConnectionContext.java
  
  Index: ConnectionContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/ConnectionContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConnectionContext.java	7 Jan 2003 16:11:01 -0000	1.1
  +++ ConnectionContext.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -63,7 +63,7 @@
   
   import javax.jms.JMSException;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   
   import org.apache.commons.messenger.Messenger;
   
  @@ -74,5 +74,5 @@
     */
   public interface ConnectionContext {
   
  -    public Messenger getConnection() throws JellyException, JMSException;
  +    public Messenger getConnection() throws JellyTagException, JMSException;
   }    
  
  
  
  1.2       +15 -7     jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/ConnectionTag.java
  
  Index: ConnectionTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/ConnectionTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConnectionTag.java	7 Jan 2003 16:11:00 -0000	1.1
  +++ ConnectionTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -61,7 +61,9 @@
    */
   package org.apache.commons.jelly.tags.jms;
   
  -import org.apache.commons.jelly.JellyException;
  +import javax.jms.JMSException;
  +
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   import org.apache.commons.messenger.Messenger;
  @@ -91,11 +93,17 @@
       
       // Tag interface
       //-------------------------------------------------------------------------                    
  -    public void doTag(XMLOutput output) throws Exception {        
  -        connection = MessengerManager.get( name );
  +    public void doTag(XMLOutput output) throws JellyTagException {        
  +        
  +        try { 
  +            connection = MessengerManager.get( name );
  +        }
  +        catch (JMSException e) {
  +            throw new JellyTagException(e);
  +        }
   
           if (connection == null) {        
  -            throw new JellyException( "Could not find a JMS connection called: " + name );
  +            throw new JellyTagException( "Could not find a JMS connection called: " + name );
           }
   
           if ( var != null ) {
  
  
  
  1.2       +21 -12    jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/DestinationTag.java
  
  Index: DestinationTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/DestinationTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DestinationTag.java	7 Jan 2003 16:11:01 -0000	1.1
  +++ DestinationTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -62,8 +62,9 @@
   package org.apache.commons.jelly.tags.jms;
   
   import javax.jms.Destination;
  +import javax.jms.JMSException;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   import org.apache.commons.messenger.Messenger;
  @@ -83,24 +84,32 @@
           
       // Tag interface
       //-------------------------------------------------------------------------                    
  -    public void doTag(XMLOutput output) throws Exception {        
  +    public void doTag(XMLOutput output) throws JellyTagException {        
           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");
  +            throw new JellyTagException("<jms:destination> tag must be within a <jms:connection> or <jms:send> or <jms:receive> tag");
           }
  -        Messenger messenger = messengerTag.getConnection();
  -        if (messenger == null) {
  -            throw new JellyException("No JMS Connection could be found!" );            
  +        
  +        Destination destination = null;
  +        try {
  +            Messenger messenger = messengerTag.getConnection();
  +            if (messenger == null) {
  +                throw new JellyTagException("No JMS Connection could be found!" );            
  +            }
  +            String subject = (name != null) ? name : getBodyText();
  +            destination = messenger.getDestination( subject );
  +        } 
  +        catch (JMSException e) {
  +            throw new JellyTagException(e);
           }
  -        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");
  +                throw new JellyTagException("<jms:destination> tag must be within a <jms:send> or <jms:receive> tag or the 'var' attribute should be specified");
               }
               tag.setDestination( destination );
           }
  
  
  
  1.2       +7 -6      jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/MapEntryTag.java
  
  Index: MapEntryTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/MapEntryTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MapEntryTag.java	7 Jan 2003 16:11:01 -0000	1.1
  +++ MapEntryTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -61,7 +61,7 @@
    */
   package org.apache.commons.jelly.tags.jms;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.MissingAttributeException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
  @@ -82,14 +82,15 @@
       
       // Tag interface
       //-------------------------------------------------------------------------                    
  -    public void doTag(XMLOutput output) throws Exception {        
  +    public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {        
           if ( name == null ) {
               throw new MissingAttributeException("name");
           }
           MapMessageTag tag = (MapMessageTag) findAncestorWithClass( MapMessageTag.class );
           if ( tag == null ) {
  -            throw new JellyException("<jms:mapEntry> tag must be within a <jms:mapMessage> tag");
  +            throw new JellyTagException("<jms:mapEntry> tag must be within a <jms:mapMessage> tag");
           }
  +        
           if (value != null) {
               tag.addEntry( name, value );
           }
  
  
  
  1.2       +27 -9     jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/MapMessageTag.java
  
  Index: MapMessageTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/MapMessageTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MapMessageTag.java	7 Jan 2003 16:11:01 -0000	1.1
  +++ MapMessageTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -66,6 +66,9 @@
   
   import javax.jms.Message;
   import javax.jms.MapMessage;
  +import javax.jms.JMSException;
  +
  +import org.apache.commons.jelly.JellyTagException;
   
   /** Creates a JMS MapMessage
     *
  @@ -77,9 +80,14 @@
       public MapMessageTag() {
       }
   
  -    public void addEntry(String name, Object value) throws Exception {
  +    public void addEntry(String name, Object value) throws JellyTagException {
           MapMessage message = (MapMessage) getMessage();
  -        message.setObject(name, value);
  +        try {
  +            message.setObject(name, value);
  +        } 
  +        catch (JMSException e) {
  +            throw new JellyTagException(e);
  +        }
       }
       
       // Properties
  @@ -88,19 +96,29 @@
       /**
        * Sets the Map of entries to be used for this Map Message
        */
  -    public void setMap(Map map) throws Exception {
  +    public void setMap(Map map) throws JellyTagException {
           MapMessage message = (MapMessage) getMessage();
           for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) {
               Map.Entry entry = (Map.Entry) iter.next();
               String name = entry.getKey().toString();
               Object value = entry.getValue();
  -            message.setObject(name, value);
  +            
  +            try {
  +                message.setObject(name, value);
  +            } 
  +            catch (JMSException e) {
  +                throw new JellyTagException(e);
  +            }
           }
       }
       
       // Implementation methods
       //-------------------------------------------------------------------------                            
  -    protected Message createMessage() throws Exception {
  -        return getConnection().createMapMessage();
  +    protected Message createMessage() throws JellyTagException {
  +        try {
  +            return getConnection().createMapMessage();
  +        } catch (JMSException e) {
  +            throw new JellyTagException(e);
  +        }
       }    
   }    
  
  
  
  1.2       +9 -9      jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/MessageOperationTag.java
  
  Index: MessageOperationTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/MessageOperationTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MessageOperationTag.java	7 Jan 2003 16:11:01 -0000	1.1
  +++ MessageOperationTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -64,7 +64,7 @@
   import javax.jms.Destination;
   import javax.jms.JMSException;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.messenger.Messenger;
   
  @@ -89,7 +89,7 @@
       
       // Properties
       //-------------------------------------------------------------------------                                
  -    public Messenger getConnection() throws JellyException, JMSException {
  +    public Messenger getConnection() throws JellyTagException, JMSException {
           if ( connection == null ) {
               return findConnection();
           }
  @@ -103,7 +103,7 @@
           this.connection = connection;
       }
       
  -    public Destination getDestination() throws JellyException, JMSException {
  +    public Destination getDestination() throws JellyTagException, JMSException {
           if (destination == null) {
               // if we have a subject defined, lets use it to find the destination
               if (subject != null) {
  @@ -134,10 +134,10 @@
       /**
        * Strategy Method allowing derived classes to change this behaviour
        */
  -    protected Messenger findConnection() throws JellyException, JMSException {
  +    protected Messenger findConnection() throws JellyTagException, JMSException {
           ConnectionContext messengerTag = (ConnectionContext) findAncestorWithClass( ConnectionContext.class );
           if ( messengerTag == null ) {
  -            throw new JellyException("This tag must be within a <jms:connection> tag or the 'connection' attribute should be specified");
  +            throw new JellyTagException("This tag must be within a <jms:connection> tag or the 'connection' attribute should be specified");
           }
           return messengerTag.getConnection();
       }
  @@ -145,7 +145,7 @@
       /**
        * Strategy Method allowing derived classes to change this behaviour
        */
  -    protected Destination findDestination(String subject) throws JellyException, JMSException {
  +    protected Destination findDestination(String subject) throws JellyTagException, JMSException {
           return getConnection().getDestination(subject);
       }
   }    
  
  
  
  1.2       +56 -22    jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/MessageTag.java
  
  Index: MessageTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/MessageTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MessageTag.java	7 Jan 2003 16:11:03 -0000	1.1
  +++ MessageTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -63,8 +63,9 @@
   
   import javax.jms.Destination;
   import javax.jms.Message;
  +import javax.jms.JMSException;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
   
  @@ -90,24 +91,32 @@
       }
       
       /** Adds a JMS property to the message */
  -    public void addProperty(String name, Object value) throws Exception {
  +    public void addProperty(String name, Object value) throws JellyTagException {
           Message message = getMessage();
  -        message.setObjectProperty(name, value);
  +        
  +        try {
  +            message.setObjectProperty(name, value);
  +        } catch (JMSException e) {
  +            throw new JellyTagException(e);
  +        }
       }
       
       // Tag interface
       //-------------------------------------------------------------------------                    
  -    public void doTag(XMLOutput output) throws Exception {                
  +    public void doTag(XMLOutput output) throws JellyTagException {                
           if ( var == null ) {
               // expose message to parent message consumer
               SendTag tag = (SendTag) findAncestorWithClass( SendTag.class );
               if ( tag == null ) {
  -                throw new JellyException("<jms:message> tags must either have the 'var' attribute specified or be used inside a <jms:send> tag");
  +                throw new JellyTagException("<jms:message> tags must either have the 'var' attribute specified or be used inside a <jms:send> tag");
               }
  -            tag.setMessage( getMessage() );            
  +            
  +            tag.setMessage( getMessage() );
           }
           else {
  +            
               context.setVariable( var, getMessage() );
  +
           }        
       }
       
  @@ -119,7 +128,7 @@
           this.var = var;        
       }
       
  -    public Messenger getConnection() throws Exception {
  +    public Messenger getConnection() throws JellyTagException {
           if ( connection == null ) {
               return findConnection();
           }
  @@ -133,7 +142,7 @@
           this.connection = connection;
       }
       
  -    public Message getMessage() throws Exception {
  +    public Message getMessage() throws JellyTagException {
           if ( message == null ) {
               message = createMessage();
           }
  @@ -146,35 +155,60 @@
       /**
        * Sets the JMS Correlation ID to be used on the message 
        */    
  -    public void setCorrelationID(String correlationID) throws Exception {
  -        getMessage().setJMSCorrelationID(correlationID);
  +    public void setCorrelationID(String correlationID) throws JellyTagException {
  +        try {
  +            getMessage().setJMSCorrelationID(correlationID);
  +        } 
  +        catch (JMSException e) {
  +            throw new JellyTagException(e);
  +        }
       }
       
       /**
        * Sets the reply-to destination to add to the message
        */
  -    public void setReplyTo(Destination destination) throws Exception {
  -        getMessage().setJMSReplyTo(destination);
  +    public void setReplyTo(Destination destination) throws JellyTagException {
  +        try {
  +            getMessage().setJMSReplyTo(destination);
  +        } 
  +        catch (JMSException e) {
  +            throw new JellyTagException(e);
  +        }
       }
       
       /**
        * Sets the type name of the message
        */
  -    public void setType(String type) throws Exception {
  -        getMessage().setJMSType(type);
  +    public void setType(String type) throws JellyTagException {
  +        try {
  +            getMessage().setJMSType(type);
  +        } 
  +        catch (JMSException e) {
  +            throw new JellyTagException(e);
  +        }
       }
       
       // Implementation methods
       //-------------------------------------------------------------------------                            
  -    protected Messenger findConnection() throws Exception {
  +    protected Messenger findConnection() throws JellyTagException {
           ConnectionContext messengerTag = (ConnectionContext) findAncestorWithClass( ConnectionContext.class );
           if ( messengerTag == null ) {
  -            throw new JellyException("This tag must be within a <jms:connection> tag or the 'connection' attribute should be specified");
  +            throw new JellyTagException("This tag must be within a <jms:connection> tag or the 'connection' attribute should be specified");
  +        }
  +        
  +        try {
  +            return messengerTag.getConnection();
  +        } 
  +        catch (JMSException e) {
  +            throw new JellyTagException(e);
           }
  -        return messengerTag.getConnection();
       }
       
  -    protected Message createMessage() throws Exception {
  -        return getConnection().createMessage();
  +    protected Message createMessage() throws JellyTagException {
  +        try {
  +            return getConnection().createMessage();
  +        } catch (JMSException e) {
  +            throw new JellyTagException(e);
  +        }
       }    
   }    
  
  
  
  1.2       +13 -5     jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/ObjectMessageTag.java
  
  Index: ObjectMessageTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/ObjectMessageTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ObjectMessageTag.java	7 Jan 2003 16:11:01 -0000	1.1
  +++ ObjectMessageTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -63,8 +63,11 @@
   
   import java.io.Serializable;
   
  +import javax.jms.JMSException;
   import javax.jms.Message;
   
  +import org.apache.commons.jelly.JellyTagException;
  +
   /** Creates a JMS ObjectMessage
     *
     * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  @@ -91,8 +94,13 @@
       
       // Implementation methods
       //-------------------------------------------------------------------------                            
  -    protected Message createMessage() throws Exception {
  +    protected Message createMessage() throws JellyTagException {
           Serializable value = (object != null) ? object : getBodyText();
  -        return getConnection().createObjectMessage(value);
  +        try {
  +            return getConnection().createObjectMessage(value);
  +        } 
  +        catch (JMSException e) {
  +            throw new JellyTagException(e);
  +        }
       }    
   }    
  
  
  
  1.2       +8 -8      jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/OnMessageTag.java
  
  Index: OnMessageTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/OnMessageTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OnMessageTag.java	7 Jan 2003 16:11:03 -0000	1.1
  +++ OnMessageTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -65,7 +65,7 @@
   import javax.jms.MessageListener;
   
   import org.apache.commons.jelly.JellyContext;
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.Script;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
  @@ -94,10 +94,10 @@
   
       // Tag interface
       //-------------------------------------------------------------------------                    
  -    public void doTag(XMLOutput output) throws Exception {
  +    public void doTag(XMLOutput output) throws JellyTagException {
   		ConsumerTag tag = (ConsumerTag) findAncestorWithClass(ConsumerTag.class);
   		if (tag == null) {
  -			throw new JellyException("This tag must be nested within a ConsumerTag like the subscribe tag");
  +			throw new JellyTagException("This tag must be nested within a ConsumerTag like the subscribe tag");
   		}			
   
   
  
  
  
  1.2       +6 -6      jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/PropertyTag.java
  
  Index: PropertyTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/PropertyTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PropertyTag.java	7 Jan 2003 16:11:01 -0000	1.1
  +++ PropertyTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -62,7 +62,7 @@
   
   package org.apache.commons.jelly.tags.jms;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.MissingAttributeException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
  @@ -83,13 +83,13 @@
       
       // Tag interface
       //-------------------------------------------------------------------------                    
  -    public void doTag(XMLOutput output) throws Exception {
  +    public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
           if ( name == null ) {
               throw new MissingAttributeException("name");
           }
           MessageTag tag = (MessageTag) findAncestorWithClass( MessageTag.class );
           if ( tag == null ) {
  -            throw new JellyException("<jms:property> tag must be within a <jms:message> tag");
  +            throw new JellyTagException("<jms:property> tag must be within a <jms:message> tag");
           }
           
           if ( value != null ) {
  
  
  
  1.2       +32 -25    jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/ReceiveTag.java
  
  Index: ReceiveTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/ReceiveTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ReceiveTag.java	7 Jan 2003 16:11:01 -0000	1.1
  +++ ReceiveTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -63,8 +63,9 @@
   
   import javax.jms.Destination;
   import javax.jms.Message;
  +import javax.jms.JMSException;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.XMLOutput;
   
   import org.apache.commons.logging.Log;
  @@ -88,35 +89,41 @@
       
       // Tag interface
       //-------------------------------------------------------------------------                    
  -    public void doTag(XMLOutput output) throws Exception {
  +    public void doTag(XMLOutput output) throws JellyTagException {
           // evaluate body as it may contain a <destination> tag
           invokeBody(output);
           
  -        Destination destination = getDestination();
  -        if ( destination == null ) {
  -            throw new JellyException( "No destination specified. Either specify a 'destination' attribute or use a nested <jms:destination> tag" );
  -        }
           Message message = null;
  -        if ( timeout > 0 ) {
  -            if ( log.isDebugEnabled() ) {
  -                log.debug( "Receiving message on destination: " + destination + " with timeout: " + timeout );
  +        try {
  +            Destination destination = getDestination();
  +            if ( destination == null ) {
  +                throw new JellyTagException( "No destination specified. Either specify a 'destination' attribute or use a nested <jms:destination> tag" );
               }
  -            
  -            message = getConnection().receive( destination, timeout );
  -        }
  -        else if ( timeout == 0 ) {
  -            if ( log.isDebugEnabled() ) {
  -                log.debug( "Receiving message on destination: " + destination + " with No Wait" );
  +            if ( timeout > 0 ) {
  +                if ( log.isDebugEnabled() ) {
  +                    log.debug( "Receiving message on destination: " + destination + " with timeout: " + timeout );
  +                }
  +                
  +                message = getConnection().receive( destination, timeout );
               }
  -            
  -            message = getConnection().receiveNoWait( destination );
  -        }
  -        else {
  -            if ( log.isDebugEnabled() ) {
  -                log.debug( "Receiving message on destination: " + destination );
  +            else if ( timeout == 0 ) {
  +                if ( log.isDebugEnabled() ) {
  +                    log.debug( "Receiving message on destination: " + destination + " with No Wait" );
  +                }
  +                
  +                message = getConnection().receiveNoWait( destination );
  +            }
  +            else {
  +                if ( log.isDebugEnabled() ) {
  +                    log.debug( "Receiving message on destination: " + destination );
  +                }
  +                message = getConnection().receive( destination );
               }
  -            message = getConnection().receive( destination );
           }
  +        catch (JMSException e) {
  +            throw new JellyTagException(e);
  +        }
  +            
           onMessage( message );
       }
       
  
  
  
  1.2       +17 -10    jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/SendTag.java
  
  Index: SendTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/SendTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SendTag.java	7 Jan 2003 16:11:03 -0000	1.1
  +++ SendTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -62,9 +62,10 @@
   package org.apache.commons.jelly.tags.jms;
   
   import javax.jms.Destination;
  +import javax.jms.JMSException;
   import javax.jms.Message;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.XMLOutput;
   
   /** Sends a JMS message to some destination.
  @@ -82,19 +83,25 @@
           
       // Tag interface
       //-------------------------------------------------------------------------                    
  -    public void doTag(XMLOutput output) throws Exception {
  +    public void doTag(XMLOutput output) throws JellyTagException {
           // evaluate body as it may contain a <destination> or message tag
           invokeBody(output);
           
           Message message = getMessage();
           if ( message == null ) {
  -            throw new JellyException( "No message specified. Either specify a 'message' attribute or use a nested <jms:message> tag" );
  +            throw new JellyTagException( "No message specified. Either specify a 'message' attribute or use a nested <jms:message> tag" );
           }
  -        Destination destination = getDestination();
  -        if ( destination == null ) {
  -            throw new JellyException( "No destination specified. Either specify a 'destination' attribute or use a nested <jms:destination> tag" );
  +        
  +        try {
  +            Destination destination = getDestination();
  +            if ( destination == null ) {
  +                throw new JellyTagException( "No destination specified. Either specify a 'destination' attribute or use a nested <jms:destination> tag" );
  +            }
  +            getConnection().send( destination, message );
  +        }
  +        catch (JMSException e) {
  +            throw new JellyTagException(e);
           }
  -        getConnection().send( destination, message );
       }
       
       // Properties
  
  
  
  1.2       +6 -6      jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/StopwatchTag.java
  
  Index: StopwatchTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/StopwatchTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StopwatchTag.java	7 Jan 2003 16:11:01 -0000	1.1
  +++ StopwatchTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -63,7 +63,7 @@
   
   import javax.jms.MessageListener;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.XMLOutput;
   
   import org.apache.commons.logging.Log;
  @@ -94,7 +94,7 @@
       
       // Tag interface
       //-------------------------------------------------------------------------                    
  -    public void doTag(XMLOutput output) throws Exception {
  +    public void doTag(XMLOutput output) throws JellyTagException {
   
           // evaluate body as it may contain child tags to register a MessageListener
           invokeBody(output);
  @@ -103,7 +103,7 @@
   
   		ConsumerTag tag = (ConsumerTag) findAncestorWithClass(ConsumerTag.class);
   		if (tag == null) {
  -			throw new JellyException("This tag must be nested within a ConsumerTag like the subscribe tag");
  +			throw new JellyTagException("This tag must be nested within a ConsumerTag like the subscribe tag");
   		}			
   
           // clear the listener for the next tag invocation, if caching is employed
  
  
  
  1.2       +26 -13    jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/SubscribeTag.java
  
  Index: SubscribeTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/SubscribeTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SubscribeTag.java	7 Jan 2003 16:11:03 -0000	1.1
  +++ SubscribeTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -62,9 +62,10 @@
   package org.apache.commons.jelly.tags.jms;
   
   import javax.jms.Destination;
  +import javax.jms.JMSException;
   import javax.jms.MessageListener;
   
  -import org.apache.commons.jelly.JellyException;
  +import org.apache.commons.jelly.JellyTagException;
   import org.apache.commons.jelly.XMLOutput;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -93,23 +94,30 @@
       
       // Tag interface
       //-------------------------------------------------------------------------                    
  -    public void doTag(XMLOutput output) throws Exception {
  +    public void doTag(XMLOutput output) throws JellyTagException {
   
           // evaluate body as it may contain child tags to register a MessageListener
           invokeBody(output);
           
           MessageListener listener = getMessageListener();
           if (listener == null) {
  -            throw new JellyException( "No messageListener attribute is specified so could not subscribe" );
  +            throw new JellyTagException( "No messageListener attribute is specified so could not subscribe" );
           }
   
           // clear the listener for the next tag invocation, if caching is employed
           setMessageListener(null);
   
           
  -        Destination destination = getDestination();
  +        Destination destination = null;
  +        try {
  +            destination = getDestination();
  +        } 
  +        catch (JMSException e) {
  +            throw new JellyTagException(e);
  +        }
  +        
           if ( destination == null ) {
  -            throw new JellyException( "No destination specified. Either specify a 'destination' attribute or use a nested <jms:destination> tag" );
  +            throw new JellyTagException( "No destination specified. Either specify a 'destination' attribute or use a nested <jms:destination> tag" );
           }
           
           if ( log.isDebugEnabled() ) {
  @@ -117,12 +125,17 @@
           }
               
           log.info( "About to consume to: " + destination + " with listener: " + listener );
  -            
  -        if (selector == null ) {            
  -            getConnection().addListener( destination, listener );
  +        
  +        try {
  +            if (selector == null ) {            
  +                getConnection().addListener( destination, listener );
  +            }
  +            else {
  +                getConnection().addListener( destination, selector, listener );
  +            }
           }
  -        else {
  -            getConnection().addListener( destination, selector, listener );
  +        catch (JMSException e) {
  +            throw new JellyTagException(e);
           }
       }
       
  
  
  
  1.2       +12 -5     jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/TextMessageTag.java
  
  Index: TextMessageTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/TextMessageTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TextMessageTag.java	7 Jan 2003 16:11:01 -0000	1.1
  +++ TextMessageTag.java	26 Jan 2003 06:24:47 -0000	1.2
  @@ -62,6 +62,9 @@
   package org.apache.commons.jelly.tags.jms;
   
   import javax.jms.Message;
  +import javax.jms.JMSException;
  +
  +import org.apache.commons.jelly.JellyTagException;
   
   /** Creates a JMS TextMessage
     *
  @@ -89,8 +92,12 @@
       
       // Implementation methods
       //-------------------------------------------------------------------------                            
  -    protected Message createMessage() throws Exception {
  +    protected Message createMessage() throws JellyTagException {
           String value = (text != null) ? text : getBodyText();
  -        return getConnection().createTextMessage(value);
  +        try {
  +            return getConnection().createTextMessage(value);
  +        } catch (JMSException e) {
  +            throw new JellyTagException(e);
  +        }
       }    
   }    
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>