Coverage report

  %line %branch
org.apache.commons.jelly.tags.jmx.ServerTag
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  
 
 17  
 package org.apache.commons.jelly.tags.jmx;
 18  
 
 19  
 import javax.management.MBeanServer;
 20  
 import javax.management.MBeanServerFactory;
 21  
 
 22  
 import org.apache.commons.jelly.JellyTagException;
 23  
 import org.apache.commons.jelly.MissingAttributeException;
 24  
 import org.apache.commons.jelly.TagSupport;
 25  
 import org.apache.commons.jelly.XMLOutput;
 26  
 import org.apache.commons.logging.Log;
 27  
 import org.apache.commons.logging.LogFactory;
 28  
 
 29  
 /**
 30  
  * Binds a Java bean to the given named Jelly tag so that the attributes of
 31  
  * the tag set the bean properties..
 32  
  *
 33  
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
 34  
  * @version $Revision: 1.4 $
 35  
  */
 36  0
 public class ServerTag extends TagSupport {
 37  
 
 38  
     /** The Log to which logging calls will be made. */
 39  0
     private static final Log log = LogFactory.getLog(ServerTag.class);
 40  
 
 41  
     private MBeanServer server;
 42  
 
 43  0
     public ServerTag() {
 44  0
     }
 45  
 
 46  
     // Tag interface
 47  
     //-------------------------------------------------------------------------
 48  
     public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
 49  
 
 50  
         // force the creation of a Server
 51  0
         MBeanServer server = getServer();
 52  
 
 53  
         // allow children to register beans
 54  0
         invokeBody(output);
 55  0
     }
 56  
 
 57  
 
 58  
     // Properties
 59  
     //-------------------------------------------------------------------------
 60  
     /**
 61  
      * @return MBeanServer
 62  
      */
 63  
     public MBeanServer getServer() {
 64  0
         if (server == null) {
 65  0
             server = createServer();
 66  
         }
 67  0
         return server;
 68  
     }
 69  
 
 70  
     /**
 71  
      * Sets the server.
 72  
      * @param server The server to set
 73  
      */
 74  
     public void setServer(MBeanServer server) {
 75  0
         this.server = server;
 76  0
     }
 77  
 
 78  
 
 79  
 
 80  
     // Implementation methods
 81  
     //-------------------------------------------------------------------------
 82  
     /**
 83  
      * Factory method to lazily create an MBeanServer if none is supplied
 84  
      *
 85  
      * @return MBeanServer
 86  
      */
 87  
     protected MBeanServer createServer() {
 88  0
         return MBeanServerFactory.newMBeanServer();
 89  
     }
 90  
 
 91  
 }

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