Book a Demo

Author Topic: code generation and Signals  (Read 3160 times)

Paul Lotz

  • EA User
  • **
  • Posts: 248
  • Karma: +1/-0
    • View Profile
code generation and Signals
« on: May 11, 2010, 10:41:56 am »
This is, I think, the last major piece in a puzzle I am trying to solve.  For the record, I also posed a version of this question to Sparx support.

How do I generate code for a Signal?

In the current version of EA a Signal is a unique type.  A Signal-typed element looks an awful lot like a class.  A signal can have attributes.  It generally does not have operations, but the UML specification does not forbid this and in fact EA allows it.  While it is not necessary for a Signal to be an object, in practice I think it is quite common to implement signals as objects.

In particular, EA 8.0 (build 856) has a Select Signal browser one can use to select an existing Signal-typed element to apply to, say, a message in a sequence diagram.  I think this is very cool!  (For the record, it is also possible to apply a <<signal>> stereotype to a class but such a class does not appear in the Select Signal dialog.)  It seems to me quite appropriate, then, to represent signals (particularly in a publish-subscribe system) as Signal-typed elements in the model.

Now, the last bit is how does one generate code for such a Signal?  In our case for each Signal we want to generate a Java class with the corresponding attributes.  (I'm guessing implementing a Signal as a Class is the most common approach.)  How can I do this?

I think we need to extend the templates under Settings...Code Generation Templates so that they apply to a Signal, but I don't (yet) know how.  Can anyone shed some light on how to do this?

Thanks!

Paul

Paul Lotz

  • EA User
  • **
  • Posts: 248
  • Karma: +1/-0
    • View Profile
Re: code generation and Signals
« Reply #1 on: May 12, 2010, 06:48:14 am »
After speaking with a colleague who walked me through the code generation process, I realized what I really need is a Transformation Template that handles a Signal.  Has anyone tried this?

I suggest this will become a pretty common use case....