On Thu, Oct 21, 2010 at 2:42 PM, Yang Lei <[email protected]> wrote: > I have a need to get the classLoader resolved from a contribution after > Node.start. I noticed a couple of things when I try to get it to work. > > 1. It seems NodeImpl has the list of contribution object who contains the > classLoader. So I used the following code to access it. > > for (org.apache.tuscany.sca.contribution.Contribution item: > ((NodeImpl)node).getContributions()) > > { > > ...item.getClassLoader(); > > } > > I wonder if if there is a more elegant way to do it. e.g. If I can get the > org.apache.tuscany.sca.contribution.Contribution from the > org.apache.tuscany.sca.node.Contribution, then I do not need to interate the > contirbutions from the NodeImpl, nor I need to cast the NodeImpl type > > 2. When I execute the above code, the classLoader retrieved is null. I > noticed there is no code setting classLoader in the contribution. So I > changed ClassLoaderModelResolver constructor to add the following line . > > contribution.setClassLoader( > > this); > > > > I would like to know what is the right way for me to get classLoader for a > given contribution which honors the import statement. > > -- > > Thanks. Yang. >
The support for Import/Export is done via a delegation chain trough the Resolver. Maybe you could accomplish the same trough the ModelResolver from a given contribution ? -- Luciano Resende http://people.apache.org/~lresende http://twitter.com/lresende1975 http://lresende.blogspot.com/
