1 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.impl.XmlModuleDescriptorProvider; 24 import org.apache.hivemind.util.FileResource; 25 26 31 public class ExampleUtils 32 { 33 39 public static Registry buildRegistry(String fileName) 40 { 41 45 String projectRoot = System.getProperty("PROJECT_ROOT", "."); 46 String path = projectRoot + "/examples/src/descriptor/META-INF/" + fileName; 47 48 ClassResolver resolver = new DefaultClassResolver(); 49 RegistryBuilder builder = new RegistryBuilder(); 50 51 builder.addModuleDescriptorProvider(new XmlModuleDescriptorProvider(resolver)); 52 53 builder.addModuleDescriptorProvider(new XmlModuleDescriptorProvider(resolver, 56 new FileResource(path))); 57 58 return builder.constructRegistry(Locale.getDefault()); 59 } 60 61 } | Popular Tags |