You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by "Millies, Sebastian" <Se...@softwareag.com> on 2012/01/13 18:39:39 UTC

Imports cannot be loaded into contribution

Hello there,

how can I explicitly load an imported resource that is not a Java class or xsd file?
I have failed to make this work in Tuscany 1.6

This could be another bug related to resource imports. By that I mean imports
specified in sca-contribution.xml that have the form
  <import.resource uri="/properties/SDOTypeFiles.properties"/>

I would expect such imported resources to be loadable through
   someObject.getClass().getResource(name)

in line with what classloaders (e. g. URLClassLoader) normally do. Here
someObject would be part of the importing contribution and loaded by
the ContributionClassLoader.

However, that does not happen, because ContributionClassLoader#findResource(name),
which is called internally by getResource(), only looks at JavaImports, other imports
are simply disregarded!

I have tried coming up with code to find the resource. The problem is,
for a ResourceImport, how can I even find the exporting contribution to delegate
to? Only the JavaImportModelResolver seems to have a suitable method.

Do I really need to copy that properties file to every contribution that needs it?
There must be a standard way to share such artifacts between contributions.
At least that’s how I understand the SCA assembly spec.


n  Sebastian
IDS Scheer Consulting GmbH
Geschäftsführer/Managing Directors: Kamyar Niroumand, Ivo Totev
Sitz/Registered office: Altenkesseler Straße 17, 66115 Saarbrücken, Germany - Registergericht/Commercial register: Saarbrücken HRB 19681
http://www.softwareag.com