Coverage report

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

 1  
 package org.apache.turbine.services;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2004 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,v 1.6.2.2 2004/05/20 03:05:18 seade Exp $
 33  
  */
 34  
 public class BaseUnicastRemoteService extends UnicastRemoteObject
 35  
         implements Service
 36  
 {
 37  
     protected Configuration configuration;
 38  
     private boolean isInitialized;
 39  
     private InitableBroker initableBroker;
 40  
     private String name;
 41  
     private ServiceBroker serviceBroker;
 42  
 
 43  
     public BaseUnicastRemoteService()
 44  
             throws RemoteException
 45  0
     {
 46  0
         isInitialized = false;
 47  0
         initableBroker = null;
 48  0
         name = null;
 49  0
         serviceBroker = null;
 50  0
     }
 51  
 
 52  
     /**
 53  
      * Returns the configuration of this service.
 54  
      *
 55  
      * @return The configuration of this service.
 56  
      */
 57  
     public Configuration getConfiguration()
 58  
     {
 59  0
         if (name == null)
 60  
         {
 61  0
             return null;
 62  
         }
 63  
         else
 64  
         {
 65  0
             if (configuration == null)
 66  
             {
 67  0
                 configuration = getServiceBroker().getConfiguration(name);
 68  
             }
 69  0
             return configuration;
 70  
         }
 71  
     }
 72  
 
 73  
     public void init(ServletConfig config)
 74  
             throws InitializationException
 75  
     {
 76  0
         setInit(true);
 77  0
     }
 78  
 
 79  
     public void setInitableBroker(InitableBroker broker)
 80  
     {
 81  0
         this.initableBroker = broker;
 82  0
     }
 83  
 
 84  
     public InitableBroker getInitableBroker()
 85  
     {
 86  0
         return initableBroker;
 87  
     }
 88  
 
 89  
     public void init(Object data)
 90  
             throws InitializationException
 91  
     {
 92  0
         init((ServletConfig) data);
 93  0
     }
 94  
 
 95  
     public void init() throws InitializationException
 96  
     {
 97  0
         setInit(true);
 98  0
     }
 99  
 
 100  
     protected void setInit(boolean value)
 101  
     {
 102  0
         isInitialized = value;
 103  0
     }
 104  
 
 105  
     public boolean getInit()
 106  
     {
 107  0
         return isInitialized;
 108  
     }
 109  
 
 110  
     /**
 111  
      * Shuts down this service.
 112  
      */
 113  
     public void shutdown()
 114  
     {
 115  0
         setInit(false);
 116  0
     }
 117  
 
 118  
     public Properties getProperties()
 119  
     {
 120  0
         return ConfigurationConverter.getProperties(getConfiguration());
 121  
     }
 122  
 
 123  
     public void setName(String name)
 124  
     {
 125  0
         this.name = name;
 126  0
     }
 127  
 
 128  
     public String getName()
 129  
     {
 130  0
         return name;
 131  
     }
 132  
 
 133  
     public ServiceBroker getServiceBroker()
 134  
     {
 135  0
         return serviceBroker;
 136  
     }
 137  
 
 138  
     public void setServiceBroker(ServiceBroker broker)
 139  
     {
 140  0
         this.serviceBroker = broker;
 141  0
     }
 142  
 }

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