Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "SCA/Components/SCA Java Run and Debug"

< SCA
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
 +
[[Image:SCA Java Run and Debug runAs.gif|frame|center|<div style="text-align: center; font-size: 12px; font-weight: bold; margin-top: 5px;">Run and Debug SCA Java projects</div>]]
 +
 +
 
== Goals ==
 
== Goals ==
  
Generally, when you want to deploy an SCA Java project on a platform (e.g. Apache Tuscany), you have to add the libraries of this platform to the classpath of the project, and then write a main application to deploy your composite on this runtime. The disadvantages of this method is that your project is coupled to a precise runtime through these dependencies. If you want to test the deployment on another version of this runtime, or another runtime, you have to modify the project classpath every time.
+
Generally, to deploy an SCA Java project on a platform (e.g. Apache Tuscany), the libraries of this platform must be added to the classpath of the project, and then a main application must be written to deploy a composite on this runtime. The disadvantages of this method is the SCA project is coupled to a precise runtime through these dependencies. Therefore, the project classpath must be modified to test the deployment on another version of this runtime, or another runtime.
  
  
 
Given that SCA Tools now provide the SCA Java annotations, the runtime libraries are only useful for deployment.<br />
 
Given that SCA Tools now provide the SCA Java annotations, the runtime libraries are only useful for deployment.<br />
To avoid all of this, SCA Tools introduce run and debug configurations.<br />
+
To avoid all of this, SCA Tools introduced run and debug configurations.<br />
 
Meaning that the project is on one side, the runtime on another, and both are bound inside a configuration. This configuration can be launched either in '''run''' mode, or in '''debug''' mode.<br />
 
Meaning that the project is on one side, the runtime on another, and both are bound inside a configuration. This configuration can be launched either in '''run''' mode, or in '''debug''' mode.<br />
 
The debug mode can be used to debug the SCA project (the Java code) or the SCA platform.
 
The debug mode can be used to debug the SCA project (the Java code) or the SCA platform.
Line 53: Line 56:
  
  
When you create a new master launch configuration, you simply give it a name.<br />
+
Creating a new master launch configuration simply consists in giving it a name.<br />
  
 
[[Image:SCA Java Run and Debug newMasterLaunch.gif]]
 
[[Image:SCA Java Run and Debug newMasterLaunch.gif]]
Line 63: Line 66:
  
  
The arguments line is also pre-filled with <code>${composite_name}</code>. When you instantiate a master launch configuration (to create a concrete one), this variable will be replaced by the name of the composite to deploy.
+
The arguments line is also pre-filled with <code>${composite_name}</code>. When a concrete configuration is created from the master launch configuration, this variable is replaced by the name of the composite to deploy.
  
 
[[Image:SCA Java Run and Debug masterLaunchMainPrefs.gif]]
 
[[Image:SCA Java Run and Debug masterLaunchMainPrefs.gif]]
Line 73: Line 76:
  
 
They may be completed later with new ones or/and the usual Java ones.
 
They may be completed later with new ones or/and the usual Java ones.
As usual with Eclipse preferences, you have to click '''OK''' or '''Apply''' to save your modifications in the page, or '''Cancel''' to cancel them.
+
As usual with Eclipse preferences, saving modifications is done by clicking '''OK''' or '''Apply''', and '''Cancel''' is used to to cancel them.
  
  
== Run / Debug your SCA application ==
+
== Run / Debug an SCA application ==
 
+
Once you have at least one master launch configuration, and that you have an SCA Java project to run, you can simply launch it by right-clicking on the composite to deploy and selecting '''Run as &gt; SCA application'''.
+
  
 +
Run / Debug here means launch a configuration (in run or debug mode).
 +
An SCA Java project can be launched by right-clicking on the composite to deploy and selecting '''Run as &gt; SCA application'''.
  
 
[[Image:SCA Java Run and Debug runAs.gif]]
 
[[Image:SCA Java Run and Debug runAs.gif]]
  
  
If you only defined one master launch configuration, this one will be automatically instantiated for this composite and saved.
+
If there is only one master launch configuration, this one will be automatically instantiated for this composite and saved.
If you have several ones, a selection dialog shows up and expect you to select the one to instantiate.
+
If there are several ones, a selection dialog shows up with a list of configurations.
 
+
  
 
[[Image:SCA Java Run and Debug runAsOnThisPlatform.gif]]
 
[[Image:SCA Java Run and Debug runAsOnThisPlatform.gif]]
Line 98: Line 100:
  
  
What it means also, is that the called main method may not be related to a runtime. It could be to perform another action on the composite (e.g. parsing or transformation). Even if obviously, this is not what we recommend regarding the use of this feature (SCA Tools already support parsing and transformation of composites). But it illustrates the flexibility of this mechanism. Thus, you could easily imagine run scripts or automate tests through this '''Run as''' action.
+
What it means also, is that the called main method may not be related to a runtime. It could be to perform another action on the composite (e.g. parsing or transformation). Even if obviously, this is not what we recommend regarding the use of this feature (SCA Tools already support parsing and transformation of composites). But it illustrates the flexibility of this mechanism. Thus, one could easily imagine run scripts or automate tests through this '''Run as''' action.
 +
 
 +
 
 +
