Coverage report

  %line %branch
org.apache.turbine.services.BaseUnicastRemoteService
0% 
0% 

 1  
 package org.apache.turbine.services;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2005 The Apache Software Foundation.
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License")
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 import java.rmi.RemoteException;
 20  
 import java.rmi.server.UnicastRemoteObject;
 21  
 import java.util.Properties;
 22  
 import javax.servlet.ServletConfig;
 23  
 
 24  
 import org.apache.commons.configuration.Configuration;
 25  
 import org.apache.commons.configuration.ConfigurationConverter;
 26  
 
 27  
 /**
 28  
  * A base implementation of an {@link java.rmi.server.UnicastRemoteObject}
 29  
  * as a Turbine {@link org.apache.turbine.services.Service}.
 30  
  *
 31  
  * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
 32  
  * @version $Id: BaseUnicastRemoteService.java 278822 2005-09-05 19:53:05Z henning $
 33  
  */
 34  
 public class BaseUnicastRemoteService extends UnicastRemoteObject
 35  
         implements Service
 36  
 {
 37  
     /** Serial Version UID */
 38  
     private static final long serialVersionUID = -7775459623190960297L;
 39  
 
 40  
     protected Configuration configuration;
 41  
     private boolean isInitialized;
 42  
     private InitableBroker initableBroker;
 43  
     private String name;
 44  
     private ServiceBroker serviceBroker;
 45  
 
 46  
     public BaseUnicastRemoteService()
 47  
             throws RemoteException
 48  0
     {
 49  0
         isInitialized = false;
 50  0
         initableBroker = null;
 51  0
         name = null;
 52  0
         serviceBroker = null;
 53  0
     }
 54  
 
 55  
     /**
 56  
      * Returns the configuration of this service.
 57  
      *
 58  
      * @return The configuration of this service.
 59  
      */
 60  
     public Configuration getConfiguration()
 61  
     {
 62  0
         if (name == null)
 63  
         {
 64  0
             return null;
 65  
         }
 66  
         else
 67  
         {
 68  0
             if (configuration == null)
 69  
             {
 70  0
                 configuration = getServiceBroker().getConfiguration(name);
 71  
             }
 72  0
             return configuration;
 73  
         }
 74  
     }
 75  
 
 76  
     public void init(ServletConfig config)
 77  
             throws InitializationException
 78  
     {
 79  0
         setInit(true);
 80  0
     }
 81  
 
 82  
     public void setInitableBroker(InitableBroker broker)
 83  
     {
 84  0
         this.initableBroker = broker;
 85  0
     }
 86  
 
 87  
     public InitableBroker getInitableBroker()
 88  
     {
 89  0
         return initableBroker;
 90  
     }
 91  
 
 92  
     public void init(Object data)
 93  
             throws InitializationException
 94  
     {
 95  0
         init((ServletConfig) data);
 96  0
     }
 97  
 
 98  
     public void init() throws InitializationException
 99  
     {
 100  0
         setInit(true);
 101  0
     }
 102  
 
 103  
     protected void setInit(boolean value)
 104  
     {
 105  0
         isInitialized = value;
 106  0
     }
 107  
 
 108  
     public boolean getInit()
 109  
     {
 110  0
         return isInitialized;
 111  
     }
 112  
 
 113  
     /**
 114  
      * Shuts down this service.
 115  
      */
 116  
     public void shutdown()
 117  
     {
 118  0
         setInit(false);
 119  0
     }
 120  
 
 121  
     public Properties getProperties()
 122  
     {
 123  0
         return ConfigurationConverter.getProperties(getConfiguration());
 124  
     }
 125  
 
 126  
     public void setName(String name)
 127  
     {
 128  0
         this.name = name;
 129  0
     }
 130  
 
 131  
     public String getName()
 132  
     {
 133  0
         return name;
 134  
     }
 135  
 
 136  
     public ServiceBroker getServiceBroker()
 137  
     {
 138  0
         return serviceBroker;
 139  
     }
 140  
 
 141  
     public void setServiceBroker(ServiceBroker broker)
 142  
     {
 143  0
         this.serviceBroker = broker;
 144  0
     }
 145  
 }

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