"alesj" wrote :
| Looks like ear's lib (or whatever user defines as 'lib')
| should be always strictly excluded in annotation scanning visitor?
I've hacked something of the following,
which I think should/could do the trick:
| public class EarLibExcludeDeployer extends
AbstractSimpleVFSRealDeployer<JBossAppMetaData>
| {
| public EarLibExcludeDeployer()
| {
| super(JBossAppMetaData.class);
| setStage(DeploymentStages.POST_CLASSLOADER);
| setOutputs(ResourceFilter.class + ".recurse");
| }
|
| public void deploy(VFSDeploymentUnit unit, JBossAppMetaData jBossAppMetaData)
throws DeploymentException
| {
| if (unit.isTopLevel() == false)
| return;
|
| try
| {
| VirtualFile root = unit.getRoot();
| String libDir = jBossAppMetaData.getLibraryDirectory();
| if (libDir == null || libDir.length() == 0) // take 'lib' even on
empty
| libDir = "lib";
| VirtualFile lib = root.getChild(libDir);
| if (lib != null)
| {
| ResourceFilter recurseFilter = new UrlExcludeResourceFilter(lib.toURL());
| unit.addAttachment(ResourceFilter.class + ".recurse",
recurseFilter, ResourceFilter.class);
| }
| }
| catch (Exception e)
| {
| throw DeploymentException.rethrowAsDeploymentException("Cannot exclude
ear's lib.", e);
| }
| }
|
| /**
| * Do exclude based on url.
| */
| private class UrlExcludeResourceFilter implements ResourceFilter
| {
| private URL url;
|
| private UrlExcludeResourceFilter(URL url)
| {
| if (url == null)
| throw new IllegalArgumentException("Null url");
| this.url = url;
| }
|
| public boolean accepts(ResourceContext rc)
| {
| return url.equals(rc.getUrl()) == false;
| }
| }
| }
|
Where this recurse ResourceFilter would
then later on be picked up by FilteredAnnotationEnvironmentDeployer.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4179413#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...