September 26, 2007

EclipseGraphviz on non-Windows platforms

Filed under: Eclipse, Graphviz — rafael.chaves @ 11:43 pm

Starting today there is support for EclipseGraphviz on non-Windows platforms. Scott Bronson convinced me that while bundling a Graphviz install was a good idea for the Windows audience, on Linux and other platforms that really would not make sense given that Linux runs on many different architectures, not to mention other Unix-like systems where Eclipse and Graphviz are known to work and EclipseGraphviz would not due to lack of a corresponding bundled Graphviz install.

Thanks to Scott’s patches, EclipseGraphviz should now work out of the box on any Windows system or on any other platform where Eclipse and Graphviz were successfully installed. If Graphviz is installed under a location that is not part of the system path, you will have to open the Graphviz preference page, choose the “Specify manually” option and enter the absolute location of the “dot” executable:

eclipse-graphviz-prefs1.png

Do you create diagrams using Graphviz dot language or would you like to see the UML visualization capabilities on non-Windows platforms? Make sure you have Graphviz installed (Windows users can skip this step), then point the Eclipse update manager to http://eclipsegraphviz.sf.net/update and get the latest build. Any problems, report here or on the EclipseGraphviz issue tracker. Need help? Ask away, either here or on the forum. We only tested on Windows XP and Linux/x86 64 bits so if you are using another platform, please tell us what OS/architecture you are using EclipseGraphviz on and whether it works or not.

September 19, 2007

EclipseGraphviz gets an update site

Filed under: Eclipse, Graphviz — rafael.chaves @ 12:34 am

A few people have asked for a more convenient way of getting EclipseGraphviz other than by checking it out from the Subversion repository on Sourceforge, so I decided to create an update site with the most current code. Again, this is alpha code, so proceed with caution.

Check out the EclipseGraphviz wiki on instructions for installing EclipseGraphviz from the update site and a few hints on how to use it.

Enjoy. Feedback is most appreciated.

September 8, 2007

TextUML Toolkit M2a - Java 5 users please read

Filed under: TextUML Toolkit, UML — rafael.chaves @ 12:36 pm

A user has just reported that the TextUML Toolkit M2 build did not work at all for him. Ouch. Thankfully, the user included in the bug report all the information I needed to allow a quick diagnostic: turns out he was using a Java 5 VM, and he was getting exceptions like this:

java.lang.UnsupportedClassVersionError: Bad version number in .class file

 at java.lang.ClassLoader.defineClass1(Native Method)

 ...

I then realized that for the M2 build some of the plug-ins were accidentally compiled having Java 6 as the target platform, and thus wouldn’t work on a Java 5 VM. This is being fixed as I write this, and a new M2a build will be available shortly.

So, for those of you running with a Java 5 VM, please make sure you download the TextUML Toolkit M2a build. Otherwise, if you are using a Java 6 VM, you should be fine with M2, no need to download the build again.

Thanks to Jon for reporting the issue. Keep those bug reports coming!

September 6, 2007

UML 101 with TextUML - Profiles and Stereotypes

Filed under: TextUML Toolkit, UML — rafael.chaves @ 10:09 pm

Profiles and stereotypes form a lightweight mechanism for extending the UML metamodel.

A stereotype allows you to tag elements in your model so they can be interpreted differently from ordinary model elements, much like annotations work in languages such as C# and Java. These tags can then be used to drive code generation, for example, so for every class marked as “persistent”, appropriate persistence code should be generated.

A profile is a special kind of package intended to contain stereotype declarations that extend UML to cover some specific domain or platform.

Let’s see how to declare and use profiles and stereotypes with the help of the TextUML Toolkit.

Declaring a stereotype

To declare a stereotype in TextUML, one uses the following syntax:

profile <profile-name>;

stereotype <stereotype-name> extends <metaclass-1 [,...metaclass-n]…]
[<property-1>; [... property-n;]…]
end;

end.

In other words, a stereotype can be declared as applicable to one or more metaclasses (i.e. types of elements in a UML model), and a stereotype can optionally declare properties (more on properties later) . For instance, a classes could be tagged with the <<persistent>> stereotype:

