struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Musachy Barroso" <musa...@gmail.com>
Subject Re: [VOTE] Bring Convention plugin into trunk and deprecate Zero Config
Date Tue, 15 Jul 2008 13:43:17 GMT
the important code is this PackageBasedActionConfigBuilder:findActions:

               ClassFinder finder = new ClassFinder(getClassLoader(),
buildUrlSet().getUrls(), true);

                // named packages
                if (actionPackages != null) {
                    for (String packageName : actionPackages) {
                        Test<ClassFinder.ClassInfo> test =
getPackageFinderTest(packageName);
                        classes.addAll(finder.findClasses(test));
                    }
                }

                //package locators
                if (packageLocators != null &&
!disablePackageLocatorsScanning) {
                    for (String packageLocator : packageLocators) {
                        Test<ClassFinder.ClassInfo> test =
getPackageLocatorTest(packageLocator);
                        classes.addAll(finder.findClasses(test));
                    }
                }

the class finder will find classes in all jars that are not excluded
by buildUrlSet(). Then the classes that match the actionPackages
(named packages like "com.my.package") will be queued for processing,
as well as classes whose package matches one of the locators
("action", "actions", etc). If you name your packages using
actionPackages, the plugin will find the classes in them. You said you
had to exclude some jars, what kind of problem did you have? it could
be a bug in the plugin.

musachy

On Tue, Jul 15, 2008 at 9:32 AM, Piero Sartini <lists@pierosartini.de> wrote:
>> yes, the locators. We could have an option like a "jar locators" which
>> would limit the jars scanned, it would be really easy to implement
>> with the URLSets.
>
> This could be a solution, but I can't imagine how to find a restriction that
> is useful.... We had to enforce a naming scheme on the modules. Wouldn't my
> first suggestion be easier? Or is that not possible at all? I am pretty lost
> with these class scanning code...
>
> The best thing for me would be if the locators are applied to a given parent
> package only (like com.project.**). Everything else is ignored. So instead of
> excluding packages I do not need, I just include what is needed. So I am able
> to restrict the scanning to areas of the package hierarchy where I have
> control. And it should give much better performance as well.
>
> If you could give me a hint in the right direction how to implement this I am
> happy and thankful :)
>
>        Piero
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message