-
1. Re: Russian doll packaging in arbitrary directories - JBAS-5
adrian.brock Aug 29, 2008 11:24 AM (in response to adrian.brock)"adrian@jboss.org" wrote:
1) We could create a new but deprecated "DirectoryStructure" that adds this behaviour
for backwards compatiblity purposes.
i.e. instead of ignoring directories inside deployments that don't have
a META-INF subfolder, we could scan them (recursively) for deployments.
This solution has the problem that directories no longer need extensions
to be deployable. e.g.
parent.jar/child/WEB-INF/web.xml
makes "child" a valid web application subdeployment.
so If there was also a
parent.jar/child/WEB-INF/lib/util.jar
it would be wrong to treat util.jar as a subdeployment since it is part of the
war classpath. -
2. Re: Russian doll packaging in arbitrary directories - JBAS-5
adrian.brock Aug 29, 2008 11:38 AM (in response to adrian.brock)"adrian@jboss.org" wrote:
so If there was also a
parent.jar/child/WEB-INF/lib/util.jar
it would be wrong to treat util.jar as a subdeployment since it is part of the
war classpath.
Which basically means the "DirectoryStructure" has to come after
other StructureDeployers so when the WARStructure recognises the "child" directory
it doesn't get processed by the DirectoryStructure. -
3. Re: Russian doll packaging in arbitrary directories - JBAS-5
alesj Sep 19, 2008 4:55 AM (in response to adrian.brock)How do we diff between this example:
- test-in-lib.sar/lib
- test-in-lib.sar/lib/somejar.jar/META-INF
For war it's not a problem,
it's jar structure that recursively checks all children as possible contexts.
Hence it's picking up META-INF, which we now recognize as dir structure.
This is my current DirectoryStructure code:public boolean determineStructure(StructureContext context) throws DeploymentException { try { // jar structure should already handle top level dirs if (context.isTopLevel() == false) { VirtualFile file = context.getFile(); // only simple directories, non-leaves with META-INF are handled by jar structure if (isLeaf(file) == false) { addAllChildren(context); return true; } } return false; } catch (Exception e) { throw DeploymentException.rethrowAsDeploymentException("Error determining structure.", e); } }
-
4. Re: Russian doll packaging in arbitrary directories - JBAS-5
alesj Sep 19, 2008 5:17 AM (in response to adrian.brock)And the same issue, if not even worse :-),
is the packages directories:
- myapp.jar/org/jboss/demos/foorbar/acme/...
Each of those is gonna be checked. -
5. Re: Russian doll packaging in arbitrary directories - JBAS-5
alesj Sep 19, 2008 6:26 AM (in response to adrian.brock)Actually, the right thing is to remove that 'return true'.
Since we don't want to recognize dir as deployment context,
we only want its valid children to be recognized.
Then it's just an issue of performance,
since we check all directories (recursively) for possible valid deployments.
But the test is still failing for me, even if I add this DirectoryStructure.
I'll look into it a bit more. :-) -
6. Re: Russian doll packaging in arbitrary directories - JBAS-5
alesj Sep 20, 2008 4:08 PM (in response to adrian.brock)"alesj" wrote:
I'll look into it a bit more. :-)
I've managed to see/find the problem.
Hacking this dir structure deployer deploys that 'broken' sar deployment:public class DirectoryStructure extends AbstractVFSStructureDeployer { public DirectoryStructure() { setRelativeOrder(Integer.MAX_VALUE); } public boolean determineStructure(StructureContext context) throws DeploymentException { try { VirtualFile file = context.getFile(); // jar structure should already handle top level dirs if (context.isTopLevel() == false && isLeaf(file) == false && isMetadataPath(context) == false) { List<VirtualFile> children = file.getChildren(); if (children != null && children.isEmpty() == false) { VFSStructuralDeployers structuralDeployers = context.getDeployers(); // get top while (context.getParentContext() != null) context = context.getParentContext(); for (VirtualFile child : children) structuralDeployers.determineStructure(child, context); } } return false; } catch (Exception e) { throw DeploymentException.rethrowAsDeploymentException("Error determining structure.", e); } } /** * Is the current context already part of metadata path. * * @param context the current structure context * @return true if already part of parent's context metadata path */ protected boolean isMetadataPath(StructureContext context) { String relativePath = AbstractStructureDeployer.getRelativePath(context.getParent(), context.getFile()); return "META-INF".equalsIgnoreCase(relativePath) || "WEB-INF".equalsIgnoreCase(relativePath); } }
But it looks too much of a hack. :-(
e.g. dunno how it would handle that top structure context search in some ear deployment -
7. Re: Russian doll packaging in arbitrary directories - JBAS-5
adrian.brock Sep 23, 2008 8:44 AM (in response to adrian.brock)Rather than the hacky hardwiring of META-INF/WEB-INF
can't you just tell it not to recurse into paths that are defined as metadata locations
in the parent structure? -
8. Re: Russian doll packaging in arbitrary directories - JBAS-5
alesj Sep 24, 2008 5:30 AM (in response to adrian.brock)I'll port this DirectoryStructure to deployers project, to simplify the work needed to test this:
--> sar with lib
--> sar with top/snd/third (multiple dirs)
--> sar inside ear with lib
--> sar inside ear with top/snd/third (multiple dirs)
Then if someone wants to use this, (s)he can enable it in AS - in some xyz-dpeloyers-jboss-beans.xml -
9. Re: Russian doll packaging in arbitrary directories - JBAS-5
alesj Sep 25, 2008 4:28 AM (in response to adrian.brock)I've committed initial version of it - see trunk.
If you can add a test to RealDirStructureUnitTestCase that breaks this
- e.g. some classloading scoping,
I'm willing to fix it to work against 'real' parent structure context. :-) -
10. Re: Russian doll packaging in arbitrary directories - JBAS-5
alesj Sep 26, 2008 7:22 AM (in response to adrian.brock)The JBoss5_trunk deployers part of testsuite
works w/o any problems with this new addition. :-)