profile business_apps;

import uml;

stereotype persistent extends Class
end;

end.

Or operations could be marked as <<transactional>>, meaning that a transaction will be started whenever the operation starts executing, and finished when its execution ends:

profile business_apps;

import uml;

stereotype transactional extends Operation
end;

end.

Any UML element can be affected by stereotypes, but stereotypes are declared as targetting (potentially multiple) specific element types. For instance, the UML specification has an example of a profile for Enterprise JavaBeans that defines a <<Session>> stereotype for session beans. The<<Session>> stereotype declares a property that allows modelers to define whether the session bean component is stateful or stateless.

profile EJB;

enumeration StateKind
  STATELESS, STATEFUL
end;

stereotype Bean extends uml::Component
end;

stereotype Session specializes Bean
  property kind : StateKind;
end;

stereotype Entity specializes Bean
end;

end.

Applying a stereotype

Now that we know how to declare stereotypes, lets see how to use them. First of all, you must apply the profile defining the stereotypes to the model declaring elements you want to apply stereotypes to:

model bank;

apply business_apps;

/* other model elements here */

end.

You can then attach stereotypes defined in the applied profile to the suitable model elements in your model:

model bank;

apply business_apps;

[persistent]
class Account
    attribute accountNumber : base::String;
    attribute balance : base::Real;
    attribute changes : AccountChange[0,*];
    [transactional] operation withdraw(amount : Real);
    [transactional] operation deposit(amount : Real);
    operation balance() : Real;
    [transactional] operation transfer(other : Account, amount : Real);
end;

end.

In the example above, we applied the <<persistent>> stereotype to the Bank class, and the <<transactional>> stereotype to the withdraw, deposit and transfer operations. In order to have access to these stereotypes, we had to apply the “business_apps” profile to our model.

Conclusion

In this post/article on UML basics using TextUML, we saw how to declare stereotypes and apply them to elements in UML models. We learned that a stereotype must explicitly declare the metaclasses they are applicable to, and that optionally stereotypes might declare properties. Finally, we saw that before a stereotype can be used in a model, the profile declaring the stereotype must be applied to the model.

September 2, 2007

Rendering UML2 models with Graphviz

Filed under: Eclipse, Graphviz, UML — rafael.chaves @ 1:28 am

The primary goal of the EclipseGraphviz project is to support Eclipse-based applications that want to use Graphviz as an easy way of producing non-interactive structured diagrams without requiring the complexity of GEF or GMF.

The TextUML Toolkit is the only application currently known to be based on the EclipseGraphviz project. To support rendering UML models generated using the TextUML textual notation, EclipseGraphviz has now the ability of rendering any UML model generated using the Eclipse UML2 API.

In this screenshot, you can see the UML model used in the article “Getting started with UML2” rendered with EclipseGraphviz:

getting-started-with-uml2-small.jpg

The main benefits are that the EclipseGraphviz graphical rendering of UML2 models is quite lightweight, and Graphviz produces great layouts automatically. The main caveat is that the diagrams are not interactive. Not to mention that EclipseGraphviz is still quite in its early stages, so it lacks maturity and features. And it does not run yet on non-Windows platforms.

There is where you can make a difference. Check out the project from the Subversion repository, give it a try, and contribute with bug reports, feature requests and patches.

TextUML Toolkit 1.0 M2 is available!

Filed under: TextUML Toolkit, UML — rafael.chaves @ 12:56 am

After a few minor bug fixes and improvements to the test build, the M2 milestone of TextUML Toolkit is available. With this milestone you can:

  • create UML models using the TextUML textual representation
  • visualize the model created using the conventional graphical notation for class diagrams

This milestone does not support non-Windows platforms. But progress is being made in that direction. See below a screenshot of TextUML Toolkit running on Ubuntu Feisty Fawn:
ubuntu-first-small.jpg

Just go to the download page and fetch it, it is free with no restrictions (or guarantees). Make sure to check out the tutorial. Your feedback is most appreciated.

Now off to a long weekend on the beach…

Copyright Abstratt Technologies - Powered by WordPress - Entries (RSS) - Comments (RSS)