1 15 package org.apache.tapestry.pageload; 16 17 import java.util.ArrayList ; 18 import java.util.Iterator ; 19 import java.util.List ; 20 import java.util.StringTokenizer ; 21 22 import org.apache.hivemind.ClassResolver; 23 import org.apache.tapestry.INamespace; 24 import org.apache.tapestry.services.ClassFinder; 25 26 33 public class NamespaceClassSearchComponentClassProvider implements ComponentClassProvider 34 { 35 39 private String _packagesName; 40 41 private ClassFinder _classFinder; 42 43 public String provideComponentClassName(ComponentClassProviderContext context) 44 { 45 INamespace namespace = context.getNamespace(); 46 String packages = namespace.getPropertyValue(_packagesName); 47 48 String componentClassName = context.getName().replace('/', '.'); 49 50 Class clazz = _classFinder.findClass(packages, componentClassName); 51 52 return clazz == null ? null : clazz.getName(); 53 } 54 55 public void setPackagesName(String packagesName) 56 { 57 _packagesName = packagesName; 58 } 59 60 public void setClassFinder(ClassFinder classFinder) 61 { 62 _classFinder = classFinder; 63 } 64 } | Popular Tags |