Clover coverage report - Code Coverage for hivemind release 1.1
Coverage timestamp: Tue Oct 25 2005 10:47:07 EDT
file stats: LOC: 66   Methods: 3
NCLOC: 26   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
PrimitiveServiceModel.java 100% 100% 100% 100%
coverage
 1    // Copyright 2004, 2005 The Apache Software Foundation
 2    //
 3    // Licensed under the Apache License, Version 2.0 (the "License");
 4    // you may not use this file except in compliance with the License.
 5    // You may obtain a copy of the License at
 6    //
 7    // http://www.apache.org/licenses/LICENSE-2.0
 8    //
 9    // Unless required by applicable law or agreed to in writing, software
 10    // distributed under the License is distributed on an "AS IS" BASIS,
 11    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12    // See the License for the specific language governing permissions and
 13    // limitations under the License.
 14   
 15    package org.apache.hivemind.impl.servicemodel;
 16   
 17    import org.apache.hivemind.events.RegistryShutdownListener;
 18    import org.apache.hivemind.impl.ConstructableServicePoint;
 19   
 20    /**
 21    * Implementation of {@link org.apache.hivemind.internal.ServiceModel} for the primitive services
 22    * (that do not include the standard deferred instantiation proxy).
 23    *
 24    * @author Howard Lewis Ship
 25    */
 26    public final class PrimitiveServiceModel extends AbstractServiceModelImpl
 27    {
 28    private Object _constructedService;
 29   
 30  386 public PrimitiveServiceModel(ConstructableServicePoint servicePoint)
 31    {
 32  386 super(servicePoint);
 33    }
 34   
 35    /**
 36    * Constructs the service (the first time this is invoked) and returns it.
 37    */
 38  387 public synchronized Object getService()
 39    {
 40  387 if (_constructedService == null)
 41    {
 42  386 _constructedService = constructServiceImplementation();
 43  383 if( _constructedService instanceof RegistryShutdownListener )
 44    {
 45  4 getShutdownCoordinatorService().addRegistryShutdownListener( ( RegistryShutdownListener )_constructedService );
 46    }
 47    }
 48   
 49    // Note: if the service's declared interface is a class AND
 50    // the service has interceptors, then it will not be possible
 51    // to cast the result (since the returned interceptor will implement
 52    // the synthetic service interface).
 53   
 54  384 return _constructedService;
 55    }
 56   
 57    /**
 58    * Invokes {@link #getService()} to ensure that the core service implementation has been
 59    * instantiated.
 60    */
 61  1 public void instantiateService()
 62    {
 63  1 getService();
 64    }
 65   
 66    }