Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 Tools » Generating a UML-Component: How to add a requiered/provided Interface to a Port ?
icon5.gif  Generating a UML-Component: How to add a requiered/provided Interface to a Port ? [message #1007454] Tue, 05 February 2013 17:13 Go to next message
Rudolf Weber is currently offline Rudolf Weber
Messages: 11
Registered: February 2013
Junior Member
in http://www.eclipse.org/forums/index.php/m/471902/ is described how to generate a Component with a Port and required/provided interface.
But a Port may have the provided/required Interface too:

String componame = "mycompo";
String portname = "myPort";
String ifname = "myinterface";
org.eclipse.uml2.uml.Package pkg = ...;
org.eclipse.uml2.uml.Component mycompo = (Component)pkg.createOwnedType(componame, UMLPackage.eINSTANCE.getComponent());

org.eclipse.uml2.uml.Port port = mycompo.createOwnedPort(portname, null);
org.eclipse.uml2.uml.Interface myif = pkg.createOwnedInterface(ifname);

How can I add a Required or an Required Interface to the port ?
I found a port.getRequired(ifname) in , but I miss a port.setRequired(ifname,myif).

(EList<Interface> el = port.getRequireds();
el.add(interfo);
compiles, but it throws a "UnimplementedExcpetion", because it is a readonly list Laughing
)

Re: Generating a UML-Component: How to add a requiered/provided Interface to a Port ? [message #1007484 is a reply to message #1007454] Wed, 06 February 2013 01:54 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3998
Registered: July 2009
Senior Member
HI

From UML 2.5

/required : Interface [0..*]{} (opposite A_required_port::port) The
Interfaces specifying the set of Operations and Receptions that the
EncapsulatedCassifier expects its environment to handle via this port.
This association is derived according to the value of isConjugated. If
isConjugated is false, required is derived as the union of the sets of
Interfaces used by the type of the Port and its supertypes. If
isConjugated is true, it is derived as the union of the sets of
Interfaces realized by the type of the Port and its supertypes, or
directly from the type of the Port if the Port is typed by an Interface.

"/" means derived and so read-only. You need to modify what it is
derived from.

Regards

Ed Willink

On 06/02/2013 01:11, Rudolf Weber wrote:
> in http://www.eclipse.org/forums/index.php/m/471902/ is described how
> to generate a Component with a Port and required/provided interface.
> But a Port may have the provided/required Interface too:
>
> String componame = "mycompo";
> String portname = "myPort";
> String ifname = "myinterface";
> org.eclipse.uml2.uml.Package pkg = ...;
> org.eclipse.uml2.uml.Component mycompo =
> (Component)pkg.createOwnedType(componame,
> UMLPackage.eINSTANCE.getComponent());
>
> org.eclipse.uml2.uml.Port port = mycompo.createOwnedPort(portname, null);
> org.eclipse.uml2.uml.Interface myif = pkg.createOwnedInterface(ifname);
>
> How can I add a Required or an Required Interface to the port ?
> I found a port.getRequired(ifname) in , but I miss a
> port.setRequired(ifname,myif).
>
> (EList<Interface> el = port.getRequireds();
> el.add(interfo);
> compiles, but it throws a "UnimplementedExcpetion", because it is a
> readonly list :lol: )
>
>
Re: Generating a UML-Component: How to add a requiered/provided Interface to a Port ? [message #1009286 is a reply to message #1007484] Thu, 14 February 2013 15:33 Go to previous message
Rudolf Weber is currently offline Rudolf Weber
Messages: 11
Registered: February 2013
Junior Member
Thank you very much.
I have to generate a class first, with refine a Interface or usage an Interface.
A port has this class als his type and then it has the provided interfaces.

The code is realized in http colon slash slash www.infnet.verein.de/modellierung/uml/komponenten/compodsl4eclipse/index.html
Previous Topic:Activity Diagram - Decision Node - Decision Input
Next Topic:So Utterly Disappointed
Goto Forum:
  


Current Time: Sun Jul 13 12:21:24 EDT 2014

Powered by FUDForum. Page generated in 0.03561 seconds