ClassFinder.ClassInfo has a list of implemented interfaces, so I am checking if "com.opensymphony.xwork2.Action" is one of them
musachy On Thu, May 29, 2008 at 11:47 AM, Brian Pontarelli <[EMAIL PROTECTED]> wrote: > > Just a quick question. How did you modify ClasFinder to check for > implementation of the XWork Action interface? Doesn't this need to parse up > the inheritance chain as well as the implementation chain? It didn't look > like ClassFinder currently did that, unless I missed it. > > -bp > > > Musachy Barroso wrote: >> >> Thanks for the tips, I wasn't using UrlSet at yet, but that looks >> great . I am using ASM 3 with it, I don't know about new features you >> could take advantage of, but it is easy to get it running. I think >> this method is wrong on ClassInfo: >> >> public String getPackageName(){ >> return name.substring(name.lastIndexOf(".")+1, name.length()); >> } >> >> musachy >> >> On Wed, May 28, 2008 at 9:04 PM, David Blevins <[EMAIL PROTECTED]> >> wrote: >> >>> >>> On May 28, 2008, at 4:54 PM, Musachy Barroso wrote: >>> >>> >>>>> >>>>> It is a standalone library, used heavily by the OpenEJB and Geronimo >>>>> guys. >>>>> >>>> >>>> oops. >>>> >>>> >>>>> >>>>> Personally, I favor copying the code over and jarjar'ing the asm >>>>> dependency. >>>>> >>>> >>>> +1 >>>> >>> >>> +1 :) >>> >>> Just wanted to throw my support in for fun. >>> >>> I'd pull in the ClassFinder and UrlSet. ClassFinder.java is a standalone >>> class (aside from ASM), but the UrlSet is really useful for narrowing >>> down >>> the scope of jars that you search which of course makes things even >>> faster. >>> >>> If you know the exact jar(s) you want to search, you're set. But if you >>> simply have a classloader and want to search everything "in" it, you >>> might >>> want to rip out some standard vm jars and other jars you know you do not >>> care about. Here's an example usage: >>> >>> // Just this line right here is good as is will diff the classpath of >>> the >>> // parent classloader against the classpath of the supplied classloader >>> and >>> // give you the difference. >>> UrlSet urlSet = new UrlSet(classLoader); >>> >>> // If you happen to need to search the system classloader, the >>> difference >>> // still leaves a lot of useless garbage >>> urlSet = urlSet.exclude(ClassLoader.getSystemClassLoader().getParent()); >>> urlSet = urlSet.excludeJavaExtDirs(); >>> urlSet = urlSet.excludeJavaEndorsedDirs(); >>> urlSet = urlSet.excludeJavaHome(); >>> urlSet = urlSet.excludePaths(System.getProperty("sun.boot.class.path", >>> "")); >>> urlSet = urlSet.exclude(".*/JavaVM.framework/.*"); >>> >>> // If the remainder contains a lot of third party libraries required by >>> you >>> // that you know don't contain annotations you're interested in, then it >>> can >>> // be good to aggressively cut those out. >>> urlSet = urlSet.exclude(".*/activemq-(core|ra)-[\\d.]+.jar(!/)?"); >>> urlSet = urlSet.exclude(".*/catalina-[\\d.]+.jar(!/)?"); >>> urlSet = >>> >>> urlSet.exclude(".*/commons-(logging|cli|pool|lang|collections|dbcp)-[\\d.]+.jar(!/)?"); >>> urlSet = urlSet.exclude(".*/derby-[\\d.]+.jar(!/)?"); >>> urlSet = >>> urlSet.exclude(".*/geronimo-(connector|transaction)-[\\d.]+.jar(!/)?"); >>> urlSet = urlSet.exclude(".*/geronimo-[^/]+_spec-[\\d.]+.jar(!/)?"); >>> urlSet = >>> urlSet.exclude(".*/geronimo-javamail_([\\d.]+)_mail-[\\d.]+.jar(!/)?"); >>> urlSet = urlSet.exclude(".*/hsqldb-[\\d.]+.jar(!/)?"); >>> urlSet = urlSet.exclude(".*/idb-[\\d.]+.jar(!/)?"); >>> urlSet = urlSet.exclude(".*/jaxb-(impl|api)-[\\d.]+.jar(!/)?"); >>> urlSet = urlSet.exclude(".*/junit-[\\d.]+.jar(!/)?"); >>> urlSet = urlSet.exclude(".*/log4j-[\\d.]+.jar(!/)?"); >>> urlSet = >>> >>> urlSet.exclude(".*/openjpa-(jdbc|kernel|lib|persistence|persistence-jdbc)(-5)?-[\\d.]+.jar(!/)?"); >>> >>> // then eventually >>> List<URL> urls = urlSet.getUrls(); >>> ClassFinder classFinder = new ClassFinder(classloader, urls); >>> >>> >>> As far as the stability of the API, it hasn't changed in months and >>> months. >>> I do have one planned change involving the use of ASM 3 and new flag >>> that >>> will speed up the scanning by allowing ASM to skip by large chunks of the >>> byte code. >>> >>> Let me see if I can't get that in there real quick. >>> >>> -David >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >> >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]