Ales Justin [
http://community.jboss.org/people/alesj] replied to the discussion
"Implementing a non-flat deployment for Weld Integration"
To view the discussion, visit:
http://community.jboss.org/message/559359#559359
--------------------------------------------------------------
Roughly speaking, this is how we would fill in the gaps of the TODO
mark you added in your getLibraries method:
OK, refactored things a bit, I now have
this:
// create an ArchiveInfo with the ClassLoader
ArchiveInfo archiveInfo = new ArchiveInfo(cl);
// finally create the Archive
Archive archive = ArchiveFactory.createArchive(archiveInfo, new
ArrayList<EjbDescriptor<?>>());
// ... and the corresponding BDA
ServiceRegistry serviceRegistry = new SimpleServiceRegistry();
// TODO: fill in serviceRegistry? With which services?
libs.add(archive.createBeanDeploymentArchive(serviceRegistry));
// the env
WeldDiscoveryEnvironment environment = archiveInfo.getEnvironment();
// fill in the Weld classes
// the WBDiscoveryVisitor from ArchiveDiscoveryDeployer...
ResourceVisitor visitor = environment.visitor();
Module module = entry.getKey();
for (VirtualFile child : files)
{
URL beansXmlURL =
child.getChild(provider.getResourceName()).toURL();
environment.addWeldXmlURL(beansXmlURL);
module.visit(visitor, ClassFilter.INSTANCE, null, child.toURL());
}
It all compiles. :-)
The other piece of code that we are missing is the part that invokes
this, right? At some point we need to fill in the DefaultDomain Classpath (take a look at
ClasspathFactory for more details) with the lib BDAs created by your getLibraries method.
As we agreed before, this should be done ideally at the first weld deployment. So, I would
simply add a piece of code to ClasspathFactory that calls getLibraries, unless you prefer
this call to be performed somewhere else.
OK, I still need to think about this one a
bit.
I think that the best way to check everything is working ok is adding
a Weld jar to jboss lib prior to start up and make sure that a BDA is being created for
it. Other than that, I don't have any use cases :-).
Yup, I'll create a
simple test for this -- probably (until we do have a *real* CDI lib present) I'll have
to create a new server config for it.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/559359#559359]
Start a new discussion in JBoss Microcontainer Development POJO Server at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]