[[Category:SOA_Tools]]
 +
[[Category:SOA]]
 +
[[Category:STP]]
 +
[[Category:SCA]]

Latest revision as of 10:57, 8 July 2010

Run and Debug SCA Java projects


Goals

Generally, to deploy an SCA Java project on a platform (e.g. Apache Tuscany), the libraries of this platform must be added to the classpath of the project, and then a main application must be written to deploy a composite on this runtime. The disadvantages of this method is the SCA project is coupled to a precise runtime through these dependencies. Therefore, the project classpath must be modified to test the deployment on another version of this runtime, or another runtime.


Given that SCA Tools now provide the SCA Java annotations, the runtime libraries are only useful for deployment.
To avoid all of this, SCA Tools introduced run and debug configurations.
Meaning that the project is on one side, the runtime on another, and both are bound inside a configuration. This configuration can be launched either in run mode, or in debug mode.
The debug mode can be used to debug the SCA project (the Java code) or the SCA platform.


Master and concrete launch configurations

An SCA launch configuration looks like a Java launch configuration.
It has a main tab, an argument tab and so on.

SCA Java Run and Debug scaLaunchConfigurations.gif


Such a configuration has some particular elements.
It defines a main class to call. This main class will be delegated the task to perform (e.g. deploy the composite on the runtime).
This main class can be either defined in a library contributed by the user, or be one of the main classes provided by SCA Tools.
Currently, there is one main class to deploy on Apache Tuscany 1.x and one for OW2 FraSCAti. We expect some others to be added later on.


The classpath mandatory includes the runtime libraries and the SCA project classpath.

SCA Java Run and Debug scaLaunchClasspath.gif


Eventually, the configuration needs arguments. Usually, it is the composite file name. It could be the composite file path. And there could be other arguments as well.

SCA Java Run and Debug scaLaunchArguments.gif


SCA run configurations are listed in the SCA category in the Run > Run configurations... menu. SCA debug configurations are listed in the SCA category in the Run > Debug configurations... menu.


These configurations are "concrete" configurations. That is to say they are already executable. A simple way to create one is to right click on the SCA category, select New and configure this new launch configuration. Set the classpath, the arguments, the main class... To ease the creation of such configurations, and avoid to set specify everytime which runtime to use, SCA tools introduce the concept of master launch configurations. Master launch configurations are "abstract" launch configurations. They are not directly executable, but concrete ones can be created from them when a composite file is specified.


SCA Java Run and Debug masterLaunchConfigurationPrefs.gif


Master launch configurations are defined by the user in the SCA preference pages.
To create one, go into Window > Preferences > SCA Tools > Run / Debug.
The master launch configurations are listed in the top table. The bottom tabs are used to specify the properties of a master launch configuration (main class, classpath, arguments). Some other tabs may be added later, depending on the needs (e.g. which JRE to use).


Creating a new master launch configuration simply consists in giving it a name.

SCA Java Run and Debug newMasterLaunch.gif


Once created, some properties have been initialized automatically. The classpath contains one entry to the org.eclipse.stp.sca.deployment plug-in, which contains main classes to run SCA applications on Apache Tuscany and OW2 FraSCAti. It's up to the user then, to add the libraries for the runtime he wants.

SCA Java Run and Debug masterLaunchClasspathPrefs.gif


The arguments line is also pre-filled with ${composite_name}. When a concrete configuration is created from the master launch configuration, this variable is replaced by the name of the composite to deploy.

SCA Java Run and Debug masterLaunchMainPrefs.gif


There are two pre-defined SCA variables:

  • ${composite_name} will be replaced by the composite file name.
  • ${composite_path} will be replaced by the composite file path.

They may be completed later with new ones or/and the usual Java ones. As usual with Eclipse preferences, saving modifications is done by clicking OK or Apply, and Cancel is used to to cancel them.


Run / Debug an SCA application

Run / Debug here means launch a configuration (in run or debug mode). An SCA Java project can be launched by right-clicking on the composite to deploy and selecting Run as > SCA application.

SCA Java Run and Debug runAs.gif


If there is only one master launch configuration, this one will be automatically instantiated for this composite and saved. If there are several ones, a selection dialog shows up with a list of configurations.

SCA Java Run and Debug runAsOnThisPlatform.gif


What happens after the Run as depends on the main class that was chosen.
If a user uses the main classes provided by SCA Tools, it simply deploys the composite. It's up to the user to write the client to call its application. Or he has to write its own main to deploy the application and then call the services.


SCA Java Run and Debug runAsOnThisPlatformConsole.gif


What it means also, is that the called main method may not be related to a runtime. It could be to perform another action on the composite (e.g. parsing or transformation). Even if obviously, this is not what we recommend regarding the use of this feature (SCA Tools already support parsing and transformation of composites). But it illustrates the flexibility of this mechanism. Thus, one could easily imagine run scripts or automate tests through this Run as action.

Back to the top