I
NTEGRATION
W
ITH
O
PTIMAL
J
user’s guide
No Magic, Inc. January, 2007
C O N T E N T S
1
MagicDraw UML OptimalJ Edition installation 3
Editions requirements 3
MagicDraw and OptimalJ integration 3
Model exchange between OptimalJ and MagicDraw 4
Step #1 Save the MagicDraw project 4
Step #2 Import MagicDraw UML model into OptimalJ 4 Step #3 Generate code in OptimalJ 6
Sequence Diagram creation for OptimalJ generated code 6
Sequence Diagram creation with OptimalJ build on Eclipse 6 Step #1 Open/create MagicDraw UML project 7
Step #2 Update MagicDraw UML model from OptimalJ 8 Step #3 Create Sequence Diagram in MagicDraw 9
I N T E G R A T I O N W I T H O P T I M A L J
M a g i c D r a w U M L O p t i m a l J E d i t i o n i n s t a l l a t i o n
© 2007 No Magic, Inc. 3
I N T E G R A T I O N W I T H
O P T I M A L J
2
M
AGIC
D
RAW
UML O
PTIMAL
J E
DITION
INSTALLATION
Editions requirements
One of these OptimalJ 4.3 editions installed:
• Professional Edition build on Eclipse; • Architecture Edition build on Eclipse.
MagicDraw and OptimalJ integration
If OptimalJ Professional Edition build on Eclipse is installed, MagicDraw UML Integration Tool starts when MagicDraw installation is completed.
Click the Integrate button for MagicDraw and OptimalJ integration in the MagicDraw UML Integration Tool dialog box.
For more information about MagicDraw and Eclipse integration, see MagicDraw Integrations UserGuide.pdf, Integration with Eclipse/WSAD section.
NOTE: In Eclipse, MagicDraw by default becomes part of the Java perspective. Also separate MagicDraw perspective is added.
M o d e l e x c h a n g e b e t w e e n O p t i m a l J a n d M a g i c D r a w
2
M
ODEL
EXCHANGE
BETWEEN
O
PTIMAL
J
AND
M
AGIC
D
RAW
Model (UML model) exchange between MagicDraw and OptimalJ is done through XMI (model saved to XML). XMI is the native MagicDraw project file format.
ST E P #1 SA V E T H E MA G I CDR A W P R O J E C T
In MagicDraw:
1 From the File menu, choose the Save Project or Save Project As
command, or click the Save button on the main toolbar, or press shortcut keys CTRL+S. The Save dialog box opens.
2 Select the destination directory (where you wish to save the
project) and type the file name for it.
3 Choose the Extensible Markup Language (*.xml) format for
saving.
ST E P #2 IM P O R T MA G I CDR A W UML M O D E L I N T O OP T I M A LJ
I N T E G R A T I O N W I T H O P T I M A L J
M o d e l e x c h a n g e b e t w e e n O p t i m a l J a n d M a g i c D r a w
© 2007 No Magic, Inc. 5 .
2 Select MagicDraw saved project file and in the Import UML do
S e q u e n c e D i a g r a m c r e a t i o n f o r O p t i m a l J g e n e r a t e d c o d e
2
ST E P #3 GE N E R A T E C O D E I N OP T I M A LJ
For the details how to process the imported model in OptimalJ, see OptimalJ documentation.
S
EQUENCE
D
IAGRAM
CREATION
FOR
O
PTIMAL
J
GENERATED
CODE
MagicDraw UML can create Sequence Diagram for any Java source code. If you did not integrate MagicDraw with OptimalJ, using the MagicDraw UML
Integration tool, you can follow the steps, specified in MagicDraw Tutorials.pdf,
Java Reverse to Sequence Diagram section.
Also you may watch Java Reverse to Sequence Diagram demo in MagicDraw webpage www.magicdraw.com/viewlets about how to perform Java code reverse from the existing source files to Sequence Diagram.
If you did run the MagicDraw UML integration tool, follow the steps in the Section “Sequence Diagram creation with OptimalJ build on Eclipse” on page 6.
Sequence Diagram creation with OptimalJ build on Eclipse
This option is available only if MagicDraw is integrated with OptimalJ (see Section “MagicDraw and OptimalJ integration” on page 3).
If integration was successful, the MagicDraw menu appears in the main OptimalJ menu and MagicDraw perspective is added.
NOTE: For more information how to work with MagicDraw and Eclipse integration, see MagicDraw Integrations UserGuide.pdf, Integration with Eclipse/WSAD section.
I N T E G R A T I O N W I T H O P T I M A L J
S e q u e n c e D i a g r a m c r e a t i o n f o r O p t i m a l J g e n e r a t e d c o d e
© 2007 No Magic, Inc. 7
ST E P #1 OP E N/C R E A T E MA G I CDR A W UML P R O J E C T
In the browser (Package Explorer in Java perspective or Code Model browser in Application perspective), select project and from the shortcut menu, choose Open MagicDraw Project.
S e q u e n c e D i a g r a m c r e a t i o n f o r O p t i m a l J g e n e r a t e d c o d e
2
ST E P #2 UP D A T E MA G I CDR A W UML M O D E L F R O M OP T I M A LJ
Select java package or file element in the Browser and from the shortcut menu, choose Update MagicDraw UML Model. The UML Model representing the java source code is created/updated in MagicDraw.
I N T E G R A T I O N W I T H O P T I M A L J
S e q u e n c e D i a g r a m c r e a t i o n f o r O p t i m a l J g e n e r a t e d c o d e
© 2007 No Magic, Inc. 9
ST E P #3 CR E A T E SE Q U E N C E DI A G R A M I N MA G I CDR A W
1 Switch to MagicDraw perspective.
2 In the Containment Tree Browser tab, select desirable operation
and from the shortcut menu, choose Reverse Implementation.
3 The Sequence Diagram from Java Source Wizard dialog box is
opened. For more information about this wizard, see MagicDraw UserGuide.pdf, the Sequence Diagram from Java Source Wizard