Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "MoDisco/SimpleTransformationChain"
Line 111: | Line 111: | ||
[[Image:MoDisco_SimpleCaptchaExample_J2SE5ModelView.jpg|center|The J2SE5 model, a focus on SimpleCaptcha class.]] | [[Image:MoDisco_SimpleCaptchaExample_J2SE5ModelView.jpg|center|The J2SE5 model, a focus on SimpleCaptcha class.]] | ||
− | ====Get the KDM model==== | + | ==== Get the KDM model ==== |
− | Using the ATL transformation [http://dev.eclipse.org/viewsvn/index.cgi/plugins/trunk/org.eclipse.gmt.modisco.j2se5.discoverer/src/org/eclipse/gmt/modisco/j2se5/resources/transformations/J2SE5ToKDM.atl?root=Modeling_MODISCO&view=log J2SE5toKDM], we will transform the J2SE5 model into a KDM model. | + | Using the ATL transformation [http://dev.eclipse.org/viewsvn/index.cgi/plugins/trunk/org.eclipse.gmt.modisco.j2se5.discoverer/src/org/eclipse/gmt/modisco/j2se5/resources/transformations/J2SE5ToKDM.atl?root=Modeling_MODISCO&view=log J2SE5toKDM], we will transform the J2SE5 model into a KDM model. We have to configure another configuration to perform such transformation. |
− | We have to configure another configuration to perform such transformation. | + | |
− | Open the "Run configurations..." dialog. | + | Open the "Run configurations..." dialog. Then, press the "New" button to create a configuration of type "ATL Transformation". |
− | Then, press the "New" button to create a configuration of type "ATL Transformation". | + | |
− | Enter a name for this configuration, "Java to Kdm transformation" for example. | + | Enter a name for this configuration, "Java to Kdm transformation" for example. Select ATL module in your workspace, "/Transformations/JavaToKdm.atl" for example. Select metamodels uris from EMF Registry (<nowiki>http://www.eclipse.org/MoDisco/J2SE5</nowiki> and <nowiki>http://www.eclipse.org/MoDisco/kdm/action</nowiki>). Select source model in your workspace, and enter a path for your target model. |
− | Select ATL module in your workspace, "/Transformations/JavaToKdm.atl" for example. | + | |
− | Select metamodels uris from EMF Registry (http://www.eclipse.org/MoDisco/J2SE5 and http://www.eclipse.org/MoDisco/kdm/action). | + | |
− | Select source model in your workspace, and enter a path for your target model. | + | |
− | [[Image: | + | [[Image:MoDisco JavaToKdmTransformation.jpg|center|Java to Kdm ATL Transformation configuration element.]] |
− | Finally, press "Run" button to get the KDM model. | + | Finally, press "Run" button to get the KDM model. |
− | You could also use the the contextual menu (right click) when the j2se5 model of Pet Store application is selected. Navigate in MoDisco menu, click on "Discover KDM model from J2SE5 model" menu item. | + | You could also use the the contextual menu (right click) when the j2se5 model of Pet Store application is selected. Navigate in MoDisco menu, click on "Discover KDM model from J2SE5 model" menu item. |
− | [[Image: | + | [[Image:MoDisco SimpleCaptchaExample KDMModelView.jpg|center|The KDM model, a focus on SimpleCaptcha class.]] |
==== Get the UML model==== | ==== Get the UML model==== |
Revision as of 10:46, 3 August 2009
The goal of SimpleTransformationsChain plugin aims at gathering the infrastructure and technologies plugins and at providing orchestration of these plugins. These additional facilities reuse the features offered by the other plugins in order to allow performing more elaborate operations and complex tasks, such as directly generating a UML model from a Java project.
Contents
Description
After discovery of your application, you will obtain a UML model. This model could be imported in some usual modelers like Papyrus or UML2 Tools from Modeling project.
The SimpleTransformationsChain plugin offers simple Eclipse contextual actions to dynamically launch the additionally provided features.
You can launch the “Discover UML model from Java project” action from a Java project by right-clicking on the corresponding Java project (into your workspace) and then selecting the appropriate action in the provided contextual menu.
Launch configuration
The SimpleTransformationsChain plugin is conform to Discoverer extension point, so in launch configurations, you are able to create a discoverer launcher dedicated to a project.
Java API
To use programmatically the SimpleTransformationsChain plugin, you will have to instantiate the class ModelplexKnowledgeDiscoveryFramework and use following method:
public Resource getUML2ModelFromJavaSource(IJavaProject javaProject,URI umlTargetModelUri) throws ATLCoreException;
Requirements
Eclipse Galileo with modeling plugins:
- EMF
- EMF UML2
- ATL 3.0.0
A complete bundle of Modeling components could be found at this url : Eclipse Modeling Galileo Bundle
Warning : after installation, you will have to change your eclipse settings (file eclipse.ini) to increase memory size allowed to 1Go at least, parameter « -Xmx1024m ».
Example :
-startup plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519 -product org.eclipse.epp.package.modeling.product --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx1024m -XX:ThreadStackSize=4096
Team
Gabriel Barbier (Mia-Software)
Install
To install this plugin, you will have to retrieve it and its dependencies from MoDisco SVN. All following bundles are available in folder "plugins/trunk":
- org.eclipse.gmt.modisco.modelplex
- org.eclipse.gmt.modisco.kdm.uml2converter
- org.eclipse.gmt.modisco.j2se5
- org.eclipse.gmt.modisco.j2se5.discoverer
- org.eclipse.gmt.modisco.kdm
- org.eclipse.gmt.modisco.common.core
User manual
To illustrate SimpleTransformationsChain plugin, we will use a sample inspired from the Pet Store Application.
Get and install use case
The models are available from MoDisco SVN (how to...) in subdirectory "examples/trunk/org.eclipse.gmt.modisco.usecase.simpletransformationschain" or from downloadable archive. If you use a SVN client in eclipse (Subversive or Subclipse), the project will be immediately available in your Eclipse workspace.
Sources of Pet Store application are available from Sun downloads. You may have to download several libraries to obtain an eclipse project without errors (JPA, JTA, JSF-apis and Servlets-jsp-apis). A complete bundle is also available from Mia-Software... To view this application in your Eclipse workspace, you will have to extract content of this archive, and use the "import" wizard (import project in workspace).
Get the UML model of Pet Store application
We will explains different ways to get the UML model, it will demonstrate how several simple steps have been combined to build a complex task : discover a UML model from a java project.
Basic way
It exists several tools that are each able to perform a specific task, we will see how each task works.
Get the java model
Open the "Run configurations..." dialog. Then, press the "New" button to create a configuration of type "MoDisco Discoverers".
Enter a name for this configuration, "PetStore reverse to J2SE5 model" for example. Select Discoverer kind "Discover J2SE5 model from java project". Enter path to the project of PetStore application.
Finally, press "Run" button to get the J2SE5 model.
You could also use the the contextual menu (right click) when the project of Pet Store application is selected. Navigate in MoDisco/java menus, click on "Discover J2SE5 model from java project" menu item.
Get the KDM model
Using the ATL transformation J2SE5toKDM, we will transform the J2SE5 model into a KDM model. We have to configure another configuration to perform such transformation.
Open the "Run configurations..." dialog. Then, press the "New" button to create a configuration of type "ATL Transformation".
Enter a name for this configuration, "Java to Kdm transformation" for example. Select ATL module in your workspace, "/Transformations/JavaToKdm.atl" for example. Select metamodels uris from EMF Registry (http://www.eclipse.org/MoDisco/J2SE5 and http://www.eclipse.org/MoDisco/kdm/action). Select source model in your workspace, and enter a path for your target model.
Finally, press "Run" button to get the KDM model.
You could also use the the contextual menu (right click) when the j2se5 model of Pet Store application is selected. Navigate in MoDisco menu, click on "Discover KDM model from J2SE5 model" menu item.
Get the UML model
Using the ATL transformation KDMtoUML, we will transform the KDM model into a UML model. We have to configure another configuration to perform such transformation.
Open the "Run configurations..." dialog. Then, press the "New" button to create a configuration of type "ATL Transformation".
Enter a name for this configuration, "Kdm to Uml transformation" for example. Select ATL module in your workspace, "/Transformations/KdmToUml.atl" for example. Select metamodels uris from EMF Registry ( http://www.eclipse.org/MoDisco/kdm/action and http://www.eclipse.org/uml2/2.1.0/UML). Select source model in your workspace, and enter a path for your target model.
Finally, press "Run" button to get the UML model.
You could also use the the contextual menu (right click) when the kdm model of Pet Store application is selected. Navigate in MoDisco menu, click on "Discover UML model from KDM model" menu item.
Initialize a workflow
To be able to chain previous tasks, MoDisco a workflow initializer.
Open the "Run configurations..." dialog. Then, press the "New" button to create a configuration of type "MoDisco Workflow".
Enter a name for this configuration, "Discovery of PetStore application" for example. Then, press the "Load..." button to successively add "PetStore reverse to J2SE5 model" configuration, "Java to Kdm transformation" configuration and "Kdm to Uml transformation" configuration.
Finally, press "Run" button to get the UML model. This is a first way to get a Uml model from a java application, however when parameters change (the selected java application, target uml model, ...), you will have to change it in different configurations and check coherency of all steps.
SimpleTransformationsChain way
Open the "Run configurations..." dialog. Then, press the "New" button to create a configuration of type "MoDisco Discoverers".
Enter a name for this configuration, "PetStore reverse to UML model" for example. Select Discoverer kind "Discover UML model from java project". Enter path to the project of PetStore application.
Finally, press "Run" button to get the UML model.
You could also use the the contextual menu (right click) when the project of Pet Store application is selected. Navigate in MoDisco/java menus, click on "Discover UML model from java project" menu item.
Visualize the UML model
There is different possibility to visualize the target model, and explore informations located in.
Using MoDisco model browser
The MoDisco model browser show basically the model as a tree. It proposes a view of all instances sorted by metaclass, and offer the possibility to visualize all links in model (empty or not, cardinality, etc.).
Using UML2 Tool
After installation of UML2 Tool, a component of Modeling/MDT project, you will be able to initialize class diagrams from the UML model.
Current limitations
As these component is an aggregation of existing components, its limitations reflect this architecture: main limitations come from KDM to UML converter.