SCA/SCA Component/SCA Java Run and Debug Other
This tutorial explains how you can run an SCA Java project created with SCA Tools on your own runtime.
There are four simple steps to perform:
- Create your launcher application.
- Create a master launch configuration for your runtime.
- Instantiate this configuration for the composite to deploy.
- Optionaly, modify the generated configuration (for advanced use).
For the following, we assume you have taken a look at these links:
- Run and Debug SCA projects
- Run and Debug SCA projects on Apache Tuscany
- Run and Debug SCA projects on OW2 FraSCAti
The two last steps are similar to what was done for Tuscany and FraSCAti.
We will only detail the two first steps.
Write your own launcher
This step is quite simple to describe.
Simply write a Java program and package it into a jar file.
This program will be in charge of deploying (or performing an action) on a composite file. It will be called by Eclipse when a user selects the "Run as..." action on a composite with your runtime.
As an example, the
org.eclipse.stp.sca.deployment plug-in provides two main classes to deploy a composite on Apache Tuscany and OW2 FraSCAti. These classes use the Java reflect API because we don't want any dependency between the plug-in and the runtime platform. If you want your launcher to be part of SCA Tools, you can contribute it in the STP bugzilla. Just make sure to avoid code dependencies between the launcher and your platform (use Java reflect if necessary). In any case, this launcher does not have to be a plug-in. A single class or a simple Java project is enough.
Create a master launch configuration for your runtime
Go into Window > Preferences > SCA Tools > Run / Debug.
Click Add.... In the dialog that shows up, type in a name of your master launch configuration.
In the Classpath tab, add the libraries of your runtime and add the library for your launcher.
In the Launch tab, specify the name of the launcher class.
Make sure the arguments are valid according to what the main class expects.
Save the preferences by clicking Apply or OK. That's it.
You then just have to run the composite as an instance of your master launch configuration.