Someone was asking me about how to load a contribution and get the
Tuscany model objects for its artifacts so I've just committed a
testcase to show one way of doing that, see:

https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/DeployerTestCase.java

That loads a contribution jar and then gets the composite, component
and service thats in the contribution. The main part of the code is:

        Node node = TuscanyRuntime.newInstance().createNode();
        String curi =
node.installContribution("src/test/resources/sample-helloworld.jar");
        node.validateContribution(curi);
        Contribution contribution = node.getContribution(curi);

If you wanted to run that in a separate Maven build outside of the
domain-node module build then the simplest dependency to use in a
Maven pom.xml is:

      <dependency>
         <groupId>org.apache.tuscany.sca</groupId>
         <artifactId>tuscany-base-runtime</artifactId>
         <version>2.0-SNAPSHOT</version>
      </dependency>

That seems the simplest approach to me, there are other ways such as
using the Deployer directly, does anyone want to show some code to do
that?

   ...ant

Reply via email to