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...@ids-scheer.com> on 2010/09/01 20:39:53 UTC

Q: Adding classes to a node

Hello there,

is it possible (in Tuscany 1.6) to add classes to a node without having 
to package them in a composite? Or add them to the domain so that they 
will be available to all nodes in the domain? I. e. I want to say something
like node.addToClasspath(<pathToJar>)

Alternatively, I could imagine building a composite with a component that does 
not offer any service at all, but simply contains the classes, to be deployed with 
separate composites that add whatever service definitions and bindings are
relevant for a node. Would this be possible, i. e. could I completely separate 
the component and service definitions in different *.composite files?

Background:

I have a composite (packaged with all the classes) in Eclipse project 1.
In another project 2 I simply define a second *.composite file that gives the
the service from jar1 a different binding.
 
I would prefer not to include the classes from project 1 in the jar file of
project 2 (in case they are run in the same JVM, I handle this case with
import.java/export.java in the META-INF/sca-contribution.xml). 

I also do not want to deploy the jar of project1 in my node, because I do not
want the node to make the service available over those bindings.

So, in order to avoid a ClassNotFoundException, I would simply want to add 
the jar 1 to the class path of the node running the service from jar 2.
But neither the SCANodeFactory nor the Node or SCADomain have this
capability.

To me, it seems a reasonable thing to do, and I believe it is possible in 
Frascati, at least the screenshots from their domain manager suggest so.


-- Sebastian 

Re: Q: Adding classes to a node

Posted by ant elder <an...@gmail.com>.
On Thu, Sep 2, 2010 at 4:48 PM, Millies, Sebastian
<Se...@ids-scheer.com> wrote:
> thanks for the links, Luciano. I dare say I am confused about
> many things. So I will put a simpler question:
>
> If my contribution depends on additional libraries (jar files
> for which I do not own the sources), how do I package these additional
> libraries with my contribution for deployment in an SCA
> node?
>
> -- Sebastian

If you use a zip format contribution then the zip may contain jars
which will be included on the classpath of that contribution. For an
example fo that see:
https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/trunk/itest/contribution-folder/

In the 2.x code there is an API that allows specifying an external
sca-contribution.xml file when installing a contribution, that enables
installing any arbitrary jar as a contribution and having an
sca-contribution.xml side file define which classes in that jar are
exported and so available to other contributions in the domain. Any
chance you can move up to the 2.x code?

   ...ant

Re: Q: Adding classes to a node

Posted by Raymond Feng <en...@gmail.com>.
You can just add these jars to the classpath. In a web app, copy them into WEB-INF/lib.

Raymond Feng
Sent from my iPhone

On Sep 2, 2010, at 8:48 AM, "Millies, Sebastian" <Se...@ids-scheer.com> wrote:

> thanks for the links, Luciano. I dare say I am confused about
> many things. So I will put a simpler question: 
> 
> If my contribution depends on additional libraries (jar files
> for which I do not own the sources), how do I package these additional 
> libraries with my contribution for deployment in an SCA 
> node?
> 
> -- Sebastian
> 
> -----Original Message-----
> From: Luciano Resende [mailto:luckbr1975@gmail.com] 
> Sent: Thursday, September 02, 2010 4:24 AM
> To: user@tuscany.apache.org
> Subject: Re: Q: Adding classes to a node
> 
> On Wed, Sep 1, 2010 at 11:39 AM, Millies, Sebastian
> <Se...@ids-scheer.com> wrote:
>> Hello there,
>> 
>> is it possible (in Tuscany 1.6) to add classes to a node without having
>> to package them in a composite? Or add them to the domain so that they
>> will be available to all nodes in the domain? I. e. I want to say something
>> like node.addToClasspath(<pathToJar>)
>> 
>> Alternatively, I could imagine building a composite with a component that does
>> not offer any service at all, but simply contains the classes, to be deployed with
>> separate composites that add whatever service definitions and bindings are
>> relevant for a node. Would this be possible, i. e. could I completely separate
>> the component and service definitions in different *.composite files?
>> 
> 
> Not sure if you are overloading the term "composite" above where it
> really means a contribution.
> Anyway, the following integration tests might be of some help.
> 
> https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/branches/sca-java-1.6/itest/contribution-import-export/
> 
> The store tutorial also provides some deployment scenarios similar to
> what you have mentioned.
> 
> https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/branches/sca-java-1.6/tutorials/store/

RE: Q: Adding classes to a node

Posted by "Millies, Sebastian" <Se...@ids-scheer.com>.
thanks for the links, Luciano. I dare say I am confused about
many things. So I will put a simpler question: 

If my contribution depends on additional libraries (jar files
for which I do not own the sources), how do I package these additional 
libraries with my contribution for deployment in an SCA 
node?

-- Sebastian

-----Original Message-----
From: Luciano Resende [mailto:luckbr1975@gmail.com] 
Sent: Thursday, September 02, 2010 4:24 AM
To: user@tuscany.apache.org
Subject: Re: Q: Adding classes to a node

On Wed, Sep 1, 2010 at 11:39 AM, Millies, Sebastian
<Se...@ids-scheer.com> wrote:
> Hello there,
>
> is it possible (in Tuscany 1.6) to add classes to a node without having
> to package them in a composite? Or add them to the domain so that they
> will be available to all nodes in the domain? I. e. I want to say something
> like node.addToClasspath(<pathToJar>)
>
> Alternatively, I could imagine building a composite with a component that does
> not offer any service at all, but simply contains the classes, to be deployed with
> separate composites that add whatever service definitions and bindings are
> relevant for a node. Would this be possible, i. e. could I completely separate
> the component and service definitions in different *.composite files?
>

Not sure if you are overloading the term "composite" above where it
really means a contribution.
Anyway, the following integration tests might be of some help.

https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/branches/sca-java-1.6/itest/contribution-import-export/

The store tutorial also provides some deployment scenarios similar to
what you have mentioned.

https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/branches/sca-java-1.6/tutorials/store/

Re: Q: Adding classes to a node

Posted by Luciano Resende <lu...@gmail.com>.
On Wed, Sep 1, 2010 at 11:39 AM, Millies, Sebastian
<Se...@ids-scheer.com> wrote:
> Hello there,
>
> is it possible (in Tuscany 1.6) to add classes to a node without having
> to package them in a composite? Or add them to the domain so that they
> will be available to all nodes in the domain? I. e. I want to say something
> like node.addToClasspath(<pathToJar>)
>
> Alternatively, I could imagine building a composite with a component that does
> not offer any service at all, but simply contains the classes, to be deployed with
> separate composites that add whatever service definitions and bindings are
> relevant for a node. Would this be possible, i. e. could I completely separate
> the component and service definitions in different *.composite files?
>

Not sure if you are overloading the term "composite" above where it
really means a contribution.
Anyway, the following integration tests might be of some help.

https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/branches/sca-java-1.6/itest/contribution-import-export/

The store tutorial also provides some deployment scenarios similar to
what you have mentioned.

https://svn.apache.org/repos/asf/tuscany/sca-java-1.x/branches/sca-java-1.6/tutorials/store/


-- 
Luciano Resende
http://people.apache.org/~lresende
http://twitter.com/lresende1975
http://lresende.blogspot.com/