You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Raymond Feng <cy...@gmail.com> on 2010/07/28 22:58:57 UTC

Handling resource locations with Tuscany/SCA

Hi,

I ran into a few issues related to the resource locations we have in Tuscany for various implementation types, such as:

<tuscany:implementation.widget location="<uri>"/>
<implementation.spring location="<uri>"/>
<implementation.jee archive="<uri>"/>

Apparently we don't have a common resource resolver to locate the resources in a consistent manner (The SCA spec probably needs to clarify in this area). I'm in the position to define a common utility to unify the logic after we agree on how the URIs should be resolved based on the following scenario.

Let's assume we have the following contributions for the given SCA domain:

Contribution #1:
uri=c1, file:/contributions/c1.jar

Contribution #2:
uri=c2, file:/contributions/c2.jar

c1.jar contains:
/d1/A.composite
/d2/B.html

c2.jar contains:
/d3/C.composite
/d4/D.xml

Now I have the following requirements (not adding the complexity to use classpath searches) :

Case 1: A.composite needs to reference B.html within contribution c1. I could try the following URIs:

location="../d2/B.html" (relative to the composite file)
location="/d2/B.html" (relative to the root of the containing contribution)
location="http://example.com/c1/d2/B.html" (an absolute URI, take it as is)

Case 2: A.composite needs to reference D.xml from contribution c2. I could try the following URIs:

location="/d4/D.xml" (relative to the root of contribution c2, hoping that the resolver can go to contribution c2 following import/export)
location="contribution:c1!/d4/D.xml" (inventing a new URI scheme for SCA domain/contribution/artifacts so that we can explicitly point to a given contribution by its uri)
location="http://example.com/c2/d4/D.xml" (an absolute URI, take it as is)

Does this match your expectations? 

It seems that Spring has some interesting ideas around the resource handling, see:

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/resources.html

Thanks,
Raymond

Re: Handling resource locations with Tuscany/SCA

Posted by Simon Laws <si...@googlemail.com>.
Coincidentally here's another one I just came across...

@WebService(name="Service1", wsdlLocation="Service1.wsdl")

Although this doesn't use SCA resolution and should use the catalog mechanism.

Two comments in line....


On Wed, Jul 28, 2010 at 9:58 PM, Raymond Feng <cy...@gmail.com> wrote:
> Hi,
>
> I ran into a few issues related to the resource locations we have in Tuscany for various implementation types, such as:
>
> <tuscany:implementation.widget location="<uri>"/>
> <implementation.spring location="<uri>"/>
> <implementation.jee archive="<uri>"/>
>
> Apparently we don't have a common resource resolver to locate the resources in a consistent manner (The SCA spec probably needs to clarify in this area). I'm in the position to define a common utility to unify the logic after we agree on how the URIs should be resolved based on the following scenario.
>
> Let's assume we have the following contributions for the given SCA domain:
>
> Contribution #1:
> uri=c1, file:/contributions/c1.jar
>
> Contribution #2:
> uri=c2, file:/contributions/c2.jar
>
> c1.jar contains:
> /d1/A.composite
> /d2/B.html
>
> c2.jar contains:
> /d3/C.composite
> /d4/D.xml
>
> Now I have the following requirements (not adding the complexity to use classpath searches) :
>
> Case 1: A.composite needs to reference B.html within contribution c1. I could try the following URIs:
>
> location="../d2/B.html" (relative to the composite file)
> location="/d2/B.html" (relative to the root of the containing contribution)
> location="http://example.com/c1/d2/B.html" (an absolute URI, take it as is)
>
> Case 2: A.composite needs to reference D.xml from contribution c2. I could try the following URIs:
>
> location="/d4/D.xml" (relative to the root of contribution c2, hoping that the resolver can go to contribution c2 following import/export)

But we only currently support namespace and java resolution via this mechanism.

> location="contribution:c1!/d4/D.xml" (inventing a new URI scheme for SCA domain/contribution/artifacts so that we can explicitly point to a given contribution by its uri)

And this would be proposed as an extension to the spec or a Tuscany
specific function?

> location="http://example.com/c2/d4/D.xml" (an absolute URI, take it as is)
>
> Does this match your expectations?
>
> It seems that Spring has some interesting ideas around the resource handling, see:
>
> http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/resources.html
>
> Thanks,
> Raymond



-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com