...
NodeFactory maintains a NodeProxy inner class that supports cross-classloader calls. The calling client api will have been loaded by the app classloader but the underlying node will have been loaded by a bundle classloader. We need to bridge that gap.
...
#Contribution Class Loading
Wiki Markup |
---|
When a contribution is read, containing an implementation.java element, a ClassReference is instantiated, which contains the name of the class. ClassReference instances are resolved by a ClassLoaderModelResolver, by virtue of the entry in \[2\] |
The ClassLoaderModelResolver (CLMR) specializes java.net.URL.URLClassLoader and implements o.a.t.s....ModelResolver. Each contribution is contribution is associated with a single CLMR . On construction the CLMR is endowed with a set of URLs that allow it to find all classes in it's its contribution via the URLClassLoader behaviour.
Wiki Markup |
---|
*T{*}heThe itest project _import-export-tests_ has a class TestTestCase with method testOneNode which demonstrates a more complex scenario where a cross contribution import/export of a java package exists between the contributions. In this example a node is created using 2 composite URIs for contributions ... "../exports/target/classes", "../imports/target/classes". An imported class is resolved using the CLMR of the exporting contribution. The exporter's CLMR is made available to the importing CLMR by deployment \[1\] code which traverses all contributions, identifying cross contribution dependencies (see buildDependencies at \[1\]) and using the set of remaining contributions to resolve the import, potentially more than once. |
...
Wiki Markup |
---|
\[2\] [http://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver|http://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver] |