Coverage report

  %line %branch
org.apache.commons.jelly.tags.jms.SendTag
0% 
0% 

 1  
 /*
 2  
  * Copyright 2002,2004 The Apache Software Foundation.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.apache.commons.jelly.tags.jms;
 17  
 
 18  
 import javax.jms.Destination;
 19  
 import javax.jms.JMSException;
 20  
 import javax.jms.Message;
 21  
 
 22  
 import org.apache.commons.jelly.JellyTagException;
 23  
 import org.apache.commons.jelly.XMLOutput;
 24  
 
 25  
 /** Sends a JMS message to some destination.
 26  
   *
 27  
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
 28  
   * @version $Revision: 1.5 $
 29  
   */
 30  
 public class SendTag extends MessageOperationTag {
 31  
 
 32  
     /** The JMS Message to be sent */
 33  
     private Message message;
 34  
 
 35  0
     public SendTag() {
 36  0
     }
 37  
 
 38  
     // Tag interface
 39  
     //-------------------------------------------------------------------------
 40  
     public void doTag(XMLOutput output) throws JellyTagException {
 41  
         // evaluate body as it may contain a <destination> or message tag
 42  0
         invokeBody(output);
 43  
 
 44  0
         Message message = getMessage();
 45  0
         if ( message == null ) {
 46  0
             throw new JellyTagException( "No message specified. Either specify a 'message' attribute or use a nested <jms:message> tag" );
 47  
         }
 48  
 
 49  
         try {
 50  0
             Destination destination = getDestination();
 51  0
             if ( destination == null ) {
 52  0
                 throw new JellyTagException( "No destination specified. Either specify a 'destination' attribute or use a nested <jms:destination> tag" );
 53  
             }
 54  0
             getConnection().send( destination, message );
 55  0
         }
 56  
         catch (JMSException e) {
 57  0
             throw new JellyTagException(e);
 58  
         }
 59  0
     }
 60  
 
 61  
     // Properties
 62  
     //-------------------------------------------------------------------------
 63  
     public Message getMessage() {
 64  0
         return message;
 65  
     }
 66  
 
 67  
     /**
 68  
      * Sets the JMS message to be sent
 69  
      */
 70  
     public void setMessage(Message message) {
 71  0
         this.message = message;
 72  0
     }
 73  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.