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 <en...@gmail.com> on 2009/06/19 00:41:21 UTC
Re: [DISCUSS] Supporting files outside the contribution for implementation.spring
There are two separate things.
1) Spring provides two subclasses of AbstractXmlApplicationContext [1] to
handle the file-based locations and classpath-based locations.
2) Tuscany implementation.spring uses locations either as absolute URLs or
relative to contributions
IMO, we should subclass AbstractXmlApplicationContext and provide a
ResourcePatternResolver [2] to create UrlResource [3] to support our
location schemes.
[1]
http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/context/support/AbstractXmlApplicationContext.html
[2]
http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/core/io/support/ResourcePatternResolver.html
[3]
http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/core/io/UrlResource.html
Thanks,
Raymond
From: Ramkumar R
Sent: Thursday, June 18, 2009 3:40 AM
To: dev@tuscany.apache.org
Subject: [DISCUSS] Supporting files outside the contribution for
implementation.spring
Implementation Spring supports handling of multiple application contexts
using ClassPathXmlApplicationContext
and FileSystemXmlApplicationContext.
ClassPathXmlApplicationContext looks good as it accepts the path to files
relative to the contribution, but there
seems to be an issue while dealing with FileSystemXmlApplicationContext, as
the relative path to the contribution is not
accepted by spring (as per design), instead it expects a path relative to
the current VM working directory.
To be specific, the path expected by spring runtime is shown below....
<bean id="beanRefFactory"
class="org.springframework.context.support.FileSystemXmlApplicationContext">
<constructor-arg>
<list>
<value>/src/main/resources/beanRef-SpringHelloWorld-context.xml</value>
<value>/src/main/resources/bean-frontend-springimpl-context.xml</value>
</list>
</constructor-arg>
</bean>
In such cases, Tuscany classloaders are unable to see the files are they are
out of the contribution and also
possibly out of the classloaders visibility.
Should we support any files outside the contribution OR can Tuscany support
such usecases?
--
Thanks & Regards,
Ramkumar Ramalingam
Re: [DISCUSS] Supporting files outside the contribution for
implementation.spring
Posted by Simon Laws <si...@googlemail.com>.
On Fri, Jun 26, 2009 at 8:24 AM, Ramkumar R<ra...@gmail.com> wrote:
> Hi Raymond and Luciano,
>
> Looks like here the issue is not about supporting files that are part of
> other contributions, but to
> support the paths relative to the current VM working directory, which is a
> deviation from the
> current contribution model that we are following in SCA.
>
> NOTE: In Spring, plain paths in FileSystemXmlApplicationContext will always
> be interpreted as relative to the current VM working directory, even if they
> start with a slash. (This is consistent with the semantics in a Servlet
> container.) Use an explicit "file:" prefix to enforce an absolute file path.
>
> I believe, this will lead to some confusion within the user, whether they
> should place the files
> within the contribution OR keep them outside always.
>
> So, I think it would be good if we can remove the support of loading
> multiple application contexts with
> FileSystemXmlApplicationContext in implementation.spring.
>
> NOTE: We will still support loading of multiple application contexts with
> ClassPathXmlApplicationContext,
> and we will recommend the users to use ClassPathXmlApplicationContext for
> all the multiple application context loading
> feature with Tuscany.
>
>
Sounds OK to me Ram
Simon
Re: [DISCUSS] Supporting files outside the contribution for
implementation.spring
Posted by Ramkumar R <ra...@gmail.com>.
Hi Raymond and Luciano,
Looks like here the issue is not about supporting files that are part of
other contributions, but to
support the paths relative to the current VM working directory, which is a
deviation from the
current contribution model that we are following in SCA.
*NOTE:* In Spring, plain paths in FileSystemXmlApplicationContext will
always be interpreted as relative to the current VM working directory, even
if they start with a slash. (This is consistent with the semantics in a
Servlet container.) *Use an explicit "file:" prefix to enforce an absolute
file path.*
I believe, this will lead to some confusion within the user, whether they
should place the files
within the contribution OR keep them outside always.
So, I think it would be good if we can remove the support of loading
multiple application contexts with
FileSystemXmlApplicationContext in implementation.spring.
*NOTE:* We will still support loading of multiple application contexts with
ClassPathXmlApplicationContext,
and we will recommend the users to use ClassPathXmlApplicationContext for
all the multiple application context loading
feature with Tuscany.
On Fri, Jun 19, 2009 at 7:04 PM, Luciano Resende <lu...@gmail.com>wrote:
> On Thu, Jun 18, 2009 at 3:41 PM, Raymond Feng<en...@gmail.com> wrote:
> > There are two separate things.
> >
> > 1) Spring provides two subclasses of AbstractXmlApplicationContext [1] to
> > handle the file-based locations and classpath-based locations.
> > 2) Tuscany implementation.spring uses locations either as absolute URLs
> or
> > relative to contributions
> >
> > IMO, we should subclass AbstractXmlApplicationContext and provide a
> > ResourcePatternResolver [2] to create UrlResource [3] to support our
> > location schemes.
> >
> > [1]
> >
> http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/context/support/AbstractXmlApplicationContext.html
> > [2]
> >
> http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/core/io/support/ResourcePatternResolver.html
> > [3]
> >
> http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/core/io/UrlResource.html
> >
>
> I think what Raymond is trying to say is that, if we use 2), then
> existent SCA mechanisms could easily accomplish what you want, you
> could use resource import/export in sca-contribution.xml file to
> easily allow you to import spring contexts from other contributions.
> If you are looking to support this in 2.x, then we might need to check
> if contribution-resource is already ported to that code stream.
>
> > Thanks,
> > Raymond
> >
> > From: Ramkumar R
> > Sent: Thursday, June 18, 2009 3:40 AM
> > To: dev@tuscany.apache.org
> > Subject: [DISCUSS] Supporting files outside the contribution for
> > implementation.spring
> >
> >
> > Implementation Spring supports handling of multiple application contexts
> > using ClassPathXmlApplicationContext
> > and FileSystemXmlApplicationContext.
> >
> > ClassPathXmlApplicationContext looks good as it accepts the path to files
> > relative to the contribution, but there
> > seems to be an issue while dealing with FileSystemXmlApplicationContext,
> as
> > the relative path to the contribution is not
> > accepted by spring (as per design), instead it expects a path relative to
> > the current VM working directory.
> >
> > To be specific, the path expected by spring runtime is shown below....
> >
> > <bean id="beanRefFactory"
> >
> class="org.springframework.context.support.FileSystemXmlApplicationContext">
> > <constructor-arg>
> > <list>
> >
> > <value>/src/main/resources/beanRef-SpringHelloWorld-context.xml</value>
> >
> > <value>/src/main/resources/bean-frontend-springimpl-context.xml</value>
> > </list>
> > </constructor-arg>
> > </bean>
> >
> > In such cases, Tuscany classloaders are unable to see the files are they
> are
> > out of the contribution and also
> > possibly out of the classloaders visibility.
> >
> > Should we support any files outside the contribution OR can Tuscany
> support
> > such usecases?
> >
> > --
> > Thanks & Regards,
> > Ramkumar Ramalingam
> >
>
>
>
> --
> Luciano Resende
> Apache Tuscany, Apache PhotArk
> http://people.apache.org/~lresende <http://people.apache.org/%7Elresende>
> http://lresende.blogspot.com/
>
--
Thanks & Regards,
Ramkumar Ramalingam
Re: [DISCUSS] Supporting files outside the contribution for
implementation.spring
Posted by Luciano Resende <lu...@gmail.com>.
On Thu, Jun 18, 2009 at 3:41 PM, Raymond Feng<en...@gmail.com> wrote:
> There are two separate things.
>
> 1) Spring provides two subclasses of AbstractXmlApplicationContext [1] to
> handle the file-based locations and classpath-based locations.
> 2) Tuscany implementation.spring uses locations either as absolute URLs or
> relative to contributions
>
> IMO, we should subclass AbstractXmlApplicationContext and provide a
> ResourcePatternResolver [2] to create UrlResource [3] to support our
> location schemes.
>
> [1]
> http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/context/support/AbstractXmlApplicationContext.html
> [2]
> http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/core/io/support/ResourcePatternResolver.html
> [3]
> http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/core/io/UrlResource.html
>
I think what Raymond is trying to say is that, if we use 2), then
existent SCA mechanisms could easily accomplish what you want, you
could use resource import/export in sca-contribution.xml file to
easily allow you to import spring contexts from other contributions.
If you are looking to support this in 2.x, then we might need to check
if contribution-resource is already ported to that code stream.
> Thanks,
> Raymond
>
> From: Ramkumar R
> Sent: Thursday, June 18, 2009 3:40 AM
> To: dev@tuscany.apache.org
> Subject: [DISCUSS] Supporting files outside the contribution for
> implementation.spring
>
>
> Implementation Spring supports handling of multiple application contexts
> using ClassPathXmlApplicationContext
> and FileSystemXmlApplicationContext.
>
> ClassPathXmlApplicationContext looks good as it accepts the path to files
> relative to the contribution, but there
> seems to be an issue while dealing with FileSystemXmlApplicationContext, as
> the relative path to the contribution is not
> accepted by spring (as per design), instead it expects a path relative to
> the current VM working directory.
>
> To be specific, the path expected by spring runtime is shown below....
>
> <bean id="beanRefFactory"
> class="org.springframework.context.support.FileSystemXmlApplicationContext">
> <constructor-arg>
> <list>
>
> <value>/src/main/resources/beanRef-SpringHelloWorld-context.xml</value>
>
> <value>/src/main/resources/bean-frontend-springimpl-context.xml</value>
> </list>
> </constructor-arg>
> </bean>
>
> In such cases, Tuscany classloaders are unable to see the files are they are
> out of the contribution and also
> possibly out of the classloaders visibility.
>
> Should we support any files outside the contribution OR can Tuscany support
> such usecases?
>
> --
> Thanks & Regards,
> Ramkumar Ramalingam
>
--
Luciano Resende
Apache Tuscany, Apache PhotArk
http://people.apache.org/~lresende
http://lresende.blogspot.com/