Clover coverage report - Code Coverage for hivemind-examples release 1.0-rc-2
Coverage timestamp: Sat Sep 11 2004 09:10:24 EDT
file stats: LOC: 62   Methods: 1
NCLOC: 20   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
ExampleUtils.java - 0% 0% 0%
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.examples;
 16   
 
 17   
 import java.util.Locale;
 18   
 
 19   
 import org.apache.hivemind.ClassResolver;
 20   
 import org.apache.hivemind.Registry;
 21   
 import org.apache.hivemind.impl.DefaultClassResolver;
 22   
 import org.apache.hivemind.impl.RegistryBuilder;
 23   
 import org.apache.hivemind.util.FileResource;
 24   
 
 25   
 /**
 26   
  * Utilities needed by the examples.
 27   
  *
 28   
  * @author Howard Lewis Ship
 29   
  */
 30   
 public class ExampleUtils
 31   
 {
 32   
     /**
 33   
      * Builds a Registry for a file stored in the src/descriptor/META-INF directory.
 34   
      * 
 35   
      * @param fileName -- the name of the module descriptor file.
 36   
      */
 37  0
     public static Registry buildRegistry(String fileName)
 38   
     {
 39   
         // The examples package is structured oddly (so that it doesn't interfere with
 40   
         // the main HiveMind framework tests), so we have to go through some gyrations
 41   
         // here that aren't necessary in an ordinary HiveMind application.
 42   
 
 43  0
         String projectRoot = System.getProperty("PROJECT_ROOT", ".");
 44  0
         String path = projectRoot + "/examples/src/descriptor/META-INF/" + fileName;
 45   
 
 46  0
         RegistryBuilder builder = new RegistryBuilder();
 47  0
         ClassResolver resolver = new DefaultClassResolver();
 48   
 
 49   
         // Process standard files, on the classpath.
 50   
 
 51  0
         builder.processModules(resolver);
 52   
 
 53   
         // Process the examples.xml file, which (given its non-standard name) 
 54   
         // is not visible.
 55   
 
 56  0
         builder.processModule(resolver, new FileResource(path));
 57   
 
 58  0
         return builder.constructRegistry(Locale.getDefault());
 59   
     }
 60   
 
 61   
 }
 62