Clover coverage report - Code Coverage for hivemind release 1.0-beta-1
Coverage timestamp: Sat Jul 3 2004 09:41:37 EDT
file stats: LOC: 75   Methods: 6
NCLOC: 43   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
CreateClassServiceConstructor.java 100% 100% 100% 100%
coverage
 1   
 //  Copyright 2004 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;
 16   
 
 17   
 import org.apache.hivemind.ClassResolver;
 18   
 import org.apache.hivemind.internal.Module;
 19   
 import org.apache.hivemind.internal.ServiceImplementationConstructor;
 20   
 import org.apache.hivemind.util.ConstructorUtils;
 21   
 
 22   
 /**
 23   
  * Constructs a service by instantiating a class.
 24   
  *
 25   
  * @author Howard Lewis Ship
 26   
  */
 27   
 public final class CreateClassServiceConstructor
 28   
     extends BaseLocatable
 29   
     implements ServiceImplementationConstructor
 30   
 {
 31   
     private Module _contributingModule;
 32   
     private String _instanceClassName;
 33   
     private Class _instanceClass;
 34   
 
 35  184
     public Object constructCoreServiceImplementation()
 36   
     {
 37  184
         Class instanceClass = getInstanceClass();
 38   
 
 39  184
         return ConstructorUtils.invokeConstructor(instanceClass, null, this);
 40   
     }
 41   
 
 42  184
     private synchronized Class getInstanceClass()
 43   
     {
 44  184
         if (_instanceClass == null)
 45   
         {
 46  183
             ClassResolver resolver = _contributingModule.getClassResolver();
 47   
 
 48  183
             _instanceClass = resolver.findClass(_instanceClassName);
 49   
         }
 50   
 
 51  184
         return _instanceClass;
 52   
     }
 53   
 
 54  1
     public Module getContributingModule()
 55   
     {
 56  1
         return _contributingModule;
 57   
     }
 58   
 
 59  1
     public String getInstanceClassName()
 60   
     {
 61  1
         return _instanceClassName;
 62   
     }
 63   
 
 64  255
     public void setContributingModule(Module module)
 65   
     {
 66  255
         _contributingModule = module;
 67   
     }
 68   
 
 69  255
     public void setInstanceClassName(String string)
 70   
     {
 71  255
         _instanceClassName = string;
 72   
     }
 73   
 
 74   
 }
 75