Clover coverage report - Code Coverage for hivemind-lib release 1.0-beta-2
Coverage timestamp: Sun Aug 1 2004 14:04:17 EDT
file stats: LOC: 69   Methods: 3
NCLOC: 36   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
SpringLookupFactory.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.lib.impl;
 16   
 
 17   
 import java.util.List;
 18   
 
 19   
 import org.apache.hivemind.HiveMind;
 20   
 import org.apache.hivemind.ServiceImplementationFactory;
 21   
 import org.apache.hivemind.impl.BaseLocatable;
 22   
 import org.apache.hivemind.internal.Module;
 23   
 import org.apache.hivemind.lib.SpringBeanFactorySource;
 24   
 import org.springframework.beans.factory.BeanFactory;
 25   
 
 26   
 /**
 27   
  * Implementation of {@link org.apache.hivemind.ServiceImplementationFactory}
 28   
  * that doesn't create beans, but instead it looks them up inside a Spring 
 29   
  * {@link org.springframework.beans.factory.BeanFactory}.
 30   
  *
 31   
  * @author Howard Lewis Ship
 32   
  */
 33   
 public class SpringLookupFactory extends BaseLocatable implements ServiceImplementationFactory
 34   
 {
 35   
     private String _pointId;
 36   
     private SpringBeanFactorySource _defaultBeanFactorySource;
 37   
 
 38  3
     public Object createCoreServiceImplementation(
 39   
         String serviceId,
 40   
         Class serviceInterface,
 41   
         Module invokingModule,
 42   
         List parameters)
 43   
     {
 44  3
         HiveMind.checkFactoryParameterCount(_pointId, parameters, 1);
 45   
 
 46  3
         SpringBeanParameter p = (SpringBeanParameter) parameters.get(0);
 47   
 
 48  3
         String beanName = p.getName();
 49  3
         SpringBeanFactorySource s = p.getBeanFactorySource();
 50   
 
 51  3
         if (s == null)
 52  2
             s = _defaultBeanFactorySource;
 53   
 
 54  3
         BeanFactory f = s.getBeanFactory();
 55   
 
 56  3
         return f.getBean(beanName, serviceInterface);
 57   
     }
 58   
 
 59  2
     public void setDefaultBeanFactorySource(SpringBeanFactorySource source)
 60   
     {
 61  2
         _defaultBeanFactorySource = source;
 62   
     }
 63   
 
 64  1
     public void setPointId(String string)
 65   
     {
 66  1
         _pointId = string;
 67   
     }
 68   
 }
 69