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: 112   Methods: 8
NCLOC: 66   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
InvokeFactoryServiceConstructor.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 java.util.List;
 18   
 
 19   
 import org.apache.hivemind.ServiceImplementationFactory;
 20   
 import org.apache.hivemind.internal.Module;
 21   
 import org.apache.hivemind.internal.ServicePoint;
 22   
 import org.apache.hivemind.internal.ServiceImplementationConstructor;
 23   
 import org.apache.hivemind.schema.Schema;
 24   
 
 25   
 /**
 26   
  * Constructs a new service by invoking methods on
 27   
  * another service (which implements the
 28   
  * {@link org.apache.hivemind.ServiceImplementationFactory} interface.
 29   
  *
 30   
  * @author Howard Lewis Ship
 31   
  */
 32   
 public final class InvokeFactoryServiceConstructor
 33   
     extends BaseLocatable
 34   
     implements ServiceImplementationConstructor
 35   
 {
 36   
     private String _factoryServiceId;
 37   
     private ServicePoint _serviceExtensionPoint;
 38   
     private Module _contributingModule;
 39   
 
 40   
     /** List of {@link org.apache.hivemind.Element}, the raw XML parameters. */
 41   
     private List _parameters;
 42   
 
 43   
     /** The factory service to be invoked. */
 44   
     private ServiceImplementationFactory _factory;
 45   
 
 46   
     /** The parameters converted to objects as per the factory's parameter schema. */
 47   
     private List _convertedParameters;
 48   
 
 49  214
     public Object constructCoreServiceImplementation()
 50   
     {
 51  214
         if (_factory == null)
 52   
         {
 53  212
             ServicePoint factoryPoint = _contributingModule.getServicePoint(_factoryServiceId);
 54   
 
 55  212
             _factory =
 56   
                 (ServiceImplementationFactory) factoryPoint.getService(
 57   
                     ServiceImplementationFactory.class);
 58   
 
 59  212
             Schema schema = factoryPoint.getParametersSchema();
 60   
 
 61  212
             SchemaProcessorImpl processor =
 62   
                 new SchemaProcessorImpl(_contributingModule.getErrorHandler(), schema);
 63   
 
 64  212
             processor.process(_parameters, _contributingModule);
 65   
 
 66  212
             _convertedParameters = processor.getElements();
 67   
         }
 68   
 
 69  214
         return _factory.createCoreServiceImplementation(
 70   
             _serviceExtensionPoint.getExtensionPointId(),
 71   
             _serviceExtensionPoint.getServiceInterface(),
 72   
             _contributingModule,
 73   
             _convertedParameters);
 74   
     }
 75   
 
 76  1
     public Module getContributingModule()
 77   
     {
 78  1
         return _contributingModule;
 79   
     }
 80   
 
 81  590
     public void setContributingModule(Module module)
 82   
     {
 83  590
         _contributingModule = module;
 84   
     }
 85   
 
 86  1
     public List getParameters()
 87   
     {
 88  1
         return _parameters;
 89   
     }
 90   
 
 91  1
     public ServicePoint getServiceExtensionPoint()
 92   
     {
 93  1
         return _serviceExtensionPoint;
 94   
     }
 95   
 
 96  590
     public void setParameters(List list)
 97   
     {
 98  590
         _parameters = list;
 99   
     }
 100   
 
 101  589
     public void setFactoryServiceId(String string)
 102   
     {
 103  589
         _factoryServiceId = string;
 104   
     }
 105   
 
 106  590
     public void setServiceExtensionPoint(ServicePoint point)
 107   
     {
 108  590
         _serviceExtensionPoint = point;
 109   
     }
 110   
 
 111   
 }
 112