Clover coverage report - Code Coverage for hivemind-lib release 1.0
Coverage timestamp: Wed Sep 22 2004 08:05:53 EDT
file stats: LOC: 62   Methods: 2
NCLOC: 31   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.commons.logging.Log;
 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 SpringBeanFactorySource _defaultBeanFactorySource;
 36   
 
 37  3
     public Object createCoreServiceImplementation(
 38   
         String serviceId,
 39   
         Class serviceInterface,
 40   
         Log serviceLog,
 41   
         Module invokingModule,
 42   
         List parameters)
 43   
     {
 44  3
         SpringBeanParameter p = (SpringBeanParameter) parameters.get(0);
 45   
 
 46  3
         String beanName = p.getName();
 47  3
         SpringBeanFactorySource s = p.getBeanFactorySource();
 48   
 
 49  3
         if (s == null)
 50  2
             s = _defaultBeanFactorySource;
 51   
 
 52  3
         BeanFactory f = s.getBeanFactory();
 53   
 
 54  3
         return f.getBean(beanName, serviceInterface);
 55   
     }
 56   
 
 57  2
     public void setDefaultBeanFactorySource(SpringBeanFactorySource source)
 58   
     {
 59  2
         _defaultBeanFactorySource = source;
 60   
     }
 61   
 }
 62